:root {
  color-scheme: light dark;
  --ink: #1a1a1a;
  --muted: #5a5a5a;
  --rule: #e0ddd6;
  --paper: #fbfaf7;
  --accent: #7a4a2b;
  /* The Allegro IT content width, 1320 px (Jack, 2026-10-16), in rem so it
     scales with the reader's font size; the gutter is fluid, never under 24 px. */
  --frame: 82.5rem;
  --gutter: max(1.5rem, 4vw);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ececec;
    --muted: #a0a0a0;
    --rule: #333;
    --paper: #16161a;
    --accent: #d9a06b;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding-inline: var(--gutter);
  padding-block: 0 3rem;
  background: var(--paper);
  color: var(--ink);
  font: 1.125rem/1.7 Georgia, 'Times New Roman', serif;
  -webkit-text-size-adjust: 100%;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  max-inline-size: var(--frame);
  margin-inline: auto;
  padding-block: 1rem;
  border-block-end: 1px solid var(--rule);
  font-family: system-ui, sans-serif;
  font-size: 0.875rem;
}

.page-header a { color: var(--muted); text-decoration: none; }
.page-header .home { font-weight: 600; color: var(--ink); }
.page-header .ask { color: var(--accent); }

/* The page is the frame, text included. */
main, footer { max-inline-size: var(--frame); margin-inline: auto; }

h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-block: 1.5rem 0.5rem;
}

.lede { color: var(--muted); }

.version { margin-block: 2rem; }

.version h2 {
  font-family: system-ui, sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding-block-end: 0.35rem;
  border-block-end: 1px solid var(--rule);
}

.version .tier {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  margin-inline-start: 0.5rem;
}

/* Which consolidation the text came from. On its own line rather than beside
   the tier: it is the one thing on the page a reader can look up for
   themselves, and a reader checking it is reading a document number, not
   skimming a badge. */
.version .citation {
  display: block;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Hebrew and Greek need a face that actually has the glyphs, at a size that
   makes the pointing legible rather than merely present. */
.version[lang='he'], .version[lang='arc'] {
  font-family: 'SBL Hebrew', 'Ezra SIL', 'Noto Serif Hebrew', 'Times New Roman', serif;
  font-size: 1.5rem;
  line-height: 2;
}

.version[lang='grc'] {
  font-family: 'SBL Greek', 'Noto Serif', 'Gentium Plus', Georgia, serif;
}

.verse { margin-block: 0.6rem; }

.verse .number {
  font-family: system-ui, sans-serif;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  vertical-align: 0.4em;
  margin-inline-end: 0.15rem;
}

/* The id is on the verse number, not the line, so `.verse:target` never matched
   and a linked verse was never marked. */
.verse:has(:target) .text { background: color-mix(in srgb, var(--accent) 15%, transparent); }

/* The verse actions (verse-actions.js). A line and the heading can be tapped;
   the selection is marked more strongly than a linked verse. */
.verse[data-ref], main h1[data-ref] { cursor: pointer; }
.verse.is-selected .text,
main h1.is-selected { background: color-mix(in srgb, var(--accent) 28%, transparent); }

.verse-actions {
  position: fixed;
  inset-block-end: 1rem;
  inset-inline: var(--gutter);
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  max-inline-size: 40rem;
  margin-inline: auto;
  padding-block: 0.6rem;
  padding-inline: 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 0.75rem;
  background: var(--paper);
  box-shadow: 0 0.5rem 1.5rem color-mix(in srgb, var(--ink) 25%, transparent);
  font-family: system-ui, sans-serif;
  font-size: 0.9375rem;
}

.verse-actions[hidden] { display: none; }

.verse-actions__label { flex: 1 1 auto; font-weight: 600; }

.verse-actions button {
  padding-block: 0.45rem;
  padding-inline: 0.8rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}

.verse-actions button:first-of-type { background: var(--accent); color: var(--paper); }

/* The question at the end of a chapter. */
.ask-more {
  margin-block: 2rem 0;
  font-family: system-ui, sans-serif;
  font-size: 1rem;
}

.ask-more a { color: var(--accent); }

.chapters {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-block: 2.5rem;
  padding-block-start: 1rem;
  border-block-start: 1px solid var(--rule);
  font-family: system-ui, sans-serif;
  font-size: 0.9375rem;
}

.chapters a {
  color: var(--accent);
  text-decoration: none;
  /* Comfortably tappable on a phone held one-handed. */
  padding-block: 0.75rem;
}

.books {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.25rem;
  font-family: system-ui, sans-serif;
  font-size: 0.9375rem;
}

.books a {
  display: block;
  padding-block: 0.6rem;
  color: var(--ink);
  text-decoration: none;
}

.books a:hover { color: var(--accent); }

/* Corpus › book › chapter › version. Small and quiet: it is for climbing back
   up, not for reading. */
.breadcrumb {
  max-inline-size: var(--frame);
  margin-inline: auto;
  padding-block-start: 0.75rem;
  font-family: system-ui, sans-serif;
  font-size: 0.8125rem;
  color: var(--muted);
}

.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.breadcrumb li + li::before { content: "›"; margin-inline: 0.4rem; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

/* A book's chapters. Numbers are short, so the cells are tappable squares;
   an act's labels ("§ 5 a", "betragtning 41") need wider ones. */
.chapter-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr));
  gap: 0.35rem;
  font-family: system-ui, sans-serif;
  font-size: 0.9375rem;
}

