/* HashBench site — shared design tokens and components.
 *
 * Chrome keeps the reference-price design language (IBM Plex, Archivo Narrow
 * labels, teal accent). Data series use a validated categorical palette
 * (blue, orange, aqua: all-pairs CVD-safe in both modes on these surfaces),
 * status uses reserved colors that never stand for a series, and every status
 * ships with an icon and a label.
 */

:root {
  color-scheme: light;
  --brand-light-display: block;
  --brand-dark-display: none;
  --paper: #F3F5F2;
  --surface: #FFFFFF;
  --sunk: #E9EDE8;
  --ink: #16201D;
  --muted: #56625D;
  --faint: #7C8782;
  --rule: #D5DBD6;
  --grid: #E6EAE6;
  --axis: #C3CAC5;
  --accent: #0F6B5C;
  --accent-ink: #FFFFFF;
  --accent-soft: #D7ECE6;
  --bar-other: #9FB8B1;
  --shadow: 0 1px 2px rgba(22, 32, 29, 0.06), 0 4px 16px rgba(22, 32, 29, 0.06);

  --s1: #2a78d6;   /* series 1: blue   */
  --s2: #eb6834;   /* series 2: orange */
  --s3: #1baf7a;   /* series 3: aqua   */
  --s-other: #9AA39F;

  --good: #0ca30c;
  --good-ink: #006300;
  --warn: #fab219;
  --warn-ink: #7a5200;
  --crit: #d03b3b;
  --crit-ink: #a42a2a;
  --up: #006300;
  --down: #a42a2a;

  --display: "Archivo Narrow", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 8px;
  --gutter: 24px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand-light-display: none;
    --brand-dark-display: block;
    --paper: #0F1513;
    --surface: #161E1B;
    --sunk: #1C2622;
    --ink: #E2E8E5;
    --muted: #97A39E;
    --faint: #75817C;
    --rule: #28332E;
    --grid: #222C28;
    --axis: #34403B;
    --accent: #5FB8A7;
    --accent-ink: #0F1513;
    --accent-soft: #173A33;
    --bar-other: #3E5A53;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s-other: #5E6A65;
    --good-ink: #0ca30c;
    --warn-ink: #fab219;
    --crit-ink: #e66767;
    --up: #0ca30c;
    --down: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand-light-display: none;
  --brand-dark-display: block;
  --paper: #0F1513;
  --surface: #161E1B;
  --sunk: #1C2622;
  --ink: #E2E8E5;
  --muted: #97A39E;
  --faint: #75817C;
  --rule: #28332E;
  --grid: #222C28;
  --axis: #34403B;
  --accent: #5FB8A7;
  --accent-ink: #0F1513;
  --accent-soft: #173A33;
  --bar-other: #3E5A53;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s-other: #5E6A65;
  --good-ink: #0ca30c;
  --warn-ink: #fab219;
  --crit-ink: #e66767;
  --up: #0ca30c;
  --down: #e66767;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent); text-underline-offset: 2px; }
button { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: 0.88em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ── Shell ─────────────────────────────────────────────────────────────── */
.site-header {
  --header-bg: var(--ink);
  background: var(--header-bg);
  color: var(--paper);
  position: sticky;
  top: 0;
  z-index: 50;
}
:root[data-theme="dark"] .site-header { --header-bg: #0A0F0D; color: #E2E8E5; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-header { --header-bg: #0A0F0D; color: #E2E8E5; }
}
.site-header .bar {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 var(--gutter);
  height: 52px;
}
.brand { display: inline-flex; align-items: center; text-decoration: none; color: inherit; flex-shrink: 0; }
.brand-logo { display: block; width: 188px; height: 32px; flex-shrink: 0; }
.brand-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.site-header .brand { min-height: 44px; }
.site-header .brand-logo { width: 164.5px; height: 28px; }
.nav-toggle { display: none; }
.nav { display: flex; gap: 2px; flex: 1; min-width: 0; }
.nav a {
  color: inherit;
  opacity: 0.72;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 6px;
  white-space: nowrap;
}
.nav a:hover { opacity: 1; background: rgba(255, 255, 255, 0.08); }
.nav a[aria-current="page"] { opacity: 1; background: rgba(255, 255, 255, 0.14); }
.header-meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; font-size: 12px; opacity: 0.8; white-space: nowrap; }
.exp-chip {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(250, 178, 25, 0.6);
  color: #fab219;
  padding: 1px 8px;
  border-radius: 99px;
}
.icon-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  color: inherit;
  display: inline-grid;
  place-items: center;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); }
