:root {
  --bg: #fbfaf8;  --panel: #ffffff;  --ink: #1c1b19;  --muted: #6b6864;
  --rule: #e3e0da; --accent: #7a4b2a; --accent-soft: #f2ece6;
  --warn-bg: #fdf3e3; --warn-ink: #8a5a10;
  --gap-bg: #eef2f7;  --gap-ink: #3d5a80;
  --measure: 70ch;
  --page: 1140px;
  --gutter: 1.6rem;

  /* Relevance ramp: one hue, three ordered steps, light -> dark as relevance rises.
     Validated against the panel surface (monotone lightness, >= 0.06 delta L between
     steps, lightest step clears 2:1 contrast). Category is deliberately NOT a colour:
     seven hues on a node-link diagram cannot stay separable under colour-vision
     deficiency, so category is a filter and a layout instead. */
  --rule-strong: #2b2926;
  --rel-medium: #cfa478; --rel-high: #a8703f; --rel-critical: #5c3418;
  /* Disagreement. A reserved status colour, never used for a category. */
  --critique: #d03b3b;
  --ok-bg: #dff0e2; --ok-ink: #21603a;
  --bad-bg: #f7dede; --bad-ink: #8a2b2b;
  --shadow: 0 1px 2px rgba(28, 27, 25, .06), 0 8px 24px rgba(28, 27, 25, .08);
  --focus: #2a78d6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16151a; --panel: #1e1d23; --ink: #e9e6e1; --muted: #9a958e;
    --rule: #33313a; --accent: #d9a273; --accent-soft: #2a2630;
    --warn-bg: #33291a; --warn-ink: #e0b978;
    --gap-bg: #1f2833; --gap-ink: #9dbdd8;
    --rule-strong: #57545f;
    --rule-strong: #57545f;
  --rel-medium: #8a5a33; --rel-high: #c08a55; --rel-critical: #e6c19b;
    --ok-bg: #1d3327; --ok-ink: #8fd0a6;
    --bad-bg: #3a2020; --bad-ink: #eba0a0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .45);
    --focus: #86b6ef;
  }
}
/* The toggle must win in both directions, so the dark tokens are declared again
   under an explicit stamp rather than only inside the media query. */
:root[data-theme="dark"] {
  --bg: #16151a; --panel: #1e1d23; --ink: #e9e6e1; --muted: #9a958e;
  --rule: #33313a; --accent: #d9a273; --accent-soft: #2a2630;
  --warn-bg: #33291a; --warn-ink: #e0b978;
  --gap-bg: #1f2833; --gap-ink: #9dbdd8;
  --rel-medium: #8a5a33; --rel-high: #c08a55; --rel-critical: #e6c19b;
  --ok-bg: #1d3327; --ok-ink: #8fd0a6;
  --bad-bg: #3a2020; --bad-ink: #eba0a0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .45);
  --focus: #86b6ef;
}
html { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.72 ui-serif, Georgia, "Iowan Old Style", Charter, "Times New Roman", serif;
  font-kerning: normal;
  font-variant-numeric: oldstyle-nums proportional-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  hanging-punctuation: first last;
}
main { max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter) 6rem; }
a { color: var(--accent); text-decoration-thickness: from-font; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
::selection { background: var(--accent-soft); }
p { text-wrap: pretty; }
/* Interface chrome is sans and lining; running prose is serif and old-style. Mixing the
   two inside one element is what makes a research page look like a dashboard. */
button, input, select, .tag, kbd, .sitenav, .controls, table { font-variant-numeric: normal; }

.masthead {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.masthead-bar, .sitenav {
  max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter);
}
.masthead-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; padding-top: .8rem;
}
.brand { text-decoration: none; color: var(--ink); display: flex; align-items: baseline;
  gap: .6rem; flex-wrap: wrap; }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-sub { color: var(--muted); font-size: .82rem; }

.masthead-tools { display: flex; gap: .4rem; align-items: center; }
.tool {
  font: 500 .8rem/1.4 ui-sans-serif, system-ui, sans-serif;
  display: inline-flex; align-items: center; gap: .45rem;
  background: var(--panel); color: var(--muted);
  border: 1px solid var(--rule); border-radius: 8px;
  padding: .35rem .6rem; cursor: pointer;
}
.tool:hover { border-color: var(--accent); color: var(--ink); }
.search-trigger { min-width: 9rem; justify-content: space-between; }
.theme-toggle { text-transform: lowercase; min-width: 4.2rem; justify-content: center; }

kbd {
  font: 600 .68rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 4px;
  padding: .16rem .3rem; background: var(--bg); color: var(--muted);
}