.chapter-list--labels { grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); }

.chapter-list a {
  display: block;
  padding-block: 0.6rem;
  text-align: center;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--rule);
  border-radius: 0.25rem;
}

.chapter-list a:hover { color: var(--accent); border-color: var(--accent); }

.chapter-list a[aria-current="page"] {
  color: var(--paper);
  background: var(--accent);
  border-color: var(--accent);
}

.version h2 a { color: inherit; text-decoration: none; }
.version h2 a:hover { color: var(--accent); }

/* The version tabs. `hidden` in the markup; passage.js shows the row, so a
   reader without JavaScript never meets buttons that do nothing. */
.version-tabs {
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-block: 1rem 0.5rem;
  font-family: system-ui, sans-serif;
  font-size: 0.875rem;
}

.version-tabs button {
  padding-block: 0.45rem;
  padding-inline: 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.version-tabs button:hover { color: var(--accent); border-color: var(--accent); }

.version-tabs button[aria-pressed="true"] {
  color: var(--paper);
  background: var(--accent);
  border-color: var(--accent);
}

/* Parallel: one row per verse, one column per chosen version. passage.js builds
   it; every row holds one cell per version, so flowing the cells into equal
   columns needs no count. On a phone the cells stack under each verse, each named. */
.parallel { margin-block: 1.5rem; }

.parallel__row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 0 1.5rem;
  padding-block: 0.4rem;
  border-block-end: 1px solid var(--rule);
}

.parallel__head {
  font-family: system-ui, sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.parallel__cell .verse { margin-block: 0.2rem; }

.parallel__label {
  display: none;
  font-family: system-ui, sans-serif;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.parallel__cell[lang='he'], .parallel__cell[lang='arc'] {
  font-family: 'SBL Hebrew', 'Ezra SIL', 'Noto Serif Hebrew', 'Times New Roman', serif;
  font-size: 1.35rem;
  line-height: 1.9;
}

.parallel__cell[lang='grc'] {
  font-family: 'SBL Greek', 'Noto Serif', 'Gentium Plus', Georgia, serif;
}

@media (max-width: 40rem) {
  .parallel__row { grid-auto-flow: row; gap: 0.35rem 0; }
  .parallel__head { display: none; }
  .parallel__label { display: block; }
}

/* The corpus's own words on how the versions divide the chapter. Shown in
   Parallel and without JavaScript; passage.js hides it for a single version. */
.versification {
  margin-block: 1rem;
  padding-block: 0.6rem;
  padding-inline: 0.9rem;
  border-inline-start: 3px solid var(--accent);
  font-family: system-ui, sans-serif;
  font-size: 0.8125rem;
  color: var(--muted);
}

.versification p { margin-block: 0.25rem; }

.other-versions {
  font-family: system-ui, sans-serif;
  font-size: 0.9375rem;
}

.other-versions ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.other-versions a { color: var(--accent); text-decoration: none; }

footer {
  margin-block-start: 3rem;
  padding-block-start: 1.5rem;
  border-block-start: 1px solid var(--rule);
  font-family: system-ui, sans-serif;
  font-size: 0.8125rem;
  color: var(--muted);
}

footer h2 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.attribution { list-style: none; padding: 0; }
.attribution li { margin-block: 0.5rem; }
footer a { color: var(--accent); }
