
/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  min-height: 44px;
  padding: .72em 1.25em;
  border: 1px solid var(--control-edge);
  color: var(--ink);
  font-family: var(--ui);
  font-size: var(--ap-lg); font-weight: 600;
  letter-spacing: .01em;
  background: var(--control-wash);
  transition: border-color var(--dur-fast) var(--ease),
              background-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.btn:hover, .btn:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--ink);
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[disabled] { opacity: .35; cursor: not-allowed; }

.btn-icon {
  border: 0; background: none; padding: .5em; min-width: 44px;
  color: var(--ink-soft);
}
.btn-icon:hover, .btn-icon:focus-visible { background: none; color: var(--ink); }

/* Transport buttons */
/* Keep the play geometry in sync with the jacket and sample-card glyphs. */
.transport-play {
  --transport-size: 46px;
  /* Subtract both 1.5px borders so the SVG fits the button's content box. */
  --transport-glyph: calc(var(--transport-size) - 3px);
  width: var(--transport-size); height: var(--transport-size);
  min-width: var(--transport-size); min-height: var(--transport-size);
  padding: 0;
  display: grid; place-items: center;
  border: 1.5px solid var(--accent); border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              transform 80ms var(--ease);
}
.transport-play svg {
  width: var(--transport-glyph); height: var(--transport-glyph);
  fill: currentColor; display: block;
  /* The fill-colored stroke rounds the triangle and restores area lost at the corners. */
  stroke: currentColor; stroke-width: 3; stroke-linejoin: round;
}
.transport-play .ico-pause rect { stroke: none; }
/* The player bar and Listening Room both toggle .is-playing. */
.transport-play .ico-pause { display: none; }
.transport-play.is-playing .ico-pause { display: block; }
.transport-play.is-playing .ico-play { display: none; }
.transport-play:hover, .transport-play:focus-visible {
  background: var(--accent); border-color: var(--accent); color: var(--paper);
}
.transport-play:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.transport-play:active { transform: scale(.96); }

/* Skip buttons */
.skip-mark {
  --skip-size: 44px;
  --skip-num: .72rem;
  position: relative;
  width: var(--skip-size); height: var(--skip-size);
  min-width: var(--skip-size); min-height: var(--skip-size);
  padding: 0; border: 0; background: none;
  display: grid; place-items: center;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), transform 80ms var(--ease);
}
.skip-mark svg { width: 100%; height: 100%; display: block; }
.sm-n {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--ui); font-size: var(--skip-num); font-weight: 600;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: .02em;
  padding-top: .18em;   /* Aligns the arrowhead with the ring. */
}
.skip-mark:hover, .skip-mark:focus-visible { color: var(--ink); }
.skip-mark:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip-mark:active { transform: scale(.94); }

.btn-solid { border-color: var(--accent); background: var(--accent); color: var(--paper); }
.btn-solid:hover, .btn-solid:focus-visible {
  background: color-mix(in srgb, var(--accent) 84%, var(--ink));
  border-color: color-mix(in srgb, var(--accent) 84%, var(--ink));
  color: var(--paper);
}

/* Begin and resume buttons */
.btn-begin {
  border: 0;
  border-left: 2px solid var(--accent);
  border-radius: 0;
  background: none;
  color: var(--ink);
  align-items: center;
  gap: .85em;
  padding: .85em 1.4em .85em 1.05em;
  min-height: 60px;
  text-align: left;
  transition: background-color var(--dur-fast) var(--ease);
}
.btn-begin:hover, .btn-begin:focus-visible {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-left-color: var(--accent);
  color: var(--ink);
}
.bb-glyph { display: block; width: 40px; height: 40px; flex: 0 0 40px; }
.bb-glyph svg { display: block; width: 100%; height: 100%; }
.bb-ring {
  fill: color-mix(in srgb, var(--accent) 14%, transparent);
  stroke: var(--accent); stroke-width: 1.5;
  transition: fill var(--dur-fast) var(--ease);
}
.bb-tri {
  fill: var(--accent); stroke: var(--accent);
  stroke-width: 3; stroke-linejoin: round;
}
.btn-begin:hover .bb-ring,
.btn-begin:focus-visible .bb-ring { fill: color-mix(in srgb, var(--accent) 26%, transparent); }
.bb-text { display: block; min-width: 0; }
.bb-label {
  display: block;
  font-family: var(--ui); font-size: .92rem; font-weight: 600;
  letter-spacing: .005em; line-height: 1.25;
}
/* js/ui.js reveals the place line only when a saved position is available. */
.bb-place {
  display: block;
  margin-top: .18em;
  font-family: var(--ui); font-size: var(--ap-md); font-weight: 400;
  letter-spacing: .09em; text-transform: uppercase;
  line-height: 1.3;
  color: var(--ink-soft);
  font-variant-numeric: lining-nums tabular-nums;
}
.bb-place[hidden] { display: none; }

/* Navigation */
#site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 800;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  transition: transform var(--dur-med) var(--ease), opacity var(--dur-med) var(--ease);
  color: var(--ink);
}
#site-nav.nav-hidden { transform: translateY(-100%); }
#site-nav.nav-faded { opacity: 0; pointer-events: none; }

.nav-shell {
  max-width: var(--shell); margin-inline: auto; padding: 0 var(--edge);
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  min-height: 58px;
}
.nav-mark {
  font-family: var(--ui); font-size: var(--ap-md); font-weight: 600;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink);
}
.nav-mark { display: inline-flex; align-items: center; min-height: 44px; }
.nav-chapters { display: flex; gap: .1rem; }
.nav-chapters a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px;
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-size: .8rem; font-weight: 500; letter-spacing: 0;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--ink-faint);
  transition: color var(--dur-fast) var(--ease);
}
.nav-chapters a:hover, .nav-chapters a:focus-visible { color: var(--ink); }
.nav-chapters a.is-active { color: var(--accent); font-weight: 600; }
.nav-actions { display: flex; gap: .3rem; align-items: center; }
.nav-actions .btn { padding: .6em 1em; min-height: 44px; font-size: var(--ap-md); }

/* On narrow screens, reclaim space from gaps and the redundant wordmark
   to preserve the 44px touch targets. */
@media (max-width: 420px) {
  .nav-actions { gap: .15rem; }
  .nav-actions .btn { padding: .6em .5em; }
}
@media (max-width: 380px) {
  .nav-mark { display: none; }
}
@media (max-width: 480px) {
  .nav-shell { gap: .5rem; }
}
@media (max-width: 340px) {
  .nav-toc-toggle { padding: 0 .4em; }
  .nav-actions { gap: 0; }
}

/* The 940px cutoff gives the chapter numerals and action group room to coexist. */
@media (max-width: 940px) {
  .nav-chapters { display: none; }
  .nav-shell { min-height: 52px; }
}

/* Hero */
/* Keep the grid's inline padding to offset the plate's negative margins. */
#hero { padding-block: 0; }

/* Bleed to the shell edges. Viewport units would count classic scrollbars. */
.hero-plate {
  grid-column: 1 / -1;
  margin-inline: calc(var(--edge) * -1);
  position: relative; overflow: hidden;
}
.hero-plate img {
  width: 100%;
  /* Image sources are selected by width. This height only changes the crop. */
  height: clamp(340px, 64vh, 700px);
  object-fit: cover; object-position: 50% 45%;
  transform: scale(1.07);
}

.hero-block {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: start;
  padding: clamp(1.5rem, 2.5vw, 2.3rem) 0 clamp(1.2rem, 2.1vw, 1.9rem);
}
@supports not (grid-template-columns: subgrid) {
  .hero-block { grid-template-columns: repeat(12, 1fr); column-gap: var(--step); }
}
.hero-hebrew {
  grid-column: 3 / 10;
  justify-self: start;
  /* The physical left margin offsets touch padding against the title.
     Inline start is on the right inside the Hebrew element. */
  margin-left: -.12em;
  font-family: var(--heb); font-weight: 400;
  font-size: clamp(3.1rem, 6.6vw, 5.4rem); line-height: 1;
  color: var(--accent);
  padding-top: 0;
  margin-bottom: clamp(.25rem, .6vw, .55rem);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-fast) var(--ease);
}
.hero-hebrew:hover, .hero-hebrew:focus-visible {
  border-bottom-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.hero-hebrew:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
/* Keep both touch-target minimums independent of the font-size clamp. */
.hero-hebrew {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 44px;
  padding-inline: .12em;
}
.hero-title {
  grid-column: 3 / 10;
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  font-weight: 350;
  margin: 0;
}
.hero-subtitle {
  grid-column: 3 / 9;
  color: var(--ink-soft);
  font-size: clamp(1.05rem, 1.5vw, 1.28rem);
  margin: 1.1rem 0 0; max-width: 48ch;
}
.hero-pull {
  grid-column: 3 / 9;
  font-variation-settings: var(--lit-mid);
  font-weight: 350;
  font-size: clamp(1.14rem, 1.75vw, 1.46rem);
  line-height: 1.44; letter-spacing: -.01em;
  color: var(--ink);
  max-width: 40ch;
  margin: 1.5rem 0 0; padding-top: 1.3rem;
  border-top: 1px solid var(--rule);
}
.hero-meta {
  grid-column: 10 / 13;
  font-family: var(--ui); font-size: var(--ap-md); letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-soft); line-height: 2.1;
  padding-top: .5em;
}
.hero-meta b { display: block; color: var(--ink); font-weight: 600; }
.hero-actions { grid-column: 3 / 9; display: flex; gap: .8rem; align-items: center; margin-top: 1.8rem; flex-wrap: wrap; }
.hero-lang {
  display: inline-flex; align-items: center;
  min-height: 44px; padding: 0 .2em;
  font-family: var(--ui); font-size: var(--ap-xl); font-weight: 400;
  color: var(--ink-soft);
  background: none; border: 0;
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: .35em;
  transition: color var(--dur-fast) var(--ease),
              text-decoration-color var(--dur-fast) var(--ease);
}
.hero-lang:hover, .hero-lang:focus-visible {
  color: var(--ink);
  text-decoration-color: var(--accent);
}

@media (max-width: 900px) {
  .hero-block { grid-column: 1 / -1; }
  @supports not (grid-template-columns: subgrid) {
    .hero-block { grid-template-columns: repeat(6, 1fr); }
  }
  .hero-title, .hero-subtitle, .hero-pull, .hero-meta, .hero-actions { grid-column: 1 / 7; }
  .hero-hebrew {
    grid-column: 1 / 7;
    justify-self: start;
    margin-left: -.12em;
    margin-bottom: .45rem;
  }
  .hero-meta { margin-top: 1.4rem; }
}

/* Chapter opening */
/* Subgrid keeps the opening aligned to the same tracks as the chapter prose. */
.chapter-header {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  padding-bottom: clamp(1.4rem, 2.6vw, 2.4rem);
}
.chapter-header .chapter-margin { grid-column: 1 / 3; }
.chapter-header .chapter-titleblock { grid-column: 3 / 11; }
.chapter-actions {
  margin-top: 1.5rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
}
.listen-from-here { margin-top: 0; }
.btn-quiet {
  border-color: transparent; background: none;
  color: var(--ink-faint);
  padding-inline: .2em;
}
.btn-quiet:hover, .btn-quiet:focus-visible {
  background: none; color: var(--ink);
  border-color: transparent;
  text-decoration: underline; text-underline-offset: .3em;
}