.sitenav {
  display: flex; flex-wrap: wrap; gap: .1rem 1.4rem;
  padding-top: .5rem; padding-bottom: .5rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.navgroup { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.navgroup-label {
  font-size: .64rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); opacity: .8;
}
.navgroup-items { display: flex; flex-wrap: wrap; gap: .1rem; }
.sitenav a {
  font-size: .82rem; text-decoration: none; color: var(--muted);
  padding: .2rem .45rem; border-radius: 6px; white-space: nowrap;
}
.sitenav a:hover { color: var(--ink); background: var(--accent-soft); }
.sitenav a[aria-current="page"] { color: var(--ink); font-weight: 600; background: var(--accent-soft); }

.skip-link {
  position: absolute; left: -9999px; top: .5rem; z-index: 50;
  background: var(--panel); border: 1px solid var(--accent); border-radius: 8px;
  padding: .5rem .9rem; font-family: ui-sans-serif, system-ui, sans-serif;
}
.skip-link:focus { left: 1rem; }

:where(a, button, input, select, summary):focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px;
}

h1, h2, h3 { text-wrap: balance; font-weight: 600; }
h1 {
  font-size: 2.05rem; line-height: 1.18; margin: 2rem 0 .5rem;
  letter-spacing: -0.012em; font-weight: 700;
}
:where(h1, h2, h3)[id] { scroll-margin-top: 7.5rem; }
h2 { font-size: 1.28rem; line-height: 1.3; margin: 2.4rem 0 .6rem; letter-spacing: -0.006em; }
h3 { font-size: 1.04rem; margin: 1.6rem 0 .4rem; }
.lede {
  max-width: var(--measure); color: var(--muted);
  font-size: 1.1rem; line-height: 1.6; margin: .6rem 0 1.4rem;
}
.muted { color: var(--muted); font-size: .92rem; }
.intro { padding-bottom: .4rem; }

/* ---- index ---- */
.stats {
  display: flex; flex-wrap: wrap; gap: 0 2.6rem;
  margin: 1.8rem 0 2.4rem; padding-top: .9rem;
  border-top: 2px solid var(--rule-strong);
}
.stat { padding: .1rem 0 .6rem; min-width: 6rem; }
.stat .n {
  display: block; font-size: 1.75rem; line-height: 1.1; font-weight: 600;
  font-variant-numeric: lining-nums tabular-nums; letter-spacing: -0.02em;
}
.stat .l {
  display: block; color: var(--muted); margin-top: .15rem;
  font: 500 .68rem/1.4 ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase; letter-spacing: .09em;
}
.stat.gap .n { color: var(--gap-ink); }

.breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.5rem; margin: 2rem 0; }
.facet ul { list-style: none; padding: 0; margin: .4rem 0 0; }
.facet li { margin: .3rem 0; font-size: .92rem; }

.paper-list { list-style: none; padding: 0; counter-reset: paper; }
.paper-card { border-bottom: 1px solid var(--rule); padding: 1.3rem 0; }
.paper-card:last-child { border-bottom: 0; }
.paper-title {
  font-size: 1.1rem; font-weight: 600; text-decoration: none; line-height: 1.35;
  display: inline-block; text-wrap: balance;
}
.paper-title:hover { text-decoration: underline; }
.paper-meta { color: var(--muted); font-size: .85rem; margin: .25rem 0; }
.paper-summary { max-width: var(--measure); margin: .45rem 0; font-size: .95rem; }
.paper-tags { margin: .5rem 0 0; display: flex; flex-wrap: wrap; gap: .35rem; }

.tag {
  display: inline-block; font: 600 .66rem/1.6 ui-sans-serif, system-ui, sans-serif;
  text-transform: uppercase; letter-spacing: .07em;
  background: var(--accent-soft); color: var(--ink);
  border-radius: 3px; padding: .05rem .45rem; white-space: nowrap;
}
.tag.warn, .tag.v-UNVERIFIED { background: var(--warn-bg); color: var(--warn-ink); }
.tag.gap { background: var(--gap-bg); color: var(--gap-ink); }
.tag.r-critical { background: var(--rel-critical); color: var(--panel); }
.tag.r-high { background: var(--rel-high); color: var(--panel); }
.tag.r-medium { background: var(--rel-medium); color: var(--bg); }
.chip-r-critical .chip-n, .chip-r-high .chip-n, .chip-r-medium .chip-n { opacity: .8; }
.tag.verdict-verified { background: var(--ok-bg); color: var(--ok-ink); }
.tag.verdict-plausible, .tag.verdict-unchecked { background: var(--warn-bg); color: var(--warn-ink); }
.tag.verdict-refuted { background: var(--bad-bg); color: var(--bad-ink); }

