/* ==========================================================================
   sysone-bench — editorial data essay
   Paper, hairlines, and numbers as the primary graphic.
   No cards, no panels, no shadows, no grain.
   ========================================================================== */

:root {
  --paper:      #f2efe9;
  --paper-2:    #ece8e0;
  --paper-3:    #e4dfd5;

  --ink:        #14130e;
  --ink-2:      #4b4841;
  --ink-3:      #8b867a;

  --rule:       #cdc7ba;
  --rule-soft:  #e0dbd0;

  --accent:     #8a2b1f;   /* oxblood: emphasis, open-weights marks */
  --closed:     #2f4858;   /* slate: the closed-API reference, always distinct */
  --ok:         #3f6b4a;
  --warn:       #9c6f1c;
  --caveat:     #6b6455;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono:  "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gut: clamp(1.25rem, 4vw, 3.5rem);
  --measure: 60ch;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: auto;
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.06rem;
  line-height: 1.62;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--ink); color: var(--paper); }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 300;
  line-height: 1.02;
  letter-spacing: -0.022em;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0 0 1.1em; max-width: var(--measure); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; }
em { font-style: italic; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 0.7rem 1.1rem;
  font-family: var(--mono); font-size: 0.78rem;
}
.skip:focus { left: 0; }

.wrap { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: var(--gut); }
.wide  { max-width: 100%; padding-inline: 0; }

.mono, .axis-label, .bar-label, .bar-value, .proof dt, .chip,
.rail-seal, .note, figcaption, th, .foot {
  font-family: var(--mono);
  font-feature-settings: "tnum" 1;
}

.label, .proof dt, .chart-head h3 + p, figcaption p {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ------------------------------------------------------------------- nav */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in oklab, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav-in { display: flex; align-items: baseline; gap: 2rem; padding-block: 0.85rem; }
.nav-brand {
  font-family: var(--serif); font-size: 1.06rem; font-weight: 500;
  letter-spacing: -0.01em; text-decoration: none; margin-right: auto;
}
.nav-brand span { color: var(--ink-3); font-weight: 300; }
.nav-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.nav-links a {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.11em;
  text-transform: uppercase; text-decoration: none; color: var(--ink-2);
}
.nav-links a:hover { color: var(--accent); }

/* ------------------------------------------------------------------ hero */
.hero { padding-block: clamp(4rem, 13vh, 9rem) clamp(3rem, 8vh, 6rem); }

.hero-title {
  font-size: clamp(2.7rem, 8.2vw, 7.2rem);
  line-height: 0.94;
  letter-spacing: -0.035em;
  max-width: 20ch;
  margin-bottom: 2rem;
}
.hero-title em { font-style: italic; color: var(--accent); }

.hero-lede {
  font-size: clamp(1.1rem, 1.9vw, 1.42rem);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 54ch;
  border-top: 1px solid var(--rule);
  padding-top: 1.5rem;
}

/* proof: a ruled row of figures, not cards */
.readout-band { border-block: 1px solid var(--rule); padding-block: 0; margin-top: clamp(2.5rem, 7vh, 4.5rem); }
.proof {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0; padding: 2.2rem 0;
}
.proof > div { padding-inline: 1.4rem; border-left: 1px solid var(--rule-soft); }
.proof > div:first-child { padding-left: 0; border-left: 0; }
.proof dt { margin: 0 0 0.55rem; }
.proof dd {
  margin: 0; font-family: var(--mono); font-weight: 300;
  font-size: clamp(1.9rem, 3.6vw, 3rem); line-height: 1; letter-spacing: -0.03em;
}
.proof small {
  display: block; margin-top: 0.5rem;
  font-family: var(--mono); font-size: 0.68rem; line-height: 1.5; color: var(--ink-3);
}

.readout-plot { padding: 2.4rem 0 2.8rem; border-top: 1px solid var(--rule); margin: 0; }

/* --------------------------------------------------------------- sections */
section { padding-block: clamp(4.5rem, 12vh, 9rem); border-top: 1px solid var(--rule); }
section:first-of-type { border-top: 0; }

.band-head { max-width: 52ch; margin-bottom: clamp(2.5rem, 6vh, 4rem); }
.band-head h2 { font-size: clamp(2.1rem, 5.4vw, 4.2rem); margin-bottom: 1.1rem; }
.band-head p { color: var(--ink-2); font-size: 1.08rem; }
.band-head::before {
  content: ""; display: block; width: 3.5rem; height: 2px;
  background: var(--accent); margin-bottom: 1.6rem;
}

/* --------------------------------------------------------------- surfaces */
.card, .chart, .multiple, .model {
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.chart, .card, .multiple { border-top: 1px solid var(--rule); padding-top: 1.5rem; }
.chart + .chart, .chart + .reveal, .card + .chart { margin-top: clamp(2rem, 5vh, 3.5rem); }

.chart-head { margin-bottom: 1.4rem; }
.chart-head h3 {
  font-family: var(--mono); font-size: 0.74rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; margin: 0 0 0.4rem;
}
.chart-head p { font-family: var(--serif); font-size: 0.98rem; color: var(--ink-2); margin: 0; max-width: 62ch; }
.chart-head .spacer { margin-left: auto; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(2rem, 5vw, 4rem); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.6rem, 3.5vw, 3rem); }
.cols  { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: clamp(1.6rem, 3.5vw, 3rem); }

/* --------------------------------------------------------------- controls */
.controls {
  display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap;
  padding-block: 1.1rem; border-block: 1px solid var(--rule); margin-bottom: 2rem;
}
.controls .label { color: var(--ink-3); }

select {
  font-family: var(--mono); font-size: 0.8rem;
  color: var(--ink); background: transparent;
  border: 1px solid var(--rule); border-radius: 0;
  padding: 0.5rem 0.7rem; min-width: 15rem;
}
select:hover { border-color: var(--ink-3); }

.chip-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chip {
  font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-2); background: transparent;
  border: 1px solid var(--rule); border-radius: 0;
  padding: 0.45rem 0.8rem; cursor: pointer;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-pressed="true"], .chip.on {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}