@media (max-width: 1200px) { .header-meta .asof { display: none; } }
@media (max-width: 960px) {
  .site-header .bar { gap: 8px; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; margin-left: auto; padding: 0 12px; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 6px; background: none; color: inherit; cursor: pointer; font-size: 13px; }
  .nav-toggle:is(:hover, [aria-expanded="true"]) { background: rgba(255, 255, 255, 0.08); }
  .site-header .icon-btn { width: 44px; height: 44px; }
  .site-header :is(.nav-toggle, .icon-btn, .nav a):focus-visible { outline-color: currentColor; outline-offset: -2px; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 4px; max-height: calc(100dvh - 52px); overflow-y: auto; overscroll-behavior: contain; padding: 12px var(--gutter) 16px; border-top: 1px solid rgba(255, 255, 255, 0.14); border-bottom: 1px solid rgba(255, 255, 255, 0.14); background: var(--header-bg); box-shadow: var(--shadow); }
  .nav[data-open="true"] { display: flex; }
  .nav a { display: flex; align-items: center; min-height: 44px; padding: 10px 12px; }
  .header-meta .exp-chip { display: none; }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .site-header .brand-logo { width: 32px; height: 32px; }
}

.page { max-width: 1320px; margin: 0 auto; padding: 24px var(--gutter) 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-title { font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: 0.005em; line-height: 1.15; }
.page-sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; max-width: 72ch; }
.run-line { font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-align: right; }
.run-line b { color: var(--ink); font-weight: 500; }