.warnings { border-top: 1px solid var(--rule); margin-top: 2.5rem; padding-top: 1rem; }
.warnings ul { padding-left: 0; list-style: none; }
.warnings li { margin: .5rem 0; font-size: .88rem; max-width: var(--measure); }

/* ---- paper page ---- */
.crumbs { margin: 1.25rem 0 0; font-size: .85rem; }
.paper-head { border-bottom: 1px solid var(--rule); padding-bottom: 1rem; }
.paper-body { display: grid; grid-template-columns: 17rem 1fr; gap: 2.5rem; align-items: start; }
@media (max-width: 900px) { .paper-body { grid-template-columns: 1fr; } }

.sidebar { position: sticky; top: 1rem; font-size: .88rem; }
.sidebar section {
  border: 1px solid var(--rule); background: var(--panel); border-radius: 4px;
  padding: .85rem 1rem; margin: 1.2rem 0;
}
.sidebar h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 .5rem; }
.sidebar ul, .sidebar ol { margin: 0; padding-left: 1.1rem; }
.sidebar li { margin: .25rem 0; }
.sidebar dl { margin: 0; }
.sidebar dt { font-weight: 600; margin-top: .5rem; }
.sidebar dd { margin: 0; color: var(--muted); }
.gaps { border-color: var(--gap-ink) !important; }

