/* Who Cited It — one stylesheet, no framework, no build step.
   Dense on purpose: the reader came for a specific paper or person and wants
   the structure, not whitespace. */

:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  --panel: #ffffff;
  --ink: #16150f;
  --ink-soft: #55524a;
  --ink-faint: #86827a;
  --rule: #e3e0d7;
  --accent: #7a4b1e;
  --accent-soft: #b9762f;
  --focus: #16150f;
  /* Validated with the dataviz skill's checker, light surface: normal-vision
     dE 33.6 and worst-CVD dE 24.7 between the pair (floors 15 and 8). The
     previous muted green/amber measured 13.6 normal-vision -- below the floor,
     i.e. two colours a full-colour reader struggles to tell apart, which on a
     citation graph means not being able to tell a reference from a citer. */
  --ref: #2a78d6;
  --citer: #eb6834;
  --high: #2f6f5c;
  --medium: #9a7315;
  --low: #a33a2a;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14140f;
    --panel: #1c1c16;
    --ink: #eeece4;
    --ink-soft: #b0ada2;
    --ink-faint: #807d74;
    --rule: #33322a;
    --accent: #d99a55;
    --accent-soft: #e0aa6f;
    --focus: #eeece4;
    /* Not a flip of the light pair: the same two hues re-stepped for the dark
       surface and re-validated there (dE 31.8 normal, 26.8 worst CVD). */
    --ref: #3987e5;
    --citer: #d95926;
    --high: #6fbfa2;
    --medium: #d4b35a;
    --low: #e0765f;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-soft); }
h1, h2, h3 { line-height: 1.2; font-weight: 620; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.62rem; }
h2 { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); font-weight: 600; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px 80px; }
header.site { border-bottom: 1px solid var(--rule); margin-bottom: 26px; }
header.site .wrap { display: flex; gap: 22px; align-items: baseline; padding-top: 14px; padding-bottom: 14px; }
header.site a.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
header.site nav { display: flex; gap: 16px; font-size: 13.5px; margin-left: auto; }
header.site nav a { color: var(--ink-soft); text-decoration: none; }
header.site nav a:hover { color: var(--accent); }

footer.site { border-top: 1px solid var(--rule); margin-top: 48px; padding-top: 18px; font-size: 13px; color: var(--ink-faint); }

.lede { font-size: 1.05rem; color: var(--ink-soft); max-width: 62ch; }
.meta { font-size: 13.5px; color: var(--ink-soft); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.faint { color: var(--ink-faint); }

.panel { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 16px 18px; margin: 0 0 18px; }
.grid { display: grid; gap: 18px; }
@media (min-width: 820px) { .grid.two { grid-template-columns: 1fr 300px; align-items: start; } }

.stats { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; background: var(--panel); margin-bottom: 22px; }
.stats div { flex: 1 1 120px; padding: 12px 16px; border-right: 1px solid var(--rule); }
.stats div:last-child { border-right: 0; }
.stats b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stats span { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 600; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--rule); }
td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; padding: 8px 0 8px 18px; white-space: nowrap; }
th.num { padding-top: 6px; padding-bottom: 6px; }
tr:last-child td { border-bottom: 0; }
.scroll { overflow-x: auto; }

.badge { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 650; padding: 2px 7px; border-radius: 999px; border: 1px solid currentColor; }
.badge.high { color: var(--high); }
.badge.medium { color: var(--medium); }
.badge.low { color: var(--low); }
.badge.plain { color: var(--ink-faint); }

.evidence { list-style: none; margin: 12px 0 0; padding: 0; }
.evidence li { padding: 9px 0; border-top: 1px solid var(--rule); display: grid; grid-template-columns: 88px 1fr; gap: 12px; font-size: 13.5px; }
.evidence .dir { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 650; padding-top: 2px; }
.dir.supports { color: var(--high); }
.dir.weakens { color: var(--low); }
.dir.neutral { color: var(--ink-faint); }

figure.graph { margin: 0 0 8px; }
figure.graph svg { width: 100%; height: auto; display: block; background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; }
figure.graph figcaption { font-size: 12.5px; color: var(--ink-faint); margin-top: 8px; }
.node-label { font: 10.5px var(--sans); fill: var(--ink-soft); pointer-events: none; }
.node circle { stroke: var(--panel); stroke-width: 1.5; }
.node:hover circle { stroke: var(--ink); }
.node.focus circle { fill: var(--focus); }
.node.reference circle { fill: var(--ref); }
.node.citer circle { fill: var(--citer); }
.node.coauthor circle { fill: var(--ref); }
.edge { stroke: var(--rule); fill: none; }
.edge.inner { stroke-dasharray: 2 3; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-soft); margin-top: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

.withheld { border-left: 3px solid var(--medium); padding: 8px 0 8px 12px; color: var(--ink-soft); font-size: 13.5px; margin: 0 0 14px; }

