/* Wilson Visual Fact-Check — reading desk
   System fonts only, no network requests. */

:root {
  --desk: #efe9de;   /* was #e6dfd1 — lightened 2026-11-17 */
  --desk-2: #e5ddcf; /* was #d9d0bf */
  --paper: #fbf8f1;
  --paper-edge: #f2ecdf;
  --ink: #221d17;
  --ink-2: #4a4239;
  --muted: #605649;
  --rule: #ddd3c2;
  --rule-2: #cabfab;
  --focus: #2b5d8a;
  --select: #2a2520;           /* neutral marker for "passage under examination" */

  /* evidential status — hue + glyph + text label, never hue alone */
  --st-supported: #2f6a4c;
  --st-qualified: #8e6214;
  --st-correction: #8a3a2c;
  --st-interpretation: #4d5c7e;
  --st-unverified: #686258;

  /* severity — outlined badge + dot meter + label, distinct from the filled status badges */
  --sev-major: #a3263a;
  --sev-moderate: #9a6a12;
  --sev-minor: #7a7266;

  --src: #2a6670;              /* sources the audit consulted */
  --trail: #67498f;            /* Citation trail (canvas convention: purple) */
  --gap: #6f6557;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  /* surfaces and theme hooks (themes/*.css override these) */
  --desk-hi: #f4efe6; /* was #ece6da */
  --card: #fffdf8;
  --well: #f6f1e6;
  --limits-bg: #fffaf0; --limits-border: #c9b48a; --limits-ink: #7a5a1c;
  --trail-bg: #fbf8fd; --trail-note-bg: #f6f1fb; --trail-note-border: #dcd0ec;
  --glass: rgba(251,248,241,.6);
  --veil: rgba(251,248,241,.62);
  --gutter-2: #e3d9c6; --gutter-mid: #d8cdb8;
  --stage: #e9e3d7;
  --scan-bg: #fff;
  --img-filter: none;
  --select-ink: #fbf8f1;
  --pager-glass: rgba(244,239,230,.94);
  --on-desk: var(--ink); --on-desk-2: var(--ink-2); --on-desk-muted: var(--muted); --desk-rule: var(--rule-2);
  --page-ink: var(--ink); --page-ink-2: var(--ink-2); --page-muted: var(--muted);
  --pressed-bg: var(--ink); --pressed-fg: var(--paper);

  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, sans-serif;
  --shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 18px 40px -22px rgba(48,36,20,.45), 0 2px 6px rgba(48,36,20,.08);
  --ease: cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(120% 90% at 50% 10%, var(--desk-hi) 0%, var(--desk) 55%, var(--desk-2) 100%);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100dvh;
  overflow: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
kbd { font: 600 11px/1 var(--sans); padding: 2px 5px; border: 1px solid var(--rule-2); border-bottom-width: 2px; border-radius: 4px; background: var(--paper); color: var(--ink-2); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 12px; }
.micro { font: 600 11px/1.3 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0; }

/* ───────────────────────── masthead ───────────────────────── */
.masthead {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 14px 28px 10px;
}
.kicker { margin: 0 0 2px; font: 600 11px/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.brand h1 { margin: 0; font: 500 20px/1.2 var(--serif); letter-spacing: -.005em; text-wrap: balance; }
.brand h1 em { font-style: italic; }
.brand .dash { color: var(--muted); }
.sample-note { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-2); }
.sample-note b { font-weight: 600; }

.brand, .tools { min-width: 0; }

.tools { justify-self: end; display: flex; gap: 8px; }
.tool {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 6px; border: 1px solid var(--rule-2);
  background: var(--glass); font: 500 13.5px/1 var(--sans); color: var(--ink);
  text-decoration: none; white-space: nowrap;
  transition: background .2s, border-color .2s;
}
.tool:hover { background: var(--paper); border-color: var(--ink-2); }
.tool svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tool[aria-pressed="true"] { background: var(--pressed-bg); color: var(--pressed-fg); border-color: var(--pressed-bg); }
.tool .state { font-weight: 600; }
.tool.small { padding: 6px 10px; font-size: 12.5px; }

/* ───────────────────────── desk + spread ───────────────────────── */
.desk {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 18px;
  padding: 6px 22px 8px 28px;
  min-height: 0;
}
.spread {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px minmax(0, 1fr);
  grid-template-areas: "fact gutter doc";
  min-height: 0;
  filter: drop-shadow(0 22px 30px rgba(48,36,20,.18));
}
.spread.swapped { grid-template-areas: "doc gutter fact"; }
.page-fact { grid-area: fact; }
.page-doc { grid-area: doc; }
.gutter { grid-area: gutter; }

.page {
  position: relative;
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  background: var(--paper);
  outline: none;
  overflow: hidden;
}
/* the two halves meet at the gutter; outer corners softly rounded */
.spread:not(.swapped) .page-fact, .spread.swapped .page-doc { border-radius: 10px 2px 2px 10px; background: linear-gradient(90deg, var(--paper) 0%, var(--paper) 88%, var(--paper-edge) 100%); }
.spread:not(.swapped) .page-doc, .spread.swapped .page-fact { border-radius: 2px 10px 10px 2px; background: linear-gradient(270deg, var(--paper) 0%, var(--paper) 88%, var(--paper-edge) 100%); }
.gutter {
  background: linear-gradient(90deg, var(--paper-edge) 0%, var(--gutter-2) 42%, var(--gutter-mid) 50%, var(--gutter-2) 58%, var(--paper-edge) 100%);
  position: relative;
}
.gutter-link {
  position: absolute; left: 50%; top: var(--link-y, 50%); width: 22px; height: 22px; margin: -11px 0 0 -11px;
  transition: top .45s var(--ease);
  border-radius: 50%; background: var(--paper); border: 1px solid var(--rule-2);
  box-shadow: 0 1px 3px rgba(48,36,20,.15);
}
.gutter-link::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--select); }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 30px 10px; border-bottom: 1px solid var(--rule);
}
.runner { font: 600 11px/1.3 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.runner .cid { color: var(--ink); }
.page-body { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--rule-2) transparent; }