@supports not (grid-template-columns: subgrid) {
  .chapter-header { grid-template-columns: repeat(12, 1fr); column-gap: var(--step); }
}

@media (max-width: 900px) {
  .chapter-header { grid-column: 1 / -1; padding-bottom: 1rem; }
  .chapter-header .chapter-margin { grid-column: 1 / 7; }
  .chapter-header .chapter-titleblock { grid-column: 1 / 7; }
  @supports not (grid-template-columns: subgrid) {
    .chapter-header { grid-template-columns: repeat(6, 1fr); }
  }
  /* Reorder the mark and numeral visually while preserving DOM reading order. */
  .chapter-header .chapter-margin {
    display: flex; align-items: baseline; flex-wrap: wrap;
    column-gap: .8rem; row-gap: 0;
    margin-bottom: .45rem;
  }
  .chapter-header .chapter-num { order: 2; padding-top: 0; margin-bottom: 0; }
  .chapter-header .chapter-mark { order: 1; }
}

/* Chapter marks */
.chapter-mark {
  font-family: var(--heb); font-weight: 300;
  font-size: clamp(2.45rem, 3.4vw, 3.15rem);
  line-height: 1.24;
  /* Keep the grapheme spans in inline flow. Flex would make each letter a separate item. */
  min-height: 44px;
  display: block;
  color: var(--accent);
  margin-top: .5em;
  user-select: none;
  cursor: help;
  transition: color var(--dur-fast) var(--ease);
}
.chapter-mark:hover, .chapter-mark:focus-visible { color: var(--ink); }
.chapter-mark:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
/* Greek runs optically larger than Frank Ruhl at the same size. */
.chapter-mark.is-greek {
  font-family: var(--serif);
  font-size: clamp(1.42rem, 2.3vw, 2.05rem);
  font-style: italic;
}
.chapter-mark .heb-g {
  display: inline-block;
  opacity: 0; transform: translateY(6px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}
.chapter-mark.is-visible .heb-g { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .chapter-mark .heb-g { opacity: 1; transform: none; transition: none; }
}
@media (max-width: 900px) {
  /* Keep enough room for the mark and chapter numeral to share a row on phones. */
  .chapter-mark { font-size: 2.45rem; margin-top: 0; }
  .chapter-mark.is-greek { font-size: 1.75rem; }
}

.hero-hebrew .heb-g {
  display: inline-block;
  opacity: 0; transform: translateY(8px);
  animation: heb-in 620ms var(--ease) forwards;
}
@keyframes heb-in { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .hero-hebrew .heb-g { animation: none; opacity: 1; transform: none; }
}

/* Verse and citation layout */
.verse-box {
  grid-column: 3 / 9;
  margin: 2.1em 0 2.3em;
  padding-left: clamp(1rem, 1.6vw, 1.6rem);
  border-left: 2px solid var(--accent);
}
.verse-text {
  font-family: var(--serif);
  font-variation-settings: var(--lit-mid);
  font-weight: 350;
  font-size: clamp(1.25rem, 2.1vw, 1.62rem);
  line-height: 1.36;
  letter-spacing: -.012em;
  max-width: 32ch;
}
.verse-text .verse-line { display: block; }
.verse-box { position: relative; }
.verse-ref {
  font-family: var(--serif);
  font-variation-settings: var(--lit-normal);
  font-size: var(--ap-md); font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent);
  position: absolute; top: .25em; right: calc(100% + var(--step));
  width: calc(var(--step) * 6);
  text-align: right;
  margin-top: 0;
}
.verse-ref-text { display: block; }
.vr-book {
  display: block;
  font-size: var(--ap-sm);
  letter-spacing: .13em;
  line-height: 1.3;
}
.vr-loc {
  display: block;
  margin-top: .42em; padding-top: .42em;
  border-top: 1px solid var(--rule-strong);
  font-size: var(--ap-md);
  font-variant-numeric: lining-nums tabular-nums;
  font-weight: 400; letter-spacing: 0; text-transform: none;
  color: var(--ink-soft);
}
.verse-ref .verse-translation { display: block; margin-top: .5em; margin-left: 0; color: var(--ink-faint); font-weight: 400; font-size: var(--ap-sm); }
.prayer-zone .verse-ref,
.section[data-ch="10"] .prayer-zone .verse-ref {
  position: static; width: auto; text-align: left; margin-top: 1.1em;
}
.prayer-zone .verse-ref .vr-book,
.prayer-zone .verse-ref .vr-loc { display: inline; }
.prayer-zone .verse-ref .vr-loc {
  margin: 0 0 0 .5em; padding: 0; border-top: 0; font-size: var(--ap-sm);
}
/* Leave a subpixel gap before the apparatus layout starts at 1100px. */
@media (max-width: 1099.98px) {
  .verse-ref { position: static; width: auto; text-align: left; margin-top: 1.1em; }
  .verse-ref .verse-translation { display: inline; margin-top: 0; margin-left: .6em; }
  .verse-ref .vr-book, .verse-ref .vr-loc { display: inline; }
  .verse-ref .vr-loc {
    margin: 0 0 0 .5em; padding: 0; border-top: 0; font-size: var(--ap-sm);
  }
}
.verse-quotemark { display: none; }

/* Verse notes */
/* js/spanish-text.js marks English-only apparatus on Spanish pages. */
[data-es-hidden] { display: none !important; }

.verse-note {
  margin: 1.15em 0 0;
  padding-top: .85em;
  border-top: 1px solid var(--rule);
  max-width: 46ch;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-variation-settings: var(--lit-normal);
  font-size: var(--ap-lg);
  line-height: 1.62;
  letter-spacing: .002em;
}
.verse-note .vn-line { margin: 0; }
.verse-note .vn-line + .vn-line { margin-top: .7em; }
.verse-note em { font-style: italic; color: var(--ink); }
.vn-label {
  font-family: var(--ui);
  font-size: .82em; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent);
  margin-right: .7em;
  white-space: nowrap;
}
/* Place the period outside the tracked label to avoid a gap before it. */
.vn-label::after {
  content: '.';
  letter-spacing: 0;
}
.prayer-zone .verse-note { display: none; }

@media (max-width: 640px) {
  .verse-note { max-width: none; }
  .vn-label { display: block; margin-bottom: .2em; }
}


.block-ref {
  grid-column: 3 / 9;
  margin: -1.1em 0 1.5em;
  font-family: var(--ui);
  font-size: var(--ap-sm); font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-faint);
}
/* Standalone citation notes are direct grid children and need their own column span.
   The citation's bottom margin supplies the gap. */
.block-ref + .verse-note { grid-column: 3 / 9; margin-top: 0; }
@media (max-width: 900px) {
  .block-ref,
  .block-ref + .verse-note { grid-column: 1 / 7; }
}

/* Narration styling activates only while playback and Follow are active
   and the reader has stayed with the text. */
.verse-box.is-live { border-left-color: var(--ink); }
html.is-narrating .block-p { color: var(--ink-soft); }
/* The live selector needs enough specificity to beat the narration dimming rule. */
html.is-narrating .block-p.is-live { color: var(--ink); }
.block-p { transition: color var(--dur-med) var(--ease); }
@media (prefers-reduced-motion: reduce) { .block-p { transition: none; } }

/* js/sync.js derives --read from elapsed cue time without word timings.
   The margin marker leaves text wrapping unchanged. */
@property --read { syntax: '<number>'; inherits: true; initial-value: 0; }
.block-p.is-live { position: relative; transition: color var(--dur-med) var(--ease), --read 300ms linear; }
html.is-narrating .block-p.is-live::after {
  content: '';
  position: absolute; left: -.85em; top: .35em; bottom: .35em;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent) calc(var(--read, 0) * 100%), var(--rule) 0);
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) { .block-p.is-live { transition: none; } }

@media (max-width: 900px) { .verse-box { grid-column: 1 / 7; } }

/* Desktop verse apparatus */
@media (min-width: 1100px) {
  .verse-box {
    grid-column: 3 / 13;
    display: grid;
    grid-template-columns: subgrid;
    column-gap: var(--step);
    align-items: start;
    border-left: 0;
    padding-left: 0;
  }
  /* Subgrid line 1 corresponds to page line 3. */
  .verse-box > .verse-text {
    grid-column: 1 / 7;
    grid-row: 1;
    padding-left: clamp(1rem, 1.6vw, 1.6rem);
    border-left: 2px solid var(--accent);
    transition: border-color var(--dur-med) var(--ease);
  }
  .verse-box > .verse-ref { grid-column: 1 / 7; grid-row: 1; }
  .verse-box > .verse-note {
    grid-column: 8 / 11;
    grid-row: 1;
    margin: 0;
    padding-top: .3em;
    border-top: 0;
    max-width: none;
    font-size: var(--ap-lg);
    line-height: 1.66;
  }
  .verse-box.is-live { border-left-color: transparent; }
  .verse-box.is-live > .verse-text { border-left-color: var(--ink); }
  /* The prayer's frequent citations stay inline to preserve the flow of the lines. */
  .prayer-zone .verse-box {
    grid-column: 3 / 9;
    display: block;
    padding-left: clamp(1rem, 1.6vw, 1.6rem);
    border-left: 2px solid var(--accent);
  }
  .prayer-zone .verse-box > .verse-text { padding-left: 0; border-left: 0; }
  .prayer-zone .verse-box.is-live { border-left-color: var(--ink); }
}
@supports not (grid-template-columns: subgrid) {
  @media (min-width: 1100px) {
    .verse-box { grid-template-columns: repeat(10, 1fr); }
  }
}

/* Plates and figures */
.plate {
  grid-column: 1 / -1;
  margin: clamp(2.2rem, 4vw, 3.6rem) calc(var(--edge) * -1);
  display: block;   /* A subgrid would inherit tracks displaced by the negative margins. */
}
.plate-frame {
  height: clamp(320px, 62vh, 680px);
  overflow: hidden;   /* Clip the scaled image so parallax cannot paint over the caption. */
}
/* Use a landscape frame on phones to avoid a narrow portrait crop. */
@media (max-width: 900px) {
  .plate-frame { height: auto; aspect-ratio: 4 / 3; }
  .hero-plate img { height: auto; aspect-ratio: 4 / 3; }
}
/* The image may sit inside a picture element. */
.plate-frame img {
  width: 100%; height: 100%; object-fit: cover;
  /* Match the initial scale in js/motion.js to avoid a jump when parallax starts. */
  transform: scale(1.07);
}
.plate-caption {
  grid-column: 1 / -1;
  padding: .85rem var(--edge) 0;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--step);
}
@media (max-width: 900px) {
  .plate-caption { grid-template-columns: repeat(6, 1fr); }
}
.plate-caption .plate-text {
  grid-column: 3 / 9;
  font-style: italic; color: var(--ink-soft); font-size: var(--ap-xl); line-height: 1.5;
  max-width: 54ch;
}
@media (max-width: 900px) {
  .plate-caption .plate-text { grid-column: 1 / 7; }
}

.img-slot { grid-column: 3 / 9; margin: 2rem 0; position: relative; }
.slot-open {
  display: block; width: 100%;
  padding: 0; margin: 0; border: 0; background: none;
  font: inherit; color: inherit; text-align: inherit;
  cursor: zoom-in;
}
.slot-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.img-slot img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.img-slot figcaption {
  font-family: var(--ui); font-size: var(--ap-md); line-height: 1.6;
  color: var(--ink-soft); padding-top: .6rem;
  letter-spacing: .01em;
}
@media (max-width: 900px) { .img-slot { grid-column: 1 / 7; } }


