/* Altilly Files — indigo and teal, restrained institutional surfaces.
   Dark is the default; the saved theme preference is applied before first paint. */

@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/space-grotesk-latin-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope-latin-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-latin-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --paper: #0a0c12;
  --surface: #0f121a;
  --surface-2: #151a25;
  --ink: #e8edf5;
  --ink-2: #bcc6d6;
  --muted: #96a4b8;
  --rule: #1b2030;
  --rule-strong: #58677f;
  --accent: #65c8d5;
  --accent-ink: #0a0c12;
  --accent-soft: #122c37;
  --indigo: #a5a9fa;
  --nav-active: #242349;
  --note: #191b35;
  --note-edge: #8587e6;
  --note-ink: #d7dbff;
  --bar: #d8e1ee;
  --bar-ink: #10151e;
  --focus: #8eacff;
  --target: #284962;
  --target-ink: #effaff;
  --danger: #f49caa;
  --danger-soft: #331b27;
  --ok: #80d5ac;
  --ok-soft: #112d25;
  --shadow: 0 18px 48px rgb(0 0 0 / .24);
  --who-1: #8fb5ff;
  --who-2: #b4a9f6;
  --who-3: #73c7d4;
  --who-4: #a5bde2;
  --who-5: #b5bdd0;
  --avatar-ink: #0a0c12;
  --brand-start: #7797ff;
  --brand-end: #3fb7c9;
  --brand-gradient: linear-gradient(135deg, var(--brand-start), var(--brand-end));
  --button-start: #7797ff;
  --button-end: #3fb7c9;
  --button-ink: #0a0c12;
  --hero-glow: rgb(94 94 182 / .12);
  --header-bg: rgb(10 12 18 / .94);

  --font-display: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  --font-ui: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-read: var(--font-ui);
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --step--1: .875rem;
  --step-0: 1rem;
  --step-1: 1.1875rem;
  --step-2: 1.5rem;
  --step-3: 2rem;
  --step-4: clamp(2.25rem, 1.6rem + 3vw, 3.5rem);
  --measure: 70ch;
  --wide: 77.5rem;
  --gutter: clamp(1.25rem, .5rem + 2vw, 2rem);
  --header-h: 4.75rem;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --paper: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #edf1f7;
  --ink: #172638;
  --ink-2: #34465d;
  --muted: #526279;
  --rule: #dce2ec;
  --rule-strong: #7b889d;
  --accent: #176275;
  --accent-ink: #ffffff;
  --accent-soft: #e2eff3;
  --indigo: #4d4a9f;
  --nav-active: #ececf9;
  --note: #eeeffc;
  --note-edge: #5e5eb6;
  --note-ink: #393975;
  --bar: #1d3e51;
  --bar-ink: #ffffff;
  --focus: #4147a1;
  --target: #d3e3ff;
  --target-ink: #172638;
  --danger: #a32c46;
  --danger-soft: #fbeaf0;
  --ok: #226341;
  --ok-soft: #e4f2e9;
  --shadow: 0 18px 48px rgb(20 70 95 / .09);
  --who-1: #285b9e;
  --who-2: #65509b;
  --who-3: #176275;
  --who-4: #445f83;
  --who-5: #586278;
  --avatar-ink: #ffffff;
  --brand-start: #4d4a9f;
  --brand-end: #176275;
  --button-start: #514fad;
  --button-end: #176b7a;
  --button-ink: #ffffff;
  --hero-glow: rgb(94 94 182 / .07);
  --header-bg: rgb(245 247 251 / .94);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--step-0);
  line-height: 1.55;
  font-feature-settings: "kern", "liga";

}
img, video { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--accent-soft); }
.vh {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 0.5rem; top: -3rem; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 0.5rem 0.75rem; border-radius: 4px;
}
.skip:focus { top: 0.5rem; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.site-header .inner {
  max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter);
  height: var(--header-h);
  display: flex; align-items: center; gap: 1rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-mark {
  display: inline-block; width: 1.6rem; height: 0.7rem; background: var(--bar); border-radius: 1px;
}
.brand:hover { text-decoration: none; }
.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.15rem; }
.site-nav a {
  display: block; padding: 0.4rem 0.55rem; border-radius: 4px;
  color: var(--ink-2); text-decoration: none; font-size: 0.9rem; font-weight: 500; white-space: nowrap;
}
.site-nav a:hover { background: var(--surface); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 -2px 0 var(--ink); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  min-width: 2.5rem; height: 2.5rem; padding: 0 0.6rem;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--rule-strong); }
.icon-btn svg { width: 1.15rem; height: 1.15rem; }
.menu-btn { display: none; }



/* ---------- Sample-data banner ---------- */
.sample-banner {
  background: var(--note); color: var(--note-ink); border-bottom: 1px solid var(--note-edge);
  font-size: var(--step--1); padding: 0.45rem var(--gutter); text-align: center;
}

/* ---------- Layout ---------- */
main { display: block; }
.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }
.page { padding-block: clamp(2rem, 1rem + 4vw, 4rem); }
.page-head { max-width: var(--measure); margin-bottom: 2rem; }
.page-head h1 {
  font-size: var(--step-4); line-height: 1.05; letter-spacing: -0.025em; font-weight: 700; margin: 0 0 0.75rem;
}
.page-head .lede { font-size: var(--step-1); color: var(--ink-2); margin: 0; max-width: 36rem; }
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 16rem; gap: 3rem; align-items: start; }
@media (max-width: 60rem) { .page-grid { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; } }
.aside-box {
  position: sticky; top: calc(var(--header-h) + 1.5rem);
  font-size: 0.9rem; color: var(--ink-2); border-left: 3px solid var(--rule-strong); padding-left: 1rem;
}
.aside-box h2 { font-size: 0.95rem; margin: 0 0 0.5rem; color: var(--ink); }
.aside-box p { margin: 0 0 0.75rem; }
.aside-box ul { margin: 0; padding-left: 1.1rem; }
@media (max-width: 60rem) { .aside-box { position: static; } }