/* ───────────────────────── fact page ───────────────────────── */
.fact-scroll { padding: 6px 34px 30px; overflow-wrap: anywhere; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: none; }
.runner { padding-top: 4px; }
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px 4px 7px; border-radius: 5px;
  font: 600 12px/1 var(--sans); letter-spacing: .02em; color: #fff;
}
.status .glyph { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: rgba(255,255,255,.22); font-size: 11px; line-height: 1; }
.st-supported { background: var(--st-supported); }
.st-qualified { background: var(--st-qualified); }
.st-correction { background: var(--st-correction); }
.st-interpretation { background: var(--st-interpretation); }
.st-unverified { background: transparent; color: var(--st-unverified); border: 1.5px dashed var(--st-unverified); }
.st-unverified .glyph { background: rgba(104,98,88,.14); }

.neighbour {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 10px 0; color: var(--muted); font: 15px/1.4 var(--serif);
  transition: filter .35s var(--ease), opacity .35s var(--ease);
}
.neighbour .micro { display: block; margin-bottom: 2px; }
.neighbour:hover { color: var(--ink); }
.neighbour.prev { border-bottom: 1px dashed var(--rule); margin-bottom: 14px; }
.neighbour.next { border-top: 1px dashed var(--rule); margin-top: 22px; }
body.focus-on .neighbour { opacity: .5; filter: blur(1.4px); }
body.focus-on .neighbour:hover, body.focus-on .neighbour:focus-visible, body.context-shown .neighbour { opacity: 1; filter: none; }