.toc-row.toc-back .toc-num { color: var(--ink-faint); font-size: .9em; }
.toc-row.toc-back .toc-title { font-style: italic; }
.toc-row.toc-back .toc-dur { font-variant-numeric: normal; }
.ntr-sep {
  display: block; height: 1px; margin: .6rem 0;
  background: var(--rule-strong);
}
.ntr.ntr-back .ntr-title { font-style: italic; color: var(--ink-soft); }
.ntr.ntr-back:hover .ntr-title, .ntr.ntr-back:focus-visible .ntr-title { color: var(--accent); }
.ntr.ntr-back .ntr-num { color: var(--ink-faint); }

/* Index of Scripture */
.si-head {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: subgrid;
  padding-bottom: clamp(1.6rem, 3vw, 2.6rem);
  border-bottom: 1px solid var(--rule-strong);
}
@supports not (grid-template-columns: subgrid) {
  .si-head { grid-template-columns: repeat(12, 1fr); column-gap: var(--step); }
}
.si-head .chapter-num { grid-column: 1 / 3; padding-top: .55em; }
/* Shared back-matter headings */
.si-head.is-bare, .lex-head.is-bare, .thread-head.is-bare { margin-bottom: clamp(.6rem, 1.4vw, 1.1rem); }
.si-head.is-bare .chapter-num,
.lex-head.is-bare .chapter-num,
.thread-head.is-bare .chapter-num {
  padding-top: 0; margin: 0;
  grid-column: 1 / 8;
  font-family: var(--serif); font-variation-settings: var(--lit-mid);
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  font-weight: 350; line-height: 1.08;
  letter-spacing: .01em; text-transform: none;
  color: var(--accent);
}
@media (max-width: 900px) {
  .si-head.is-bare .chapter-num,
  .lex-head.is-bare .chapter-num,
  .thread-head.is-bare .chapter-num { grid-column: 1 / 7; }
}
@media (max-width: 900px) {
  .si-head .chapter-num { grid-column: 1 / 7; }
}

/* Keep each book together as the column count changes. */
.si-books {
  grid-column: 1 / -1;
  margin-top: clamp(1.8rem, 3vw, 2.8rem);
  columns: 4 15rem;
  column-gap: clamp(1.6rem, 3vw, 3rem);
}
.si-book { break-inside: avoid; margin: 0 0 1.6rem; }
.si-book-name {
  font-family: var(--ui); font-size: var(--ap-sm); font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 .5em; padding-bottom: .35em;
  border-bottom: 1px solid var(--rule-strong);
}
.si-list { list-style: none; margin: 0; padding: 0; }
.si-cite { margin: 0; }
.si-cite a {
  display: flex; align-items: baseline; gap: .5em;
  min-height: 32px; padding: .18em 0;
  color: var(--ink-soft); text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
.si-ref {
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-size: .92rem; line-height: 1.35;
}
.si-cite a::after {
  content: ''; flex: 1 1 auto; align-self: center;
  height: 1px; min-width: .8em;
  background: repeating-linear-gradient(to right,
    var(--rule-strong) 0 1px, transparent 1px 4px);
  opacity: .7;
}
.si-ch {
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-variant-numeric: lining-nums tabular-nums;
  font-size: .78rem; letter-spacing: .04em;
  color: var(--ink-faint);
  flex: 0 0 auto;
  /* Order the numeral after the generated leader, which defaults to the last flex item. */
  order: 1;
}
.si-cite a:hover, .si-cite a:focus-visible { color: var(--ink); }
.si-cite a:hover .si-ch, .si-cite a:focus-visible .si-ch { color: var(--accent); }
.si-ref-bk {  }

/* Compact verse index */
@media (max-width: 900px) {
  .si-books { columns: auto; column-gap: 0; }
  .si-book { margin-bottom: 1.4rem; }
  .si-list { display: flex; flex-wrap: wrap; gap: 0 .55rem; }
  .si-cite a {
    display: inline-flex; align-items: baseline; gap: .3em;
    min-height: 44px; padding: 0 .1em;
  }
  .si-cite a::after { display: none; }
  .si-ref-bk {
    position: absolute; width: 1px; height: 1px;
    margin: -1px; padding: 0; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
  .si-ref { font-size: 1rem; }
  .si-ch { font-size: .82rem; color: var(--accent); }
}
.si-cite a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The dense index uses shorter rows. Single-column rows restore the 44px target. */
.si-cite + .si-cite { border-top: 1px solid color-mix(in srgb, var(--rule) 60%, transparent); }
@media (max-width: 640px) {
  .si-books { columns: 1; }
  .si-cite a { min-height: 44px; }
}

/* Lightbox */
#lightbox {
  position: fixed; inset: 0; z-index: 980;
  background: rgba(14, 12, 9, .94);
  display: flex; align-items: center; justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
}
#lightbox[hidden] { display: none; }
#lightbox img { max-width: min(94vw, 1280px); max-height: 88vh; object-fit: contain; }
#lightbox .sheet-close { position: fixed; top: 1.1rem; right: 1.1rem; color: #EDE9E0; }

/* Sheets, dialogs, and notifications */
.sheet {
  position: fixed; z-index: 960;
  background: var(--paper);
  color: var(--ink);
  border-left: 1px solid var(--rule-strong);
  transition: transform var(--dur-med) var(--ease);
  box-shadow: -24px 0 60px -30px rgba(0,0,0,.35);
  /* This .sheet styles dialogs. The page grid shares the class in site.css. */
  display: block;
}
.sheet[hidden] { display: block; visibility: hidden; pointer-events: none; }
.sheet-inner { padding: 2rem 1.6rem 2.6rem; max-height: 100vh; overflow-y: auto; }
.sheet-close { position: absolute; top: .7rem; right: .7rem; font-size: 1.1rem; }

@media (max-width: 720px) {
  .sheet { left: 0; right: 0; bottom: 0; border-left: 0; border-top: 1px solid var(--rule-strong); transform: translateY(100%); }
  .sheet:not([hidden]) { transform: translateY(0); }
  .sheet-inner { max-height: 82vh; }
}
@media (min-width: 721px) {
  .sheet { top: 0; right: 0; bottom: 0; width: min(420px, 92vw); transform: translateX(100%); }
  .sheet:not([hidden]) { transform: translateX(0); }
}

.sheet h2 {
  font-variation-settings: var(--lit-mid);
  font-weight: 400; font-size: 1.75rem; line-height: 1.1; margin-bottom: .7em;
  letter-spacing: -.015em;
}
.sheet p { margin-bottom: 1em; line-height: 1.62; font-size: .96rem; color: var(--ink-soft); }

.sheet h3.about-sub {
  font-family: var(--ui); font-size: var(--ap-sm); font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint);
  margin: 1.9em 0 .8em; padding-top: 1.4em; border-top: 1px solid var(--rule);
}
.about-thanks {
  font-style: italic; color: var(--ink) !important;
  border-left: 2px solid var(--accent); padding-left: .9em;
}
.about-links a {
  display: flex; align-items: center; min-height: 44px;
  margin: .25em 0; text-decoration: underline; text-underline-offset: 3px;
}

.about-fineprint {
  margin: 1.9em 0 0; padding-top: 1.2em; border-top: 1px solid var(--rule);
  font-family: var(--ui); font-size: var(--ap-md); letter-spacing: .04em;
}
.about-fineprint a {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--ink-faint); text-decoration: underline; text-underline-offset: 3px;
}
.about-fineprint a:hover, .about-fineprint a:focus-visible { color: var(--ink); }
.sheet p.about-notice {
  font-family: var(--ui); font-size: var(--ap-md); line-height: 1.55;
  color: var(--ink-faint); margin-bottom: .8em;
}

/* The Thread */
#thread { padding-block: clamp(3rem, 8vh, 6rem); }
.thread-head {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: subgrid;
  padding-bottom: clamp(1.6rem, 3vw, 2.6rem);
  border-bottom: 1px solid var(--rule-strong);
}
@supports not (grid-template-columns: subgrid) {
  .thread-head { grid-template-columns: repeat(12, 1fr); column-gap: var(--step); }
}

/* Native details provides keyboard disclosure and find-in-page expansion. */
.thread-item {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: subgrid;
  border-bottom: 1px solid var(--rule);
}
@supports not (grid-template-columns: subgrid) {
  .thread-item { grid-template-columns: repeat(12, 1fr); column-gap: var(--step); }
}

/* Safari also needs its own summary marker suppressed. */
.thread-summary {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: subgrid;
  align-items: start;
  padding: clamp(1.1rem, 2.4vw, 1.6rem) 0;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
}
@supports not (grid-template-columns: subgrid) {
  .thread-summary { grid-template-columns: repeat(12, 1fr); column-gap: var(--step); }
}
.thread-summary::-webkit-details-marker { display: none; }
.thread-summary::marker { content: ''; }
.thread-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Chapter span rail */
.thread-span { grid-column: 1 / 3; padding-top: .5em; }
.thread-rail {
  position: relative; display: block;
  height: 13px;
  margin-right: .8em;
}
.thread-rail .thr-tick, .thread-rail .thr-bar { position: absolute; }
/* Keep tick and bar positions on the same scale across all ten chapters. */
.thr-tick {
  top: 2px; left: calc((var(--n) - 1) / 9 * 100%);
  width: 1px; height: 7px; margin-left: -.5px;
  /* The stronger ink mix keeps the ticks visible on dark chapter stocks. */
  background: color-mix(in srgb, var(--ink) 48%, transparent);
}
.thr-tick.is-under { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.thr-tick.is-plant, .thr-tick.is-payoff {
  top: 0; height: 11px; width: 1.5px; background: var(--accent);
}
.thr-tick.is-payoff::after {
  content: ''; position: absolute; left: 50%; top: 3px;
  width: 5px; height: 5px; margin-left: -2.5px;
  border-radius: 50%; background: var(--accent);
}
.thr-bar {
  top: 5px; height: 1.5px;
  left: calc((var(--from) - 1) / 9 * 100%);
  width: calc((var(--to) - var(--from)) / 9 * 100%);
  background: var(--accent);
}
/* Keep the legend separate from the ticks so adjacent chapter numerals cannot collide. */
.thr-legend {
  flex: 0 0 auto;
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-variant-numeric: lining-nums tabular-nums;
  font-size: var(--ap-md); font-weight: 600;
  letter-spacing: .12em; line-height: 1;
  color: var(--accent);
  white-space: nowrap;
}
.thr-legend .thr-to {
  font-style: normal; color: var(--ink-faint);
  margin: 0 .45em; letter-spacing: 0;
}
.thread-leader {
  flex: 1 1 auto; align-self: center;
  min-width: 1.2em; height: 1px;
  background: repeating-linear-gradient(to right,
    var(--rule-strong) 0 1px, transparent 1px 4px);
  opacity: .7;
}

.thread-head-body {
  grid-column: 3 / 13;
  display: flex; align-items: baseline; gap: .75em;
}
.thread-name {
  font-variation-settings: var(--lit-mid);
  font-weight: 400; font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.16; letter-spacing: -.012em; margin: 0;
  transition: color var(--dur-fast) var(--ease);
}
/* Empty generated alt text keeps the glyph out of the summary's accessible name. */
.thread-name::after {
  content: '+' / '';
  margin-left: .5em;
  font-family: var(--ui); font-weight: 400; font-size: .8em;
  color: var(--ink-faint);
}
.thread-item[open] .thread-name::after { content: '\2212' / ''; }
.thread-summary:hover .thread-name, .thread-summary:focus-visible .thread-name { color: var(--accent); }

/* The browser's details wrapper needs to pass grid tracks to the detail.
   Leave its content-visibility under browser control for the closed state. */
.thread-item::details-content {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
}
@supports not (grid-template-columns: subgrid) {
  .thread-item::details-content {
    grid-template-columns: repeat(12, 1fr); column-gap: var(--step);
  }
}
.thread-detail {
  grid-column: 3 / 11;
  padding-bottom: clamp(1.2rem, 2.6vw, 1.8rem);
}
@supports not (grid-template-columns: subgrid) {
  .thread-detail { grid-column: 3 / 11; }
}
.thread-note {
  font-size: 1rem; line-height: 1.62; color: var(--ink-soft);
  max-width: 58ch; margin: 0;
}
.thread-note em { font-style: italic; color: var(--ink); }
.thread-refs {
  margin: .7em 0 0;
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-size: var(--ap-sm); font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--accent);
}
.thread-jump {
  margin: .9em 0 0;
  display: flex; flex-wrap: wrap; gap: 1.4em;
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-size: var(--ap-sm); font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
}
.thread-jump a {
  color: var(--ink-faint);
  border-bottom: 1px solid currentColor;
  min-height: 44px; display: inline-flex; align-items: center;
}
.thread-jump a:hover, .thread-jump a:focus-visible { color: var(--ink); }