/* ---------- Prose (rendered markdown) ---------- */
.prose { max-width: var(--measure); font-family: var(--font-ui); font-size: 1.0625rem; line-height: 1.7; color: var(--ink); }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--font-ui); line-height: 1.2; letter-spacing: -0.01em; }
.prose h1 { font-size: var(--step-3); font-weight: 700; }
.prose h2 { font-size: var(--step-2); font-weight: 700; margin: 2.5rem 0 0.75rem; }
.prose h3 { font-size: var(--step-1); font-weight: 700; margin: 2rem 0 0.5rem; }
.prose h4 { font-size: var(--step-0); font-weight: 700; margin: 1.5rem 0 0.25rem; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table, .prose pre { margin: 0 0 1.1rem; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-bottom: 0.35rem; }
.prose li > ul, .prose li > ol { margin: 0.35rem 0 0; }
.prose blockquote {
  margin-left: 0; padding: 0.1rem 0 0.1rem 1.1rem; border-left: 3px solid var(--rule-strong); color: var(--ink-2);
}
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
.prose code { font-family: var(--font-mono); font-size: 0.88em; background: var(--surface); border: 1px solid var(--rule); border-radius: 3px; padding: 0.05em 0.3em; }
.prose pre { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 1rem; overflow-x: auto; }
.prose pre code { border: 0; padding: 0; background: none; }
.prose img { border-radius: 4px; border: 1px solid var(--rule); }
.prose .table-wrap { overflow-x: auto; margin: 0 0 1.25rem; }
.prose table { border-collapse: collapse; width: 100%; font-family: var(--font-ui); font-size: 0.92rem; }
.prose th, .prose td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th { font-weight: 700; border-bottom-color: var(--rule-strong); }
.prose .placeholder, .placeholder-note {
  font-family: var(--font-ui); font-size: 0.9rem; background: var(--note); color: var(--note-ink);
  border-left: 3px solid var(--note-edge); padding: 0.6rem 0.9rem; border-radius: 0 4px 4px 0;
}

/* Message reference links: [#1234] */
a.msgref {
  font-family: var(--font-ui); font-size: 0.86em; font-weight: 600; font-variant-numeric: tabular-nums;
  text-decoration: none; white-space: nowrap;
  padding: 0.05em 0.35em; border-radius: 3px; border: 1px solid var(--rule-strong); background: var(--surface);
}
a.msgref:hover { border-color: var(--accent); background: var(--accent-soft); }

/* Callouts and evidence cards from ::: containers */
.callout { font-family: var(--font-ui); font-size: 0.95rem; border: 1px solid var(--rule); border-left-width: 4px; border-radius: 4px; padding: 0.9rem 1.1rem; margin: 0 0 1.25rem; background: var(--surface); }
.callout > :last-child { margin-bottom: 0; }
.callout-note { border-left-color: var(--accent); }
.callout-caveat { border-left-color: var(--note-edge); background: var(--note); color: var(--note-ink); }
.callout-caveat a { color: inherit; }

.evidence {
  font-family: var(--font-ui); font-size: 0.97rem; line-height: 1.6;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 6px;
  margin: 0 0 1.25rem; padding: 1.1rem 1.25rem 1rem; box-shadow: var(--shadow);
}
.evidence > h3, .evidence > h4 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.evidence > :last-child { margin-bottom: 0; }
.evidence .weight {
  display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-bottom: 0.4rem;
}
.evidence .weight i { display: inline-flex; gap: 2px; }
.evidence .weight i b { width: 0.9rem; height: 0.35rem; border-radius: 1px; background: var(--rule); }
.evidence[data-weight="strong"] .weight i b:nth-child(-n+3),
.evidence[data-weight="moderate"] .weight i b:nth-child(-n+2),
.evidence[data-weight="weak"] .weight i b:nth-child(-n+1) { background: var(--ink); }
.evidence[data-weight="against"] { border-left: 4px solid var(--danger); }
.evidence[data-weight="against"] .weight { color: var(--danger); }
.evidence .refs { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--rule); font-size: 0.85rem; color: var(--muted); }