.label { margin: 0 0 6px; font: 600 11px/1.3 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.claim-block { margin: 4px 0 16px; }
.claim { margin: 0; font: 500 26px/1.22 var(--serif); letter-spacing: -.01em; text-wrap: balance; }
.claim-kind { margin: 8px 0 0; font: 13px/1.4 var(--sans); color: var(--muted); }

.finding {
  position: relative; margin: 0 0 18px; padding: 14px 16px 14px 18px;
  background: var(--card); border: 1px solid var(--rule); border-left: 4px solid var(--st, var(--ink)); border-radius: 4px 8px 8px 4px;
}
.finding .verdict { margin: 0; font: 600 20px/1.32 var(--serif); color: var(--ink); text-wrap: pretty; }
.finding .sep-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

.prose { margin: 0 0 18px; font: 17px/1.58 var(--serif); color: var(--ink); hyphens: auto; }
.prose strong { font-weight: 600; }
.ref {
  border: 0; padding: 0 2px; margin: 0 -2px; background: none; cursor: pointer;
  font: inherit; color: var(--src); text-decoration: underline; text-decoration-color: rgba(42,102,112,.35); text-underline-offset: 3px; text-decoration-thickness: 1.5px;
  border-radius: 3px;
}
.ref:hover { background: rgba(42,102,112,.08); text-decoration-color: var(--src); }
.ref::after { content: " ↗"; font: 600 11px var(--sans); }
.ref[data-doc^="passage"]::after { content: " ¶"; }
.ref-static { border-bottom: 1px dotted var(--rule-2); }
.srec { display: inline-block; padding: 0 5px; border-radius: 4px; background: rgba(34,29,23,.06); font: 600 11.5px/1.5 var(--sans); color: var(--ink-2); vertical-align: 1px; }
a.ext { color: var(--src); text-underline-offset: 3px; text-decoration-color: rgba(42,102,112,.4); }
a.ext::after { content: " ⧉"; font: 11px var(--sans); }

.limits {
  margin: 0 0 22px; padding: 12px 16px 13px;
  background: repeating-linear-gradient(135deg, rgba(142,98,20,.045) 0 8px, transparent 8px 16px), var(--limits-bg);
  border: 1px dashed var(--limits-border); border-radius: 8px;
}
.limits .label { color: var(--limits-ink); }
.limits p.txt { margin: 0; font: 16px/1.55 var(--serif); }

details.follow { margin: 0 0 22px; border: 1px solid var(--rule); border-radius: 8px; background: var(--card); }
details.follow summary { cursor: pointer; padding: 10px 14px; font: 600 13px/1.3 var(--sans); color: var(--ink-2); list-style: none; display: flex; justify-content: space-between; gap: 10px; }
details.follow summary::-webkit-details-marker { display: none; }
details.follow summary::after { content: "Show"; font-weight: 500; color: var(--src); }
details.follow[open] summary::after { content: "Hide"; }
details.follow .follow-body { padding: 0 14px 12px; font: 15px/1.5 var(--serif); }
details.follow .follow-body p { margin: 0 0 10px; }
details.follow table { width: 100%; border-collapse: collapse; font: 13.5px/1.4 var(--sans); }
details.follow th, details.follow td { text-align: left; vertical-align: top; padding: 7px 8px; border-top: 1px solid var(--rule); }
details.follow th { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-top: 0; }

.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 6px 0 10px; padding-top: 14px; border-top: 1px solid var(--rule); }
.sec-head h3 { margin: 0; font: 600 13px/1.3 var(--sans); letter-spacing: .02em; }
.sec-head .hint { font-size: 12px; color: var(--muted); }

