/* Freedom Forge Studios Leaderboard — design tokens (Blueprint direction)
   Change a value here and it propagates everywhere. Theme: <html data-theme="dark|light">.
   Brand: --brand drives accent fill + derived accent text tints. */

/* Dark is the default and also available as a nested scope: <div data-theme="dark"> */
:root, [data-theme="dark"] {
  /* ---------- Brand / accent ---------- */
  --brand: #3f6899;                                   /* Freedom Forge Studios primary */
  --accent: var(--brand);                             /* fills: buttons, bars (white text = 5.8:1) */
  --accent-hover: color-mix(in oklab, var(--brand) 85%, white);
  --accent-active: color-mix(in oklab, var(--brand) 85%, black);
  --accent-text: color-mix(in oklab, var(--brand) 50%, white);   /* links/text on dark: lighter tint */
  --accent-soft: color-mix(in oklab, var(--brand) 18%, transparent);
  --accent-line: color-mix(in oklab, var(--brand) 55%, transparent);
  --on-accent: #ffffff;

  /* ---------- Neutral scale (dark) ---------- */
  --neutral-0: #070a0f;
  --neutral-50: #0c1118;
  --neutral-100: #111823;
  --neutral-200: #16202e;
  --neutral-300: #1f2b3b;
  --neutral-400: #2b3a4f;
  --neutral-500: #4a5a70;
  --neutral-600: #75849a;
  --neutral-700: #9aa8bb;
  --neutral-800: #c3cedd;
  --neutral-900: #e6ecf4;
  --neutral-1000: #ffffff;

  /* ---------- Semantic surfaces & text ---------- */
  --bg: var(--neutral-50);
  --surface: var(--neutral-100);
  --surface-raised: var(--neutral-200);
  --surface-sunken: var(--neutral-0);
  --border: var(--neutral-300);
  --border-strong: var(--neutral-400);
  --text: var(--neutral-900);
  --text-muted: var(--neutral-700);      /* 7:1 on surface */
  --text-subtle: var(--neutral-600);     /* 4.9:1 on surface */
  --overlay: rgb(3 6 10 / .72);

  /* ---------- Semantic colors ---------- */
  --success: #5fd4a0;  --success-soft: rgb(95 212 160 / .14);
  --warning: #f0b84a;  --warning-soft: rgb(240 184 74 / .14);
  --danger:  #ff7b7b;  --danger-soft:  rgb(255 123 123 / .14);
  --info:    #6cb4ff;  --info-soft:    rgb(108 180 255 / .14);

  /* ---------- Rank colors ---------- */
  --rank-gold: #e3b341;   --rank-gold-soft: rgb(227 179 65 / .12);
  --rank-silver: #aab4c3; --rank-silver-soft: rgb(170 180 195 / .10);
  --rank-bronze: #d08a58; --rank-bronze-soft: rgb(208 138 88 / .12);
  --rank-highlight: var(--accent-soft);  /* "you" / selected row */
  --live: #5fd4a0;

  /* ---------- Chart palette (categorical, 6) ---------- */
  --chart-1: #6aa0e0; --chart-2: #5fd4a0; --chart-3: #e3b341;
  --chart-4: #c78bff; --chart-5: #ff8f6b; --chart-6: #4fd6e0;
  --chart-grid: var(--border);

  /* ---------- Typography ---------- */
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-ui: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --numeric: tabular-nums slashed-zero;              /* use with font-feature/variant */
  --fs-2xs: .6875rem; --fs-xs: .75rem; --fs-sm: .8125rem; --fs-md: .9375rem;
  --fs-lg: 1.125rem; --fs-xl: 1.375rem; --fs-2xl: 1.75rem; --fs-3xl: 2.25rem;
  --fs-4xl: 3rem; --fs-5xl: 4rem;
  --fs-title: clamp(2.5rem, 7vw, 6rem); --fs-giant: clamp(3rem, 13vw, 11rem);
  --row-h: 68px;
  --lh-tight: 1.1; --lh-snug: 1.3; --lh-normal: 1.5;
  --fw-regular: 400; --fw-medium: 500; --fw-bold: 700;
  --tracking-tight: -.02em; --tracking-caps: .08em;

  /* ---------- Spacing (4px base) ---------- */
  --space-0: 0; --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px; --space-12: 56px; --space-16: 80px;

  /* ---------- Radii & borders ---------- */
  /* ADR 0014: one small scale, never heavy. Square by default; toasts and menus use sm/md. */
  --radius-xs: 0; --radius-sm: 2px; --radius-md: 4px; --radius-lg: 6px;
  --border-width: 1px; --border-width-strong: 2px;
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-text);

  /* ---------- Elevation & glow ---------- */
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-md: 0 6px 18px rgb(0 0 0 / .38);
  --shadow-lg: 0 18px 48px rgb(0 0 0 / .5);
  --glow-accent: 0 0 0 1px var(--accent-line), 0 0 24px color-mix(in oklab, var(--brand) 45%, transparent);
  --glow-gold: 0 0 28px rgb(227 179 65 / .28);
  --glow-live: 0 0 0 3px rgb(95 212 160 / .18);

  /* ---------- Motion ----------
     --motion-speed is the global dial: 1 = default, 0.5 = twice as fast, 2 = slower, 0 = off. */
  --motion-speed: 1;
  --dur-instant: calc(80ms * var(--motion-speed));
  --dur-fast: calc(140ms * var(--motion-speed));
  --dur-base: calc(240ms * var(--motion-speed));
  --dur-slow: calc(420ms * var(--motion-speed));
  --dur-reorder: calc(520ms * var(--motion-speed));
  --dur-draw: calc(1100ms * var(--motion-speed));
  --dur-count: calc(1200ms * var(--motion-speed));
  --dur-pulse: calc(1800ms * var(--motion-speed));
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-snap: cubic-bezier(.3, 0, 0, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --stagger: calc(35ms * var(--motion-speed));
  --ease-expo: cubic-bezier(.16, 1, .3, 1);
  --dur-wipe: calc(520ms * var(--motion-speed));

  /* ---------- Layout ---------- */
  --sidebar-w: 248px; --topbar-h: 60px; --content-max: 1240px;
  --z-sticky: 20; --z-overlay: 100; --z-toast: 200;
}

