/* Design tokens.
 *
 * The palette is drawn from manuscript and church interiors: warm parchment,
 * deep ink, a restrained Byzantine red, a midnight blue, and gold used only as
 * an accent line or rule - never as body text, where it could not hold
 * contrast. Every colour is defined on bare :root first, so a page still has a
 * complete palette when no media query and no data-theme attribute apply.
 */
:root {
  color-scheme: light;

  --parchment: #faf6ee;
  --parchment-deep: #f2ebdd;
  --parchment-edge: #e6dcc7;
  --ink: #23201c;
  --ink-soft: #4a443c;
  --ink-faint: #6d665b;
  --byzantine: #7b1d21;
  --byzantine-bright: #96262b;
  --ultramarine: #1f3260;
  --ultramarine-soft: #33487d;
  --gold: #9a7b28;
  --gold-line: #c9ab5e;

  --bg: var(--parchment);
  --bg-raised: #fffdf8;
  --bg-sunken: var(--parchment-deep);
  --text: var(--ink);
  --text-soft: var(--ink-soft);
  --text-faint: var(--ink-faint);
  --accent: var(--byzantine);
  --accent-strong: var(--byzantine-bright);
  --link: var(--ultramarine);
  --link-visited: #4b3468;
  --rule: var(--parchment-edge);
  --rule-strong: #d3c6a9;
  --focus: #1f3260;

  --source-bg: #f4efe2;
  --source-border: var(--gold-line);
  --summary-bg: #eef1f7;
  --summary-border: #b9c4dc;
  --warn-bg: #fbf0e4;
  --warn-border: #d8a86a;

  /* Typeface stacks.
   *
   * Atkinson Hyperlegible and Source Serif are named first because they are
   * the intended faces and are used when a reader already has them installed.
   * They are NOT bundled: no font files could be obtained for this build, and
   * shipping an @font-face rule with no file behind it would only cost a
   * failed request. The fallbacks are therefore load-bearing and are ordinary
   * system faces chosen to read well at length. See public/fonts/README.md. */
  --font-body: "Atkinson Hyperlegible", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --step--1: clamp(0.83rem, 0.80rem + 0.14vw, 0.90rem);
  --step-0: clamp(1rem, 0.96rem + 0.20vw, 1.10rem);
  --step-1: clamp(1.20rem, 1.13rem + 0.35vw, 1.38rem);
  --step-2: clamp(1.44rem, 1.32rem + 0.60vw, 1.75rem);
  --step-3: clamp(1.73rem, 1.53rem + 1.00vw, 2.25rem);
  --step-4: clamp(2.07rem, 1.76rem + 1.55vw, 2.90rem);

  --measure: 68ch;
  --gap: 1rem;
  --gap-lg: 1.75rem;
  --radius: 4px;
  --tap: 44px;

  --reader-scale: 1;
  --reader-leading: 1.7;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']):not([data-theme='contrast']) {
    color-scheme: dark;
    --bg: #16151a;
    --bg-raised: #1e1d24;
    --bg-sunken: #121116;
    --text: #ece6da;
    --text-soft: #c3bcae;
    --text-faint: #9d968a;
    --accent: #d98a8f;
    --accent-strong: #eda2a6;
    --link: #9fb6e8;
    --link-visited: #c0a8de;
    --rule: #33313b;
    --rule-strong: #46434f;
    --focus: #9fb6e8;
    --source-bg: #211f1a;
    --source-border: #7a6528;
    --summary-bg: #1b1f2b;
    --summary-border: #3d4560;
    --warn-bg: #2a2119;
    --warn-border: #8a6634;
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #16151a;
  --bg-raised: #1e1d24;
  --bg-sunken: #121116;
  --text: #ece6da;
  --text-soft: #c3bcae;
  --text-faint: #9d968a;
  --accent: #d98a8f;
  --accent-strong: #eda2a6;
  --link: #9fb6e8;
  --link-visited: #c0a8de;
  --rule: #33313b;
  --rule-strong: #46434f;
  --focus: #9fb6e8;
  --source-bg: #211f1a;
  --source-border: #7a6528;
  --summary-bg: #1b1f2b;
  --summary-border: #3d4560;
  --warn-bg: #2a2119;
  --warn-border: #8a6634;
}