.cards { display: grid; gap: 10px; margin-bottom: 18px; }
.card {
  display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 12px;
  padding: 10px 12px; border: 1px solid var(--rule); border-left: 3px solid var(--src);
  border-radius: 4px 8px 8px 4px; background: var(--card);
}
.card.missing { border-left: 3px dashed var(--gap); background: repeating-linear-gradient(135deg, rgba(104,98,88,.05) 0 6px, transparent 6px 12px), var(--card); }
.card.trail { border-left-color: var(--trail); background: var(--trail-bg); }
.thumb {
  width: 58px; height: 74px; border-radius: 3px; border: 1px solid var(--rule-2); overflow: hidden; background: var(--scan-bg);
  padding: 0; display: block;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.thumb.none { display: grid; place-items: center; font: 600 10px/1.2 var(--sans); color: var(--gap); text-align: center; background: repeating-linear-gradient(135deg, rgba(104,98,88,.08) 0 5px, transparent 5px 10px); }
.card .who { margin: 0; font: 600 12.5px/1.3 var(--sans); color: var(--ink-2); }
.card .what { margin: 1px 0 4px; font: italic 15.5px/1.3 var(--serif); }
.card .pub { font-style: normal; color: var(--muted); font-size: 13px; }
.card .locs { margin: 4px 0 6px; padding: 0; list-style: none; display: grid; gap: 3px; }
.card .locs li { font: 13px/1.35 var(--sans); }
.loc-btn { border: 0; padding: 0; background: none; color: var(--src); text-align: left; text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(42,102,112,.35); }
.loc-btn::before { content: "▸ "; text-decoration: none; display: inline-block; }
.loc-btn[aria-current="true"] { font-weight: 600; text-decoration-color: var(--src); }
.loc-static { color: var(--ink-2); }
.loc-static::before { content: "· "; color: var(--muted); }
.loc-static em { font-style: normal; color: var(--muted); font-size: 12px; }
.access { display: flex; gap: 8px; align-items: flex-start; margin-top: 4px; font: 12.5px/1.4 var(--sans); color: var(--ink-2); }
.card .access { flex-wrap: wrap; }
.card .acc-pill { max-width: 100%; white-space: normal; }
.card .acc-pill + span { flex: 1 1 15ch; min-width: 0; }
.acc-pill { flex: none; padding: 2px 7px; border-radius: 99px; font: 600 10.5px/1.5 var(--sans); letter-spacing: .03em; white-space: nowrap; }
.acc-full { background: #dcebe2; color: #23543b; }
.acc-pages { background: #dfecee; color: #1f5059; }
.acc-meta { background: #efe6d2; color: #6e5214; }
.acc-norec { background: #ece8e1; color: #5d564b; }
.acc-none { background: transparent; color: #5d564b; border: 1px dashed var(--gap); }
.access q { quotes: "“" "”"; }
.trail .who { color: var(--trail); }
.trail .cite { margin: 2px 0 6px; font: 14.5px/1.45 var(--serif); }
.trail .not-indep { display: inline-block; margin-top: 2px; font: 600 11px/1.4 var(--sans); color: var(--trail); letter-spacing: .03em; }
.record { margin: 18px 0 0; padding-top: 12px; border-top: 1px solid var(--rule); font: 12px/1.5 var(--sans); color: var(--muted); }
.record b { color: var(--ink-2); font-weight: 600; }

/* ───────────────────────── document page ───────────────────────── */
.doc-head { padding: 10px 18px 0 18px; border-bottom: 1px solid var(--rule); align-items: flex-end; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-bottom: -1px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px 9px; border: 1px solid transparent; border-bottom: 0; border-radius: 7px 7px 0 0;
  background: none; font: 500 12.5px/1 var(--sans); color: var(--muted); white-space: nowrap;
}
.tab .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--select); }
.tab[data-type="source"] .dot, .tab[data-type="data"] .dot { background: var(--src); }
.tab[data-type="notes"] .dot { background: var(--trail); }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { background: var(--paper); border-color: var(--rule); color: var(--ink); font-weight: 600; }

.doc-stage { position: relative; min-height: 0; min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
.doc-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 22px 7px; font: 12.5px/1.4 var(--sans); color: var(--ink-2); }
.doc-meta .where { min-width: 0; }
.doc-meta .where b { font-weight: 600; color: var(--ink); }
.doc-meta .side { color: var(--muted); text-align: right; }
.doc-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 22px 12px; border-top: 1px solid var(--rule); }
.doc-actions .spacer { flex: 1; }
.doc-actions .hint { font-size: 12px; color: var(--muted); }

.scan {
  position: relative; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; margin: 0 14px; min-width: 0;
  border: 1px solid var(--rule); border-radius: 4px; background: var(--scan-bg);
  scrollbar-width: thin; scrollbar-color: var(--rule-2) transparent;
}
.scan-inner { position: relative; }
.scan-inner img { display: block; width: 100%; height: auto; user-select: none; }
/* book images are short excerpts: the box fits the excerpt and the quotation sits right under it */
.doc-stage:has(> .scan) { grid-template-rows: auto minmax(0, max-content) auto; align-content: start; }
.doc-stage:has(> .scan) .doc-meta { padding-top: 14px; }
.veil {
  position: absolute; left: 0; right: 0;
  background: var(--veil);
  -webkit-backdrop-filter: blur(1.6px); backdrop-filter: blur(1.6px);
  transition: opacity .45s var(--ease);
  cursor: zoom-in;
  border: 0; padding: 0; display: block; width: 100%;
}
.veil.top { top: 0; box-shadow: 0 10px 14px -12px rgba(48,36,20,.25); }
.veil.bottom { bottom: 0; box-shadow: 0 -10px 14px -12px rgba(48,36,20,.25); }
.veil .veil-label { position: absolute; left: 50%; transform: translateX(-50%); padding: 4px 10px; border-radius: 99px; background: var(--paper); border: 1px solid var(--rule-2); font: 500 11.5px/1.3 var(--sans); color: var(--ink-2); white-space: nowrap; }
.veil.top .veil-label { bottom: 10px; }
.veil.bottom .veil-label { top: 10px; }
body:not(.focus-on) .veil, body.context-shown .veil { opacity: 0; pointer-events: none; }
.band-mark { position: absolute; width: 4px; border-radius: 2px; background: var(--select); transition: top .4s var(--ease), height .4s var(--ease); }
.band-tag.right { transform: translate(-100%, -100%); border-radius: 3px 3px 0 3px; }
.band-tag { position: absolute; transform: translateY(-100%); padding: 2px 6px; border-radius: 3px 3px 3px 0; background: var(--select); color: var(--select-ink); font: 600 10px/1.4 var(--sans); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }

.transcript { margin: 10px 14px 0; padding: 8px 14px 9px; border-radius: 6px; background: var(--well); border: 1px solid var(--rule); }
.transcript .label { display: flex; justify-content: space-between; gap: 10px; }
.transcript blockquote { margin: 0; font: 16px/1.5 var(--serif); color: var(--ink); max-height: 6em; overflow: auto; }
.transcript .cont { margin: 6px 0 0; font: 12px/1.4 var(--sans); color: var(--muted); }
.link-btn { border: 0; background: none; padding: 0; font: 600 11px/1.3 var(--sans); color: var(--src); letter-spacing: .04em; text-transform: uppercase; }
.transcript.collapsed blockquote, .transcript.collapsed .cont { display: none; }

.part-switch { display: inline-flex; gap: 4px; }
.part-switch button { padding: 3px 8px; border-radius: 4px; border: 1px solid var(--rule-2); background: transparent; font: 600 11px/1.3 var(--sans); color: var(--ink-2); }
.part-switch button[aria-pressed="true"] { background: var(--pressed-bg); color: var(--pressed-fg); border-color: var(--pressed-bg); }

.doc-plain { overflow: auto; margin: 0 14px; border: 1px solid var(--rule); border-radius: 4px; background: var(--scan-bg); overscroll-behavior: contain; }
.doc-plain img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.doc-note { margin: 10px 14px 0; padding: 10px 12px; border-radius: 6px; font: 13px/1.45 var(--sans); color: var(--ink-2); background: var(--well); border: 1px solid var(--rule); }
.doc-note.trail-note { background: var(--trail-note-bg); border-color: var(--trail-note-border); }
.doc-note b { color: var(--ink); }

/* data view (B039) */
.data-view { overflow: auto; margin: 0 14px; padding: 16px 18px; border: 1px solid var(--rule); border-radius: 4px; background: var(--card); }
.data-view h4 { margin: 0 0 4px; font: 600 15px/1.3 var(--serif); }
.data-view .sub { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }
.data-view svg { width: 100%; height: auto; display: block; }
.data-view svg text { font-family: var(--sans); fill: var(--ink-2); }
.data-view svg line { stroke: var(--rule); }
.data-view table { width: 100%; border-collapse: collapse; margin-top: 12px; font: 13px/1.4 var(--sans); }
.data-view td, .data-view th { padding: 5px 8px; border-top: 1px solid var(--rule); text-align: right; }
.data-view th:first-child, .data-view td:first-child { text-align: left; }
.data-view tfoot td { font-weight: 600; border-top: 2px solid var(--ink-2); }
.compare { display: grid; gap: 8px; margin: 14px 0 4px; }
.compare .row { display: grid; grid-template-columns: 190px minmax(0, 1fr) 70px; gap: 10px; align-items: center; font: 13px/1.3 var(--sans); }
.compare .bar { height: 14px; border-radius: 3px; background: var(--st-correction); opacity: .2; }
.compare .bar.audit { background: var(--src); opacity: 1; }
.compare .bar.claim { background: transparent; border: 1.5px dashed var(--st-correction); opacity: 1; }
.compare .v { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* ───────────────────────── rail ───────────────────────── */
.rail { min-height: 0; min-width: 0; overflow-y: auto; padding: 4px 2px 10px; scrollbar-width: thin; scrollbar-color: var(--rule-2) transparent; }
.rail .micro { padding: 4px 8px 8px; }
.rail ol { list-style: none; margin: 0; padding: 0; }
.grps { display: grid; gap: 10px; }
.grp-head { display: flex; align-items: baseline; gap: 8px; margin: 0 0 3px; padding: 0 8px; }
.grp-head .num { min-width: 18px; font: 600 15px/1 var(--serif); color: var(--muted); }
.grp-head .nm { font: 600 10.5px/1.2 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.grp[aria-current="true"] .grp-head .num, .grp[aria-current="true"] .grp-head .nm { color: var(--ink); }
.fc-items { display: grid; gap: 1px; margin-left: 17px !important; padding-left: 8px !important; border-left: 1px solid var(--rule-2); }
.fc {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 8px; gap: 8px; align-items: start;
  padding: 6px 8px; border: 1px solid transparent; border-radius: 6px; background: none; text-align: left;
  font: 13px/1.32 var(--sans); color: var(--ink-2);
  transition: background .2s, border-color .2s, color .2s;
}
.fc-ch { display: none; }
.fc-t { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.fc-dot { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--st); }
.fc-dot.dashed { background: transparent; border: 1.3px dashed var(--st); }
.fc:hover { background: var(--glass); color: var(--ink); }
.fc[aria-current="true"] { background: var(--paper); border-color: var(--rule-2); color: var(--page-ink); font-weight: 500; box-shadow: 0 1px 2px rgba(48,36,20,.1); }
.rail-foot { margin: 12px 8px 0; font: 11.5px/1.45 var(--sans); color: var(--muted); }

/* ───────────────────────── pager ───────────────────────── */
.pager { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 6px 290px 12px 28px; }
.pg-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--rule-2); background: var(--glass); font: 500 13.5px/1 var(--sans); }
.pg-btn:hover:not(:disabled) { background: var(--paper); border-color: var(--ink-2); }
.pg-btn:disabled { opacity: .4; cursor: default; }
.pg-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.position { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; justify-items: center; gap: 2px; }
.pos-text { margin: 0; font: 13px/1.2 var(--sans); color: var(--ink-2); }
.pos-text b { font-weight: 600; color: var(--ink); }
.track {
  position: relative;
  display: flex; align-items: center; justify-content: safe center; gap: 3px;
  width: 100%; min-width: 0; margin: 0; padding: 6px 4px; list-style: none;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: var(--rule-2) transparent;
}
.track li { flex: 1 0 8px; max-width: 14px; }
.track button { display: block; width: 100%; height: 10px; padding: 0; border: 0; border-radius: 3px; background: var(--st); opacity: .55; transition: transform .25s var(--ease), opacity .2s; }
.track button.dashed { background: transparent; border: 1.5px dashed var(--st); }
.track button:hover { opacity: .9; }
.track button[aria-current="true"] { opacity: 1; transform: scaleY(1.6); box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--ink); }
.track button.filtered { opacity: .12; }

/* ───────────────────────── dialogs ───────────────────────── */
dialog { border: 0; padding: 0; color: var(--ink); background: var(--paper); box-shadow: 0 30px 80px rgba(20,14,6,.45); }
dialog::backdrop { background: rgba(38,30,20,.55); backdrop-filter: blur(2px); }
.viewer { width: min(1180px, 94vw); height: 92vh; border-radius: 10px; }
.viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.viewer-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; padding: 14px 18px 10px; border-bottom: 1px solid var(--rule); }
.viewer-head h2 { margin: 3px 0 0; font: 500 17px/1.3 var(--serif); }
.viewer-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.zoom { display: inline-flex; border: 1px solid var(--rule-2); border-radius: 6px; overflow: hidden; }
.zoom button { border: 0; background: none; padding: 6px 10px; font: 500 12.5px/1 var(--sans); border-right: 1px solid var(--rule); }
.zoom button:last-child { border-right: 0; }
.zoom button[aria-pressed="true"] { background: var(--pressed-bg); color: var(--pressed-fg); }
.viewer-stage { overflow: auto; background: var(--stage); padding: 18px; }
.viewer-stage img { display: block; margin: 0 auto; box-shadow: 0 6px 24px rgba(48,36,20,.2); background: #fff; }
.viewer-note { margin: 0; padding: 9px 18px 12px; font: 12.5px/1.45 var(--sans); color: var(--ink-2); border-top: 1px solid var(--rule); }
.tool.disabled { opacity: .45; pointer-events: none; }

.about { width: min(980px, 94vw); max-height: 90vh; border-radius: 10px; }
.about-inner { padding: 18px 24px 22px; overflow: auto; max-height: 90vh; }
.about header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.about h2 { margin: 0; font: 500 22px/1.2 var(--serif); }
.about-cols { columns: 2 340px; column-gap: 32px; font: 14px/1.5 var(--sans); }
.about-cols section { break-inside: avoid; margin: 0 0 16px; }
.about-cols h3 { margin: 10px 0 6px; font: 600 12px/1.3 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.about-cols p { margin: 0 0 8px; }
.about-cols ul { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 6px; }
.about-cols li { display: flex; gap: 8px; align-items: flex-start; }
.about-cols li .status, .about-cols li .acc-pill { flex: none; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; }

/* ───────────────────────── theme scoping ─────────────────────────
   Text sitting directly on the desk (masthead, rail, pager) uses the
   on-desk tokens; controls that sit on paper switch back to page ink. */
.masthead, .rail, .pager { --ink: var(--on-desk); --ink-2: var(--on-desk-2); --muted: var(--on-desk-muted); --rule-2: var(--desk-rule); color: var(--ink); }
.fc[aria-current="true"], .masthead .tool:hover, .pager .pg-btn:hover:not(:disabled) { --ink: var(--page-ink); --ink-2: var(--page-ink-2); --muted: var(--page-muted); }
.scan-inner img, .doc-plain img, .thumb img, .viewer-stage img { filter: var(--img-filter); }

/* ───────────────────────── motion ───────────────────────── */
.enter { animation: enter .38s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.doc-swap { animation: docin .3s var(--ease) both; }
@keyframes docin { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
.pulse { animation: pulse 1s var(--ease) 1; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(42,102,112,.45); } 100% { box-shadow: 0 0 0 10px rgba(42,102,112,0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ───────────────────────── smaller laptops ───────────────────────── */
@media (max-width: 1280px) {
  .masthead { grid-template-columns: minmax(220px, 1fr) auto; gap: 16px; padding: 12px 20px 8px; }
  .brand h1 { font-size: 18px; }
  .tool span { display: none; }
  .tool { padding: 8px; }
  .desk { grid-template-columns: minmax(0, 1fr) 214px; padding: 4px 16px 6px 20px; gap: 14px; }
  .pager { padding: 6px 248px 10px 20px; }
  .fact-scroll { padding: 4px 26px 26px; }
  .page-head { padding: 12px 22px 9px; }
  .claim { font-size: 23px; }
  .finding .verdict { font-size: 18.5px; }
  .prose { font-size: 16px; }
  .fc { font-size: 12.5px; }
}
@media (max-height: 820px) and (min-width: 901px) {
  .masthead { padding-top: 9px; padding-bottom: 4px; }
  .kicker { display: none; }
  .transcript blockquote { max-height: 4.6em; font-size: 16px; }
}
@media (max-height: 600px) and (min-width: 901px) {
  .page-doc .doc-stage { display: block; overflow-y: auto; scrollbar-width: thin; }
}

/* ───────────────────────── phones / narrow ───────────────────────── */
@media (max-width: 900px) {
  html { scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  body { height: auto; min-height: 100dvh; overflow: auto; display: block; }
  .masthead { grid-template-columns: 1fr auto; padding: 12px 16px 6px; gap: 10px; }
  .tools { align-self: start; }
  .brand h1 { font-size: 17px; }
  .kicker, .sample-note .long { display: none; }
  .sample-note { font-size: 12px; }
  .desk { gap: 4px; }
  .track li { flex: 0 0 14px; }
  .pos-text { max-width: 100%; font-size: 12px; text-align: center; }
  .desk { display: flex; flex-direction: column-reverse; padding: 0 12px 90px; gap: 10px; }
  .rail { overflow: visible; padding: 0; }
  /* the list becomes one swipeable row of check cards, each tagged with its chapter */
  .rail .micro, .rail-foot, .grp-head { display: none; }
  .grps { display: flex; align-items: stretch; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
  .grp, .fc-items { display: contents; }
  .fc-items > li { flex: none; display: flex; }
  .fc { width: 196px; grid-template-columns: minmax(0, 1fr) 8px; grid-template-rows: auto auto; padding: 7px 10px; border-color: var(--rule-2); background: var(--glass); font-size: 12.5px; }
  .fc-ch { display: block; grid-column: 1; font: 600 10.5px/1.4 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .fc-t { grid-column: 1; -webkit-line-clamp: 2; }
  .fc-dot { grid-column: 2; grid-row: 1; }
  html, body { max-width: 100%; overflow-x: hidden; }
  .masthead, .desk, .spread, .page { min-width: 0; max-width: 100%; }
  .spread, .spread.swapped { display: flex; flex-direction: column; filter: none; gap: 0; }
  .page-doc { order: 1; }      /* quotation first on phones … */
  .page-fact { order: 3; }
  .spread.swapped .page-doc { order: 3; }   /* … unless swapped */
  .spread.swapped .page-fact { order: 1; }
  .gutter { order: 2; height: 34px; background: none; }
  .gutter::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 2px dotted var(--rule-2); }
  .gutter-link { width: auto; height: auto; margin: 0; transform: translate(-50%, -50%); padding: 4px 10px; border-radius: 99px; font: 600 10.5px/1.3 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
  .gutter-link::before { display: none; }
  .gutter-link::after { content: "paired with"; }
  .page, .spread:not(.swapped) .page-fact, .spread.swapped .page-doc, .spread:not(.swapped) .page-doc, .spread.swapped .page-fact { border-radius: 10px; background: var(--paper); box-shadow: var(--shadow); }
  .page-body { overflow: visible; }
  .page-doc .doc-stage { grid-template-rows: auto auto auto; }
  .scan { height: auto; max-height: 46vh; margin: 0 10px; }
  .doc-meta { flex-wrap: wrap; }
  .doc-actions .hint { flex-basis: 100%; }
  .card { grid-template-columns: 48px minmax(0, 1fr); }
  .thumb { width: 48px; height: 62px; }
  .access { flex-wrap: wrap; }
  .sec-head { flex-wrap: wrap; }
  .runner { padding-top: 0; }
  .doc-plain, .data-view { max-height: 70vh; margin: 0 10px; }
  .fact-scroll { padding: 4px 18px 22px; }
  .page-head { padding: 12px 18px 9px; flex-wrap: wrap; }
  .doc-head { padding: 8px 10px 0; }
  .doc-meta, .doc-actions { padding-left: 14px; padding-right: 14px; }
  .claim { font-size: 22px; }
  .finding .verdict { font-size: 18px; }
  .prose { font-size: 16.5px; }
  .pager { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--pager-glass); backdrop-filter: blur(8px); border-top: 1px solid var(--rule-2); gap: 10px; }
  .pg-btn span { display: none; }
  .viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; border-radius: 0; }
  .viewer-head { flex-direction: column; }
  .compare .row { grid-template-columns: 120px minmax(0, 1fr) 56px; }
}

/* frame drawn by the page on unmarked excerpts (Chapter 1 checks) */
.drawn-frame { position: absolute; border: 1.5px solid #c8323c; border-radius: 2px; pointer-events: none; }
.prose { margin: 0 0 1em; }

/* ───────────────────────── severity ───────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sev-major { --sev: var(--sev-major); }
.sev-moderate { --sev: var(--sev-moderate); }
.sev-minor { --sev: var(--sev-minor); }
.sev {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 7px; border-radius: 5px; border: 1.5px solid var(--sev);
  font: 600 12px/1 var(--sans); letter-spacing: .02em; color: var(--sev); background: var(--card);
}
.meter { font-size: 8px; letter-spacing: 1px; line-height: 1; }
.sev-why { margin: 10px 0 0; padding: 7px 11px; border-left: 3px solid var(--sev); border-radius: 0; background: var(--well); font: 13px/1.45 var(--sans); color: var(--ink-2); }
.sev-why b { color: var(--sev); font-weight: 600; }
.sev-chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 8px 10px; }
.sev-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 6px;
  border: 1px solid var(--rule-2); background: var(--glass); font: 500 12px/1 var(--sans); color: var(--ink-2); cursor: pointer;
}
.sev-chip .meter { color: var(--sev); }
.sev-chip .n { color: var(--muted); font-weight: 400; }
.sev-chip:hover { border-color: var(--sev, var(--ink-2)); color: var(--ink); }
.sev-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.sev-chip[aria-pressed="true"] .n, .sev-chip[aria-pressed="true"] .meter { color: var(--paper); }
.fc[class*="sev-"] { border-left: 3px solid var(--sev); border-top-left-radius: 0; border-bottom-left-radius: 0; }
@media (max-width: 900px) {
  .sev-chips { padding: 0 2px 8px; }
}
