/* CastCheck — one accent colour, a warm/cool diverging pair for bias, and nothing else.
   Light is the base; dark is a token swap under prefers-color-scheme and under [data-theme].
   Tables are the content: every figure repeats its numbers in a table next to it. */

:root {
  --bg: #fbfbf9;
  --surface: #fff;
  --surface-2: #f4f3ef;
  --border: #e4e2dc;
  --ink: #1a1a19;
  --ink-2: #55534e;
  --ink-3: #7c7970;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --warm-3: #b4340f;
  --warm-2: #e0642f;
  --warm-1: #f5c8a8;
  --cool-1: #bcd7ea;
  --cool-2: #3d7fae;
  --cool-3: #154b6b;
  --null: #a8a49c;
  --grid: #ece9e3;
  --zero: #8b877e;
  --ok: #2c7a4b;
  --warn: #b06d00;
  --bad: #b3261e;
  --notice-bg: #fdf6e3;
  --notice-ink: #57492a;
  --radius: 6px;
  --gap: 16px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --surface: #1b1e24;
    --surface-2: #22262d;
    --border: #2c3138;
    --ink: #e9e7e2;
    --ink-2: #b3b0a9;
    --ink-3: #8a877f;
    --accent: #5b9bff;
    --accent-soft: #1d2a3f;
    --warm-3: #ff8f60;
    --warm-2: #f0794a;
    --warm-1: #6b3a24;
    --cool-1: #22455c;
    --cool-2: #5ba3d0;
    --cool-3: #8fc6e8;
    --null: #6e6b64;
    --grid: #252a31;
    --zero: #6f6c66;
    --ok: #56b981;
    --warn: #d59b3b;
    --bad: #f2827a;
    --notice-bg: #241f14;
    --notice-ink: #d9c9a3;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #14161a;
  --surface: #1b1e24;
  --surface-2: #22262d;
  --border: #2c3138;
  --ink: #e9e7e2;
  --ink-2: #b3b0a9;
  --ink-3: #8a877f;
  --accent: #5b9bff;
  --accent-soft: #1d2a3f;
  --warm-3: #ff8f60;
  --warm-2: #f0794a;
  --warm-1: #6b3a24;
  --cool-1: #22455c;
  --cool-2: #5ba3d0;
  --cool-3: #8fc6e8;
  --null: #6e6b64;
  --grid: #252a31;
  --zero: #6f6c66;
  --ok: #56b981;
  --warn: #d59b3b;
  --bad: #f2827a;
  --notice-bg: #241f14;
  --notice-ink: #d9c9a3;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 15px/1.55 var(--sans);
  overflow-wrap: break-word;
}
main { max-width: 1180px; margin: 0 auto; padding: 0 20px 56px; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

h1 { font-size: 28px; line-height: 1.18; font-weight: 600; margin: 26px 0 8px; letter-spacing: -0.015em; }
h2 { font-size: 20px; line-height: 1.25; font-weight: 600; margin: 32px 0 10px; }
h3 { font-size: 16px; font-weight: 600; margin: 22px 0 6px; }
p { margin: 8px 0; }
section { margin-top: 6px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 20;
  background: var(--surface); color: var(--ink); padding: 8px 14px;
  border: 1px solid var(--accent); border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; }

.fairness {
  margin: 0; padding: 7px 20px;
  background: var(--notice-bg); border-bottom: 1px solid var(--border);
  color: var(--notice-ink); font-size: 12.5px;
}
header.site {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px;
  max-width: 1180px; margin: 0 auto; padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
header.site .brand {
  font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none;
  letter-spacing: -0.02em;
}
header.site nav { display: flex; flex-wrap: wrap; gap: 14px; }
header.site .head-right { margin-left: auto; display: flex; align-items: baseline; gap: 12px; }
header.site .asof { color: var(--ink-2); font-size: 12px; }

button.theme {
  font: inherit; font-size: 12px; line-height: 1;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 5px 9px; cursor: pointer;
}
button.theme:hover { color: var(--ink); border-color: var(--ink-3); }

/* ------------------------------------------------------------------ headline */

.headline {
  margin: 18px 0 6px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.headline p.verdict { font-size: 18px; line-height: 1.4; margin: 0 0 8px; }
.headline .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.meta {
  display: flex; flex-wrap: wrap; gap: 4px 20px;
  margin: 10px 0 0; padding: 0; list-style: none;
  font-size: 12.5px; color: var(--ink-2);
}
.meta b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.lede { max-width: 74ch; color: var(--ink-2); }
.note, .sub, .period, .tiny { color: var(--ink-2); font-size: 12px; }
.period { white-space: nowrap; }
.dimtext { color: var(--ink-3); }
.empty {
  padding: 12px 14px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--ink-2);
}
.mono, code, samp { font-family: var(--mono); font-size: 0.9em; }
.ok { color: var(--ok); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.warnc { color: var(--warn); font-weight: 600; }

/* ------------------------------------------------------------------ switchers */

.switch { font-size: 13px; margin: 10px 0; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.switch .k { color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; font-size: 11px; }
.switch a {
  text-decoration: none; color: var(--ink-2);
  border: 1px solid transparent; border-radius: var(--radius); padding: 2px 7px;
}
.switch a:hover { background: var(--surface-2); color: var(--ink); }
.switch a.current {
  color: var(--ink); font-weight: 600; background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

/* ------------------------------------------------------------------ tables */

.scroll { overflow-x: auto; max-width: 100%; }
/* A wrapper with overflow-x also establishes a vertical scroll box, so a sticky header only
   sticks inside it. Long tables therefore get their own capped, scrollable box — that is where a
   sticky header actually earns its keep. */
.scroll.tall { max-height: 78vh; overflow: auto; }
/* Sticky only inside a box that actually scrolls vertically. On the page itself a sticky header
   is opaque and, while its table is still partly in view, parks over whatever follows — which is
   how it swallowed the next heading. */
.scroll.tall table.scores thead th { position: sticky; top: 0; z-index: 2; }
table.scores { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.scores caption { text-align: left; color: var(--ink-2); font-size: 12.5px; padding-bottom: 6px; }
table.scores th, table.scores td {
  padding: 5px 9px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: baseline;
}
table.scores thead th {
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-2); white-space: nowrap;
}
table.scores td.num, table.scores th.num,
table.scores.grid tbody td,
table.scores.card tbody td:nth-child(n+5):nth-child(-n+14),
table.scores.two tbody td:last-child,
table.scores.nums tbody td {
  text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px;
}
table.scores tbody tr:hover { background: var(--surface-2); }
table.scores .ci { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; }
/* An interval always sits on its own tight line under the value it belongs to, so a row is
   exactly two lines high instead of reflowing unpredictably. */
table.scores.card tbody td .ci { display: block; line-height: 1.2; }
table.scores.card tbody td { line-height: 1.35; }
table.scores td.num a, table.scores.grid tbody td a { color: inherit; text-decoration: none; }
table.scores td.num a:hover, table.scores.grid tbody td a:hover { text-decoration: underline; }
table.scores td.best > a, table.scores td.best > span { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
table.scores tr.low-n td, table.scores tr.low-n td a { color: var(--null); }
table.scores td.low-n, table.scores td.low-n a { color: var(--null); }
table.scores tr.baseline { font-style: italic; }
table.scores tr.baseline th[scope="row"], table.scores tr.baseline td:first-child { font-style: italic; }
table.grid th[scope="row"] { white-space: nowrap; }
table.grid td .sub { display: block; font-family: var(--sans); font-size: 10.5px; white-space: nowrap; }
table.scores td .sub, table.scores th .sub {
  display: block; font-family: var(--sans); font-size: 10.5px; white-space: nowrap;
  font-weight: 400; font-style: normal; color: var(--ink-3);
}
table.scores td .sub.mono, table.scores th .sub.mono { font-family: var(--mono); }
abbr[title] { text-decoration: underline dotted; text-underline-offset: 2px; cursor: help; }
table.scores.grid tbody th[scope="row"] { text-align: left; font-family: var(--sans); font-size: 13.5px; }
table.scores td.sig { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

.legend { font-size: 12px; color: var(--ink-2); margin: 6px 0 0; }
.legend .swatch {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  vertical-align: -1px; margin-right: 3px; border: 1px solid var(--border);
}

/* diverging bias fills, always paired with a printed sign */
.b-warm-3 { background: var(--warm-3); }
.b-warm-2 { background: var(--warm-2); }
.b-warm-1 { background: var(--warm-1); }
.b-cool-1 { background: var(--cool-1); }
.b-cool-2 { background: var(--cool-2); }
.b-cool-3 { background: var(--cool-3); }
.b-flat { background: var(--null); }
.b-null { background: var(--grid); }
i.c {
  display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px;
  vertical-align: 0; border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
}

/* ------------------------------------------------------------------ bars */

.barcell { width: 34%; min-width: 140px; }
.bar { display: inline-block; height: 8px; background: var(--accent); border-radius: 4px; min-width: 2px; }

.avail-grid td.cellbox { width: 9px; min-width: 9px; padding: 4px 1px; }
.cellbox { position: relative; }
.cellbox::after { content: ""; display: block; height: 16px; border-radius: 2px; background: var(--grid); }
.cellbox.yes::after { background: var(--ok); }
.cellbox.part::after { background: var(--warn); }
.cellbox.no::after { background: var(--bad); opacity: 0.55; }
.sr, .sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

svg.uptime { display: block; width: 100%; max-width: 340px; height: 16px; }
svg.uptime .u-yes { fill: var(--ok); }
svg.uptime .u-part { fill: var(--warn); }
svg.uptime .u-no { fill: var(--bad); opacity: 0.5; }

/* ------------------------------------------------------------------ figures */

figure.chart {
  margin: 12px 0; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
figure.chart figcaption { color: var(--ink-2); font-size: 12px; margin-top: 6px; }
svg.fig { display: block; width: 100%; height: auto; }
svg .grid { stroke: var(--grid); stroke-width: 1; fill: none; }
svg .zero { stroke: var(--zero); stroke-width: 1; stroke-dasharray: 3 3; }
svg .mark { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 3; }
svg .series { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; }
svg .series-ma { fill: none; stroke: var(--warm-2); stroke-width: 2.2; opacity: 0.85; stroke-linejoin: round; }
svg .pt { fill: var(--accent); }
svg .lbl { fill: var(--ink-2); font: 10px var(--mono); }
svg .lbl.dim { fill: var(--ink-3); }
svg .bar-warm { fill: var(--warm-2); }
svg .bar-cool { fill: var(--cool-2); }
svg.map .dot { stroke: var(--surface); stroke-width: 1; }
svg.map .dot.b-warm-3 { fill: var(--warm-3); }
svg.map .dot.b-warm-2 { fill: var(--warm-2); }
svg.map .dot.b-warm-1 { fill: var(--warm-1); }
svg.map .dot.b-cool-1 { fill: var(--cool-1); }
svg.map .dot.b-cool-2 { fill: var(--cool-2); }
svg.map .dot.b-cool-3 { fill: var(--cool-3); }
svg.map .dot.b-flat { fill: var(--null); }
svg.map .dot.b-null { fill: var(--grid); }
svg.map .map-lbl { fill: var(--ink-2); font-size: 9px; }
svg.map .map-sign { fill: var(--surface); font-size: 9px; font-weight: 700; }

svg.spark { display: inline-block; width: 96px; height: 28px; vertical-align: middle; }
svg.spark .series { stroke-width: 1.3; }
.spark-empty { color: var(--ink-3); }
td.sparkcell { padding: 2px 9px; }

details.data-behind { margin: 6px 0 0; }
details.data-behind > summary {
  cursor: pointer; font-size: 12px; color: var(--ink-2); padding: 3px 0;
}
details.data-behind > summary:hover { color: var(--ink); }
details.data-behind table.scores { margin-top: 6px; font-size: 12.5px; }

/* ------------------------------------------------------------------ blocks */

blockquote.citation {
  margin: 10px 0; padding: 10px 14px; background: var(--surface-2);
  border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0;
}
blockquote.citation p { margin: 0 0 6px; font-family: var(--mono); font-size: 12.5px; word-break: break-word; }
blockquote.citation p:last-child { margin-bottom: 0; }
blockquote.citation .k { display: block; font-family: var(--sans); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); }

pre.code {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; margin: 8px 0;
}
.jsonlink { font-size: 13px; }
.downloads { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; margin: 8px 0; }

ul.cols { columns: 3 210px; padding-left: 18px; }
.cols-list { color: var(--ink-2); word-break: break-word; }
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 10px 0; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
}
.card h3 { margin: 0 0 4px; font-size: 14px; }
.card p { margin: 2px 0; font-size: 13px; color: var(--ink-2); }
.big { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }

.prose { max-width: 78ch; }
.prose table { border-collapse: collapse; font-size: 13.5px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; }
.prose h2 { border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.prose code { background: var(--surface-2); padding: 1px 4px; border-radius: 3px; }
.prose pre { overflow-x: auto; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; }
.prose img { max-width: 100%; height: auto; }
.prose blockquote { border-left: 3px solid var(--border); margin-left: 0; padding-left: 12px; color: var(--ink-2); }

footer {
  max-width: 1180px; margin: 0 auto; padding: 18px 20px 40px;
  border-top: 1px solid var(--border); color: var(--ink-2); font-size: 12.5px;
}
footer p { max-width: 94ch; }
footer a { color: var(--accent); }

@media (max-width: 640px) {
  main { padding: 0 12px 48px; }
  header.site { padding: 10px 12px; }
  header.site .head-right { margin-left: 0; width: 100%; }
  .fairness { padding: 7px 12px; }
  h1 { font-size: 23px; }
  h2 { font-size: 18px; }
  ul.cols { columns: 1; }
  table.scores th, table.scores td { padding: 5px 7px; }
  footer { padding: 16px 12px 32px; }
}

@media print {
  header.site nav, button.theme, .switch { display: none; }
  a { color: inherit; text-decoration: none; }
}