:root[data-theme='contrast'] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-raised: #ffffff;
  --bg-sunken: #f2f2f2;
  --text: #000000;
  --text-soft: #1a1a1a;
  --text-faint: #333333;
  --accent: #8a0000;
  --accent-strong: #6b0000;
  --link: #00348f;
  --link-visited: #4b0082;
  --rule: #000000;
  --rule-strong: #000000;
  --focus: #00348f;
  --source-bg: #ffffff;
  --source-border: #000000;
  --summary-bg: #ffffff;
  --summary-border: #000000;
  --warn-bg: #ffffff;
  --warn-border: #000000;
}

/* Base layer: reset, typography, links, focus, and the page shell. */

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: calc(var(--step-0) * var(--reader-scale));
  line-height: var(--reader-leading);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.body-serif .main {
  font-family: var(--font-serif);
}

img,
svg {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  line-height: 1.22;
  margin: 0 0 0.5em;
  color: var(--text);
  text-wrap: balance;
}

h1 {
  font-size: var(--step-4);
  letter-spacing: -0.01em;
}
h2 {
  font-size: var(--step-2);
  margin-top: 1.8em;
}
h3 {
  font-size: var(--step-1);
  margin-top: 1.6em;
}
h4 {
  font-size: var(--step-0);
  margin-top: 1.4em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
}

p,
ul,
ol,
dl,
blockquote,
table {
  margin: 0 0 1.1em;
}

ul,
ol {
  padding-left: 1.35em;
}

li + li {
  margin-top: 0.35em;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:visited {
  color: var(--link-visited);
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.external-marker {
  font-size: 0.8em;
  margin-inline-start: 0.15em;
  vertical-align: 0.15em;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 100;
  background: var(--bg-raised);
  color: var(--text);
  border: 2px solid var(--accent);
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  transition: top 0.15s ease-in-out;
}

.skip-link:focus {
  top: 0.5rem;
}

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--bg-raised);
  position: relative;
}

.site-header::after {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-line), transparent);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 0.7rem 1rem;
  max-width: 78rem;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
  min-height: var(--tap);
}

.brand-mark {
  color: var(--accent);
  display: inline-flex;
}

.brand-title {
  display: block;
  font-family: var(--font-serif);
  font-size: var(--step-1);
  line-height: 1.1;
}

.brand-subtitle {
  display: block;
  font-size: var(--step--1);
  color: var(--text-faint);
  line-height: 1.25;
  max-width: 26ch;
}

.header-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.icon-button {
  min-height: var(--tap);
  min-width: var(--tap);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-soft);
  font: inherit;
  font-size: var(--step--1);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.icon-button:hover {
  background: var(--bg-sunken);
  color: var(--text);
  border-color: var(--rule);
}

.button-label {
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

.site-nav {
  border-top: 1px solid var(--rule);
  background: var(--bg-raised);
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0.75rem 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem;
  max-width: 78rem;
  margin-inline: auto;
}

.site-nav li {
  margin: 0;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 0.7rem;
  color: var(--text-soft);
  text-decoration: none;
  font-size: var(--step--1);
  letter-spacing: 0.02em;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--text);
  border-bottom-color: var(--rule-strong);
}

.site-nav a[aria-current='page'] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

@media (max-width: 47.99rem) {
  .site-nav {
    display: none;
  }
  .site-nav.is-open {
    display: block;
  }
  .site-nav ul {
    flex-direction: column;
  }
  .site-nav a {
    width: 100%;
    border-bottom: 1px solid var(--rule);
  }
}

@media (min-width: 48rem) {
  .nav-toggle {
    display: none;
  }
}

/* ---------- shell ---------- */

.breadcrumbs {
  max-width: 78rem;
  margin: 0 auto;
  padding: 0.75rem 1rem 0;
  font-size: var(--step--1);
  color: var(--text-faint);
}

.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}

.breadcrumbs li + li::before {
  content: '›';
  margin-inline-end: 0.4rem;
  color: var(--rule-strong);
}

.shell {
  flex: 1;
  width: 100%;
  max-width: 78rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
  display: grid;
  gap: var(--gap-lg);
}

.main {
  min-width: 0;
}

.main > * {
  max-width: var(--measure);
}

.main > .full-width,
.shell-wide .main > * {
  max-width: none;
}

@media (min-width: 62rem) {
  .shell-with-rail {
    grid-template-columns: minmax(0, 1fr) 15rem;
  }
}

.rail {
  display: none;
}