@media (max-width: 900px) {
  .thread-head { grid-template-columns: repeat(6, 1fr); }
  .thread-item, .thread-summary { grid-template-columns: repeat(6, 1fr); }
  .thread-span { grid-column: 1 / 7; padding-top: 0; margin-bottom: .7rem; }
  .thread-rail { max-width: 220px; }
  .thread-item::details-content { grid-template-columns: subgrid; }
  @supports not (grid-template-columns: subgrid) {
    .thread-item::details-content { grid-template-columns: repeat(6, 1fr); }
  }
  .thread-head-body, .thread-detail { grid-column: 1 / 7; }
  .thread-head-body { flex-wrap: wrap; gap: .5em .75em; }
  .thread-leader { display: none; }
  .thr-legend { flex-basis: 100%; }
}

.modal {
  position: fixed; inset: 0; z-index: 970;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: rgba(14, 12, 9, .55);
}
.modal[hidden] { display: none; }
.modal-card {
  max-width: 480px; width: 100%;
  background: var(--paper); border: 1px solid var(--rule-strong);
  color: var(--ink);
  padding: clamp(1.6rem, 3vw, 2.4rem);
}
.modal-card h2 {
  font-variation-settings: var(--lit-mid);
  font-weight: 400; font-size: 1.9rem; margin-bottom: .6em; letter-spacing: -.015em;
}
.legend { margin: 1.3em 0; }
.legend li {
  display: flex; gap: .9em; align-items: baseline; padding: .4em 0;
  font-size: .92rem; color: var(--ink-soft);
  border-top: 1px solid var(--rule);
}
.legend li:first-child { border-top: 0; }
.legend kbd {
  font-family: var(--ui); font-size: var(--ap-sm); font-weight: 600;
  border: 1px solid var(--rule-strong); color: var(--ink);
  padding: .25em .5em; min-width: 2.2em; text-align: center;
  letter-spacing: .06em;
}
.completion-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* Resume notification */
.toast {
  position: fixed; left: var(--edge); bottom: calc(var(--player-h, 134px) + 10px); z-index: 940;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--control-edge);
  border-left: 2px solid var(--accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .16);
  padding: 0; display: flex; gap: 0; align-items: stretch;
  font-family: var(--ui); font-size: var(--ap-lg); max-width: min(460px, 92vw);
  opacity: 0; transform: translateY(10px);
  transition: opacity var(--dur-med) var(--ease), transform var(--dur-med) var(--ease),
              bottom var(--dur-med) var(--ease);
}
.toast:not([hidden]).is-shown { opacity: 1; transform: none; }
.toast[hidden] { display: none; }
.toast .btn-begin {
  border-left: 0;
  flex: 1 1 auto; min-width: 0;
  padding: .85em .6em .85em 1.05em;
}
/* Let long chapter titles wrap so they cannot push the dismiss button off-screen. */
.toast .bb-label { white-space: normal; }
.toast-dismiss {
  align-self: flex-start;
  min-height: 44px;
  color: var(--ink-faint);
  font-size: 1.1rem; line-height: 1;
}
.toast-dismiss:hover, .toast-dismiss:focus-visible { color: var(--ink); }

/* Reserve the offline notice's right padding for the out-of-flow dismiss button. */
.offline-note {
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem .8rem;
  padding: .85em 46px .85em 1.05em;
  max-width: min(520px, 92vw);
}
.offline-note .on-body {
  flex: 1 1 13rem; min-width: 0;
  display: flex; flex-direction: column; gap: .12em;
}
.offline-note .on-title {
  font-size: var(--ap-md); font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink);
}
.offline-note .on-text {
  font-size: var(--ap-lg); line-height: 1.45;
  color: var(--ink-soft);
}
/* Keep the action's intrinsic basis so the label can wrap as a unit. */
.offline-note .on-action { flex: 0 1 auto; font-size: var(--ap-md); padding: .6em .95em; }
/* The button's author-level display overrides the browser's hidden rule. */
.offline-note .on-action[hidden] { display: none; }
.offline-note .toast-dismiss { position: absolute; top: 0; right: 0; }

#gloss-card {
  position: absolute; z-index: 950; max-width: 320px;
  padding: 1em 1.1em;
  background: var(--paper); border: 1px solid var(--rule-strong);
  color: var(--ink);
  font-family: var(--serif);
  font-variation-settings: var(--lit-normal);
  font-size: .92rem; line-height: 1.55;
  box-shadow: 0 16px 40px -22px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(4px);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  pointer-events: none;
}
#gloss-card.is-open { opacity: 1; transform: none; pointer-events: auto; }

/* Prayer and closing line */
.prayer-zone { grid-column: 3 / 9; }
.prayer-zone .block-p { font-style: italic; color: var(--ink-soft); }
.prayer-zone .divider-beat { grid-column: auto; }
#hold-btn {
  position: fixed; left: var(--edge); z-index: 930;
  bottom: calc(var(--player-h, 134px) + 10px);
  transition: bottom var(--dur-med) var(--ease);
}
#hold-btn[hidden] { display: none; }
@media (max-width: 900px) { .prayer-zone { grid-column: 1 / 7; } }

#five-words { padding-block: clamp(6rem, 22vh, 14rem); }
/* Word padding extends the clipped background over descenders.
   Line height leaves room for those descenders when the sentence wraps. */
.fivewords-text {
  grid-column: 3 / 11;
  font-size: clamp(1.9rem, 5.4vw, 4.1rem);
  line-height: 1.16;
}
.fivewords-text .fw-word {
  display: inline-block; opacity: 0; transform: translateY(8px);
  padding-bottom: .16em;
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}
.fivewords-text .fw-word.is-visible { opacity: 1; transform: none; }

/* Keep plain ink as the fallback when text clipping is unavailable. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .fivewords-text.is-lit .fw-word {
    background-image: linear-gradient(100deg,
      var(--ink) 0 42%,
      color-mix(in srgb, var(--accent) 85%, #fff) 50%,
      var(--ink) 58% 100%);
    background-size: 320% 100%;
    background-position: 100% 0;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
    animation: fw-light 4200ms cubic-bezier(.35, .1, .3, 1) 1 forwards;
  }
}
@keyframes fw-light {
  from { background-position: 100% 0; }
  to   { background-position: 0 0; }
}
.fivewords-ref {
  grid-column: 3 / 11;
  display: block; margin-top: 1.6em;
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-size: var(--ap-md); font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; color: var(--accent);
  opacity: 0; transition: opacity var(--dur-slow) var(--ease);
}
.fivewords-ref.is-visible { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .fivewords-text .fw-word { opacity: 1; transform: none; transition: none; }
  .fivewords-ref { opacity: 1; transition: none; }
  .fivewords-text.is-lit .fw-word {
    background-image: none; -webkit-text-fill-color: currentColor;
    color: var(--ink); animation: none;
  }
}
@media (max-width: 900px) { .fivewords-text, .fivewords-ref { grid-column: 1 / 7; } }

.tear-line {
  position: absolute; top: 0; bottom: 0; left: calc(var(--step) * -1);
  width: 1px; background: var(--accent);
  transform: scaleY(0); transform-origin: top;
  transition: transform 800ms var(--ease);
}
.tear-line.is-torn { transform: scaleY(1); }
@media (prefers-reduced-motion: reduce) { .tear-line { transform: scaleY(1); transition: none; } }

/* Chapter plate ribbon */
#plates { padding-block: clamp(1.2rem, 2.6vh, 2rem) clamp(.6rem, 1.4vh, 1rem); }

/* Native scrolling keeps momentum, keyboard scrolling, and scroll-into-view. */
.pl-rail {
  grid-column: 1 / -1;
  /* js/ui.js supplies the scrollbar width so full bleed stays inside the viewport.
     Matching inline padding aligns the first plate with the text grid. */
  --pl-bleed: calc((100vw - var(--sbw, 0px) - 100%) / 2);
  margin-inline: calc(-1 * var(--pl-bleed));
  padding-inline: var(--pl-bleed);
  /* Scroll-padding percentages resolve against the scrollport.
     js/ui.js supplies a resolved length to preserve alignment on snap. */
  scroll-padding-inline: var(--pl-snap, var(--edge));
  display: flex;
  gap: clamp(.7rem, 1.4vw, 1.1rem);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  /* Proximity snapping lets short flicks settle without pulling them back to the starting plate. */
  scroll-snap-type: x proximity;
  /* Allow vertical swipes that start on the ribbon to scroll the page. */
  touch-action: pan-x pan-y;
  /* Hide vertical overflow to avoid a second scrollbar during the sway. */
  /* Top padding clears peak sway. Bottom clearance also relies on space under shorter titles.
     Recheck both when plate titles wrap differently or PLATE_SWAY changes. */
  padding-block: 7.25rem 5.5rem;
  overflow-y: hidden;
  scrollbar-width: none;
  /* Keep the prefixed mask for older Safari. */
  /* The default fades only the right edge. js/ui.js updates the fades as the rail scrolls. */
  --pl-fade: 72px;
  --pl-fade-l: 0px;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--pl-fade-l),
                      #000 calc(100% - var(--pl-fade-r, var(--pl-fade))), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--pl-fade-l),
              #000 calc(100% - var(--pl-fade-r, var(--pl-fade))), transparent 100%);
}
.pl-rail.is-scrolled { --pl-fade-l: var(--pl-fade); }
.pl-rail.at-end { --pl-fade-r: 0px; }
.pl-rail::-webkit-scrollbar { display: none; }

/* The rail's sway clearance already supplies the space above the plates. */
#plates { padding-block-start: 0; }