input[type=search] {
  width: 100%; padding: 9px 12px; font: inherit; color: var(--ink);
  background: var(--panel); border: 1px solid var(--rule); border-radius: 8px;
}
.hits { margin-top: 10px; }
.hits a { display: block; padding: 7px 0; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink); font-size: 14px; }
.hits a:hover { color: var(--accent); }
.hits small { color: var(--ink-faint); }

/* Work-record quality reuses the confidence colours: the two bands say the same
   kind of thing about different rows, and giving them separate palettes would
   imply a distinction that is not there. */
.badge.complete { color: var(--high); }
.badge.partial { color: var(--medium); }
.badge.suspect { color: var(--low); }

/* ── Interactive graph islands ─────────────────────────────────────────────
   The static SVG above is the page; this is the upgrade that mounts over it.
   Every colour is a CSS custom property so a theme change needs no JavaScript
   and the static and interactive graphs cannot drift apart. */

.island { margin: 0 0 8px; }
.island-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  margin-bottom: 10px;
}
.island-hint { margin: 0; font-size: 12.5px; color: var(--ink-faint); flex: 1 1 240px; }

.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.seg button {
  font: inherit; font-size: 13px; padding: 5px 12px; border: 0; cursor: pointer;
  background: var(--panel); color: var(--ink-soft); border-right: 1px solid var(--rule);
}
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: var(--bg); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }

.brush { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.brush input { accent-color: var(--accent); width: 150px; }
.brush b { font-variant-numeric: tabular-nums; color: var(--ink); }

.fg { position: relative; }
.fg svg {
  width: 100%; height: auto; display: block; touch-action: none;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 10px;
  cursor: grab;
}
.fg svg:active { cursor: grabbing; }

.fg-edge { stroke: var(--rule); fill: none; transition: stroke .12s, opacity .12s; }
.fg-edge.inner { stroke-dasharray: 2 3; }
.fg-edge.dim { opacity: .25; }
.fg-edge.lit { stroke: var(--ink-faint); opacity: 1; }
.fg-arrowhead { fill: var(--ink-faint); }

.fg-node { cursor: pointer; outline: none; }
.fg-hit { fill: transparent; }
/* A 2px surface ring on every mark, so overlapping nodes stay countable. */
.fg-dot { stroke: var(--panel); stroke-width: 2; transition: opacity .12s; }
.fg-node.focus .fg-dot { fill: var(--focus); stroke: var(--accent); stroke-width: 3; }
.fg-node.reference .fg-dot { fill: var(--ref); }
.fg-node.citer .fg-dot { fill: var(--citer); }
.fg-node.coauthor .fg-dot { fill: var(--ref); }
.fg-node.dim { opacity: .22; }
.fg-node.lit .fg-dot, .fg-node:focus-visible .fg-dot { stroke: var(--ink); stroke-width: 2.5; }
.fg-label {
  font: 10.5px var(--sans); fill: var(--ink-soft); pointer-events: none;
  paint-order: stroke; stroke: var(--panel); stroke-width: 3px; stroke-linejoin: round;
}
.fg-axis line { stroke: var(--rule); stroke-dasharray: 2 4; }
.fg-axis text { font: 10.5px var(--sans); fill: var(--ink-faint); }

.fg-tip {
  position: absolute; transform: translate(-50%, calc(-100% - 16px));
  background: var(--ink); color: var(--bg); padding: 7px 10px; border-radius: 7px;
  font-size: 12.5px; line-height: 1.4; max-width: 260px; pointer-events: none;
  display: flex; flex-direction: column; gap: 1px; z-index: 3;
}
.fg-tip b { font-weight: 620; }
.fg-tip span { opacity: .78; }

.fg-reset {
  position: absolute; right: 10px; bottom: 10px; font: inherit; font-size: 12px;
  padding: 4px 10px; border-radius: 6px; border: 1px solid var(--rule);
  background: var(--panel); color: var(--ink-soft); cursor: pointer;
}
.fg-reset:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .fg-edge, .fg-dot, .fg-node { transition: none; }
}

/* ── Corpus charts (server-rendered, no JavaScript) ──────────────────────── */
.chart { margin: 0 0 6px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .bar { fill: var(--ref); }
.chart .bar:hover { fill: var(--accent-soft); }
.chart .axis text { font: 10.5px var(--sans); fill: var(--ink-faint); }
.chart .axis line { stroke: var(--rule); }
/* Status steps from the dataviz reference palette, fixed and never themed.
   Every segment also carries a text label, so the colour never means alone. */
.chart .seg-good { fill: #0ca30c; }
.chart .seg-warning { fill: #fab219; }
.chart .seg-critical { fill: #d03b3b; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-soft); margin-top: 8px; }
.chart-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.chart-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin: 0 0 8px; font-weight: 600; }
.grid.two-even { display: grid; gap: 22px; margin-bottom: 22px; }
@media (min-width: 760px) { .grid.two-even:has(> :nth-child(2)) { grid-template-columns: 1fr 1fr; } }
.chart-legend i.legend-good { background: #0ca30c; }
.chart-legend i.legend-warning { background: #fab219; }
.chart-legend i.legend-critical { background: #d03b3b; }
.chart-legend b { font-variant-numeric: tabular-nums; }
