/* ============================================================
   Genesis — A Bible Storybook for Kids
   Warm, papery, friendly. Big taps, calm colors.
   ============================================================ */

:root {
  --paper:      #fbf3e2;
  --paper-2:    #f6e9cf;
  --card:       #fffdf7;
  --ink:        #3b2f26;
  --ink-soft:   #6d5c4a;
  --gold:       #e0962e;
  --gold-deep:  #c97d18;
  --sky:        #4f86c6;
  --leaf:       #5e9c6b;
  --plum:       #8a5a8f;
  --line:       #e6d6b3;
  --shadow:     0 10px 30px rgba(80, 56, 20, .14);
  --shadow-sm:  0 4px 14px rgba(80, 56, 20, .12);
  --radius:     20px;
  --ui: "Segoe UI", "Avenir Next", "Trebuchet MS", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", "Menlo", "DejaVu Sans Mono", monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: var(--ui);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, #fff8ea 0%, rgba(255,248,234,0) 60%),
    radial-gradient(900px 500px at 110% 10%, #fdeccd 0%, rgba(253,236,205,0) 55%),
    var(--paper);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.view { max-width: 860px; margin: 0 auto; padding: 24px 18px 64px; }
[hidden] { display: none !important; }

/* ---------------------------- Buttons ---------------------------- */
.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 12px 18px;
  min-height: 48px;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.btn:disabled { opacity: .4; cursor: default; box-shadow: none; transform: none; }

.btn-next {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
  color: #fff;
  border-color: var(--gold-deep);
}
.btn-mode[aria-pressed="true"] {
  background: var(--sky);
  color: #fff;
  border-color: var(--sky);
}

/* ---------------------------- Library ---------------------------- */
.site-head { text-align: center; padding: 18px 8px 28px; }
.kicker {
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: .72rem;
  font-weight: 800;
  color: var(--gold-deep);
}
.site-head h1 {
  font-size: clamp(2.6rem, 9vw, 4rem);
  margin: .08em 0 .12em;
  letter-spacing: -.01em;
  text-shadow: 0 2px 0 #fff, 0 3px 10px rgba(180,130,40,.25);
}
.tagline { color: var(--ink-soft); margin: 0; font-size: 1.05rem; }

.shelf { display: grid; gap: 18px; }
@media (min-width: 620px) { .shelf { grid-template-columns: 1fr 1fr; } }

.story-card {
  display: flex;
  gap: 14px;
  align-items: stretch;
  text-align: left;
  width: 100%;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
  font-family: inherit;
  color: inherit;
}
.story-card:hover { transform: translateY(-3px) rotate(-.3deg); border-color: var(--gold); }
.story-card:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }

.story-card .badge {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.25rem; color: #fff;
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
  box-shadow: inset 0 -2px 4px rgba(0,0,0,.12);
}
.story-card .card-body { min-width: 0; }
.story-card h3 { margin: 2px 0 2px; font-size: 1.3rem; }
.anim-badge {
  display: inline-block; margin-left: 8px; vertical-align: middle;
  font-size: .62rem; font-weight: 800; letter-spacing: .04em;
  color: #fff; background: linear-gradient(180deg, #6aa9e0, #3f76c0);
  border-radius: 999px; padding: 2px 8px; text-transform: uppercase;
}
.story-card .sub { margin: 0 0 8px; color: var(--ink-soft); font-size: .95rem; }
.story-card .thumb {
  font-family: var(--mono);
  font-size: 6px;
  line-height: 1.05;
  color: var(--ink-soft);
  background: var(--paper-2);
  border-radius: 12px;
  padding: 8px 6px;
  margin: 0;
  overflow: hidden;
  white-space: pre;
  max-height: 86px;
}

.site-foot { text-align: center; color: var(--ink-soft); font-size: .82rem; margin-top: 38px; }

/* ---------------------------- Story head ---------------------------- */
.story-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.story-titles { text-align: center; min-width: 0; }
.story-titles h2 { margin: 0; font-size: clamp(1.4rem, 5vw, 2rem); line-height: 1.1; }
.btn-mode { white-space: nowrap; }

.chip {
  display: inline-block;
  font-size: .8rem; font-weight: 700;
  color: var(--gold-deep);
  background: #fbecca;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
}
.chip-verse { color: var(--sky); background: #e8f0fb; border-color: #cfe0f5; }

/* ---------------------------- Illustration plate ---------------------------- */
.plate {
  background:
    linear-gradient(180deg, #fffdf6 0%, #fdf1d6 100%);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 6px #fff8;
  padding: 18px 10px;
  overflow-x: auto;
  display: flex;
  justify-content: center;
}
.art {
  font-family: var(--mono);
  font-size: clamp(11px, 2.7vw, 16px);
  line-height: 1.18;
  margin: 0;
  color: #4a3a2a;
  white-space: pre;
  display: inline-block;
  text-align: left;
}

.caption-wrap { margin: 20px 4px 8px; }
.caption {
  font-size: clamp(1.1rem, 3.4vw, 1.35rem);
  line-height: 1.55;
  margin: 0 0 12px;
}
.caption-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-read { font-size: .9rem; padding: 8px 14px; min-height: 40px; }
.btn-read.speaking { background: var(--leaf); color: #fff; border-color: var(--leaf); }

/* ---------------------------- Pager ---------------------------- */
.pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 26px;
}
.pager .btn-nav:first-child { justify-self: start; }
.pager .btn-next { justify-self: end; }
.dots { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--line); border: none; padding: 0; cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.dot:hover { transform: scale(1.2); }
.dot.on { background: var(--gold); transform: scale(1.25); }

/* ---------------------------- Bible text mode ---------------------------- */
.passages {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px clamp(16px, 5vw, 34px);
}
.passages h3 {
  font-size: 1.1rem; color: var(--gold-deep);
  margin: 22px 0 10px; padding-bottom: 6px;
  border-bottom: 2px solid var(--line);
}
.passages h3:first-child { margin-top: 0; }
.passages p { margin: 0 0 .85em; font-size: 1.12rem; line-height: 1.7; }
.vn {
  font-size: .7em; font-weight: 800; color: var(--gold-deep);
  vertical-align: super; margin-right: 3px; user-select: none;
}
.translation-note { text-align: center; color: var(--ink-soft); font-size: .8rem; margin-top: 16px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
