/*
  Config-web UI theme tokens — MIRROR the client's canonical deriveTheme (Fives, `c050c727`)
  EXACTLY, so config-web / SpectateView / App.vue never diverge (Echo asserts the presets).
  Presets-only via [data-theme]: Black/Red (default, dark) + Light (derived from Black/Red, tools/theme/derive-light.mjs).
  Owner 2026-07-14: Black/Red primary darkened −25% (#A10005 -> #790004); rest re-derived.
*/
:root,
:root[data-theme="brand-red"] {
  --ui-primary: #790004;
  --ui-secondary: #000000;
  --ui-surface: #0d0d0d;
  --ui-surface-2: #242424;
  --ui-accent: #a55456;
  --ui-text-on-accent: #ffffff;
  --ui-hover: #250a0b;
  --ui-active: #790004;
  --ui-border: #3d0002;
  --ui-focus: #ff3b3b;
  --ui-focus-halo: #ffffff;
  --ui-heading: #ff3b3b;
  --ui-text-on-primary: #ffffff;
  --ui-text-on-secondary: #ffffff;
  --ui-text: #e6e9ef;
  --ui-muted: #848689;
  --ui-text-dim: #5f6163;
}
:root[data-theme="light"] {
  /* Light = the dark preset hue-shifted (owner 10-31): every value is generated by tools/theme/derive-light.mjs from the
     Black/Red values above (OKLCH lightness map, hue kept). Regenerate with `node tools/theme/derive-light.mjs --write`. */
  --ui-primary: #790004;
  --ui-secondary: #c2c2c2;
  --ui-surface: #d2d2d2;
  --ui-surface-2: #dcdcdc;
  --ui-accent: #85373b;
  --ui-text-on-accent: #ffffff;
  --ui-hover: #e9d4d3;
  --ui-active: #790004;
  --ui-border: #c99c96;
  --ui-focus: #d5031b;
  --ui-focus-halo: #ffffff;
  --ui-heading: #a50112;
  --ui-text-on-primary: #ffffff;
  --ui-text-on-secondary: #121212;
  --ui-text: #131519;
  --ui-muted: #4e5053;
  --ui-text-dim: #686b6d;
  --ui-coach-led: #025e1a;   /* the dark preset's LED green, darkened to clear 4.5:1 on every light surface */
  --ui-danger: #a40218;
  --ui-success: #015c27;
}
/* Typography (owner 2026-11-02, replaces the 10-22 Nuffle titles): every text on the site is the Roster Builder's
   sans-serif system stack (Helvetica family; no font files shipped for it). Title lines (--font-heading) are the bold
   face of the same stack: "SF Sans Bold" maps the installed bold face for every weight, so a title stays bold whatever
   weight a rule asks for (the Nuffle rules asked for 500, which Helvetica / Arial would draw regular). Band header rows
   use SNES Italic (--sf-band-title-font, spa home.css). Nuffle is retired from the site UI. */
@font-face {
  font-family: "SF Sans Bold";
  src: local("Helvetica Neue Bold"), local("HelveticaNeue-Bold"), local("Helvetica Bold"), local("Helvetica-Bold"),
    local("Arial Bold"), local("Arial-BoldMT"), local("Liberation Sans Bold"), local("LiberationSans-Bold");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --font-body: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
  --font-heading: "SF Sans Bold", "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
  --text-base: 17px;
  --text-line: 1.45;
}
@media (max-width: 640px) {
  :root { --text-base: 16px; }
}

/* Fixed semantics — identical in both presets (Fives canonical). */
:root {
  --ui-danger: #ff4d4d;
  --ui-on-danger: #ffffff;      /* text and icons on a --ui-danger fill (both presets; the light danger is derived to clear 4.5:1 under it) */
  --ui-coach-led: #4cff6a;      /* bright LED green for the coach names in the desktop scoreboard */
  --ui-admin: #ffd23d;          /* bright yellow: events an organiser recorded or removed for a team they do not coach */
  --ui-scarlet: #d7141f;          /* saturated scarlet: the recorder End Turn button */
  --ui-scarlet-contrast: #ffffff; /* text on --ui-scarlet, 5.8:1 */
  --ui-warn: #f0a020;           /* amber: warning surfaces (first use: the recorder Injury button) */
  --ui-warn-contrast: #1a1200;  /* text on --ui-warn, 9:1+ */
  --ui-success: #3fb463;
  --ui-info: #4a86c8;
}

/* Focus ring = RED + white halo (dual-ring). Canonical CSS from Fives — VERBATIM so
   config-web / SpectateView / App.vue never diverge. The red alone can't clear 3:1 vs a
   red/green button fill; the halo layer carries the contrast (Echo asserts the composite). */
:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--ui-focus-halo),  /* inner: hugs the control, ≥3:1 vs the button fill */
    0 0 0 4px var(--ui-focus);        /* outer: red ring, ≥3:1 vs the surface */
}

/* Presets-only theme toggle (fixed, top-right) — config-web has no client settings store. */
.theme-toggle {
  /* Owner 10-27: bottom right of the page (was top right, beside the nav). */
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 50;
  font: 13px/1 var(--font-body);
  background: var(--ui-surface-2);
  color: var(--ui-text);
  border: 1px solid var(--ui-border);
  border-radius: 7px;
  padding: 5px 9px;
  cursor: pointer;
  opacity: 0.85;
}
.theme-toggle:hover {
  opacity: 1;
  border-color: var(--ui-primary);
}
