/* First Pew — "Archival / Documentary" art direction (Stage 6, chosen).
   Visual language of an evidence file: numbered plates, catalog records,
   verdict stamps, ledger lines. Warm neutrals + one restrained ochre accent.
   Serif (Iowan/Palatino/Georgia) for headings, clean system sans for body. */
:root {
  --paper: #FAF7F0;
  --ink: #2A2620;
  --muted: #6B6257;
  --accent: #7C4A12;
  --line: #E0D6C2;
  --card: #FFFDF8;
  --wash: #F3EDE0;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1C1A16;
    --ink: #EDE6D8;
    --muted: #B3A893;
    --accent: #D9A05B;
    --line: #3B352A;
    --card: #242019;
    --wash: #231F18;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
}
.wrap { max-width: 72rem; margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 2.5rem); }
.page { max-width: 46rem; }

/* ---------- type ---------- */
h1, h2, h3, .brand-name, .plate figcaption::before {
  font-family: var(--serif);
  font-weight: 600;
}
h1, h2, h3 { line-height: 1.25; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4.5vw, 2.6rem); margin: 0.4rem 0 1rem; letter-spacing: -0.01em; }
h2 { font-size: 1.55rem; margin: 2.75rem 0 0.8rem; }
h3 { font-size: 1.15rem; margin: 1.75rem 0 0.5rem; }
p, ul, ol, dl, figure, blockquote, table, .record { margin: 0 0 1.3rem; }
li { margin-bottom: 0.45rem; }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 0.16em; text-decoration-thickness: 1px; overflow-wrap: anywhere; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--paper); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 0.75rem 1rem;
  font-family: var(--sans);
}
.skip-link:focus { left: 0.75rem; top: 0.75rem; }

/* ---------- header ---------- */
.site-header { border-bottom: 4px double var(--line); }
.header-inner {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 0.4rem 2.5rem; padding-top: 1.1rem; padding-bottom: 1.1rem;
}
.brand { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 1.6rem; letter-spacing: -0.01em; }
.brand-tag { font-size: 0.78rem; color: var(--muted); font-family: var(--sans); }
nav ul {
  list-style: none; display: flex; flex-wrap: wrap;
  gap: 0.2rem 1.3rem; margin: 0; padding: 0;
}
nav a { text-decoration: none; font-size: 0.92rem; color: var(--ink); }
nav a:hover { color: var(--accent); text-decoration: underline; }
nav a[aria-current="page"] { color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 0.25em; }

/* ---------- page head ---------- */
.page-head { margin: 2.75rem 0 2.25rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.14em;
  font-size: 0.76rem; color: var(--muted); margin: 0 0 0.6rem;
}
.standfirst { font-size: 1.12rem; color: var(--muted); max-width: 40rem; }
.standfirst strong { color: var(--ink); font-weight: 600; }

/* ---------- plates (figures) ---------- */
article.page { counter-reset: plate; }
.plate { counter-increment: plate; margin: 2.25rem 0; border-top: 2px solid var(--ink); padding-top: 0.6rem; }
.plate img { display: block; width: 100%; height: auto; border: 1px solid var(--line); background: var(--card); }
.plate figcaption { font-size: 0.85rem; line-height: 1.55; color: var(--muted); margin-top: 0.6rem; }
.plate figcaption::before {
  content: "Plate " counter(plate, decimal-leading-zero) " · ";
  text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.78rem; color: var(--ink);
}

/* ---------- archival records (limitations / source notes) ---------- */
.record {
  background: var(--wash);
  border: 1px solid var(--line);
  border-top: 3px solid var(--ink);
  padding: 1.25rem 1.5rem 0.5rem;
  font-size: 0.94rem;
}
.record h2 {
  font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.12em;
  margin: 0 0 0.9rem; font-family: var(--sans); font-weight: 700;
}
.record ul { padding-left: 1.2rem; }

/* ---------- verdict stamps (hype audit) ---------- */
.verdict {
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  background: var(--card);
  padding: 0.85rem 1.1rem;
}
.verdict strong {
  display: block; text-transform: uppercase; letter-spacing: 0.1em;
  font-size: 0.82rem; margin-bottom: 0.25rem;
}

/* ---------- heat ledger lines (debates) ---------- */
.heat {
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); border-bottom: 1px dotted var(--line);
  padding-bottom: 0.55rem; margin-top: -0.4rem;
}
.heat-label { font-weight: 700; color: var(--ink); }
.heat-note { text-transform: none; letter-spacing: 0; }