.legend {
  display: flex; gap: 1.4rem; flex-wrap: wrap; margin-top: 1rem;
  font-family: var(--mono); font-size: 0.7rem; color: var(--ink-2);
}
.legend > div { display: flex; align-items: center; gap: 0.5rem; }
.legend i { width: 14px; height: 2px; display: inline-block; }

/* ----------------------------------------------------------------- charts */
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
#chart-suites { max-width: 1000px; }

.grid-line { stroke: var(--rule-soft); stroke-width: 1; shape-rendering: crispEdges; }
.axis-label { font-size: 11px; fill: var(--ink-3); letter-spacing: 0.06em; }
.bar-label  { font-size: 12px; fill: var(--ink-2); }
.bar-value  { font-size: 12px; fill: var(--ink); font-family: var(--mono); }
/* JS owns data colour; CSS owns only weight and hover. Forcing fill here
   flattened the compare-top-5 encoding to a single grey. */
.bar { fill-opacity: 0.82; }
.bar:hover { fill-opacity: 1; fill: var(--accent); }

/* Wide fixed-pixel charts stay scrollable instead of widening the page. */
.heatmap-scroll { overflow-x: auto; overflow-y: hidden; padding-bottom: 0.5rem; }
.heatmap-scroll::-webkit-scrollbar { height: 9px; }
.heatmap-scroll::-webkit-scrollbar-thumb { background: var(--rule); }

.tbl-scroll { overflow-x: auto; margin-inline: calc(var(--gut) * -1); padding-inline: var(--gut); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.7rem 1rem 0.7rem 0; border-bottom: 1px solid var(--rule-soft); vertical-align: baseline; }
th {
  font-family: var(--mono); font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-3);
  border-bottom: 1px solid var(--ink);
}
td.num, th.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
tbody tr:hover { background: var(--paper-2); }

.note, .note-caveat {
  font-size: 0.82rem; line-height: 1.6; color: var(--ink-2);
  border-left: 2px solid var(--rule); padding-left: 1rem; max-width: 68ch;
}
.note-caveat { border-left-color: var(--accent); }
.tie-note { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-3); margin-top: 1rem; }

