/* reader.css — the reading surface.
 *
 * One typeface family. Two weights. One accent. Nothing else.
 *
 * Every rule here is in service of one sentence: the text is the interface.
 * There are no gradients, no decorative shadows, no icon set, no stock imagery
 * and no animation beyond a fast, purposeful transition — because a stranger
 * arriving at a Bible should see a book, not a product tour.
 *
 * The measure is held at 60-70 characters, which is why the column is set in
 * `ch` and not in pixels: it is a typographic measurement and it should be
 * written as one.
 */

:root {
  color-scheme: dark light;

  /* Warm dark ground. Most listening is at night, and a blue-black screen at
   * 1 a.m. is a lamp pointed at the reader's face. */
  --ground: #14110e;
  --ground-lift: #1c1815;
  --ink: #ece4d8;
  --ink-quiet: #a2978a;
  --rule: #2e2822;

  /* The one accent. Ember, not gold: it has to survive AAA against the ground
   * as well as against the light theme's paper. */
  --ember: #e0a45c;
  --ember-deep: #a86a24;

  --measure: 66ch;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           Charter, "Bitstream Charter", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --ground: #f7f3ec;
    --ground-lift: #fffdf9;
    --ink: #1d1913;
    --ink-quiet: #5f574c;
    --rule: #ddd4c6;
    --ember: #8a4f10;
    --ember-deep: #6b3c08;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.0625rem, 0.98rem + 0.4vw, 1.25rem);
  line-height: 1.7;
  font-weight: 400;
  text-rendering: optimizeLegibility;
}

.sr, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.skip:focus {
  position: fixed; inset: 0.5rem auto auto 0.5rem;
  z-index: 10; padding: 0.6rem 1rem;
  background: var(--ember); color: var(--ground);
  border-radius: 2px;
}

/* ------------------------------------------------------------- the frame --
 * anav's bar, and the one line it needs from us.
 *
 * anav sets `.anav-brand { color: var(--anav-fg) }` and then, LATER in the same
 * stylesheet, `.anav a { color: inherit }`. The brand IS an <a>, and 0-1-1 beats
 * 0-1-0, so the brand always inherits from the page rather than from the theme.
 * On a site whose body text is light that is invisible; on this one, whose light
 * theme sets near-black ink, the wordmark rendered as a dark smudge on a dark
 * bar and was effectively unreadable.
 *
 * MEASURED, not guessed: getComputedStyle on .anav-brand returned rgb(29,25,19)
 * — this stylesheet's --ink — while --anav-fg on the same element was #f1ece3.
 * CDP's matched-rules dump named `.anav a { color: inherit }` as the winner.
 *
 * So we supply what anav assumes: a colour on the container for `inherit` to
 * resolve against. This is not an override of anav's design — it is the same
 * value anav was already trying to use.
 */
.anav { color: var(--anav-fg, #f1ece3); }

/* ---------------------------------------------------------------- topside --
 * The search field is on EVERY page and covers every book. It is the whole
 * navigation: there are no nested menus anywhere on this site.
 */

/* The search field, and nothing else. The BRAND lives in anav's bar directly
 * above; carrying a second wordmark here was two logos in 60 vertical pixels. */
.topside {
  display: flex;
  justify-content: center;
  padding: 1.1rem clamp(1rem, 5vw, 2.5rem);
  border-bottom: 1px solid var(--rule);
}

.find {
  display: flex;
  flex: 1 1 22ch;
  width: 100%;
  max-width: var(--measure);
  gap: 0;
  border-bottom: 1px solid var(--rule);
}
.find:focus-within { border-bottom-color: var(--ember); }

.find input {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.2rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
}
.find input::placeholder { color: var(--ink-quiet); opacity: 1; }
.find input:focus { outline: none; }

.find button {
  border: 0;
  background: transparent;
  color: var(--ember);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}
.find button:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }

/* ------------------------------------------------------------------ pages -- */

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(2rem, 7vw, 4.5rem) clamp(1rem, 5vw, 2rem) 4rem;
}