/* Timeline */
.timeline { list-style: none; margin: 0 0 2rem; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 0.45rem; top: 0.4rem; bottom: 0.4rem; width: 2px; background: var(--rule); }
.timeline > li { position: relative; padding: 0 0 1.4rem 2rem; }
.timeline > li::before {
  content: ""; position: absolute; left: 0; top: 0.35rem; width: 0.95rem; height: 0.95rem;
  border-radius: 50%; background: var(--paper); border: 2px solid var(--ink);
}
.timeline > li.key::before { background: var(--ink); }
.timeline .when { display: block; font-family: var(--font-ui); font-weight: 700; font-size: 0.95rem; margin: 0 0 0.2rem; letter-spacing: 0; }
.timeline > li > :last-child { margin-bottom: 0; }
.prose h2.phase { margin-top: 3rem; padding-top: 1rem; border-top: 3px solid var(--ink); }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 2.5rem; padding: 0.45rem 1rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font-weight: 600; text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.12); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--rule-strong); }
.btn.secondary:hover { border-color: var(--ink); filter: none; }
.btn.danger { background: var(--surface); color: var(--danger); border-color: currentColor; }
.btn.small { min-height: 2rem; padding: 0.25rem 0.7rem; font-size: 0.875rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.field { display: grid; gap: 0.3rem; margin-bottom: 1rem; }
.field label, .field .label { font-weight: 600; font-size: 0.92rem; }
.field .hint { font-size: 0.83rem; color: var(--muted); }
.input, textarea.input, select.input {
  width: 100%; padding: 0.55rem 0.7rem; border: 1px solid var(--rule-strong); border-radius: 6px; background: var(--surface);
}
textarea.input { min-height: 8rem; resize: vertical; line-height: 1.5; }
.input:focus-visible { outline-offset: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-status { font-size: 0.92rem; margin-top: 0.75rem; }
.form-status.error { color: var(--danger); }
.form-status.ok { color: var(--ok); }

/* ---------- Home ---------- */
.home-hero { padding-block: clamp(3rem, 6vw, 5rem) 2.75rem; }
.home-hero h1 { font: 500 clamp(2.7rem, 5.5vw, 4.6rem)/1.12 var(--font-ui); letter-spacing: -.045em; margin: 0 0 1rem; }
.hero-purpose { font-size: clamp(1.0625rem, 2vw, 1.25rem); color: var(--ink-2); max-width: 48ch; margin: 0; line-height: 1.65; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 1.75rem; }
.hero-actions .btn { padding: .65rem 1.2rem; border-radius: .5rem; }
.hero-actions .secondary { border-color: var(--rule); background: transparent; }
.facts-strip dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; margin: 0; padding: 1.6rem 0; border-block: 1px solid var(--rule); }
.facts-strip dl > div { display: grid; grid-template-rows: auto 1fr; align-content: start; gap: .3rem; }
.facts-strip dt { grid-row: 2; color: var(--muted); font-size: .875rem; }
.facts-strip dd { grid-row: 1; margin: 0; font-size: 1.75rem; font-weight: 550; letter-spacing: -.025em; font-variant-numeric: tabular-nums; line-height: 1.3; }
.entries { padding-block: 3rem; }
.entries h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 1.25rem; }
.entry-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; list-style: none; margin: 0; padding: 0; }
.entry-list li { min-width: 0; background: var(--surface-2); border-radius: .65rem; }
.entry-list a { display: block; height: 100%; padding: 1.4rem; color: var(--ink); text-decoration: none; border-radius: inherit; }
.entry-list a:hover { background: var(--accent-soft); }
.entry-list a:hover strong { text-decoration: underline; text-underline-offset: .2em; }
.entry-list strong { display: block; font-size: 1.0625rem; font-weight: 650; margin-bottom: .55rem; }
.entry-list span { display: block; font-size: .9rem; line-height: 1.65; color: var(--muted); }
.home-introduction { padding-bottom: 4rem; }
.intro-disclosure { border-top: 1px solid var(--rule); }
.intro-disclosure > summary { padding: 1.5rem 0; display: flex; justify-content: space-between; gap: 1rem; cursor: pointer; list-style: none; font-weight: 550; }
.intro-disclosure > summary::-webkit-details-marker { display: none; }
.intro-disclosure > summary::after { content: '+'; font-size: 1.25rem; line-height: 1.2; color: var(--muted); }
.intro-disclosure[open] > summary::after { content: '−'; }
.intro-body { max-width: 70ch; padding-block: 1.25rem 2rem; }
.intro-sig { margin-top: 2rem; font-weight: 600; }
@media (max-width: 64rem) { .entry-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 40rem) {
  .home-hero { padding-block: 2.75rem 2rem; }
  .facts-strip dl { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
  .facts-strip dd { font-size: 1.5rem; }
  .entry-list { grid-template-columns: minmax(0, 1fr); gap: .65rem; }
  .entry-list a { padding: 1.2rem; }
  .entries { padding-block: 2.25rem; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); background: var(--surface-2); color: var(--ink-2); font-size: 0.9rem; }
.site-footer .inner { max-width: var(--wide); margin: 0 auto; padding: 1.75rem var(--gutter) 2.25rem; display: grid; gap: 0.6rem; }
.site-footer p { margin: 0; max-width: 60rem; }
.site-footer .contact { color: var(--muted); }

/* ---------- Transparency ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: 0; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); margin: 0 0 2.5rem; }
.stat { padding: 1rem 1.2rem; border-right: 1px solid var(--rule); }
.stat:last-child { border-right: 0; }
@media (max-width: 40rem) { .stat { border-right: 0; border-bottom: 1px solid var(--rule); } .stat:last-child { border-bottom: 0; } }
.stat b { display: block; font-size: var(--step-3); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 0.9rem; }
.cat-bars { list-style: none; margin: 0 0 2rem; padding: 0; max-width: 44rem; }
.cat-bars li { display: grid; grid-template-columns: 13rem 1fr 3rem; gap: 0.75rem; align-items: center; padding: 0.3rem 0; font-size: 0.9rem; }
.cat-bars .track { height: 0.6rem; background: var(--rule); border-radius: 1px; overflow: hidden; }
.cat-bars .fill { display: block; height: 100%; background: var(--bar); }
.cat-bars .n { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 40rem) { .cat-bars li { grid-template-columns: 1fr 3rem; } .cat-bars .track { grid-column: 1 / -1; order: 3; } }
.log-controls { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; margin-bottom: 1rem; }
.log-controls .field { margin: 0; min-width: 12rem; }
.data-table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); }
.data-table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.data-table th, .data-table td { text-align: left; padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.data-table th { font-weight: 700; background: var(--surface-2); position: sticky; top: 0; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.pager { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.9rem; font-size: 0.9rem; color: var(--muted); flex-wrap: wrap; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem; }
@media (max-width: 56rem) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.section-title { font-size: var(--step-2); letter-spacing: -0.015em; margin: 3rem 0 1rem; }

/* ---------- Redaction pill (used everywhere) ---------- */
.redacted {
  display: inline-block; background: var(--bar); color: var(--bar-ink);
  font-family: var(--font-ui); font-size: 0.78em; font-weight: 600; line-height: 1.45;
  padding: 0 0.45em; border-radius: 2px; vertical-align: 0.05em; white-space: nowrap;
}
.redacted .br { opacity: 0.55; }

/* ---------- Comments (shared) ---------- */
.thread { list-style: none; margin: 0; padding: 0; }
.thread > li { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
.thread > li:last-child { border-bottom: 0; }
.c-head { display: flex; flex-wrap: wrap; gap: 0.25rem 0.6rem; align-items: baseline; font-size: 0.88rem; color: var(--muted); margin-bottom: 0.25rem; }
.c-head .c-name { color: var(--ink); font-weight: 700; }
.c-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.c-reply { margin: 0.75rem 0 0 0.9rem; padding: 0.6rem 0.9rem; border-left: 3px solid var(--ink); background: var(--surface-2); border-radius: 0 4px 4px 0; }
.badge-author {
  display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 0.05rem 0.45rem; border-radius: 3px;
  background: var(--ink); color: var(--paper);
}
.c-msg { font-size: 0.85rem; }
.empty { color: var(--muted); font-size: 0.95rem; }

/* ---------- Dialogs ---------- */
dialog {
  border: 1px solid var(--rule-strong); border-radius: 8px; padding: 0; background: var(--surface); color: var(--ink);
  width: min(40rem, calc(100vw - 2rem)); max-height: min(90dvh, 52rem);
}
dialog::backdrop { background: rgba(10, 14, 20, 0.6); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dlg-head h2 { font-size: 1.05rem; margin: 0; }
.dlg-body { padding: 1rem 1.1rem 1.25rem; }
.dlg-quote { font-size: 0.92rem; background: var(--surface-2); border-left: 3px solid var(--rule-strong); padding: 0.6rem 0.8rem; margin: 0 0 1rem; border-radius: 0 4px 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.dlg-quote b { display: block; font-size: 0.85rem; }
.dlg-section { font-size: 0.95rem; margin: 1.25rem 0 0.25rem; }

.lightbox { width: min(72rem, calc(100vw - 1rem)); background: var(--surface); }
.lightbox figure { margin: 0; padding: 1rem; display: grid; gap: 0.75rem; justify-items: center; }
.lightbox img, .lightbox video { max-height: 72dvh; width: auto; max-width: 100%; border-radius: 4px; background: var(--surface-2); }
.lightbox figcaption { font-size: 0.9rem; color: var(--ink-2); text-align: center; max-width: 50rem; }
.lb-nav { display: flex; gap: 0.5rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 90;
  background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; border-radius: 6px; font-size: 0.92rem;
  max-width: calc(100vw - 2rem);
}

/* ---------- Loading ---------- */
.loading { color: var(--muted); padding: 2rem 0; }

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

@media print {
  .site-header, .site-footer .contact, .hero-actions, .skip { display: none; }
  body { background: #fff; color: #000; }
}

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font-weight: 700; font-size: 0.95rem; margin-bottom: 0.4rem; }
.aside-box * + h2 { margin-top: 1.4rem; }

/* Reading layout and responsive navigation. */
html { scroll-padding-top: calc(var(--header-h) + 1.5rem); }
body { overflow-wrap: break-word; }
main, section, article, aside, .field, .two-col > * { min-width: 0; }
.site-header { background: var(--surface); }
.site-header .inner { min-height: 4.75rem; height: auto; padding-block: .75rem; gap: 1.25rem; }
.brand { font-family: var(--font-ui); font-size: 1.18rem; font-weight: 700; letter-spacing: -.035em; }
.brand-mark { width: .75rem; height: 1.65rem; border-radius: 0; background: none; border-block: 2px solid var(--ink); border-left: 2px solid var(--ink); }
.site-nav > ul { align-items: center; gap: .1rem; }
.site-nav a, .site-nav summary { font-size: .875rem; font-weight: 550; padding: .55rem .6rem; }
.site-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 3px 3px 0 0; }
.nav-group { position: relative; }
.nav-group summary { cursor: pointer; color: var(--ink-2); border-radius: 3px; list-style: none; white-space: nowrap; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: '⌄'; margin-left: .4em; font-size: .9em; }
.nav-group[open] summary, .nav-group summary:hover { background: var(--surface-2); }
.nav-group.is-current > summary { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.site-nav .nav-group > ul { display: block; position: absolute; top: calc(100% + .4rem); left: 0; min-width: 13rem; padding: .4rem; background: var(--surface); border: 1px solid var(--rule-strong); box-shadow: 0 8px 24px #00000012; border-radius: 4px; }
.site-nav .nav-group:not([open]) > ul { display: none; }
.site-nav .nav-group a { padding: .7rem .8rem; }
.icon-btn, .btn, input, select, summary { touch-action: manipulation; }
.icon-btn { min-width: 2.75rem; height: 2.75rem; flex-shrink: 0; }
.page { padding-top: clamp(2.25rem, 5vw, 4.5rem); }
.page-head { max-width: 52rem; margin-bottom: 2.75rem; }
.page-head h1 { font-family: var(--font-ui); font-weight: 500; line-height: 1.12; font-size: clamp(2.3rem, 4vw, 3.75rem); letter-spacing: -.035em; text-wrap: balance; }
.page-head .lede { max-width: 58ch; line-height: 1.65; font-size: 1.1rem; }
.page-grid { grid-template-columns: minmax(0, 1fr) 17rem; gap: clamp(2rem, 5vw, 5rem); }
.prose { font-size: 1.125rem; line-height: 1.8; width: 100%; overflow-wrap: anywhere; }
.prose h2 { font-family: var(--font-ui); font-size: 1.8rem; font-weight: 600; line-height: 1.25; letter-spacing: -.02em; margin: 3.5rem 0 1.1rem; }
.prose h3 { font-size: 1.2rem; line-height: 1.45; margin: 2.5rem 0 .85rem; }
.prose p, .prose ul, .prose ol { margin-bottom: 1.4rem; }
.prose blockquote { border-left-color: var(--accent); padding-left: 1.35rem; }
.prose h2, .prose h3, .prose h4, #introduction { scroll-margin-top: calc(var(--header-h) + 1.5rem); }
.callout { padding: 1.1rem 1.35rem; line-height: 1.7; border-radius: 0 4px 4px 0; margin-block: 1.5rem; }
.callout-caveat { border-left-width: 5px; }
.callout-note { background: var(--accent-soft); }
.evidence { padding: 1.4rem; line-height: 1.75; margin-block: 1.5rem; border-radius: 4px; }
.evidence .weight { font-size: .875rem; margin-bottom: .75rem; }
.evidence > h3, .evidence > h4 { font-family: var(--font-ui); font-size: 1.15rem; }
.prose .table-wrap { border: 1px solid var(--rule-strong); border-radius: 4px; max-width: 100%; }
.prose table { margin: 0; line-height: 1.55; }
.prose th { background: var(--surface-2); color: var(--ink); }
.prose th, .prose td { padding: .85rem 1rem; }
.prose tbody tr:nth-child(even) { background: var(--surface); }
.prose a:not(.msgref):not(.heading-anchor) { text-decoration-thickness: 1px; }
.redacted { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.eyebrow { font-family: var(--font-ui); font-size: .75rem; line-height: 1.5; font-weight: 650; letter-spacing: .11em; text-transform: uppercase; color: var(--muted); margin: 0 0 1.25rem; }
/* Small, predictable page-to-page navigation. */
.reading-order { margin-block: 0 2rem; padding-top: 1rem; }
.reading-steps { display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--rule); padding-top: 1rem; }
.reading-steps a { display: inline-flex; align-items: center; gap: .6rem; min-height: 2.75rem; color: var(--ink-2); text-decoration: none; font-size: .875rem; }
.reading-steps a:hover { text-decoration: underline; }
.reading-steps .next { flex-direction: row-reverse; margin-left: auto; }
.question-routes { display: flex; flex-wrap: wrap; gap: .75rem 2rem; border-block: 1px solid var(--rule); padding: 1rem 0; margin-bottom: 2rem; }
.site-footer { line-height: 1.8; }
.site-footer .inner { gap: .75rem; padding-block: 2rem 2.5rem; }
@media (max-width: 60rem) {
  .page-grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .page-head, .prose { max-width: 70ch; }
}
@media (max-width: 40rem) {
  .site-header .inner { min-height: 4rem; gap: .5rem; padding-block: .55rem; }
  .brand { font-size: 1.08rem; gap: .5rem; }
  .brand-mark { width: .6rem; height: 1.4rem; }
  .prose { font-size: 1.0625rem; line-height: 1.8; }
  .prose h2 { font-size: 1.6rem; }
  .prose h3 { font-size: 1.1rem; }
  .page-head { margin-bottom: 2rem; }
  .page-head h1 { font-size: 2.45rem; }
  .callout, .evidence { padding: 1rem; }
  .log-controls .field { min-width: 0; width: 100%; }
}

.mobile-menu { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(22rem, 100%); height: 100dvh; max-height: 100dvh; border: 0; border-left: 1px solid var(--rule); border-radius: 0; padding: 1rem 1.25rem; overflow-y: auto; overscroll-behavior: contain; }
.mobile-menu[open] { animation: menu-enter .18s ease-out; }
.mobile-menu-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; font-weight: 600; }
.mobile-menu .site-nav { display: block; margin: 0; }
.mobile-menu .site-nav > ul { flex-direction: column; align-items: stretch; }
.mobile-menu .site-nav a, .mobile-menu .site-nav summary { padding: .85rem .65rem; font-size: 1rem; white-space: normal; }
.mobile-menu .site-nav .nav-group > ul { position: static; border: 0; border-left: 1px solid var(--rule); border-radius: 0; box-shadow: none; margin-left: .65rem; padding: 0 .5rem; }
body.menu-open { overflow: hidden; }
@keyframes menu-enter { from { transform: translateX(100%); } to { transform: translateX(0); } }
@media (max-width: 56rem) {
  .menu-btn { display: inline-flex; margin-left: auto; }
  .site-header .site-nav { display: none; }
}

/* ---------- Altilly presentation ---------- */
body { line-height: 1.7; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, .brand, .page-head h1, .prose h1, .prose h2, .prose h3, .prose h4 {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -.025em;
}
.num, time, code, pre, .msgref, .timeline .when, .stat b, .cat-bars .n,
.facts-strip dd, .data-table td:first-child, .data-table td:last-child {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}
button, a, summary, .input { transition: color .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease; }
a { text-underline-offset: .22em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
::selection { background: var(--target); color: var(--target-ink); }
.site-header { background: var(--header-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.site-header .inner { min-height: 4.75rem; padding-block: .75rem; }
.brand { font-size: 1.125rem; font-weight: 600; letter-spacing: -.035em; gap: .75rem; }
.brand-mark { width: .85rem; height: 1.5rem; border: 0; border-left: 2px solid var(--accent); border-block: 2px solid var(--accent); border-radius: 2px 0 0 2px; }
.site-nav a, .site-nav summary { font-size: .875rem; font-weight: 500; border-radius: 6px; }
.site-nav a:hover, .nav-group summary:hover, .nav-group[open] > summary { background: var(--surface-2); }
.site-nav a[aria-current="page"], .nav-group.is-current > summary { background: var(--nav-active); color: var(--ink); box-shadow: none; border-radius: 6px; }
.site-nav .nav-group > ul { padding: .5rem; border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--shadow); }
.site-nav > ul > li:last-child .nav-group > ul { left: auto; right: 0; }
.site-header .icon-btn { border-color: transparent; background: transparent; color: var(--muted); }
.site-header .icon-btn:hover { color: var(--ink); background: var(--surface-2); border-color: var(--rule); }
#theme-toggle { margin-left: auto; }
.site-nav + #theme-toggle { margin-left: 0; }
.icon-btn { border-radius: 8px; }
.icon-btn:hover { background: var(--surface-2); }

.home-hero { position: relative; isolation: isolate; padding-block: clamp(4rem, 7vw, 6rem) 3.5rem; }
.home-hero::before { content: ""; position: absolute; z-index: -1; pointer-events: none; inset: 0; background: radial-gradient(ellipse at 28% 40%, var(--hero-glow), transparent 67%); }
.home-hero h1 { font-family: var(--font-display); font-size: clamp(2.65rem, 5.5vw, 4.5rem); font-weight: 600; letter-spacing: -.045em; line-height: 1.06; margin-bottom: 1.4rem; text-wrap: balance; }
.hero-accent { color: var(--accent); background: var(--brand-gradient); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-purpose { max-width: 42ch; font-size: clamp(1.0625rem, 2vw, 1.2rem); line-height: 1.75; color: var(--ink-2); }
.hero-actions { margin-top: 2rem; gap: .875rem; }
.btn { min-height: 2.75rem; padding: .6rem 1.1rem; border-radius: 8px; font-size: .9375rem; font-weight: 700; background: linear-gradient(135deg, var(--button-start), var(--button-end)); color: var(--button-ink); border: 1px solid transparent; }
.btn:hover { filter: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.btn.secondary { background: var(--surface); border-color: var(--rule-strong); color: var(--ink); font-weight: 600; }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--accent); box-shadow: none; }
.btn.danger { color: var(--danger); background: var(--danger-soft); border-color: currentColor; }
.btn[disabled]:hover { box-shadow: none; }
.hero-actions .btn { padding: .85rem 1.5rem; }
.hero-actions .secondary { background: var(--surface); border-color: var(--rule-strong); }
.facts-strip dl { gap: 0; background: var(--surface); padding: 1.7rem 0; }
.facts-strip dl > div { padding: .1rem 1.75rem; gap: .6rem; border-right: 1px solid var(--rule); }
.facts-strip dl > div:last-child { border-right: 0; }
.facts-strip dd { font-size: clamp(1.5rem, 2.5vw, 1.875rem); font-weight: 500; letter-spacing: -.045em; }
.facts-strip dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .065em; line-height: 1.6; color: var(--muted); }
.entries { padding-block: 3.5rem; }
.eyebrow, .entries > h2 { font-family: var(--font-mono); font-size: .75rem; font-weight: 500; line-height: 1.6; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.entries > h2 { margin-bottom: 1.5rem; }
.entry-list { gap: 1.125rem; }
.entry-list li { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; }
.entry-list a { padding: 1.5rem; }
.entry-list li:has(a:hover), .entry-list li:focus-within { border-color: var(--rule-strong); }
.entry-list a:hover { background: var(--surface-2); }
.entry-list a:hover strong { text-decoration: none; color: var(--accent); }
.entry-list strong { font-family: var(--font-display); font-size: 1.125rem; font-weight: 600; letter-spacing: -.025em; margin-bottom: .75rem; }
.entry-list span { font-size: .875rem; line-height: 1.75; }
.home-introduction { padding-bottom: 4.5rem; }
.intro-disclosure { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; }
.intro-disclosure > summary { padding: 1.4rem 1.5rem; font-family: var(--font-display); font-size: 1.0625rem; font-weight: 500; }
.intro-disclosure > summary::after { font-family: var(--font-mono); color: var(--accent); }
.intro-disclosure[open] { border-color: var(--rule-strong); }
.intro-disclosure[open] > summary { border-bottom: 1px solid var(--rule); }
.intro-body { max-width: 75ch; padding: 1.5rem; }

.page { padding-block: clamp(3rem, 5vw, 5rem); }
.page-head { max-width: 60rem; margin-bottom: 3rem; padding-bottom: 2.5rem; border-bottom: 1px solid var(--rule); }
.page-head h1 { font-size: clamp(2.25rem, 4.25vw, 3.25rem); line-height: 1.1; font-weight: 600; letter-spacing: -.035em; }
.page-head .lede { color: var(--ink-2); font-size: 1.0625rem; line-height: 1.75; max-width: 62ch; }
.page-grid { gap: clamp(2rem, 4vw, 4rem); }
.aside-box { border: 1px solid var(--rule); background: var(--surface); border-radius: 12px; padding: 1.3rem; font-size: .875rem; line-height: 1.75; color: var(--muted); }
.aside-box h2 { font-family: var(--font-display); font-size: 1rem; font-weight: 600; color: var(--ink); }
.prose { font-family: var(--font-ui); font-size: 1.0625rem; line-height: 1.8; color: var(--ink-2); }
.prose strong, .prose h1, .prose h2, .prose h3, .prose h4 { color: var(--ink); }
.prose h2 { font-size: clamp(1.5rem, 2.5vw, 2rem); line-height: 1.2; margin: 3rem 0 1.25rem; }
.prose h3 { font-size: 1.25rem; line-height: 1.4; margin: 2.25rem 0 .9rem; }
.prose blockquote { background: var(--surface); border-left: 2px solid var(--accent); padding: 1rem 1.25rem; border-radius: 0 8px 8px 0; }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose code { background: var(--surface-2); }
a.msgref { display: inline; font-family: var(--font-mono); font-size: .8em; font-weight: 500; padding: .1em .3em; border: 1px solid var(--rule); background: var(--surface-2); border-radius: 4px; text-decoration: none; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
a.msgref:hover { color: var(--accent); border-color: var(--accent); }
.callout, .prose .callout { border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; padding: 1.25rem 1.4rem; }
.callout-note { background: var(--surface); }
.callout-caveat, .prose .callout-caveat { border-left-color: var(--note-edge); background: var(--note); color: var(--note-ink); }
.callout-caveat strong { color: inherit; }
.evidence, .prose .evidence { padding: 1.4rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; box-shadow: none; }
.evidence > h3, .evidence > h4 { font-family: var(--font-display); font-size: 1.1875rem; }
.evidence .weight { font-size: .8125rem; font-weight: 600; }
.evidence .weight i { display: inline-flex; gap: 3px; }
.evidence .weight i b { height: .3rem; width: .65rem; border-radius: 2px; }
.evidence[data-weight="strong"] .weight { color: var(--ok); }
.evidence[data-weight="strong"] .weight i b:nth-child(-n+3) { background: var(--ok); }
.evidence[data-weight="moderate"] .weight { color: var(--accent); }
.evidence[data-weight="moderate"] .weight i b:nth-child(-n+2) { background: var(--accent); }
.evidence[data-weight="weak"] .weight { color: var(--muted); }
.evidence[data-weight="weak"] .weight i b:first-child { background: var(--muted); }
.evidence[data-weight="against"], .prose .evidence[data-weight="against"] { border-left: 3px solid var(--danger); }
.evidence[data-weight="against"] .weight { color: var(--danger); }
.evidence .refs { border-top: 1px solid var(--rule); padding-top: 1rem; }
.prose .table-wrap { border: 1px solid var(--rule); border-radius: 10px; }
.prose th { color: var(--ink); font-weight: 600; }
.prose h2.phase { border-top: 1px solid var(--rule); padding-top: 2rem; }
.timeline { margin-top: 2rem; }
.timeline::before { left: .6rem; width: 1px; background: var(--rule-strong); }
.timeline > li { margin-bottom: 1.5rem; padding: 1.25rem 1.25rem 1.25rem 2.5rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; }
.timeline > li::before { width: .7rem; height: .7rem; left: .25rem; top: 1.75rem; background: var(--paper); border: 2px solid var(--accent); box-shadow: 0 0 0 5px var(--paper); }
.timeline > li.key::before { background: var(--accent); }
.timeline .when { color: var(--accent); font-size: .875rem; font-weight: 500; line-height: 1.7; margin: 0 0 .85rem; letter-spacing: -.015em; }

.input, textarea.input, select.input { border-color: var(--rule-strong); background: var(--surface); border-radius: 8px; padding: .65rem .8rem; min-height: 2.75rem; }
.input::placeholder { color: var(--muted); opacity: 1; }
.input:hover { border-color: var(--accent); }
.input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input[type="checkbox"] { accent-color: var(--accent); }
.field label, .field .label { font-size: .875rem; }
.field .hint { font-size: .875rem; }
.stat-row { border-radius: 12px; }
.stat { padding: 1.5rem; }
.stat b { font-size: 1.875rem; font-weight: 500; margin-bottom: .5rem; }
.stat span { font-size: .8125rem; }
.cat-bars .track { border-radius: 4px; }
.cat-bars .fill { background: var(--accent); border-radius: inherit; }
.cat-bars li { padding-block: .5rem; }
.data-table-wrap { border-radius: 10px; }
.data-table th, .data-table td { padding: .85rem 1rem; }
.data-table th { font-size: .8125rem; font-weight: 600; }
.data-table td { font-size: .875rem; }
.data-table tbody tr:hover { background: var(--surface-2); }
.redacted { font-family: var(--font-mono); font-size: .75em; line-height: 1.6; border-radius: 3px; max-width: 100%; }
.c-head time { font-size: .75rem; }
.c-reply { border-left-color: var(--note-edge); background: var(--note); padding: 1rem; border-radius: 0 8px 8px 0; }
.badge-author { background: var(--nav-active); color: var(--indigo); border: 1px solid var(--note-edge); }
dialog { border-color: var(--rule-strong); border-radius: 12px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(3 6 12 / .72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.dlg-head { padding: 1.1rem 1.25rem; }
.dlg-head h2 { font-family: var(--font-display); }
.dlg-body { padding: 1.25rem; }
.toast { background: var(--surface-2); color: var(--ink); border: 1px solid var(--rule-strong); box-shadow: var(--shadow); border-radius: 8px; }
.mobile-menu { border-radius: 0; }
.reading-order { margin-block: 0 3rem; }
.reading-steps a:hover { color: var(--accent); }
.site-footer { background: var(--surface); color: var(--ink-2); font-size: .875rem; line-height: 1.8; }
.site-footer .inner { gap: .85rem; padding-block: 2.5rem; }
.site-footer p { max-width: 88ch; }
.site-footer .contact { color: var(--muted); }
@media (max-width: 64rem) {
  .facts-strip dl > div { padding-inline: 1.25rem; }
}
@media (max-width: 40rem) {
  .site-header .inner { min-height: 4.25rem; padding-block: .5rem; }
  .brand { font-size: 1rem; gap: .5rem; }
  .brand-mark { width: .6rem; height: 1.25rem; }
  .home-hero { padding-block: 3.5rem 2.5rem; }
  .hero-actions .btn { padding: .75rem 1.05rem; }
  .facts-strip dl { padding-block: 0; gap: 0; }
  .facts-strip dl > div { padding: 1.25rem; }
  .facts-strip dl > div:nth-child(2) { border-right: 0; }
  .facts-strip dl > div:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .facts-strip dd { font-size: 1.5rem; }
  .facts-strip dt { font-size: .75rem; }
  .entries { padding-block: 2.5rem; }
  .entry-list { gap: .875rem; }
  .entry-list a { padding: 1.4rem; }
  .intro-disclosure > summary, .intro-body { padding: 1.25rem; }
  .page { padding-block: 2.75rem; }
  .page-head { margin-bottom: 2rem; padding-bottom: 2rem; }
  .page-head h1 { font-size: 2.25rem; }
  .prose { font-size: 1rem; }
  .prose h2 { font-size: 1.625rem; }
  .callout, .prose .callout, .evidence, .prose .evidence { padding: 1.15rem; }
  .timeline > li { padding-right: 1rem; }
}
@media (forced-colors: active) {
  .hero-accent { background: none; color: CanvasText; -webkit-text-fill-color: CanvasText; }
  .btn { border-color: ButtonText; }
}

@media print {
  :root, :root[data-theme="dark"] { --paper: #fff; --surface: #fff; --surface-2: #f4f4f4; --ink: #000; --ink-2: #222; --muted: #444; --accent: #163c63; --rule: #bbb; --rule-strong: #888; --note: #f5f5f5; --note-ink: #111; --note-edge: #666; --accent-soft: #f5f5f5; }
  .site-header, .reading-order, .question-routes, .hero-actions, .skip, .heading-anchor, .message-preview { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .page { padding: 0; }
  .page-head { margin-bottom: 1.5rem; }
  .page-head h1 { font-size: 28pt; }
  .page-grid { display: block; }
  .prose { max-width: none; font-size: 11pt; line-height: 1.6; }
  .prose h2, .prose h3, .prose h4 { break-after: avoid; }
  .prose .callout, .prose .evidence { break-inside: avoid; }
  .prose .table-wrap { overflow: visible; }
  .prose table { font-size: 9pt; }
  .site-footer { font-size: 9pt; margin-top: 1.5rem; background: white; }
  .site-footer .inner { padding: 1rem 0; }
  .home-hero::before { display: none; }
  .hero-accent { background: none; -webkit-text-fill-color: #000; color: #000; }
  a { color: inherit; }
  @page { margin: 18mm; }
}

/* ---------- "Reading now" counter (js/track.js) ---------- */
.live-pill {
  display: inline-flex; align-items: center; gap: .45rem; flex-shrink: 0;
  height: 1.75rem; padding: 0 .7rem; border: 1px solid var(--rule); border-radius: 999px;
  background: var(--surface); color: var(--muted);
  font-family: var(--font-mono); font-size: .75rem; line-height: 1; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.live-pill .live-n { color: var(--ink); font-weight: 600; }
.live-dot { position: relative; flex-shrink: 0; width: .45rem; height: .45rem; border-radius: 50%; background: var(--ok); }
.live-dot::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--ok); animation: live-ping 2.4s ease-out infinite; }
@keyframes live-ping { 0% { transform: scale(1); opacity: .5; } 70%, 100% { transform: scale(2.6); opacity: 0; } }
@media (max-width: 64rem) and (min-width: 56.01rem) { .live-pill .live-now { display: none; } }
@media (max-width: 40rem) {
  .live-pill { height: 1.6rem; padding: 0 .55rem; gap: .35rem; font-size: .6875rem; }
  .live-pill .live-now { display: none; }
}
@media (max-width: 22.5rem) {
  .live-pill .live-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (forced-colors: active) { .live-dot, .live-dot::after { background: CanvasText; } }

/* ---------- Admin: tabs and statistics ---------- */
.admin-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--rule); margin: 0 0 1.75rem; }
.admin-tabs button {
  appearance: none; border: 0; background: none; cursor: pointer;
  padding: .7rem .9rem; margin-bottom: -1px; border-bottom: 2px solid transparent;
  color: var(--muted); font-weight: 600; font-size: .9375rem;
}
.admin-tabs button:hover { color: var(--ink); }
.admin-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.range-btns { display: inline-flex; flex-wrap: wrap; gap: .4rem; }
.range-btns .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.kpi-row { grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr)); margin-bottom: 2rem; }
.kpi-row .stat small { display: block; margin-top: .35rem; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.kpi-row .stat .live-dot { display: inline-block; margin-right: .5rem; vertical-align: .3em; }
.chart-box { border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); padding: 1rem 1rem .75rem; margin-bottom: 2.5rem; position: relative; }
.chart-box h3 { font-size: 1rem; margin: 0 0 .75rem; }
.chart-box #chart { position: relative; }
.chart-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-box .bar { fill: var(--accent); }
.chart-box .bar-hit { fill: transparent; }
.chart-box g.b:hover .bar, .chart-box g.b.on .bar { fill: var(--indigo); }
.chart-box .axis { stroke: var(--rule-strong); stroke-width: 1; }
.chart-box .grid { stroke: var(--rule); stroke-width: 1; }
.chart-box text { fill: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 2; transform: translate(-50%, calc(-100% - 8px));
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--rule-strong); border-radius: 8px;
  padding: .4rem .6rem; font-size: .8125rem; line-height: 1.45; white-space: nowrap; box-shadow: var(--shadow);
}
.chart-tip b { font-family: var(--font-mono); font-weight: 600; }
.stats-tables { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; }
.stats-tables .wide { grid-column: 1 / -1; }
.stats-tables h3 { font-size: 1rem; margin: 0 0 .75rem; }
.stats-tables .data-table td.r, .stats-tables .data-table th.r { text-align: right; }
@media (max-width: 56rem) { .stats-tables { grid-template-columns: minmax(0, 1fr); } }