.pl-plate {
  flex: 0 0 min(78vw, 340px);
  scroll-snap-align: start;
  display: block;
  min-width: 0;
  text-decoration: none;
  transition: opacity var(--dur-med) var(--ease);
  /* Anchor the absolute screen-reader label inside the scroller
     so it cannot widen the document. */
  position: relative;
}
/* Match the mobile width cap at the desktop breakpoint to avoid a sudden shrink. */
@media (min-width: 901px) { .pl-plate { flex-basis: clamp(340px, 31vw, 400px); } }

/* Use the source photograph's aspect ratio. */
.pl-frame {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 11 / 6;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.pl-frame picture { display: block; height: 100%; }

.pl-frame img {
  /* Override the global image width cap so drift has room on both sides. */
  max-width: none;
  position: absolute; top: 0; left: -6%;
  width: 112%; height: 100%;
  object-fit: cover;
  filter: saturate(.80) contrast(1.02);
  transition: filter var(--dur-slow) var(--ease);
  translate: var(--dx, 0) 0;
}
/* Translate percentages use the enlarged image width.
   Keep drift within the inset on each side of the frame. */

/* Allow long titles to wrap alongside the numeral without overflowing the frame. */
.pl-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: .1rem .55rem;
  padding: .8rem .4rem 0;
  text-align: center;
}
.pl-n {
  font-family: var(--serif);
  font-size: 1.2rem; font-weight: 500;
  letter-spacing: .12em; color: var(--accent);
  font-variant-numeric: lining-nums tabular-nums;
  transition: color var(--dur-med) var(--ease);
}
/* The printed separator is decorative. The hidden span supplies the accessible name. */
.pl-n::after {
  content: '\00B7';
  margin-left: .55rem;
  color: var(--ink-faint);
  letter-spacing: 0;
}
.pl-t {
  font-variation-settings: var(--lit-display); font-weight: 400;
  font-size: clamp(1.34rem, 2.15vw, 1.7rem);
  line-height: 1.16; letter-spacing: -.018em;
  color: var(--ink); text-wrap: balance;
  transition: transform var(--dur-med) var(--ease);
}

.pl-plate.is-bare .pl-frame { background: var(--control-wash); }

.pl-plate:not(.is-lit) .pl-frame img { filter: saturate(.62) contrast(1.02) brightness(.94); }
.pl-plate:not(.is-lit) .pl-t { color: var(--ink-soft); }
/* js/ui.js sets --hook-lit for both the selected numeral and its caption. */
.pl-plate.is-lit .pl-n {
  color: var(--hook-lit, var(--ink));
  transition: color 380ms var(--ease);
}
@media (prefers-reduced-motion: reduce) { .pl-plate.is-lit .pl-n { transition: none; } }
/* Lift the frame because the sway already owns transform on the plate. */
.pl-frame { transition: transform var(--dur-med) var(--ease); }
.pl-plate.is-lit .pl-frame { transform: translateY(-7px) scale(1.015); }
@media (prefers-reduced-motion: reduce) {
  .pl-frame { transition: none; }
  .pl-plate.is-lit .pl-frame { transform: none; }
}

@media (hover: hover) {
  .pl-rail:hover .pl-plate { opacity: .58; }
  .pl-rail .pl-plate:hover,
  .pl-rail .pl-plate:focus-visible { opacity: 1; }
  .pl-plate:hover .pl-frame img,
  .pl-plate:focus-visible .pl-frame img { filter: saturate(1) contrast(1); }
  .pl-plate:hover .pl-t, .pl-plate:focus-visible .pl-t { transform: translateY(-2px); }
  .pl-plate:hover .pl-n, .pl-plate:focus-visible .pl-n { color: var(--ink); }
  /* Drop the dimming filter on hover so it does not compound the opacity change. */
  .pl-rail:hover .pl-plate:not(.is-lit) .pl-frame img { filter: saturate(.80) contrast(1.02); }
}
.pl-plate:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* The timeline subject must sit outside the clipped frame
   so its view timeline tracks the rail. */
@supports (animation-timeline: view(inline)) {
  html.pl-sda .pl-plate { view-timeline-name: --pl-plate; view-timeline-axis: inline; }
  html.pl-sda .pl-frame img {
    translate: none;
    animation: pl-drift linear both;
    animation-timeline: --pl-plate;
    animation-range: cover 0% cover 100%;
  }
  /* Match the drift amplitude in js/ui.js and keep it within the image overhang. */
  @keyframes pl-drift {
    from { translate: -5.6% 0 }
    to   { translate:  5.6% 0 }
  }
}

/* Put the sway timeline on the section so it tracks the page's scroll.
   The rail is a scroll container and never scrolls vertically. */
/* Keep the sway symmetric. Plate amplitudes alternate in sign,
   so shifting the center up for one plate pushes its neighbor down. */
@keyframes pl-sway {
  from { transform: translateY(var(--amp, 0px)) }
  to   { transform: translateY(calc(var(--amp, 0px) * -1)) }
}
@supports (animation-timeline: view(block)) {
  html.pl-sda #plates { view-timeline-name: --pl-section; view-timeline-axis: block; }
  html.pl-sda .pl-plate {
    animation: pl-sway linear both;
    animation-timeline: --pl-section;
    animation-range: cover 0% cover 100%;
  }
}

/* Reserve the tallest caption's height so switching chapters cannot shift the page. */
.pl-hook {
  grid-column: 1 / 11;
  margin: 0;
  font-family: var(--serif);
  font-variation-settings: var(--lit-display);
  font-weight: 400;
  font-size: clamp(1.56rem, 2.42vw, 2.12rem);
  line-height: 1.3; letter-spacing: -.012em;
  color: var(--ink); text-wrap: pretty;
  /* At this line height, 1.3em tracks one line across the font-size clamp.
     Recheck the line counts when text, width, weight, or optical size changes. */
  min-height: calc(8 * 1.3em);
}
/* Caption transitions */
.pl-hook .plh-w {
  display: inline-block;
  font-style: normal;
  opacity: 0;
  transform: translateY(.32em);
  color: var(--hook-lit, var(--accent));
  transition: opacity 400ms var(--ease), transform 400ms var(--ease),
              color 700ms var(--ease) 260ms;
}
.pl-hook.is-in .plh-w {
  opacity: 1;
  transform: none;
  color: var(--ink);
  transition-delay: calc(var(--w, 0) * 24ms), calc(var(--w, 0) * 24ms),
                    calc(260ms + var(--w, 0) * 24ms);
}
@media (min-width: 330px) { .pl-hook { min-height: calc(7 * 1.3em); } }
@media (min-width: 355px) { .pl-hook { min-height: calc(6 * 1.3em); } }
@media (min-width: 429px) { .pl-hook { min-height: calc(5 * 1.3em); } }
@media (min-width: 484px) { .pl-hook { min-height: calc(4 * 1.3em); } }
@media (min-width: 643px) { .pl-hook { min-height: calc(3 * 1.3em); } }
@media (max-width: 900px) { .pl-hook { grid-column: 1 / 7; } }
@media (min-width: 901px) { .pl-hook { min-height: calc(3 * 1.3em); } }

/* Ribbon navigation */
.pl-nav {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: 44px;
  margin-top: -36px;
  position: relative;
}
.pl-step { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
.pl-step svg { width: 22px; height: 22px; }
.pl-step[aria-disabled="true"] { opacity: .3; cursor: default; }
.pl-pos {
  font-family: var(--serif);
  font-size: 1.05rem; font-weight: 500;
  letter-spacing: .12em;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--ink-soft);
  min-width: 4.6em;
  text-align: center;
}
.pl-pos-n { color: var(--hook-lit, var(--accent)); transition: color 380ms var(--ease); }
@media (prefers-reduced-motion: reduce) { .pl-pos-n { transition: none; } }

/* Animate the plate's children so arrival opacity cannot override hover dimming.
   Script arms the hidden state before starting the animation. */
.pl-rail.is-armed .pl-frame,
.pl-rail.is-armed .pl-row { opacity: 0; }
.pl-rail.is-armed.is-in .pl-frame,
.pl-rail.is-armed.is-in .pl-row {
  animation: pl-arrive 700ms var(--ease) calc(var(--i) * 55ms) both;
}
@keyframes pl-arrive {
  from { opacity: 0; transform: translateY(14px) }
  to   { opacity: 1; transform: none }
}

/* Keep snapping with reduced motion because it drives caption selection. */
@media (prefers-reduced-motion: reduce) {
  .pl-rail { scroll-behavior: auto; }
  .pl-frame, .pl-row { opacity: 1 !important; transform: none !important; animation: none !important; }
  .pl-plate { transform: none !important; animation: none !important; }
  .pl-frame img { translate: none !important; animation: none !important; }
  .pl-plate:hover .pl-t, .pl-plate:focus-visible .pl-t { transform: none; }
  .pl-hook .plh-w {
    opacity: 1; transform: none; color: var(--ink);
    transition: none;
  }
}

/* Contents */
#contents { padding-block: clamp(1.2rem, 2.6vh, 2rem) clamp(2.6rem, 6vh, 5rem); }

.toc-head {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: subgrid;
  align-items: baseline;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--rule-strong);
}
@supports not (grid-template-columns: subgrid) {
  .toc-head { grid-template-columns: repeat(12, 1fr); column-gap: var(--step); }
}
.toc-expand {
  grid-column: 1 / 8;
  justify-self: start;
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 0;
  font-family: var(--ui); font-size: var(--ap-md); font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 1px solid transparent;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.toc-expand::before { content: '+'; margin-right: .7em; font-size: 1.1em; line-height: 1; }
.toc-expand[aria-expanded="true"]::before { content: '\2212'; }
.toc-expand:hover, .toc-expand:focus-visible { color: var(--ink); border-bottom-color: var(--ink); }
.toc-expand:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }


.toc { grid-column: 1 / -1; display: block; }

.toc-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--step);
  align-items: baseline;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}
.toc-row { transition: border-color var(--dur-fast) var(--ease); }
.toc-row:hover, .toc-row:focus-visible { border-bottom-color: var(--ink); }
.toc-row .toc-num { transition: transform var(--dur-fast) var(--ease); }
.toc-row:hover .toc-num, .toc-row:focus-visible .toc-num { transform: translateX(4px); }
.toc-row:hover .toc-title, .toc-row:focus-visible .toc-title { color: var(--accent); }
.toc-title { transition: color var(--dur-fast) var(--ease); }
.toc-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.toc-num {
  grid-column: 1 / 3;
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-size: clamp(1.2rem, 2vw, 1.6rem); font-weight: 500;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: .08em; color: var(--accent);
  line-height: 1.1;
}
.toc-body { grid-column: 3 / 12; }
.toc-row.toc-back .toc-body { grid-column: 3 / 10; }
.toc-title {
  display: block;
  font-variation-settings: var(--lit-mid);
  font-weight: 350; font-size: clamp(1.34rem, 2.3vw, 1.82rem);
  line-height: 1.14; letter-spacing: -.014em;
}
.toc-hook {
  display: block; margin-top: .45em;
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-style: normal; font-weight: 450;
  color: var(--ink-soft);
  font-size: 1.06rem; line-height: 1.55; max-width: 58ch;
}
/* js/ui.js restores the reader's saved expansion choice. */
#contents:not(.is-open) .toc { display: none; }
#contents:not(.is-open) .toc-head { border-bottom-color: transparent; }
#contents:not(.is-open) .toc-head { border-bottom-color: var(--rule); padding-bottom: .9rem; }
.toc-dur {
  grid-column: 10 / 13;
  font-family: var(--ui); font-size: var(--ap-md); font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint);
  font-variant-numeric: lining-nums tabular-nums;
}