@media (min-width: 62rem) {
  .rail {
    display: block;
    position: sticky;
    top: 1.5rem;
    align-self: start;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    font-size: var(--step--1);
    border-left: 2px solid var(--rule);
    padding-left: 1rem;
  }
}

.rail-heading {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-family: var(--font-body);
  margin-bottom: 0.6rem;
}

.rail-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

.rail-toc a {
  display: block;
  padding: 0.3rem 0;
  color: var(--text-soft);
  text-decoration: none;
  line-height: 1.35;
}

.rail-toc a:hover {
  color: var(--link);
  text-decoration: underline;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 2px solid var(--rule);
  background: var(--bg-sunken);
  padding: 2.5rem 1rem 2rem;
  font-size: var(--step--1);
}

.footer-inner {
  max-width: 78rem;
  margin: 0 auto;
  display: grid;
  gap: var(--gap-lg);
}

@media (min-width: 44rem) {
  .footer-inner {
    grid-template-columns: repeat(3, 1fr);
  }
}

.footer-block h2 {
  font-size: var(--step-0);
  margin-top: 0;
}

.footer-block ul {
  list-style: none;
  padding: 0;
}

.footer-block li {
  margin-bottom: 0.15rem;
}

.footer-block a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
}

.footer-confession {
  color: var(--text-faint);
}

.footer-notice {
  max-width: 78rem;
  margin: 2rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--text-soft);
}

.footer-notice-quiet {
  border-top: 0;
  margin-top: 0.4rem;
  padding-top: 0;
  color: var(--text-faint);
}

/* ---------- reader mode ---------- */

body.reader-mode .site-nav,
body.reader-mode .rail,
body.reader-mode .breadcrumbs,
body.reader-mode .site-footer .footer-inner {
  display: none;
}

body.reader-mode .shell {
  max-width: 46rem;
}

@media (forced-colors: active) {
  .site-header::after,
  .rule-ornament {
    display: none;
  }
  .evidence-label,
  .source-tier,
  .chip {
    border: 1px solid CanvasText;
  }
}

/* Components: article furniture, cards, source containers, dialogs, tables. */

/* ---------- page heads ---------- */

.page-head {
  margin-bottom: 1.5rem;
}

.eyebrow {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-family: var(--font-body);
  margin-bottom: 0.4rem;
}

.lede {
  font-size: var(--step-1);
  color: var(--text-soft);
  line-height: 1.5;
}

.rule-ornament {
  border: 0;
  height: 1px;
  background: var(--rule-strong);
  margin: 2rem 0;
  position: relative;
  overflow: visible;
}

.rule-ornament::after {
  content: '';
  position: absolute;
  left: 50%;
  top: -4px;
  width: 9px;
  height: 9px;
  transform: translateX(-50%) rotate(45deg);
  background: var(--bg);
  border: 1px solid var(--gold-line);
}

/* ---------- evidence labels and verification ---------- */

.article-meta {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  background: var(--bg-raised);
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.75rem;
  font-size: var(--step--1);
}

.label-list {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.label-list li {
  margin: 0;
  position: relative;
}

.evidence-label {
  display: inline-block;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--bg-sunken);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  cursor: help;
}

.label-tip {
  position: absolute;
  left: 0;
  top: calc(100% + 0.35rem);
  z-index: 20;
  width: min(22rem, 78vw);
  background: var(--bg-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 0.6rem 0.7rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-soft);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.14);
  display: none;
}

.label-list li:hover .label-tip,
.label-list li:focus-within .label-tip {
  display: block;
}

.verification {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.85rem;
  align-items: baseline;
  margin: 0;
  color: var(--text-soft);
}

.verification-status::before {
  content: '';
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  margin-inline-end: 0.4rem;
  border-radius: 50%;
  background: var(--text-faint);
  border: 1px solid var(--text-soft);
}

.verification[data-status='source-audited'] .verification-status::before {
  background: #2f6b3f;
}

.verification[data-status='primary-verified'] .verification-status::before {
  background: var(--gold);
}

.verification[data-status='awaiting-tier-a-verification'] .verification-status::before {
  background: transparent;
}

.verification-status {
  font-weight: 600;
}

.outstanding {
  margin-top: 0.6rem;
}

.outstanding summary {
  cursor: pointer;
  min-height: 2rem;
  display: flex;
  align-items: center;
  color: var(--link);
}

.report-issue {
  margin: 0.6rem 0 0;
}