.site-footer {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 13px;
}
.site-footer .inner { max-width: 1320px; margin: 0 auto; padding: 32px var(--gutter) 20px; }
.footer-top { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr)); gap: 48px; }
.footer-brand p { max-width: 58ch; margin-top: 12px; line-height: 1.7; }
.site-footer .brand-logo-light { display: var(--brand-light-display); }
.site-footer .brand-logo-dark { display: var(--brand-dark-display); }
.footer-group-title { margin: 0 0 10px; color: var(--ink); font-family: var(--display); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.footer-links { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.footer-links a { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 0; color: inherit; text-decoration: none; }
.footer-links a:is(:hover, :focus-visible) { color: var(--accent); text-decoration: underline; }
.footer-external-icon { display: block; flex-shrink: 0; color: var(--muted); }
.footer-bottom { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px 24px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--rule); font-size: 11.5px; }
.footer-bottom #visit-count { font-variant-numeric: tabular-nums; }
.footer-bottom #visit-count:empty { display: none; }
@media (max-width: 760px) {
  .footer-top { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-links a { min-height: 44px; padding: 8px 0; }
}

/* ── Cards, labels, stats ─────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-title { font-size: 15px; font-weight: 600; }
.card-sub { color: var(--muted); font-size: 12.5px; }
.eyebrow {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 960px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

.stats-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 4px 6px;
  margin-bottom: 16px;
}
.stat { padding: 8px 18px 8px 12px; min-width: 0; }
.stat + .stat { border-left: 1px solid var(--rule); }
.stat-label { font-family: var(--display); font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.stat-value { font-size: 18px; font-weight: 600; white-space: nowrap; line-height: 1.25; }
.stat-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
@media (max-width: 640px) { .stat + .stat { border-left: none; } .stat { flex: 1 1 45%; } }

.delta { font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.flat { color: var(--muted); }

/* Status: reserved colors, always with icon and label */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 1px 8px 1px 6px;
  border-radius: 99px;
  border: 1px solid var(--rule);
  white-space: nowrap;
  background: var(--surface);
}
.status i { font-style: normal; font-size: 11px; line-height: 1; }
.status.fresh i { color: var(--good); }
.status.carried i { color: var(--warn); }
.status.withheld i { color: var(--crit); }
.status.withheld { color: var(--crit-ink); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0 7px;
  border-radius: 4px;
  background: var(--sunk);
  color: var(--muted);
  white-space: nowrap;
  line-height: 18px;
  text-decoration: none;
}
a.chip:hover { background: var(--accent-soft); color: var(--accent); }
.chip.flag { background: transparent; border: 1px dashed var(--axis); font-weight: 500; }

/* ── Controls ─────────────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.seg {
  display: inline-flex;
  background: var(--sunk);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}
.seg button {
  border: none;
  background: none;
  padding: 5px 11px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); font-weight: 600; }
.search {
  flex: 1 1 220px;
  max-width: 320px;
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.search:focus { outline: none; border-color: var(--accent); }
.hint { color: var(--muted); font-size: 12px; margin-left: auto; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn .kbd, .kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 0 4px;
  opacity: 0.7;
}
.btn.ghost { border-color: transparent; background: none; }

/* ── Tables ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.data thead th {
  background: var(--sunk);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 2;
}
table.data th.num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data.compact td { padding: 5px 8px; font-size: 12.5px; }
table.data.compact thead th { padding: 6px 8px; font-size: 10px; }
table.data th.active-col { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
table.data td.active-col { font-weight: 600; }
.sym { font-family: var(--mono); font-size: 11px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.name { font-weight: 600; display: block; line-height: 1.25; }

/* ── Charts ───────────────────────────────────────────────────────────── */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick text, .chart .axis-label { fill: var(--muted); font-size: 11px; font-family: var(--body); font-variant-numeric: tabular-nums; }
.chart .end-label { fill: var(--ink); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .end-label tspan.sub { fill: var(--muted); font-weight: 400; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .band-backcast { fill: var(--sunk); }
.chart .band-label { fill: var(--muted); font-size: 10.5px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 8px; font-size: 12.5px; color: var(--muted); }
.chart-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .key svg { flex-shrink: 0; }
.chart-tools { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.chart-tools button { font-size: 11.5px; padding: 2px 8px; }
.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 7px;
  box-shadow: var(--shadow);
  padding: 8px 10px;
  font-size: 12px;
  min-width: 150px;
  z-index: 20;
  opacity: 0;
  transition: opacity 0.08s;
}
.tooltip.on { opacity: 1; }
.tooltip .tt-title { font-weight: 600; margin-bottom: 4px; font-size: 12px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 7px; line-height: 1.6; }
.tooltip .tt-row b { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 64px; }
.tooltip .tt-row span { color: var(--muted); }
.tooltip .tt-note { color: var(--muted); font-size: 11px; margin-top: 4px; max-width: 240px; }
.chart-table { margin-top: 8px; max-height: 260px; overflow: auto; border: 1px solid var(--rule); border-radius: 6px; }
.spark { display: block; }
.spark .line { fill: none; stroke: var(--faint); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark .dot { fill: var(--accent); }
.spark .dot.withheld { fill: var(--surface); stroke: var(--crit); stroke-width: 1.5; }

/* ── States ───────────────────────────────────────────────────────────── */
.state { padding: 56px 20px; text-align: center; color: var(--muted); }
.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-dim { opacity: 0.5; transition: opacity 0.15s; }
.note {
  background: var(--sunk);
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--muted);
}
.note b { color: var(--ink); font-weight: 600; }
.purpose {
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-size: 12.5px;
  color: var(--muted);
  margin: 4px 0 14px;
}
.purpose b { color: var(--accent); font-weight: 600; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0s !important; scroll-behavior: auto !important; } }