[data-theme="light"] {
  --accent-text: color-mix(in oklab, var(--brand) 78%, black);   /* 6.9:1 on white */
  --accent-soft: color-mix(in oklab, var(--brand) 11%, transparent);
  --neutral-0: #e9edf3; --neutral-50: #f3f5f9; --neutral-100: #ffffff; --neutral-200: #f6f8fb;
  --neutral-300: #d9e0ea; --neutral-400: #c2ccd9; --neutral-500: #8696ab; --neutral-600: #5b6b80;
  --neutral-700: #43536a; --neutral-800: #2a384b; --neutral-900: #0e1620; --neutral-1000: #000;
  --overlay: rgb(14 22 32 / .45);
  --success: #0b7a4d; --success-soft: rgb(11 122 77 / .1);
  --warning: #8a5a00; --warning-soft: rgb(176 120 0 / .12);
  --danger: #c0262d;  --danger-soft: rgb(192 38 45 / .09);
  --info: #1b62b8;    --info-soft: rgb(27 98 184 / .09);
  --rank-gold: #9a6f00;   --rank-gold-soft: rgb(227 179 65 / .2);
  --rank-silver: #5b6677; --rank-silver-soft: rgb(120 135 155 / .14);
  --rank-bronze: #9a5527; --rank-bronze-soft: rgb(194 122 74 / .16);
  --live: #0b7a4d;
  --accent-hover: color-mix(in oklab, var(--brand) 85%, white); --accent-line: color-mix(in oklab, var(--brand) 55%, transparent);
  --bg: var(--neutral-50); --surface: var(--neutral-100); --surface-raised: var(--neutral-200); --surface-sunken: var(--neutral-0);
  --border: var(--neutral-300); --border-strong: var(--neutral-400); --text: var(--neutral-900); --text-muted: var(--neutral-700); --text-subtle: var(--neutral-600);
  --chart-grid: var(--border); --rank-highlight: var(--accent-soft);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-text);
  --chart-1: #2f62a6; --chart-2: #0b8a58; --chart-3: #b07800;
  --chart-4: #8a45c9; --chart-5: #cc5328; --chart-6: #0b8a96;
  --shadow-sm: 0 1px 2px rgb(14 22 32 / .08);
  --shadow-md: 0 6px 18px rgb(14 22 32 / .1);
  --shadow-lg: 0 18px 48px rgb(14 22 32 / .18);
  --glow-accent: 0 0 0 1px var(--accent-line), 0 0 22px color-mix(in oklab, var(--brand) 22%, transparent);
  --glow-gold: 0 0 28px rgb(227 179 65 / .35);
  --glow-live: 0 0 0 3px rgb(11 122 77 / .16);
}

/* Reduced motion: collapse durations; components also drop transforms/animations */
@media (prefers-reduced-motion: reduce) {
  :root { --motion-speed: 0.001; }
}
[data-motion="off"] { --motion-speed: 0.001; }
