/* Gallery page — uses app theme variables. Pictures fill a wide grid; captions stay quiet. */
.container.gallery { max-width: 1280px; }
.gallery .gal-dim { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.gal-books { list-style: none; margin: 16px 0; padding: 0; columns: 3 220px; }
.gal-books li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 4px; break-inside: avoid;
  border-bottom: 1px solid var(--border); }


.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 20px; }
.gal-item { margin: 0; }
.gal-item img { display: block; width: 100%; height: auto; border-radius: 8px; cursor: zoom-in; background: var(--surface); }
.gal-item figcaption { margin-top: 6px; font-size: 14px; color: var(--text-soft); }
.gal-missing {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 3 / 2; border-radius: 8px;
  border: 1px dashed var(--border); color: var(--muted); font-size: 14px;
}

/* A book as one scroll: each chapter's heading (a link to read it) over its pictures. */
.gal-chapter { margin: 8px 0 40px; scroll-margin-top: 64px; }  /* clear of the sticky label */
.gal-chapter h2 { margin: 0 0 12px; font-size: 20px; }
.gal-chapter h2 a:hover { color: var(--accent); }
.gal-end { margin: 8px 0 40px; text-align: center; }
.gal-next { display: inline-block; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); font-weight: 500; }
.gal-next:hover { border-color: var(--accent); color: var(--accent); }

/* The sticky label: the book and the chapter on screen, opening the chapter picker. */
.gal-bar { position: sticky; top: calc(-1 * var(--main-pad-top)); z-index: 5; display: flex; align-items: center; gap: 14px;
  margin: -8px 0 8px; padding: 10px 0; background: var(--bg); border-bottom: 1px solid var(--border);
  box-shadow: 0 -40px 0 var(--bg); }  /* covers the strip above while pinned */
.gal-bar h1 { margin: 0; font-size: 22px; }
.gal-where { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
  cursor: pointer; font-variant-numeric: tabular-nums; }
.gal-where:hover, .gal-where[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.gal-caret { font-size: 11px; }
.gal-pop { position: absolute; top: calc(100% + 6px); left: 0; width: min(420px, calc(100vw - 32px)); max-height: 60vh;
  overflow: auto; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg);
  box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.gal-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 4px; }
.gal-picker a { padding: 6px 0; text-align: center; font-size: 13px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); font-variant-numeric: tabular-nums; }
.gal-picker a:hover { border-color: var(--accent); color: var(--accent); }
.gal-picker a.current { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.gal-start:empty { height: 1px; }
.gal-item img.unsized { aspect-ratio: 3 / 2; object-fit: cover; }
.gal-read { display: block; margin-top: 2px; font-size: 13px; color: var(--accent); }
.gal-read:hover { text-decoration: underline; text-underline-offset: 2px; }
/* Where the scroll runs on into the next book. */
.gal-book-title { margin: 56px 0 8px; padding-top: 24px; border-top: 1px solid var(--border);
  font-family: Literata, Georgia, serif; font-size: 28px; }
.gal-stream > .gal-book-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

/* Listening: the picture being read is outlined, with the verse being read under it; while the reading plays the
   other pictures step back. The player is the reader's (style.css .listen-dock); gallery.js sets its place. */
.gal-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px; }
.gal-links .gal-read { margin-top: 0; }
/* As the reader's Listen button (style.css .listen-start), in the accent colour. */
.gal-listen { order: -1; display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--accent); background: none; color: var(--accent); font: 500 13px Inter, system-ui, sans-serif;
  cursor: pointer; }
.gal-listen span { font-size: 10px; }
.gal-listen:hover { background: var(--accent); color: var(--bg); }
.gal-now .gal-listen { background: var(--accent); color: var(--bg); }
.gal-item { transition: opacity .4s; }
.gal-item img { transition: box-shadow .3s; }
.gal-now img { box-shadow: 0 0 0 3px var(--accent); }
.gal-playing .gal-item:not(.gal-now) { opacity: .45; }
.gal-reading { display: block; margin-top: 8px; color: var(--text); font: 17px/1.6 Literata, Georgia, serif; }
.gal-reading:empty { display: none; }
.gal-reading sup { margin-right: 4px; color: var(--muted); font: 600 11px Inter, system-ui, sans-serif; }