/* ---------- source text vs editorial summary ---------- */

.source-text {
  background: var(--source-bg);
  border: 1px solid var(--source-border);
  border-left: 5px solid var(--source-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem 0.6rem;
  margin: 1.5rem 0;
  font-family: var(--font-serif);
}

.source-text-label {
  font-family: var(--font-body);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--gold);
  margin-bottom: 0.7rem;
}

.source-text-attribution {
  font-family: var(--font-body);
  font-size: var(--step--1);
  color: var(--text-faint);
  border-top: 1px solid var(--source-border);
  padding-top: 0.6rem;
}

.editorial-summary {
  background: var(--summary-bg);
  border: 1px dashed var(--summary-border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem 0.5rem;
  margin: 1.5rem 0;
  font-family: var(--font-body);
}

.editorial-summary-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--ultramarine-soft);
  margin-bottom: 0.6rem;
}

:root[data-theme='dark'] .editorial-summary-label {
  color: var(--link);
}

.text-warning {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-left: 5px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin: 1.25rem 0;
  font-size: var(--step--1);
}

.text-warning-label {
  font-weight: 600;
  display: block;
  margin-bottom: 0.25rem;
}

/* ---------- notes, callouts, quotes ---------- */

.note {
  border-left: 3px solid var(--rule-strong);
  padding: 0.15rem 0 0.15rem 0.9rem;
  margin: 1.25rem 0;
  color: var(--text-soft);
  font-size: var(--step--1);
}

.note-label {
  font-weight: 600;
  color: var(--text);
}

.callout {
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 1rem 1.15rem 0.4rem;
  margin: 1.5rem 0;
  background: var(--bg-raised);
}

.callout-title {
  margin-top: 0;
  font-size: var(--step-0);
}

.callout-myth {
  border-color: var(--warn-border);
  background: var(--warn-bg);
}

.callout-pastoral {
  border-color: var(--summary-border);
  background: var(--summary-bg);
}

.pull-quote {
  border-left: 3px solid var(--accent);
  padding-left: 1.1rem;
  margin: 1.5rem 0;
  font-family: var(--font-serif);
  font-size: var(--step-1);
  color: var(--text-soft);
}

.pull-quote footer {
  font-family: var(--font-body);
  font-size: var(--step--1);
  color: var(--text-faint);
  margin-top: 0.5rem;
}

.quotation {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin: 1.25rem 0;
  background: var(--bg-raised);
}

.quotation blockquote {
  font-family: var(--font-serif);
  margin: 0 0 0.7rem;
}

.quotation-cite {
  font-size: var(--step--1);
  color: var(--text-faint);
  display: block;
}

.copy-citation {
  margin-top: 0.5rem;
  min-height: var(--tap);
  padding: 0.4rem 0.8rem;
  background: var(--bg-sunken);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  font: inherit;
  font-size: var(--step--1);
  color: var(--text);
  cursor: pointer;
}

/* ---------- cards and lists ---------- */

.card-grid {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  display: grid;
  gap: 1rem;
}

@media (min-width: 34rem) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  }
}

.card {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-raised);
  padding: 1rem 1.1rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.card h3,
.card h2 {
  margin: 0;
  font-size: var(--step-1);
}

.card h3 a,
.card h2 a {
  text-decoration: none;
  color: var(--text);
}

.card h3 a:hover,
.card h2 a:hover {
  color: var(--link);
  text-decoration: underline;
}

.card p {
  margin: 0;
  font-size: var(--step--1);
  color: var(--text-soft);
}

.card-meta {
  font-size: 0.78rem;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0;
}

.chip {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.16rem 0.45rem;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  color: var(--text-faint);
  background: var(--bg-sunken);
}

.index-list {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0;
  border-top: 1px solid var(--rule);
}

.index-list li {
  margin: 0;
  border-bottom: 1px solid var(--rule);
}

.index-list a {
  display: block;
  padding: 0.85rem 0.25rem;
  text-decoration: none;
  min-height: var(--tap);
}

.index-list a:hover {
  background: var(--bg-sunken);
}

.index-title {
  display: block;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: var(--step-1);
}

.index-list a:hover .index-title {
  color: var(--link);
  text-decoration: underline;
}

.index-summary {
  display: block;
  font-size: var(--step--1);
  color: var(--text-soft);
  margin-top: 0.15rem;
}

/* ---------- tables ---------- */