@media (max-width: 900px) {
  .toc-head { grid-template-columns: repeat(6, 1fr); }
  .toc-expand { grid-column: 1 / 7; grid-row: 1; min-height: 44px; }
  .toc-row { grid-template-columns: repeat(6, 1fr); }
  .toc-num { grid-column: 1 / 2; }
  .toc-body, .toc-row.toc-back .toc-body { grid-column: 2 / 7; }
  .toc-dur { grid-column: 2 / 7; margin-top: .5em; }
}

/* Invitation dialog */
.modal-invite {
  max-width: 560px;
  padding: clamp(1.8rem, 3.4vw, 3rem) clamp(1.6rem, 3vw, 2.8rem) clamp(1.4rem, 2.4vw, 2rem);
  max-height: 92vh; overflow-y: auto;
}
.invite-epigraph {
  border-left: 2px solid var(--accent);
  padding-left: 1.1rem; margin: 0 0 1.5rem;
}
.invite-epigraph p {
  font-variation-settings: var(--lit-mid);
  font-weight: 300; font-size: clamp(1.32rem, 3vw, 1.56rem); line-height: 1.3;
  letter-spacing: -.014em; color: var(--ink); margin: 0 0 .55em;
}
.invite-epigraph cite {
  font-family: var(--serif); font-style: normal;
  font-variation-settings: var(--lit-normal);
  font-size: var(--ap-md); font-weight: 500; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent);
}
.invite-lede {
  font-size: 1.06rem; line-height: 1.62; margin: 0 0 .85em;
  color: var(--ink);
}
.invite-lede:first-of-type {
  font-size: 1.16rem; line-height: 1.5; letter-spacing: -.008em;
}
.invite-lede-last {
  font-size: 1rem; color: var(--ink-soft); margin-bottom: 0;
}
.invite-lede em { font-style: italic; color: var(--accent); }
.invite-lede-es { margin-top: .85em; }
.invite-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin: 1.6rem 0 1.2rem; }
.invite-meta {
  font-family: var(--ui);
  font-size: var(--ap-md); line-height: 1.9;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint);
  border-top: 1px solid var(--rule); padding-top: .9em; margin: 0;
  font-variant-numeric: lining-nums tabular-nums;
}
@media (max-width: 560px) {
  .invite-actions .btn { flex: 1 1 100%; }
}

.about-keys { margin-bottom: 1.6em; }
.about-keys li { font-size: .88rem; }

.img-slot figcaption .slot-ref {
  display: block; margin-top: .4em;
  font-family: var(--serif); font-style: normal;
  font-variation-settings: var(--lit-normal);
  font-size: var(--ap-sm); font-weight: 500; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent);
}

.plate-ref {
  display: block; margin-top: .45em;
  font-family: var(--serif); font-style: normal;
  font-variation-settings: var(--lit-normal);
  font-size: var(--ap-sm); font-weight: 500; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent);
}

/* Navigation contents */

.toc-row { will-change: transform, opacity; }
#nav-chapters { transition: opacity var(--dur-fast) linear; }

.nav-toc-toggle {
  display: inline-flex; align-items: center; gap: .5em;
  min-height: 44px; padding: 0 .8em;
  background: none; border: 1px solid transparent; cursor: pointer;
  font-family: var(--ui); font-size: var(--ap-md); font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint);
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.nav-toc-toggle:hover, .nav-toc-toggle:focus-visible { color: var(--ink); }
.nav-toc-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-toc-toggle[aria-expanded="true"] { color: var(--accent); border-color: var(--control-edge); }

.ntt-here {
  position: relative; font-weight: 600; color: var(--accent);
  font-variant-numeric: lining-nums tabular-nums;
}
.ntt-here::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -5px; height: 1px;
  background: var(--accent);
  transform: scaleX(var(--ch-progress, 0)); transform-origin: left;
  transition: transform var(--dur-fast) linear;
}
.nav-toc-toggle .ntt-word { display: inline; }
@media (max-width: 900px) {
  .nav-toc-toggle .ntt-word { display: none; }
  .nav-toc-toggle { font-size: var(--ap-md); }
  .nav-toc-toggle::before {
    content: 'Ch'; font-size: var(--ap-sm); font-weight: 500; color: var(--ink-faint);
    letter-spacing: .14em;
  }
}

/* Keep the panel outside the nav so it escapes the nav's fade and transform.
   Its stacking order is above the nav and below the dialogs. */
:root { --nav-h: 59px; }
@media (max-width: 900px) { :root { --nav-h: 53px; } }
.nav-toc {
  position: fixed; left: 0; right: 0; top: var(--nav-h); z-index: 810;
  background: var(--paper);
  border-bottom: 1px solid var(--rule-strong);
  max-height: min(72vh, 640px); overflow-y: auto;
  overscroll-behavior: contain;
  transform-origin: top;
  transform: translateY(-8px); opacity: 0;
  transition: transform var(--dur-med) var(--ease), opacity var(--dur-med) var(--ease);
}
.nav-toc[hidden] { display: none; }
.nav-toc.is-open { transform: translateY(0); opacity: 1; }
/* Keep the opener visible so readers can close the panel after scrolling. */
body.nav-toc-open #site-nav {
  opacity: 1 !important; transform: none !important; pointer-events: auto !important;
}

.nav-toc-inner {
  max-width: var(--shell); margin-inline: auto;
  padding: .4rem var(--edge) 1.1rem;
}
.ntr {
  display: flex; align-items: baseline; gap: 1rem;
  width: 100%; min-height: 48px; padding: .55rem .2rem;
  border-bottom: 1px solid var(--rule);
  text-align: left; color: var(--ink);
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease);
}
.ntr:last-child { border-bottom: 0; }
.ntr:hover, .ntr:focus-visible { border-bottom-color: var(--ink); }
.ntr:hover .ntr-title { color: var(--accent); }
.ntr:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ntr-num {
  flex: 0 0 3.4em;
  font-family: var(--ui); font-size: var(--ap-md); font-weight: 600;
  letter-spacing: .16em; color: var(--accent);
  font-variant-numeric: lining-nums tabular-nums;
}
.ntr-title {
  flex: 1 1 auto; min-width: 0;
  font-variation-settings: var(--lit-mid);
  font-weight: 400; font-size: 1.02rem; line-height: 1.2;
  transition: color var(--dur-fast) var(--ease);
}
.ntr-dur {
  flex: 0 0 auto;
  font-family: var(--ui); font-size: var(--ap-sm); color: var(--ink-faint);
  font-variant-numeric: lining-nums tabular-nums;
}
.ntr.is-read .ntr-title { color: var(--ink-soft); }
.ntr.is-active .ntr-title { color: var(--accent); font-weight: 400; }
.ntr.is-active .ntr-num::before { content: '▸ '; }

@media (prefers-reduced-motion: reduce) {
  .nav-toc { transition: none; }
  .toc-row { transition: none; }
  .ntt-here::after { transition: none; }
}

/* Lexicon */
@property --lex-ink {
  syntax: '<percentage>';
  inherits: false;
  initial-value: 0%;
}

#lexicon { padding-block: clamp(3rem, 8vh, 6rem); }

.lex-head {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: subgrid;
  padding-bottom: clamp(1.6rem, 3vw, 2.6rem);
  border-bottom: 1px solid var(--rule-strong);
}
@supports not (grid-template-columns: subgrid) {
  .lex-head { grid-template-columns: repeat(12, 1fr); column-gap: var(--step); }
}
.lex-head .chapter-num { grid-column: 1 / 3; padding-top: .55em; }
.lex-standfirst { grid-column: 3 / 10; }
.lex-head.is-bare .lex-legend { margin-top: .45em; }
.lex-head.is-bare { padding-bottom: clamp(1.1rem, 2.2vw, 1.8rem); }
.lex-head.is-bare .lex-standfirst { grid-column: 1 / 9; }
@media (max-width: 900px) { .lex-head.is-bare .lex-standfirst { grid-column: 1 / 7; } }
.lex-standfirst p {
  font-style: italic; color: var(--ink-soft);
  font-size: 1rem; line-height: 1.55; max-width: 52ch; margin: 0;
}
.lex-legend { margin-top: .8em; }

/* Lexicon wall and article */
.lex-body {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: subgrid;
  margin-top: clamp(1.8rem, 4vw, 3rem);
}
@supports not (grid-template-columns: subgrid) {
  .lex-body { grid-template-columns: repeat(12, 1fr); column-gap: var(--step); }
}
/* Justification needs inline chips and the whitespace js/render.js inserts between them. */
.lex-wall {
  grid-column: 3 / 10;
  display: block;
  text-align: justify;
  text-align-last: left;
  -webkit-text-align-last: left;
  line-height: 1;
  --lex-w: 1.62rem;
}
.lex-chip {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: .12em;
  vertical-align: baseline;
  padding: .35em .5em .3em;
  margin: 0 0 .5rem;
  min-height: 44px;
  border: 0; border-bottom: 1px solid var(--rule);
  background: none; color: var(--ink);
  cursor: pointer; text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: border-color var(--dur-fast) var(--ease),
              background-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}
.lex-chip:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) { .lex-chip:active { transform: none; } }
.lex-chip { --lex-mul: 1; }
.lex-chip[data-weight="2"] { --lex-mul: 1.16; }
.lex-chip[data-weight="3"] { --lex-mul: 1.52; }
.lex-chip-word {
  font-family: var(--heb); font-weight: 300;
  font-size: calc(var(--lex-w) * var(--lex-mul)); line-height: 1.25;
  color: var(--accent);
}
/* Reduce the Latin and Greek sizes to match the Hebrew optically. */
.lex-chip-word.is-greek {
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-weight: 400; font-size: calc(var(--lex-w) * .85 * var(--lex-mul));
}
.lex-chip-word.is-roman {
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-style: italic; font-weight: 400;
  font-size: calc(var(--lex-w) * .85 * var(--lex-mul));
}
.lex-chip-t {
  font-family: var(--ui); font-size: var(--ap-sm); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}
.lex-chip:hover { border-bottom-color: var(--ink); background: var(--control-wash); }
.lex-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lex-chip.is-on {
  border-bottom-color: var(--accent); border-bottom-width: 2px;
  background: var(--control-wash);
}
.lex-chip.is-on .lex-chip-t { color: var(--ink); }

