/* ============================================================================
   MockDyno — dark tokens (mockup). Contrast ratios are measured, not guessed:
   see the table in system.html, generated from these exact values.

   Colour has three jobs and three jobs only:
     red   = power        (hp curve, hp readout, the slider thumb)
     blue  = torque       (chart only — data colour, not an accent)
     cream = money        (the price ticket, cost-cliff marks, part prices' total)
   Everything else is warm greys. Red stays the single saturated accent.
   ============================================================================ */
:root {
  --bg: #131313;          /* canvas — not pure black (OLED smear, harsh in a dark garage) */
  --surface: #1B1B1B;     /* panels */
  --raised: #232323;      /* inputs, table zebra, tooltip */
  --line: #2C2C2C;        /* hairlines — decorative only, never the sole boundary of a control */
  --line-2: #3A3A3A;
  --control: #77736C;     /* control borders: ≥3:1 on bg/surface/raised (WCAG 1.4.11) */
  --text: #EDEBE6;        /* warm near-white */
  --muted: #A8A49C;       /* secondary text: ≥6.3:1 everywhere */
  --stock: #8C8984;       /* stock curve, axis labels */
  --grid: #262626;        /* chart gridlines */
  --red: #FF5A4A;         /* tach-red, recalibrated for dark (old #C23B2B fails on black: 3.1:1) */
  --red-ink: #131313;     /* text on red */
  --red-dim: rgba(255, 90, 74, 0.14);
  --blue: #6FA8F0;
  --cream: #EFE3C8;       /* money — paper-on-black; a callback to the old paper sheet */
  --cream-ink: #131313;
  --cream-dim: rgba(239, 227, 200, 0.10);
  --focus: #EDEBE6;

  /* radius hierarchy — the old site had one value for everything */
  --r-ctl: 3px;           /* inputs, chips: machined, tight */
  --r-panel: 12px;        /* panels and the dock */
  --r-pill: 999px;        /* segmented controls, the thumb */

  --f-body: Barlow, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --ease-out: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--f-body); font-variant-numeric: tabular-nums;
}
a { color: var(--text); text-decoration-color: var(--control); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--red); }

/* Focus: same structure as the live site (2px solid, 2px offset), re-inked for dark */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* ---------- site chrome ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(19, 19, 19, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 28px; padding: 0 24px; height: 60px; }
.topbar .wordmark { height: 26px; width: auto; display: block; }
.nav { display: flex; gap: 4px; }
.nav a { font: 500 15px/1 var(--f-body); color: var(--muted); text-decoration: none; padding: 10px 12px; border-radius: var(--r-ctl); position: relative; }
.nav a:hover { color: var(--text); }
.nav a[aria-current] { color: var(--text); }
.nav a[aria-current]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -11px; height: 2px; background: var(--red); }
.topbar .spacer { flex: 1; }
.btn-ghost { font: 600 14px/1 var(--f-body); color: var(--text); background: none; border: 1px solid var(--control); border-radius: var(--r-pill); padding: 9px 16px; cursor: pointer; }
.btn-ghost:hover { border-color: var(--text); }
.btn-primary { font: 700 15px/1 var(--f-body); letter-spacing: .02em; color: var(--red-ink); background: var(--red); border: 0; border-radius: var(--r-pill); padding: 12px 20px; cursor: pointer; }

/* ---------- form controls ---------- */
.field { display: grid; gap: 6px; }
.label { font: 600 11px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.select, .input {
  font: 500 16px/1.2 var(--f-body); color: var(--text); background: var(--raised);
  border: 1px solid var(--control); border-radius: var(--r-ctl); padding: 11px 12px; min-height: 44px; width: 100%;
}
.select { appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.select:hover, .input:hover { border-color: var(--muted); }
.select:focus-visible, .input:focus-visible { border-color: var(--text); }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--raised); border: 1px solid var(--control); border-radius: var(--r-pill); }
.seg button { font: 600 14px/1 var(--f-body); color: var(--muted); background: none; border: 0; border-radius: var(--r-pill); padding: 9px 13px; min-height: 36px; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.check { display: inline-flex; gap: 10px; align-items: center; font: 500 15px/1.3 var(--f-body); cursor: pointer; }
.check input { appearance: none; width: 20px; height: 20px; margin: 0; border: 1.5px solid var(--control); border-radius: var(--r-ctl); background: var(--raised); display: grid; place-content: center; }
.check input:checked { background: var(--text); border-color: var(--text); }
.check input:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--bg); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }

/* ---------- money ticket ---------- */
.ticket { display: inline-grid; background: var(--cream); color: var(--cream-ink); border-radius: 4px; padding: 8px 14px 9px; position: relative; }
.ticket::before, .ticket::after { content: ""; position: absolute; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--bg); }
.ticket::before { left: -5px; } .ticket::after { right: -5px; }
.ticket .t-k { font: 600 10px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.ticket .t-v { font: 700 30px/1.05 var(--f-body); letter-spacing: -.01em; }