/* ------------------------------------------- small multiples, bare rules */
.multiples {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 0; border-top: 1px solid var(--rule);
}
.multiple { padding: 1.3rem 1.2rem 1.5rem; border-bottom: 1px solid var(--rule-soft); }
.multiple h4 {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.09em; margin: 0 0 0.35rem;
}
.multiple .sub { font-family: var(--mono); font-size: 0.66rem; color: var(--ink-3); margin: 0 0 0.8rem; }

/* ------------------------------------------ monogram wall: not editorial */
.model-grid, .mono-mark, .hash, .rail { display: none; }

/* ------------------------------------------------- the ranked field list */
.models { display: block; border-top: 1px solid var(--ink); margin: 0; }
.models .model {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 15rem) minmax(0, 1fr) 5.2rem 7rem;
  align-items: center;
  gap: 1rem;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule-soft);
  border-radius: 0;
  padding: 0.62rem 0.4rem 0.62rem 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink);
}
.models .model:hover { background: var(--paper-2); color: var(--ink); }
.models .model[aria-pressed="true"] { background: var(--paper-3); }
.models .model[aria-pressed="true"] .nm { font-weight: 500; }

.models .rk {
  font-size: 0.72rem; color: var(--ink-3);
  text-align: right; font-variant-numeric: tabular-nums;
}
.models .nm {
  font-size: 0.84rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.models .acc {
  font-size: 0.86rem; text-align: right;
  font-variant-numeric: tabular-nums;
}

/* the bar is a hairline that fills, not a slab */
.models .model-track { position: relative; display: block; height: 9px; }
.models .model-track::before {
  content: ""; position: absolute; left: 0; right: 0; top: 4px; height: 1px; background: var(--rule);
}
.models .model-track i {
  position: absolute; left: 0; top: 3px; height: 3px; display: block; opacity: 0.85;
}
.models .model:hover .model-track i { opacity: 1; }

.models .model-flags { display: flex; gap: 0.35rem; justify-content: flex-end; }
.models .pill {
  font-size: 0.6rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-3);
  border: 1px solid var(--rule-soft); padding: 0.1rem 0.32rem;
}

/* --------------------------------------------------------------- excluded */
#excluded-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: 0 2.5rem; border-top: 1px solid var(--rule); }
#excluded-grid > div { padding-block: 1.2rem; border-bottom: 1px solid var(--rule-soft); }
#excluded-grid h4 { font-family: var(--mono); font-size: 0.8rem; font-weight: 500; margin: 0 0 0.4rem; }
#excluded-grid p { font-size: 0.9rem; color: var(--ink-2); margin: 0 0 0.3rem; max-width: none; }
#excluded-grid .reason { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }

/* ---------------------------------------------------------------- footer */
footer {
  background: var(--ink); color: var(--paper);
  padding-block: clamp(3rem, 8vh, 5rem);
  margin-top: 0;
}
footer h2 { color: var(--paper); font-size: clamp(1.5rem, 3vw, 2.2rem); margin-bottom: 1rem; }
footer p, footer li { color: color-mix(in oklab, var(--paper) 72%, transparent); }
footer a { color: var(--paper); }
footer .grid-2 { border-top: 1px solid color-mix(in oklab, var(--paper) 22%, transparent); padding-top: 2rem; }

/* ----------------------------------------------------------------- reveal */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s ease, transform 0.7s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .proof { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.8rem 0; }
  .proof > div:nth-child(odd) { padding-left: 0; border-left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .nav-in { flex-wrap: wrap; gap: 0.6rem 1.2rem; }
  .nav-links { gap: 1rem; }
  .hero-title { max-width: none; }
  .band-head { max-width: none; }
  .controls { gap: 0.9rem; }
  select { min-width: 0; width: 100%; }
  .controls > * { width: 100%; }
  .chip-row { width: 100%; }
}

@media (max-width: 460px) {
  .proof { grid-template-columns: 1fr; }
  .proof > div { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule-soft); padding-top: 1rem; }
  .proof > div:first-child { border-top: 0; padding-top: 0; }
}

/* ------------------------------------------------------------------ print */
@media print {
  .nav, .rail, .skip { display: none; }
  body { background: #fff; color: #000; }
  section { break-inside: avoid; }
}