.lex-wall.is-inking .lex-chip-word {
  --lex-ink: 0%;
  -webkit-mask-image: linear-gradient(to left,
    #000 0, #000 calc(var(--lex-ink) - 9%), transparent var(--lex-ink), transparent 100%);
  mask-image: linear-gradient(to left,
    #000 0, #000 calc(var(--lex-ink) - 9%), transparent var(--lex-ink), transparent 100%);
  transition: --lex-ink var(--lex-draw-ms, 2600ms) cubic-bezier(.22, .61, .25, 1);
  transition-delay: var(--lex-delay, 0ms);
}
.lex-wall.is-inking .lex-chip-word.is-greek,
.lex-wall.is-inking .lex-chip-word.is-roman {
  -webkit-mask-image: linear-gradient(to right,
    #000 0, #000 calc(var(--lex-ink) - 9%), transparent var(--lex-ink), transparent 100%);
  mask-image: linear-gradient(to right,
    #000 0, #000 calc(var(--lex-ink) - 9%), transparent var(--lex-ink), transparent 100%);
}
.lex-wall.is-inking .lex-chip-t {
  opacity: 0;
  transition: opacity 700ms var(--ease);
  transition-delay: calc(var(--lex-delay, 0ms) + 900ms);
}
.lex-wall.is-inking .lex-chip { border-bottom-color: transparent; transition: border-color 900ms var(--ease); transition-delay: var(--lex-delay, 0ms); }
.lex-wall.is-inking.is-drawn .lex-chip-word { --lex-ink: 112%; }
.lex-wall.is-inking.is-drawn .lex-chip-t { opacity: 1; }
.lex-wall.is-inking.is-drawn .lex-chip { border-bottom-color: var(--rule); }
.lex-wall.is-inking.is-drawn .lex-chip.is-on { border-bottom-color: var(--accent); }

/* Match the animation selectors' specificity so reduced motion shows the finished text. */
@media (prefers-reduced-motion: reduce) {
  .lex-wall.is-inking .lex-chip-word {
    -webkit-mask-image: none; mask-image: none;
    transition: none; --lex-ink: 112%;
  }
  .lex-wall.is-inking .lex-chip-t { opacity: 1; transition: none; }
  .lex-wall.is-inking .lex-chip { border-bottom-color: var(--rule); transition: none; }
}

/* Pin the article to row 1. Grid auto-placement has moved past it after the controls. */
.lex-article {
  grid-column: 10 / 13; grid-row: 1;
  position: sticky; top: clamp(4.5rem, 9vh, 6.5rem);
  align-self: start;
}
.lex-article .lex-plate {
  background: none;
  border: 0;
  border-left: 1px solid var(--rule);
  padding: .1rem 0 .2rem clamp(1rem, 1.4vw, 1.4rem);
}
.lex-article .lex-plate[data-kind="mark"] { border-left: 2px solid var(--accent); }
/* Narrow phone lines have too few words for justification without large gaps. */
@media (max-width: 820px) {
  .lex-wall { text-align: left; }
}
@media (max-width: 900px) {
  .lex-article .lex-plate {
    border-left: 0; border-top: 1px solid var(--rule);
    padding: 1.2rem 0 0;
  }
  .lex-article .lex-plate[data-kind="mark"] { border-left: 0; border-top: 2px solid var(--accent); }
}

@media (max-width: 900px) {
  .lex-body { grid-template-columns: repeat(6, 1fr); }
  .lex-wall { grid-column: 1 / 7; }
  .lex-body { display: flex; flex-direction: column; }
  .lex-wall { order: 0; }
  .lex-controls { order: 1; }
  .lex-article { order: 2; margin: 0; }
  /* js/ui.js inserts the entry after the selected word. The block splits the inline run
     and the script compensates for the reflow to keep the word in place. */
  .lex-wall > .lex-article {
    display: block; width: 100%;
    margin: .1rem 0 .9rem;
    padding: 0;
    background: var(--paper);
    border-top: 1px solid var(--rule-strong);
    border-bottom: 1px solid var(--rule-strong);
  }
  .lex-wall > .lex-article .lex-plate,
  .lex-wall > .lex-article .lex-plate[data-kind="mark"] {
    padding: 1rem 0 1.1rem; border-top: 0; border-left: 0;
  }
  .lex-wall > .lex-article:has(.lex-plate[data-kind="mark"]:not([hidden])) {
    border-top: 2px solid var(--accent);
  }
}



/* Author display rules beat the browser's hidden rule for lexicon entries. */
.lex-plate[hidden] { display: none; }
.lex-plate {
  display: flex; flex-direction: column;
  padding: clamp(1.5rem, 3vw, 2.2rem);
  background: color-mix(in srgb, var(--ink) 2.5%, var(--paper));
  border: 1px solid var(--rule);
  transition: border-color var(--dur-med) var(--ease);
}
.lex-plate.is-drawn { border-color: var(--rule-strong); }
.lex-plate[data-kind="mark"] { border-left: 2px solid var(--accent); }

.lex-tag {
  margin: 0 0 .9em;
  font-family: var(--ui); font-size: var(--ap-sm); font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint);
}

.lex-word {
  font-family: var(--heb); font-weight: 300;
  font-size: clamp(2.8rem, 6vw, 4.4rem);
  line-height: 1.18;
  color: var(--accent);
  overflow: visible;
  margin-bottom: .35em;
  min-height: 1.18em;
}
.lex-word.is-greek {
  font-family: var(--serif);
  font-variation-settings: var(--lit-display);
  font-style: italic; font-weight: 300;
  font-size: clamp(1.7rem, 3.4vw, 2.7rem);
}
.lex-word.is-roman {
  font-family: var(--serif);
  font-variation-settings: var(--lit-display);
  font-style: normal; font-weight: 300;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: .04em;
}
.lex-word.is-roman .lex-ink {
  -webkit-mask-image: linear-gradient(to right,
    #000 0, #000 calc(var(--lex-ink) - 9%), transparent var(--lex-ink), transparent 100%);
  mask-image: linear-gradient(to right,
    #000 0, #000 calc(var(--lex-ink) - 9%), transparent var(--lex-ink), transparent 100%);
}

.lex-ink {
  display: inline-block;
  --lex-ink: 0%;
  -webkit-mask-image: linear-gradient(to left,
    #000 0, #000 calc(var(--lex-ink) - 9%), transparent var(--lex-ink), transparent 100%);
  mask-image: linear-gradient(to left,
    #000 0, #000 calc(var(--lex-ink) - 9%), transparent var(--lex-ink), transparent 100%);
  transition: --lex-ink 2600ms cubic-bezier(.22, .61, .25, 1);
}
.lex-word.is-greek .lex-ink {
  -webkit-mask-image: linear-gradient(to right,
    #000 0, #000 calc(var(--lex-ink) - 9%), transparent var(--lex-ink), transparent 100%);
  mask-image: linear-gradient(to right,
    #000 0, #000 calc(var(--lex-ink) - 9%), transparent var(--lex-ink), transparent 100%);
}
.lex-plate.is-drawn .lex-ink { --lex-ink: 112%; }

/* Keep grapheme spans inline so each word shapes and breaks as a word. */
.lex-g { transition: color 1100ms var(--ease); }
.lex-plate.is-rooted .lex-g { color: var(--ink-faint); }
.lex-plate.is-rooted .lex-g.is-root { color: var(--accent); }

.lex-root-note {
  margin: 0 0 .8em;
  font-family: var(--ui); font-size: var(--ap-sm); font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint);
  opacity: 0; transition: opacity 900ms var(--ease);
}
.lex-plate.is-rooted .lex-root-note { opacity: 1; }
/* Rootless entries never receive .is-rooted, so show their notes immediately. */
.lex-root-note.is-absent {
  opacity: 1; transition: none;
  letter-spacing: .1em; text-transform: none;
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-weight: 400; font-style: italic; font-size: var(--ap-lg);
  color: var(--ink-faint);
}
.lex-root-word {
  font-family: var(--heb); font-weight: 400;
  font-size: 1.5em; letter-spacing: .08em; text-transform: none;
  color: var(--accent); vertical-align: -.12em; margin-inline-start: .5em;
}

/* Fade when @property is unavailable because the unregistered mask value cannot interpolate. */
@supports not (background: paint(x)) {
  @supports not (--lex-probe: 1%) {
    .lex-ink { -webkit-mask-image: none; mask-image: none; opacity: 0; transition: opacity 900ms var(--ease); }
    .lex-plate.is-drawn .lex-ink { opacity: 1; }
  }
}

.lex-translit {
  font-family: var(--serif); font-variation-settings: var(--lit-mid);
  font-style: italic; font-weight: 400;
  font-size: clamp(1.1rem, 1.6vw, 1.35rem); line-height: 1.2;
  margin: 0 0 .55em; color: var(--ink);
}
.lex-gloss {
  font-size: .98rem; line-height: 1.62; color: var(--ink-soft);
  max-width: 46ch; margin: 0 0 auto;
}
.lex-where {
  margin: 1.2em 0 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: .9em;
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-size: var(--ap-sm); font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--accent);
}
.lex-where a {
  color: var(--ink-faint);
  border-bottom: 1px solid currentColor;
  min-height: 44px; display: inline-flex; align-items: center;
}
.lex-where a:hover, .lex-where a:focus-visible { color: var(--ink); }

@media (max-width: 900px) {
  .lex-head { grid-template-columns: repeat(6, 1fr); }
  .lex-head .chapter-num { grid-column: 1 / 7; padding-top: 0; margin-bottom: .6rem; }
  .lex-standfirst { grid-column: 1 / 7; }
}

@media (prefers-reduced-motion: reduce) {
  .lex-ink {
    -webkit-mask-image: none; mask-image: none;
    transition: none; --lex-ink: 112%;
  }
  .lex-g, .lex-root-note { transition: none; }
  .lex-plate .lex-g { color: var(--ink-faint); }
  .lex-plate .lex-g.is-root { color: var(--accent); }
  .lex-plate .lex-root-note { opacity: 1; }
}

/* Lexicon filters */
.lex-controls {
  grid-column: 3 / 10;
  display: flex; flex-wrap: wrap; gap: .4rem 1.6rem;
  align-items: center;
  margin-top: clamp(1.2rem, 2.6vw, 1.9rem);
  padding-top: clamp(1rem, 2.2vw, 1.6rem);
  border-top: 1px solid var(--rule);
}
/* This override must follow the base rule because their specificity is equal. */
@media (max-width: 900px) {
  .lex-controls { grid-column: 1 / 7; }
}
.lex-controls-label {
  font-family: var(--ui); font-size: var(--ap-sm); font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint);
  margin-inline-end: .2rem;
}
.lex-filter, .lex-sort {
  display: flex; flex-wrap: wrap; gap: .4rem;
  align-items: center;
}
.lex-filter { flex: 1 1 24rem; }
.lex-filter-sep {
  width: 1px; align-self: center; height: 1.5em; margin: 0 .55rem;
  background: var(--rule-strong);
}
.lex-filter-btn {
  position: relative;
  display: inline-flex; align-items: baseline; justify-content: center; gap: .42em;
  min-height: 44px; min-width: 44px;
  padding: .6em .55em .75em;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-size: 1rem; font-weight: 400;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: .06em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}
.lex-filter-btn::before {
  content: ''; position: absolute; left: .18em; right: .18em; bottom: .42em;
  height: 1px; background: var(--rule-strong);
}
/* Animate scale so the tab row does not reflow. */
.lex-filter-btn::after {
  content: ''; position: absolute; left: .18em; right: .18em; bottom: .38em;
  height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: 50% 50%;
  transition: transform var(--dur-med) var(--ease);
}
.lex-filter-btn:hover { color: var(--ink); }
.lex-filter-btn:hover::after { transform: scaleX(.4); }
.lex-filter-btn:active { transform: translateY(1px); }
.lex-filter-btn:active::after { transform: scaleX(.7); }
.lex-filter-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lex-filter-btn.is-on { color: var(--ink); font-weight: 500; }
.lex-filter-btn.is-on::after,
.lex-filter-btn.is-on:hover::after,
.lex-filter-btn.is-on:active::after { transform: scaleX(1); }
.lex-filter-n {
  font-family: var(--ui); font-size: var(--ap-sm); font-weight: 600;
  color: var(--ink-faint);
  align-self: flex-start; transform: translateY(.18em);
}
.lex-filter-btn.is-on .lex-filter-n { color: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .lex-filter-btn,
  .lex-filter-btn::after { transition: none; }
  .lex-filter-btn:active { transform: none; }
}

.lex-wall[data-filter="ch01"] .lex-chip:not([data-ch="ch01"]),
.lex-wall[data-filter="ch02"] .lex-chip:not([data-ch="ch02"]),
.lex-wall[data-filter="ch03"] .lex-chip:not([data-ch="ch03"]),
.lex-wall[data-filter="ch04"] .lex-chip:not([data-ch="ch04"]),
.lex-wall[data-filter="ch05"] .lex-chip:not([data-ch="ch05"]),
.lex-wall[data-filter="ch06"] .lex-chip:not([data-ch="ch06"]),
.lex-wall[data-filter="ch07"] .lex-chip:not([data-ch="ch07"]),
.lex-wall[data-filter="ch08"] .lex-chip:not([data-ch="ch08"]),
.lex-wall[data-filter="ch09"] .lex-chip:not([data-ch="ch09"]),
.lex-wall[data-filter="ch10"] .lex-chip:not([data-ch="ch10"]) { display: none; }
/* The two filter axes use attributes on one element, avoiding per-chip JS writes. */
.lex-wall[data-filter="lang:he"]  .lex-chip:not([data-lang="he"]),
.lex-wall[data-filter="lang:grc"] .lex-chip:not([data-lang="grc"]),
.lex-wall[data-filter="lang:akk"] .lex-chip:not([data-lang="akk"]) { display: none; }

/* Print every lexicon entry, regardless of the current screen selection. */
@media print {
  .lex-controls, .lex-wall { display: none !important; }
  .lex-article .lex-plate { display: flex !important; }
  .lex-article .lex-plate[hidden] { display: flex !important; }
  .lex-article { display: block !important; }
  .lex-plate .lex-ink { opacity: 1 !important; -webkit-mask-image: none !important; mask-image: none !important; }
}


/* Names and places */
.ni-body {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: subgrid;
  margin-top: clamp(1.8rem, 4vw, 3rem);
  row-gap: clamp(1.8rem, 3vw, 2.6rem);
}
@supports not (grid-template-columns: subgrid) {
  .ni-body { grid-template-columns: repeat(12, 1fr); column-gap: var(--step); }
}
.ni-letter { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; }
@supports not (grid-template-columns: subgrid) {
  .ni-letter { grid-template-columns: repeat(12, 1fr); column-gap: var(--step); }
}
.ni-letter .si-book-name {
  grid-column: 1 / 3; padding-top: .05em;
  border-bottom: 0; padding-bottom: 0;
  font-family: var(--serif);
  font-variation-settings: var(--lit-normal);
  font-size: clamp(2.1rem, 3.6vw, 3.2rem);
  font-weight: 400;
  line-height: .88;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent);
}
.ni-entries {
  grid-column: 3 / 13;
  display: grid; gap: 1.4rem clamp(1.2rem, 2vw, 2.2rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  align-content: start;
}
.ni-entry { break-inside: avoid; }
.ni-name {
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-weight: 500; font-size: 1rem; line-height: 1.3; color: var(--ink);
  margin: 0 0 .2em;
  display: flex; align-items: baseline; gap: .5em; flex-wrap: wrap;
}
.ni-note {
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-style: italic; font-size: var(--ap-lg); line-height: 1.5;
  color: var(--ink-soft); margin: 0 0 .35em; max-width: 34ch;
}
.ni-list { display: flex; flex-wrap: wrap; gap: 0 .1rem; margin: 0; padding: 0; list-style: none; }
.ni-cite { margin: 0; }
.ni-cite a {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px;
  color: var(--accent); text-decoration: none;
}
.ni-num {
  font-family: var(--ui); font-size: var(--ap-md); font-weight: 600;
  letter-spacing: .08em; font-variant-numeric: lining-nums tabular-nums;
}
.ni-cite a:hover .ni-num,
.ni-cite a:focus-visible .ni-num { box-shadow: inset 0 -1px 0 var(--accent); }
.ni-cite a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 900px) {
  .ni-body, .ni-letter { grid-template-columns: repeat(6, 1fr); }
  .ni-letter .si-book-name {
    grid-column: 1 / 7; padding-top: 0; margin-bottom: .6rem;
    padding-bottom: .12em; border-bottom: 1px solid var(--rule-strong);
  }
  .ni-entries { grid-column: 1 / 7; display: block; }

  .ni-entry {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    column-gap: .6rem;
    padding: .55rem 0 .7rem;
    border-bottom: 1px solid var(--rule);
  }
  .ni-letter:last-child .ni-entry:last-child { border-bottom: 0; }
  .ni-name { grid-column: 1; margin: 0; font-size: 1.06rem; }
  .ni-list { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  .ni-note {
    grid-column: 1 / -1; grid-row: 2;
    max-width: none;
    margin: .1rem 0 0;
    font-size: .92rem; line-height: 1.45;
  }
}

@media print {
  .ni-entry { break-inside: avoid; }
}

/* Sources */
.src-body {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: subgrid;
  margin-top: clamp(1.8rem, 4vw, 3rem);
  row-gap: clamp(2.2rem, 4vw, 3.4rem);
}
@supports not (grid-template-columns: subgrid) {
  .src-body { grid-template-columns: repeat(12, 1fr); column-gap: var(--step); }
}
.src-group { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; }
@supports not (grid-template-columns: subgrid) {
  .src-group { grid-template-columns: repeat(12, 1fr); column-gap: var(--step); }
}
.src-group-head {
  grid-column: 1 / 3;
  font-family: var(--serif);
  font-variation-settings: var(--lit-mid);
  font-size: clamp(1.25rem, 1.9vw, 1.6rem);
  font-weight: 400; line-height: 1.1;
  letter-spacing: -.005em; text-transform: none;
  color: var(--accent);
  margin: 0; padding-top: .05em;
  text-wrap: balance;
}
.src-group-note {
  grid-column: 3 / -1;
  font-style: italic; color: var(--ink-soft);
  font-size: var(--ap-lg); line-height: 1.55; max-width: 62ch;
  margin: 0 0 1.5rem;
}
.src-items {
  grid-column: 3 / -1;
  display: grid; align-content: start;
  gap: clamp(1.6rem, 2.6vw, 2.4rem) clamp(1.4rem, 2.4vw, 2.6rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
}
.src-item { break-inside: avoid; }
.src-title {
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-weight: 500; font-size: 1.05rem; line-height: 1.35;
  color: var(--ink); margin: 0 0 .25em;
}
.src-who {
  font-family: var(--ui); font-size: var(--ap-md); font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 .55em;
}
.src-what {
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-size: var(--ap-lg); line-height: 1.6; color: var(--ink-soft);
  max-width: 56ch; margin: 0;
}
.src-where {
  font-family: var(--ui); font-size: var(--ap-sm);
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); margin: .5em 0 0;
}
/* The text flag identifies an open citation independently of the accent color. */
.src-item.is-open { border-left: 2px solid var(--accent); padding-left: clamp(.9rem, 1.2vw, 1.2rem); }
.src-flag {
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-style: italic; font-size: var(--ap-lg); line-height: 1.55;
  color: var(--ink-soft); max-width: 56ch; margin: .6em 0 0;
}

@media (max-width: 900px) {
  .src-body, .src-group { grid-template-columns: repeat(6, 1fr); }
  .src-group-head { grid-column: 1 / 7; padding-top: 0; margin-bottom: .6rem; }
  .src-group-note, .src-items { grid-column: 1 / 7; }
  .src-items { grid-template-columns: 1fr; }
}

@media print {
  .src-item { break-inside: avoid; }
}

/* Search */
.sheet-search .sheet-inner { max-width: 46rem; }
.search-field { margin: 1.2rem 0 .4rem; }
#search-input {
  width: 100%;
  box-sizing: border-box;
  padding: .8em .9em;
  border: 1px solid var(--control-edge);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-variation-settings: var(--lit-normal);
  font-size: 1.05rem;
  min-height: 48px;
  border-radius: 0;
  -webkit-appearance: none;
}
#search-input::placeholder { color: var(--ink-faint); }
#search-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.search-status {
  margin: 0 0 .4rem;
  font-family: var(--ui); font-size: var(--ap-md);
  letter-spacing: .06em; color: var(--ink-faint);
  min-height: 1.2em;
}
/* Scroll the results independently so the search field stays visible. */
.search-results { max-height: min(56vh, 32rem); overflow-y: auto; }
.sr-hit {
  display: block;
  padding: .85rem 0;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  text-decoration: none;
}
.sr-hit:hover, .sr-hit:focus-visible { color: var(--ink); }
.sr-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-meta {
  display: flex; gap: .8em; align-items: baseline; flex-wrap: wrap;
  margin-bottom: .3em;
  font-family: var(--ui); font-size: var(--ap-sm);
  letter-spacing: .12em; text-transform: uppercase;
}
.sr-kind { color: var(--accent); font-weight: 600; }
.sr-where { color: var(--ink-faint); }
.sr-text {
  display: block;
  font-family: var(--serif); font-variation-settings: var(--lit-normal);
  font-size: var(--ap-lg); line-height: 1.55;
}
.sr-text mark {
  background: none;
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 -1px 0 var(--accent);
}
#search-btn svg { width: 17px; height: 17px; display: block; }
#nav-lang svg, #theme-btn svg { width: 18px; height: 18px; }
#search-btn { display: grid; place-items: center; }

@media (max-width: 640px) {
  .search-results { max-height: 50vh; }
}

/* Back-matter links */
.bm-links {
  grid-column: 3 / 11;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0 clamp(1rem, 2.2vw, 2rem);
  margin-top: clamp(2.4rem, 5vw, 4rem);
  border-top: 1px solid var(--rule);
}
@media (max-width: 900px) { .bm-links { grid-column: 1 / 7; } }
.bm-link {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: .2rem 0;
  font-family: var(--ui); font-size: var(--ap-sm); font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-faint); text-decoration: none;
  border-bottom: 1px solid transparent;
}
.bm-link:hover { color: var(--ink); border-bottom-color: var(--ink); }
.bm-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bm-link.is-back { color: var(--accent); margin-left: auto; }
.bm-link.is-back:hover { border-bottom-color: var(--accent); }
@media (max-width: 640px) { .bm-link.is-back { margin-left: 0; } }

/* Use document positioning to keep the share button with the selection during scroll. */
.quote-pill {
  position: absolute;
  z-index: 60;
  display: inline-flex; align-items: center; gap: .5em;
  min-height: 44px;
  padding: .6em 1em;
  border: 1px solid var(--control-edge);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui); font-size: var(--ap-lg); font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .16);
  transition: border-color var(--dur-fast) var(--ease),
              background-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.quote-pill svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.quote-pill:hover, .quote-pill:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--paper));
}
.quote-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.quote-pill.is-done { border-color: var(--accent); color: var(--accent); }
.quote-pill.is-done svg { display: none; }
@media (prefers-reduced-motion: reduce) {
  .quote-pill { transition: none; }
}