.note { min-width: 0; max-width: var(--measure); }
.note h2 { border-bottom: 1px solid var(--rule); padding-bottom: .25rem; }
.note blockquote {
  margin: 1.4rem 0; padding: .1rem 0 .1rem 1.2rem;
  border-left: 2px solid var(--accent); color: var(--muted); font-style: italic;
}
.note blockquote p { margin: .5rem 0; }
/* Rules, not boxes: the horizontal-only treatment of a typeset table. */
.note table {
  border-collapse: collapse; width: 100%; margin: 1.4rem 0; font-size: .92rem;
  display: block; overflow-x: auto; border-top: 1.5px solid var(--rule-strong);
  border-bottom: 1.5px solid var(--rule-strong);
}
.note th, .note td {
  border: 0; border-bottom: 1px solid var(--rule);
  padding: .45rem .9rem .45rem 0; text-align: left; vertical-align: top;
}
.note tbody tr:last-child td { border-bottom: 0; }
.note th {
  border-bottom: 1px solid var(--rule-strong); font-weight: 600;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
  font-family: ui-sans-serif, system-ui, sans-serif; color: var(--muted);
}
.note pre { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: .8rem 1rem; overflow-x: auto; }
.note code { font: .88em/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.note :not(pre) > code { background: var(--accent-soft); padding: .1em .35em; border-radius: 4px; }
.note img { max-width: 100%; }
a.wikilink { font-weight: 600; }

/* Inline citations in the synthesis prose. Deliberately quieter than a wikilink: they
   appear many times per paragraph, and prose that is half bold link is unreadable. */
a.citation {
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 1px dotted currentColor;
  text-decoration: none;
}
a.citation::before { content: "["; opacity: 0.55; }
a.citation::after  { content: "]"; opacity: 0.55; }

.nav-synthesis a { font-weight: 600; }

.critiques {
  border: 0; border-left: 2px solid var(--critique);
  padding: .1rem 0 .2rem 1.1rem; margin: 0 0 2.4rem;
}
.critiques h2 { margin-top: .9rem; font-size: 1.05rem; }
.critique { font-size: .92rem; margin: .5rem 0; }

.metadata { margin-top: 3rem; border-top: 2px solid var(--rule); padding-top: 1rem; }
.field-group { margin: 1.2rem 0; }
.field-group h3 { text-transform: capitalize; color: var(--muted); font-size: .8rem; letter-spacing: .05em; }
.field-group dl { margin: 0; font-size: .9rem; }
.field-group dt { font-weight: 600; margin-top: .7rem; text-transform: capitalize; }
.field-group dt.gap { color: var(--gap-ink); }
.field-group dd { margin: .15rem 0 0; }
.field-group ul { margin: .2rem 0; padding-left: 1.1rem; }

.math.block { display: block; overflow-x: auto; margin: 1rem 0; }
.math-error { color: var(--warn-ink); font-family: ui-monospace, monospace; font-size: .85em; }

.site-footer {
  max-width: var(--page); margin: 4rem auto 0; padding: 1.6rem var(--gutter) 3rem;
  border-top: 1px solid var(--rule); color: var(--muted); font-size: .85rem;
}
.site-footer p { max-width: var(--measure); margin: .3rem 0; }
.site-footer .built { font-family: ui-sans-serif, system-ui, sans-serif; font-size: .78rem; }

/* ---- threads ---- */
.threads, .papers, .breakdown, .disagreements, .graph-table {
  border-top: 1px solid var(--rule); margin-top: 3rem; padding-top: 1.6rem;
}
.threads > h2, .papers > h2, .breakdown > .facet > h2,
.disagreements > h2, .graph-table > h2 { margin-top: 0; }
.thread-list { list-style: none; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1rem; }
.thread-card {
  border: 1px solid var(--rule); background: var(--panel);
  border-radius: 4px; padding: 1rem 1.2rem 1.1rem;
}
.thread-card:hover { border-color: var(--accent); }
.thread-card { display: flex; flex-direction: column; gap: .15rem; }
.thread-title { font-weight: 600; text-decoration: none; font-size: 1rem; }
.thread-title:hover { text-decoration: underline; }
.thread-count {
  color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.thread-q { font-size: .9rem; color: var(--muted); margin: .4rem 0 0; }

.kicker { text-transform: uppercase; letter-spacing: .06em; font-size: .72rem;
  color: var(--muted); margin: 1.5rem 0 0; font-family: ui-sans-serif, system-ui, sans-serif; }
.thread-head { border-bottom: 1px solid var(--rule); padding-bottom: 1.2rem; }
.thread-question { max-width: var(--measure); font-size: 1.05rem; }
.thread-question p { margin: .5rem 0; }

.thread-steps { list-style: none; padding: 0; margin: 2rem 0; max-width: var(--measure); }
.thread-step { display: grid; grid-template-columns: 2.2rem 1fr; gap: 1rem;
  padding: 1.2rem 0; border-bottom: 1px solid var(--rule); }
.step-n { font: 700 1.1rem/1 ui-sans-serif, system-ui, sans-serif;
  color: var(--accent); padding-top: .2rem; font-variant-numeric: tabular-nums; }
.step-body { min-width: 0; }
.step-role { font-size: .95rem; }
.step-role p { margin: .5rem 0 0; }

.leaves-open { max-width: var(--measure); background: var(--accent-soft);
  border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0;
  padding: .5rem 1.2rem 1rem; margin: 2rem 0; }
.leaves-open h2 { margin-top: .8rem; }
.in-threads { border-color: var(--accent) !important; }

/* ---- comparators ---- */
.matrix-scroll { overflow-x: auto; margin: 1.5rem 0; }
.matrix {
  border-collapse: collapse; font-size: .84rem; min-width: 60rem;
  border-top: 1.5px solid var(--rule-strong); border-bottom: 1.5px solid var(--rule-strong);
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.matrix th, .matrix td {
  border: 0; border-bottom: 1px solid var(--rule);
  padding: .55rem .8rem; vertical-align: top; text-align: left;
}
.matrix thead th {
  background: var(--bg); position: sticky; top: 0; min-width: 11rem;
  border-bottom: 1px solid var(--rule-strong); font-size: .72rem;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
.axis-note {
  display: block; font-weight: 400; color: var(--muted); font-size: .72rem;
  margin-top: .3rem; text-transform: none; letter-spacing: 0; line-height: 1.45;
}
.matrix .rowhead {
  background: var(--bg); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .76rem; white-space: nowrap; position: sticky; left: 0; font-weight: 500;
}
.matrix td.unstated { color: var(--muted); font-style: italic; }

.eq-group { margin: 2.6rem 0; }
.eq-group h2 {
  font-size: 1.05rem; margin-bottom: .1rem; padding-bottom: .4rem;
  border-bottom: 1.5px solid var(--rule-strong);
}
.eq-group h2 a { text-decoration: none; }
.eq-group h2 a:hover { text-decoration: underline; }
.eq-group h2 .muted {
  display: block; font-weight: 400; font-size: .78rem; margin: .2rem 0 0;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
/* Displayed equations, set like a journal's: the paper's own label in a left gutter,
   the formula on its own line, the note underneath as a caption. The formulas are ASCII
   transcriptions rather than typeset mathematics, so they keep a monospaced face -- it
   is what keeps `w_{Z\U}` and `e^{-2 eps/(d+2)}` legible -- but nothing else about them
   reads as code: no box, no fill, and room to breathe. */
.eq-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.equation {
  display: grid; grid-template-columns: minmax(0, 11rem) 1fr; gap: 0 1.4rem;
  padding: .85rem 0; border-bottom: 1px solid var(--rule);
}
.equation:last-child { border-bottom: 0; }
.eq-label {
  grid-column: 1; padding-top: .12rem; color: var(--muted);
  font: 600 .72rem/1.5 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .05em; text-transform: uppercase; overflow-wrap: anywhere;
}
.eq-body { grid-column: 2; min-width: 0; }
.eq-formula {
  display: block; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  font: .95rem/1.75 ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, monospace;
  font-variant-ligatures: none; letter-spacing: -0.006em;
  font-variant-numeric: lining-nums;
}
.equation.is-math .eq-formula {
  font-family: inherit; font-size: 1.06rem; white-space: normal; letter-spacing: normal;
}
/* The transcription each formula was typeset from. Hidden until asked for, because the
   point of the gallery is to read the mathematics; available always, because the
   transcription is the record and the typesetting is a rendering of it. */
.eq-source { display: none; }
.show-transcripts .eq-source {
  display: block; margin-top: .45rem; color: var(--muted);
  font: .78rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
/* KaTeX could not parse the conversion, so the transcription is on the page instead. */
.math-fallback {
  font: .92em/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  border-bottom: 1px dotted var(--warn-ink);
}
/* An entry that is a sentence is set as one. */
.equation.is-prose .eq-formula {
  font-family: inherit; font-size: .98rem; line-height: 1.65; white-space: normal;
  letter-spacing: normal; max-width: var(--measure);
}
.eq-gloss {
  display: block; margin-top: .35rem; color: var(--muted);
  font-size: .88rem; font-style: italic; max-width: var(--measure);
}
@media (max-width: 640px) {
  .equation { grid-template-columns: 1fr; gap: .3rem; }
  .eq-label, .eq-body { grid-column: 1; }
}

.nav-views { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.5rem 0; }
.nav-views a { display: inline-block; border: 1px solid var(--rule); background: var(--panel);
  border-radius: 999px; padding: .3rem .9rem; text-decoration: none; font-size: .85rem;
  font-family: ui-sans-serif, system-ui, sans-serif; }
.nav-views a:hover { border-color: var(--accent); }

/* ---- provenance pages ---- */
.gap-row { border-bottom: 1px solid var(--rule); padding: .9rem 0; }
.gap-row h2 { font-size: 1rem; margin: 0 0 .4rem; border: 0; }
.gap-fields { display: flex; flex-wrap: wrap; gap: .3rem; margin: .3rem 0; }
.spec-gap { font-size: .9rem; max-width: var(--measure); margin: .4rem 0 0; }

.blocking-banner { border: 2px solid var(--critique); border-radius: 10px;
  background: var(--warn-bg); padding: .5rem 1.2rem 1rem; margin: 1.5rem 0; }
.blocking-banner h2 { color: var(--critique); margin-top: .8rem; }
.blocking-banner p { max-width: var(--measure); }

.amb { border-left: 3px solid var(--rule); padding: .2rem 0 .2rem 1rem; margin: 1.5rem 0;
  max-width: var(--measure); }
.amb h2 { font-size: 1rem; margin: .3rem 0; border: 0; }
.amb-id { font-family: ui-monospace, monospace; color: var(--accent); margin-right: .4rem; }
.amb-meta { font-size: .85rem; margin: .2rem 0 .5rem; }
.amb-reading { font-size: .92rem; background: var(--accent-soft);
  padding: .5rem .8rem; border-radius: 6px; }
/* The answer, distinguished from the guess that preceded it. */
.amb-resolution {
  font-size: .92rem; border-left: 2px solid var(--ok-ink);
  padding: .1rem 0 .1rem .9rem; margin-top: .6rem;
}
.amb-status-blocks_stage_5 { border-left-color: var(--critique); }
.amb-status-needs_repo { border-left-color: var(--warn-ink); }
.amb-status-resolved_from_paper { border-left-color: #2f855a; }
.tag.amb-blocks_stage_5 { background: var(--bad-bg); color: var(--bad-ink); }
.tag.amb-needs_repo { background: var(--warn-bg); color: var(--warn-ink); }
.tag.amb-resolved_from_paper { background: var(--ok-bg); color: var(--ok-ink); }
.tag.amb-evidence_available { background: var(--gap-bg); color: var(--gap-ink); }
.tag.amb-resolved_from_repo { background: var(--ok-bg); color: var(--ok-ink); }
.tag.amb-open_repo_silent { background: var(--warn-bg); color: var(--warn-ink); }
.amb-status-resolved_from_repo { border-left-color: #2f855a; }
.amb-status-open_repo_silent { border-left-color: var(--warn-ink); }

.stage-list { list-style: none; padding: 0; }
.stage { display: grid; grid-template-columns: 2rem 1fr; gap: .8rem;
  padding: .7rem 0; border-bottom: 1px solid var(--rule); }
.stage-n { font: 700 1rem/1.6 ui-sans-serif, system-ui, sans-serif; color: var(--muted); }
.stage p { margin: .2rem 0 0; max-width: var(--measure); }
.tag.st-complete { background: var(--ok-bg); color: var(--ok-ink); }
.tag.st-blocked { background: var(--bad-bg); color: var(--bad-ink); }
.tag.st-in_progress { background: var(--gap-bg); color: var(--gap-ink); }
.tag.st-on_hold { background: var(--warn-bg); color: var(--warn-ink); }

.decision { border-left: 3px solid var(--accent); padding-left: 1rem;
  margin: 1.5rem 0; max-width: var(--measure); }
.decision h3 { font-size: 1rem; margin: 0 0 .4rem; }
.decision h3 .muted { font-weight: 400; font-size: .8rem; }
.decision p { margin: .35rem 0; font-size: .95rem; }
.decision .why { color: var(--muted); }
.questions li { margin: .6rem 0; max-width: var(--measure); }
.document { max-width: var(--measure); }

/* ---- controls: filters, sorting, chips ---- */
.controls { margin: 1.2rem 0 1rem; font-family: ui-sans-serif, system-ui, sans-serif; }
.control-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: .18rem; }
.field-label {
  font-size: .64rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.field input, .field select {
  font: 400 .85rem/1.4 ui-sans-serif, system-ui, sans-serif;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 8px; padding: .35rem .55rem;
  min-width: 12rem;
}
.field select { min-width: 9rem; }
.control-count { font-size: .8rem; color: var(--muted); padding-bottom: .45rem; }
.linkish {
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--accent);
  font: inherit; font-size: .82rem; text-decoration: underline;
  text-underline-offset: 2px; font-family: ui-sans-serif, system-ui, sans-serif;
}

.chip-row { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .7rem; }
.chip-label {
  font-size: .64rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin-right: .15rem;
}
.chip {
  font: 500 .76rem/1.5 ui-sans-serif, system-ui, sans-serif;
  background: var(--panel); color: var(--muted); cursor: pointer;
  border: 1px solid var(--rule); border-radius: 999px; padding: .16rem .6rem;
  display: inline-flex; align-items: center; gap: .35rem;
}
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.chip[aria-pressed="true"] .chip-n { color: #fff; opacity: .8; }
.chip-n { font-variant-numeric: tabular-nums; font-size: .68rem; opacity: .7; }

.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.seg-btn {
  font: 500 .8rem/1.5 ui-sans-serif, system-ui, sans-serif;
  background: var(--panel); color: var(--muted); border: 0; cursor: pointer;
  padding: .35rem .7rem; border-right: 1px solid var(--rule);
}
.seg-btn:last-child { border-right: 0; }
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }

.empty-state { color: var(--muted); font-size: .9rem; padding: 1.5rem 0; }
.tag.quiet { background: transparent; border: 1px solid var(--rule); color: var(--muted); }

/* ---- search and help overlays ---- */
.overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(20, 18, 16, .38);
  display: flex; align-items: flex-start; justify-content: center; padding: 8vh 1rem 1rem;
}
.overlay[hidden] { display: none; }
.overlay-box {
  background: var(--panel); border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: var(--shadow); width: min(38rem, 100%); overflow: hidden;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.search-input {
  width: 100%; border: 0; border-bottom: 1px solid var(--rule); background: transparent;
  color: var(--ink); font: 400 1rem/1.6 ui-sans-serif, system-ui, sans-serif;
  padding: .9rem 1rem; outline: none;
}
.search-results { list-style: none; margin: 0; padding: .3rem; max-height: 52vh; overflow-y: auto; }
.search-results li { border-radius: 8px; }
.search-results a {
  display: flex; gap: .6rem; align-items: baseline; padding: .45rem .6rem;
  text-decoration: none; color: var(--ink);
}
.search-results li[aria-selected="true"] { background: var(--accent-soft); }
.result-kind {
  font-size: .6rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  border: 1px solid var(--rule); border-radius: 999px; padding: .05rem .4rem; white-space: nowrap;
}
.result-title { font-size: .88rem; flex: 1 1 auto; }
.result-meta { font-size: .74rem; color: var(--muted); }
.overlay-foot { margin: 0; padding: .5rem 1rem .7rem; border-top: 1px solid var(--rule); }
.help-box { padding: 1rem 1.3rem 1.3rem; }
.help-box h2 { margin-top: .3rem; }
.shortcuts { display: grid; grid-template-columns: 7rem 1fr; gap: .4rem 1rem; font-size: .85rem; }
.shortcuts dt { margin: 0; }
.shortcuts dd { margin: 0; color: var(--muted); }

/* ---- graph ---- */
.graph-controls { margin-bottom: .8rem; }
.graph-shell { display: grid; grid-template-columns: 1fr 19rem; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .graph-shell { grid-template-columns: 1fr; } }
.graph-figure { min-width: 0; position: relative; }
.graph-canvas {
  border: 1px solid var(--rule); border-radius: 10px 10px 0 0;
  background: var(--panel); touch-action: none;
}
.graph-canvas svg { display: block; }
/* Citekeys and axis ticks are labels, not running prose: lining figures. */
svg text { font-variant-numeric: lining-nums; }
/* A clicked node is already marked by its selection ring and lit-up neighbourhood, so
   the pointer case needs no box; keyboard focus still gets a visible ring. */
.nodes g:focus { outline: none; }
.nodes g:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.graph-legend {
  display: flex; flex-wrap: wrap; gap: .3rem 1.5rem;
  border: 1px solid var(--rule); border-top: 0; border-radius: 0 0 10px 10px;
  background: var(--panel); padding: .5rem .9rem;
  font-family: ui-sans-serif, system-ui, sans-serif; font-size: .76rem;
}
.legend-block { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.legend-title {
  font-size: .62rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.legend-item { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); }
.swatch { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; }
.swatch-medium { background: var(--rel-medium); }
.swatch-high { background: var(--rel-high); }
.swatch-critical { background: var(--rel-critical); }
.swatch-sm { width: 7px; height: 7px; background: var(--muted); }
.swatch-lg { width: 19px; height: 19px; background: var(--muted); }
.legend-ref, .legend-crit { display: inline-block; width: 1.4rem; height: 0; vertical-align: middle; }
.legend-ref { border-top: 1px solid var(--muted); opacity: .5; }
.legend-crit { border-top: 2px dashed var(--critique); }

.graph-panel {
  border: 1px solid var(--rule); border-radius: 10px; background: var(--panel);
  padding: .8rem 1rem 1rem; font-size: .85rem; position: sticky; top: 7.5rem;
  max-height: calc(100vh - 9rem); overflow-y: auto;
}
.graph-panel h2 { font-size: .95rem; margin: .2rem 0 .4rem; }
.graph-panel h3 {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 1rem 0 .3rem;
}
.graph-panel ul, .graph-panel ol { margin: .2rem 0; padding-left: 1.1rem; }
.graph-panel li { margin: .18rem 0; }
.panel-rank { list-style: none; padding: 0; font-family: ui-monospace, monospace; font-size: .78rem; }
.panel-rank li { display: flex; justify-content: space-between; gap: .5rem; }
.panel-byline { color: var(--muted); font-size: .8rem; margin: .1rem 0 .5rem; }
.panel-summary { font-size: .82rem; margin: .5rem 0; }
.panel-open { display: inline-block; margin-top: .6rem; font-size: .82rem; }
.panel-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin: .4rem 0; }

.graph-tip {
  position: absolute; pointer-events: none; z-index: 20; max-width: 17rem;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: var(--shadow); padding: .45rem .6rem;
  font: 400 .78rem/1.45 ui-sans-serif, system-ui, sans-serif; color: var(--ink);
}
.graph-tip strong { display: block; font-size: .8rem; }
.graph-tip .tip-meta { color: var(--muted); font-size: .72rem; }

.rank-table { min-width: 44rem; font-variant-numeric: tabular-nums; }
.rank-table .num { text-align: right; }
.disagreements { margin-top: 2.5rem; }
.critique-list { list-style: none; padding: 0; }
.critique-list li {
  border-left: 2px solid var(--critique); padding: .1rem 0 .1rem .9rem;
  margin: 1rem 0; max-width: var(--measure); font-size: .9rem;
}
.critique-list p { margin: .3rem 0 0; }
.graph-table { margin-top: 2.5rem; }

/* ---- paper page additions ---- */
.paper-crumbs { display: flex; flex-wrap: wrap; gap: .8rem; align-items: baseline; }
.crumb-pos { color: var(--muted); font-size: .8rem; }
.crumb-nav { margin-left: auto; display: flex; gap: .8rem; font-size: .82rem; }
.paper-actions { display: flex; flex-wrap: wrap; gap: .9rem; margin: .7rem 0 0; font-size: .85rem; }

.toc ol { list-style: none; padding-left: 0; }
.toc li { margin: .2rem 0; }
.toc a {
  text-decoration: none; color: var(--muted); display: block; padding-left: .4rem;
  border-left: 2px solid transparent;
}
.toc a:hover { color: var(--ink); }
.toc li.toc-l3 a { padding-left: 1.1rem; font-size: .95em; }
.toc a.active { color: var(--ink); font-weight: 600; border-left-color: var(--accent); }

details.field-group { border-bottom: 1px solid var(--rule); padding-bottom: .4rem; }
details.field-group > summary {
  cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: .5rem;
  padding: .5rem 0;
}
details.field-group > summary::-webkit-details-marker { display: none; }
details.field-group > summary::before {
  content: "\25B8"; color: var(--muted); font-size: .7rem; display: inline-block;
}
details.field-group[open] > summary::before { transform: rotate(90deg); }
.group-name {
  text-transform: capitalize; color: var(--muted); font-size: .8rem; letter-spacing: .05em;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.group-n { color: var(--muted); font-size: .7rem; font-variant-numeric: tabular-nums; }

.bib { margin-top: 2rem; }
pre.bibtex {
  background: var(--panel); border: 1px solid var(--rule); border-radius: 8px;
  padding: .8rem 1rem; overflow-x: auto;
  font: .78rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.paper-pager { display: flex; gap: 1rem; margin: 3rem 0 0; border-top: 1px solid var(--rule); }
.pager {
  flex: 1 1 0; padding: 1rem 0; text-decoration: none; display: flex; flex-direction: column;
  gap: .2rem; min-width: 0;
}
.pager.next { text-align: right; align-items: flex-end; }
.pager-dir {
  font: 600 .68rem/1 ui-sans-serif, system-ui, sans-serif; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted);
}
.pager-title { font-size: .9rem; }

/* ---- documents ---- */
.doc-layout { display: grid; grid-template-columns: 15rem 1fr; gap: 2.5rem; align-items: start; }
@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-side { display: none; }
}
.doc-side { position: sticky; top: 7.5rem; max-height: calc(100vh - 9rem); overflow-y: auto; }
.doc-side section {
  border: 1px solid var(--rule); background: var(--panel); border-radius: 10px;
  padding: .85rem 1rem; margin: 1.2rem 0;
}
.doc-side h2 {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 0 0 .5rem;
}
.doc-meta p { margin: .2rem 0; font-size: .8rem; }
.to-top { margin-top: 3rem; font-size: .85rem; }
.reading-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 40; }
.reading-progress i { display: block; height: 100%; width: 0; background: var(--accent); }

/* ---- matrix crosshair ---- */
.matrix.crosshair tbody tr:hover td { background: var(--accent-soft); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* ---- print: the page as a document ---- */
@media print {
  :root {
    --bg: #fff; --panel: #fff; --ink: #000; --muted: #444; --rule: #bbb;
    --accent: #000; --accent-soft: #f2f2f2;
  }
  body { font-size: 11pt; line-height: 1.5; background: #fff; color: #000; }
  main { max-width: none; padding: 0; }

  /* Controls, navigation and overlays are affordances, not content. */
  .masthead, .site-footer, .overlay, .controls, .graph-controls, .graph-panel,
  .reading-progress, .skip-link, .paper-pager, .crumbs, .nav-views,
  .search-trigger, .theme-toggle, .to-top { display: none !important; }

  /* Sidebars print after the body rather than beside it. */
  .paper-body, .doc-layout, .graph-shell { display: block; }
  .sidebar, .doc-side { position: static; max-height: none; }
  .sidebar section { break-inside: avoid; }

  /* Affordances that do nothing on paper. */
  .paper-actions button, .paper-actions a[href*="graph.html"] { display: none; }
  .sidebar section, .doc-side section {
    border: 0; border-top: 1px solid var(--rule); border-radius: 0;
    padding: .4rem 0 0; background: none;
  }

  a { color: #000; text-decoration: underline; }
  /* An external link is unusable in print unless its address is printed with it. */
  .note a[href^="http"]::after,
  .document a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; }

  details { display: block; }
  details > summary { list-style: none; }
  [hidden] { display: none !important; }
  .empty-state { display: none; }

  h1, h2, h3 { break-after: avoid; }
  .paper-card, .amb, .decision, .eq-group, .thread-step, figure, table { break-inside: avoid; }
  .graph-canvas { break-inside: avoid; }
  .note table, .matrix { font-size: 9.5pt; }
  @page { margin: 18mm 16mm; }
}
