/* The web story reader and the shelf. Shared tokens and chrome come from /css/site.css. */
:root { --font-story: "Source Serif 4", "Iowan Old Style", Georgia, serif; --paper: #fffdf8; --paper-line: #efe4cf; --prayer: #fff6dc; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --paper: #16202e; --paper-line: #2a3a50; --prayer: #2a2617; } }
:root[data-theme="dark"] { --paper: #16202e; --paper-line: #2a3a50; --prayer: #2a2617; }

.nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Shelf */
.shelf-intro { padding-block: 48px 8px; display: grid; gap: 14px; max-width: 46rem; }
.shelf-intro h1 { font-size: var(--step-3); font-weight: 800; }
.shelf-intro p { color: var(--muted); font-size: var(--step-1); }
.shelf-section { padding-block: 36px 8px; }
.shelf-section h2 { font-size: var(--step-2); font-weight: 800; margin-bottom: 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 12.5rem), 1fr)); gap: 18px; }
@media (max-width: 520px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
.tile { display: grid; gap: 4px; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 10px 14px; height: 100%; align-content: start; transition: transform 160ms ease, box-shadow 160ms ease; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 18px 30px -22px var(--shadow); }
.tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; margin-bottom: 8px; background: var(--surface-2); }
.tile-book { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.tile-title { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; line-height: 1.15; }
.more-band { margin-block: 56px 72px; background: var(--band-bg); color: var(--band-ink); border-radius: calc(var(--radius) + 6px); padding: clamp(24px, 5vw, 44px); display: grid; gap: 16px; }
.more-band h2 { font-size: var(--step-2); font-weight: 800; }
.more-band p { color: var(--band-muted); max-width: 40rem; }
.more-band .button { justify-self: start; background: var(--band-accent); color: #2a1d00; }

/* Reader */
.reader { padding-block: 20px 56px; display: grid; gap: 16px; }
.reader-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; color: var(--muted); }
.back:hover { color: var(--ink); }
.back svg, .ctrl svg, .turn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.listen { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ctrl { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 0; font: inherit; font-weight: 600; cursor: pointer; background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.ctrl[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); box-shadow: none; }
.voices { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.voices button { min-height: 38px; padding: 6px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 0.92rem; font-weight: 600; cursor: pointer; }
.voices button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 2px 6px -3px var(--shadow); }
.voice-note { font-size: 0.82rem; color: var(--muted); }

.book { background: var(--paper); border: 1px solid var(--paper-line); border-radius: calc(var(--radius) + 4px); padding: clamp(14px, 3vw, 28px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(16px, 3.5vw, 40px); align-items: center; box-shadow: 0 30px 60px -44px var(--shadow); touch-action: pan-y; }
@media (max-width: 820px) { .book { grid-template-columns: minmax(0, 1fr); } }
.picture { position: relative; aspect-ratio: 1; border-radius: 18px; overflow: hidden; background: var(--surface-2); }
.picture img { width: 100%; height: 100%; object-fit: cover; }
.words { display: grid; gap: 14px; align-content: center; min-height: 100%; }
.words .kicker { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--orange-text); }
.words h1 { font-size: clamp(1.9rem, 4.4vw, 2.9rem); font-weight: 800; }
.words .text { font-family: var(--font-story); font-size: clamp(1.18rem, 2.1vw, 1.42rem); line-height: 1.62; }
.words .text.dropcap::first-letter { float: left; font-size: 3.1em; line-height: 0.82; padding: 0.06em 0.08em 0 0; color: var(--orange-text); font-weight: 600; }
.words .text.prayer { background: var(--prayer); border-radius: 16px; padding: 18px 20px; font-style: italic; }
.words .start { justify-self: start; }

.turns { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.turn { display: inline-flex; align-items: center; gap: 6px; min-height: 50px; padding: 10px 22px; border-radius: 999px; border: 0; font: inherit; font-weight: 700; cursor: pointer; background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.turn.next { background: linear-gradient(135deg, #f2a14a, var(--orange)); color: #fff; box-shadow: none; }
.turn[disabled] { visibility: hidden; }
.dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dots span.on { background: var(--orange); transform: scale(1.25); }

.after { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: grid; gap: 12px; align-content: start; }
.card h2 { font-size: 1.35rem; font-weight: 800; }
.card p { color: var(--muted); }
.options { display: grid; gap: 10px; }
.option { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; text-align: left; padding: 8px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; cursor: pointer; }
.option img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; }
.option.right { border-color: var(--leaf); background: color-mix(in srgb, var(--leaf) 14%, var(--surface)); }
.option.try { opacity: 0.55; }
.feedback { font-weight: 600; color: var(--ink); min-height: 1.6em; }
.words-keep { display: grid; gap: 10px; }
.words-keep li { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.words-keep b { font-family: var(--font-display); font-size: 1.15rem; }
.words-keep span { color: var(--muted); font-size: 0.95rem; }
.app-card { background: var(--band-bg); color: var(--band-ink); border-color: var(--band-line); }
.app-card p { color: var(--band-muted); }
.app-card .button { justify-self: start; background: var(--band-accent); color: #2a1d00; }
.next-story { justify-self: start; }
.story-text { display: grid; gap: 14px; font-family: var(--font-story); font-size: 1.15rem; max-width: 42rem; }
.js .story-text { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .picture img.in { animation: fade 360ms ease both; }
  .words.in { animation: fade 360ms ease both; }
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
