/* ==========================================================================
   SANRAT Racers — design tokens  (Phase A)
   --------------------------------------------------------------------------
   The single source of colour and type for every page. Loaded LAST in <head>
   so it can win on equal specificity, and it defines variables only —
   page rules keep their own selectors and consume these values.

   Rules:
     · one meaning per hue. gold = money, cyan = navigation, green = confirmed,
       amber = waiting, red = failure, pink = boost. Never decorate with a
       semantic colour.
     · never go below --fs-1 (12px) for text that has to be read.
     · every surface is a step on the ramp below; do not invent a new near-black.
   ========================================================================== */

/* ---- self-hosted type (no third-party request on load) ------------------ */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/inter400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/inter500.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/inter600.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/barlow600.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/barlow700.woff2') format('woff2');
}

:root {
  /* ---- surfaces: page → topbar → panel → raised → active --------------- */
  --bg:            #0B1120;
  --bg-deep:       #070C16;
  --surface:       #141E33;
  --surface-2:     #1C2942;
  --surface-3:     #25334F;
  --border:        #2A3A55;
  --border-strong: #3B4E6E;

  /* ---- text (AA on --bg; --text-faint is the floor, 12px min) ---------- */
  --text:       #E8EFF9;
  --text-dim:   #9DB0C8;
  --text-muted: #8298B3;
  --text-faint: #6D82A0;

  /* ---- interaction ----------------------------------------------------- */
  --accent:        #38BDF8;   /* links, live marks, outlines — never a fill */
  --accent-strong: #0EA5E9;
  --btn:           #1D4ED8;   /* filled primary, --text label = 6.3:1 */
  --btn-hover:     #1E40AF;

  /* ---- meaning --------------------------------------------------------- */
  --gold:      #F0B90B;       /* money + the one primary CTA per screen */
  --gold-soft: #FBBF24;       /* prize figures on dark */
  --on-gold:   #1A1200;
  --gold-tint: #2B1A05;
  --warn:      #F59E0B;
  --ok:        #4ADE80;
  --ok-strong: #16A34A;
  --ok-tint:   #052E16;
  --err:       #F87171;
  --err-strong:#EF4444;
  --err-fill:  #B91C1C;       /* filled destructive, white label = 6.5:1 */
  --err-tint:  #2B1212;
  --boost:     #F472B6;
  --boost-strong:#EC4899;

  /* ---- type ------------------------------------------------------------ */
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
             'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Barlow Condensed', 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --fs-1: 12px;   /* micro-label, table meta — the floor */
  --fs-2: 13px;   /* labels, chips */
  --fs-3: 14px;   /* UI default in dense panels */
  --fs-4: 16px;   /* body */
  --fs-5: 20px;   /* panel / section title */
  --fs-6: 28px;   /* page title */
  --fs-7: 40px;   /* hero figure */

  --lh: 1.45;
  --tracking-display: .045em;

  /* ---- geometry -------------------------------------------------------- */
  --radius:    10px;
  --radius-sm: 6px;
  --radius-pill: 999px;
}

/* ---- base layer: only what every page should agree on ------------------- */
body {
  font-family: var(--font-ui);
  background-color: var(--bg);
  color: var(--text);
  font-size: var(--fs-4);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: var(--tracking-display);
  line-height: 1.15;
}

/* Form controls do not inherit type from the page — they fall back to the UA's
   Arial, which is why every button was the one place Inter never landed. */
button, input, select, textarea {
  font-family: var(--font-ui);
  font-size: var(--fs-3);
}

/* Numbers line up in every table and stat row. */
td, th,
.race-count, .race-prize,
[id*="prize" i], [class*="prize" i] {
  font-variant-numeric: tabular-nums;
}

/* Countdowns and addresses: fixed width so they do not jitter. */
code, kbd, pre, samp, .mono, .countdown, .addr {
  font-family: var(--font-mono);
}

::selection { background: var(--accent); color: #04121F; }

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

/* Scrollbars match the surfaces instead of the OS default. */
* { scrollbar-color: var(--surface-3) var(--bg); }