/* ---------- confidence marginalia (timeline) ---------- */
.confidence {
  display: block; margin-top: 0.45rem; padding-left: 0.8rem;
  border-left: 2px solid var(--line);
  font-size: 0.86rem; color: var(--muted); font-style: normal;
}
.route-timeline article > ul { list-style: none; padding: 0; }
.route-timeline article > ul > li {
  border-top: 1px solid var(--line); padding: 1.1rem 0; margin-bottom: 0;
}
.route-timeline article > ul > li:first-child { border-top: 2px solid var(--ink); }

/* ---------- homepage: catalog index + question ledger ---------- */
.guide-index, .qa-list { list-style: none; padding: 0; counter-reset: entry; }
.guide-index li, .qa-list li {
  counter-increment: entry;
  display: grid; grid-template-columns: 3.2rem 1fr; column-gap: 1rem;
  padding: 1.05rem 0; border-top: 1px solid var(--line); margin-bottom: 0;
}
.guide-index li:last-child, .qa-list li:last-child { border-bottom: 1px solid var(--line); }
.guide-index li::before, .qa-list li::before {
  content: counter(entry, decimal-leading-zero);
  grid-column: 1; grid-row: 1 / span 2;
  font-family: var(--serif); font-size: 1.05rem; color: var(--muted);
  padding-top: 0.15rem;
}
.guide-index li > a, .qa-list li > h3 { grid-column: 2; }
.guide-index li > a { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; text-decoration: none; color: var(--ink); }
.guide-index li > a:hover { color: var(--accent); text-decoration: underline; }
.guide-index li > p, .qa-list li > p { grid-column: 2; margin: 0.3rem 0 0; font-size: 0.98rem; color: var(--muted); }
.qa-list li > h3 { margin: 0; font-size: 1.15rem; }

/* ---------- testimony quotes (voices) ---------- */
blockquote {
  margin: 1.6rem 0; padding: 0.2rem 0 0.2rem 1.25rem;
  border-left: 3px solid var(--accent);
  font-family: var(--serif); font-size: 1.12rem; line-height: 1.6;
}
blockquote p { margin-bottom: 0.4rem; }
blockquote p:last-child { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }

/* ---------- ledger table (traditions) ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.94rem; margin: 1.75rem 0; }
caption { text-align: left; font-size: 0.85rem; color: var(--muted); padding-bottom: 0.6rem; }
th, td { text-align: left; vertical-align: top; padding: 0.65rem 0.8rem 0.65rem 0; border-bottom: 1px solid var(--line); }
thead th {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em;
  border-bottom: 2px solid var(--ink); white-space: nowrap;
}
tbody th[scope="row"] { font-weight: 700; }
tfoot td { border-bottom: none; }

/* ---------- glossary filter slip ---------- */
.term-filter { margin: 0 0 2rem; padding: 1rem 1.25rem; background: var(--wash); border: 1px solid var(--line); }
.term-filter label { display: block; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 0.5rem; }
.term-filter input {
  width: 100%; max-width: 30rem; padding: 0.65rem 0.8rem; font-size: 1rem;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 0;
}
.term-filter input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
#term-filter-count { font-size: 0.85rem; color: var(--muted); margin: 0.5rem 0 0; }
.route-glossary main ul { list-style: none; padding-left: 0; }
.route-glossary main ul li[data-term] { padding-left: 1.25rem; text-indent: -1.25rem; margin-bottom: 0.85rem; }
.route-glossary main ul li[data-term] strong { font-family: var(--serif); }

/* ---------- footer ---------- */
.site-footer { border-top: 4px double var(--line); margin-top: 4.5rem; padding: 2rem 0 3rem; font-size: 0.88rem; color: var(--muted); }
.footer-brand { font-family: var(--serif); font-size: 1.05rem; color: var(--ink); }
.footer-meta { margin-top: 0.6rem; }

/* ---------- small screens ---------- */
@media (max-width: 620px) {
  h1 { font-size: 1.85rem; }
  h2 { font-size: 1.35rem; }
  .guide-index li, .qa-list li { grid-template-columns: 2.4rem 1fr; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tr { border: 1px solid var(--line); border-bottom: none; margin-bottom: 1rem; background: var(--card); }
  td, th[scope="row"] { border-bottom: 1px solid var(--line); padding: 0.55rem 0.8rem; }
  td::before {
    content: attr(data-th); display: block;
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