.table-scroll {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.table-scroll:focus-visible {
  outline: 3px solid var(--focus);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: var(--step--1);
  margin: 0;
}

caption {
  text-align: left;
  padding: 0.7rem 0.85rem;
  color: var(--text-soft);
  border-bottom: 1px solid var(--rule);
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

thead th {
  background: var(--bg-sunken);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
}

tbody th {
  font-weight: 600;
}

/* ---------- sources section ---------- */

.sources-section {
  margin-top: 3rem;
  border-top: 2px solid var(--rule-strong);
  padding-top: 1.5rem;
}

.source-list {
  list-style: decimal;
  padding-left: 1.5rem;
  font-size: var(--step--1);
}

.source-list li {
  margin-bottom: 0.9rem;
  line-height: 1.5;
}

.source-list span {
  display: block;
}

.source-tier {
  display: inline-block !important;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  margin-bottom: 0.25rem;
  color: var(--text-faint);
}

.source-tier[data-tier='A'] {
  border-color: var(--accent);
  color: var(--accent);
}
.source-tier[data-tier='B'] {
  border-color: var(--ultramarine-soft);
  color: var(--link);
}
.source-tier[data-tier='C'] {
  border-color: var(--gold);
  color: var(--gold);
}

.source-title {
  font-family: var(--font-serif);
  color: var(--text);
}

.source-locator {
  color: var(--text-soft);
}

.source-kind,
.source-note,
.source-author {
  color: var(--text-faint);
  font-size: 0.82rem;
}

.source-note-foot {
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-top: 1rem;
}

/* ---------- dialogs ---------- */

.dialog {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgb(20 18 14 / 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.dialog[hidden] {
  display: none !important;
}

.dialog-panel {
  background: var(--bg-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  width: min(44rem, 100%);
  margin-top: 3vh;
  padding: 1.25rem;
  box-shadow: 0 20px 50px rgb(0 0 0 / 0.3);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dialog-head h2 {
  margin: 0;
  font-size: var(--step-1);
}

.search-form input[type='search'] {
  width: 100%;
  min-height: var(--tap);
  padding: 0.6rem 0.8rem;
  font: inherit;
  font-size: var(--step-0);
  border: 2px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

.search-hint,
.search-status {
  font-size: var(--step--1);
  color: var(--text-faint);
  margin: 0.5rem 0;
}

.search-filters {
  display: grid;
  gap: 0.6rem;
  margin: 0.75rem 0;
}

.search-filters fieldset {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem 0.7rem;
  margin: 0;
}

.search-filters legend {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  padding: 0 0.3rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.filter-toggle {
  min-height: 2.25rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--bg-sunken);
  color: var(--text-soft);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.filter-toggle[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

:root[data-theme='dark'] .filter-toggle[aria-pressed='true'] {
  color: #16151a;
}

.search-results {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 55vh;
  overflow-y: auto;
}

.search-results li {
  border-top: 1px solid var(--rule);
  margin: 0;
}

.search-results a {
  display: block;
  padding: 0.75rem 0.35rem;
  text-decoration: none;
  min-height: var(--tap);
}

.search-results a:hover,
.search-results a:focus-visible {
  background: var(--bg-sunken);
}

.result-title {
  display: block;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: var(--step-0);
}

.result-why {
  display: block;
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-top: 0.15rem;
}

.result-why mark {
  background: var(--gold-line);
  color: var(--ink);
  padding: 0 0.15em;
}

/* ---------- reader controls ---------- */

.reader-controls fieldset {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem 0.9rem;
  margin: 0 0 0.9rem;
}

.reader-controls legend {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  padding: 0 0.3rem;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.segmented label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--tap);
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: var(--step--1);
}

.segmented input:checked + span {
  font-weight: 700;
  color: var(--accent);
}

.switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--tap);
  font-size: var(--step--1);
}

.slider-label {
  display: block;
  font-size: var(--step--1);
  margin-bottom: 0.3rem;
}

input[type='range'] {
  width: 100%;
  min-height: var(--tap);
}

/* ---------- read aloud ---------- */

.read-aloud {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  margin: 1.5rem 0;
  background: var(--bg-raised);
  font-size: var(--step--1);
}

.read-aloud-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.5rem;
}

.read-aloud button {
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--bg-sunken);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.read-aloud button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.speaking {
  background: var(--gold-line);
  color: var(--ink);
}

/* ---------- progress and study tools ---------- */

.study-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}

.button-secondary {
  background: transparent;
  color: var(--accent);
}

.button-secondary:hover {
  background: var(--bg-sunken);
  color: var(--accent-strong);
}

:root[data-theme='dark'] .button {
  color: #16151a;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  border-top: 1px solid var(--rule);
  padding-top: 1.25rem;
  font-size: var(--step--1);
}

.pager a {
  max-width: 45%;
}

.pager-next {
  text-align: right;
  margin-inline-start: auto;
}

.progress-bar {
  height: 6px;
  background: var(--bg-sunken);
  border: 1px solid var(--rule);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: var(--gold-line);
}

/* ---------- timeline ---------- */

.timeline {
  list-style: none;
  padding: 0;
  margin: 2rem 0;
  border-left: 2px solid var(--rule-strong);
}

.timeline li {
  margin: 0 0 1.5rem;
  padding-left: 1.35rem;
  position: relative;
}

.timeline li::before {
  content: '';
  position: absolute;
  left: -0.42rem;
  top: 0.5rem;
  width: 0.7rem;
  height: 0.7rem;
  background: var(--bg);
  border: 2px solid var(--accent);
  border-radius: 50%;
}

.timeline-date {
  font-family: var(--font-body);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.timeline-title {
  font-family: var(--font-serif);
  font-size: var(--step-1);
  margin: 0.1rem 0 0.25rem;
}

.timeline-body {
  font-size: var(--step--1);
  color: var(--text-soft);
  margin: 0;
}

/* ---------- witness explorer ---------- */

.witness-grid {
  display: grid;
  gap: 0.4rem;
  margin: 1.5rem 0;
}

.book-state {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  border: 1px solid var(--rule-strong);
}

.book-state::before {
  content: '';
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
  border: 1px solid currentColor;
}

.book-state[data-state='received']::before {
  background: currentColor;
}
.book-state[data-state='disputed']::before {
  background: repeating-linear-gradient(45deg, currentColor 0 2px, transparent 2px 4px);
}
.book-state[data-state='rejected']::before {
  background: transparent;
}
.book-state[data-state='not-mentioned']::before {
  background: transparent;
  border-style: dotted;
}

/* Print styles: articles and study packets should print as clean documents,
 * with citations preserved and interface furniture removed. */

@media print {
  :root {
    --bg: #fff;
    --bg-raised: #fff;
    --bg-sunken: #fff;
    --text: #000;
    --text-soft: #222;
    --text-faint: #444;
    --rule: #999;
    --rule-strong: #666;
  }

  body {
    background: #fff;
    color: #000;
    font-family: var(--font-serif);
    font-size: 11pt;
    line-height: 1.45;
  }

  .site-header,
  .site-nav,
  .breadcrumbs,
  .rail,
  .dialog,
  .header-actions,
  .skip-link,
  .study-actions,
  .read-aloud,
  .pager,
  .report-issue,
  .footer-inner,
  .copy-citation,
  [data-print-hide] {
    display: none !important;
  }

  .shell {
    max-width: none;
    padding: 0;
    display: block;
  }

  .main > * {
    max-width: none;
  }

  h1,
  h2,
  h3 {
    break-after: avoid;
    page-break-after: avoid;
  }

  .source-text,
  .editorial-summary,
  .callout,
  .quotation,
  table,
  blockquote {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .source-text {
    border: 1pt solid #666;
    border-left: 3pt solid #666;
  }

  .editorial-summary {
    border: 1pt dashed #666;
  }

  /* Print the destination of every link so a paper copy stays checkable. */
  .main a[href^='http']::after {
    content: ' <' attr(href) '>';
    font-size: 9pt;
    color: #444;
    word-break: break-all;
  }

  .main a[href^='/']::after {
    content: ' <' attr(href) '>';
    font-size: 9pt;
    color: #444;
  }

  .sources-section {
    border-top: 1pt solid #000;
  }

  .site-footer {
    border-top: 1pt solid #000;
    padding: 0.5cm 0 0;
    background: none;
  }

  .footer-notice {
    font-size: 9pt;
    border: 0;
  }

  .packet-section {
    break-before: page;
    page-break-before: always;
  }

  .packet-section:first-of-type {
    break-before: auto;
    page-break-before: auto;
  }

  @page {
    margin: 2cm 1.8cm;
  }
}