.lede {
  font-size: clamp(1.8rem, 1.3rem + 2.2vw, 2.9rem);
  line-height: 1.15;
  font-weight: 400;
  margin: 0 0 1rem;
  text-wrap: balance;
}

.standfirst { color: var(--ink-quiet); margin: 0 0 2.5rem; }
.quiet { color: var(--ink-quiet); font-size: 0.9rem; }

.books { list-style: none; margin: 0; padding: 0; }
.books li { border-bottom: 1px solid var(--rule); }
.books a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.65rem 0.25rem;
  color: var(--ink);
  text-decoration: none;
  transition: color 90ms linear, background-color 90ms linear;
}
.books a:hover, .books a:focus-visible {
  color: var(--ember);
  background: var(--ground-lift);
  outline: none;
}
.books a:focus-visible { outline: 2px solid var(--ember); outline-offset: -2px; }
.books .ch { color: var(--ink-quiet); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- scripture -- */

.chapter-title {
  font-weight: 400;
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.2rem);
  margin: 0 0 1.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.4ch;
}
.chapter-title .no { color: var(--ember); font-variant-numeric: lining-nums; }

.listen { margin: 0 0 2.5rem; }

/* The one primary action on the page. Everything else recedes. */
.play {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border: 1px solid var(--ember);
  border-radius: 2px;
  background: transparent;
  color: var(--ember);
  font: inherit;
  font-size: 0.98rem;
  cursor: pointer;
  transition: background-color 110ms linear, color 110ms linear;
}
.play:hover, .play:focus-visible { background: var(--ember); color: var(--ground); }
.play:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }
.play[disabled] { opacity: 0.55; cursor: progress; }

.listen .quiet { margin: 0.6rem 0 0; }

.scripture { margin: 0; }

/* Verse numbers HANG in the margin: visible to the eye, out of the reading
 * line, and never spoken. On a narrow screen there is no margin to hang into,
 * so they sit inline and superior rather than overlapping the text. */
.v {
  position: relative;
  margin: 0 0 1.15rem;
  padding-left: 0;
}
.vn {
  color: var(--ink-quiet);
  font-size: 0.72em;
  font-variant-numeric: lining-nums tabular-nums;
  vertical-align: super;
  margin-right: 0.45ch;
  user-select: none;
}

@media (min-width: 46rem) {
  .v { padding-left: 0; }
  .vn {
    position: absolute;
    left: -3.2ch;
    top: 0.15em;
    vertical-align: baseline;
    font-size: 0.75em;
    margin: 0;
    text-align: right;
    width: 2.6ch;
  }
}

/* A translator's note. It is a marker the reader may choose to read — never
 * inlined into the sentence, and never spoken. */
.note {
  border: 0;
  background: transparent;
  color: var(--ember);
  font: inherit;
  font-size: 0.8em;
  vertical-align: super;
  padding: 0 0.15ch;
  cursor: help;
}
.note:focus-visible { outline: 2px solid var(--ember); outline-offset: 1px; }

.notice {
  border-left: 2px solid var(--ember);
  padding: 0.75rem 0 0.75rem 1rem;
  margin: 0 0 2.5rem;
  color: var(--ink-quiet);
  font-size: 0.95rem;
}

/* ----------------------------------------------------------------- onward --
 * One chapter at a time. The reader clicks. Nothing rolls on by itself, and
 * that is a decision, not an omission.
 */

.onward {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.95rem;
}
.onward a { color: var(--ember); text-decoration: none; }
.onward a:hover { text-decoration: underline; text-underline-offset: 0.25em; }
.onward a:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }

.footing {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2rem clamp(1rem, 5vw, 2rem) 3rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-quiet);
  font-size: 0.85rem;
}
.footing p { margin: 0 0 0.4rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
