/* ==========================================================================
   brand/tokens.css - ChessRecaps brand tokens "Midnight & Gold" (C130, Nov 2026).
   Same variable names as css/skin.css, so it can be applied in one pass:
     - either load it AFTER css/skin.css: <link rel="stylesheet" href="brand/tokens.css">
     - or paste the values over the matching blocks in skin.css.
   New names (no existing equivalent): --neutral, --eval-*, --q-*, --board-*, --arrow-*, --font-display.
   Contrast: every text pairing below passes WCAG AA (see brand/contrast-report.txt).
   ========================================================================== */

/* ---------------- dark (default) ---------------- */
:root,
:root[data-theme="dark"],
:root:not([data-theme="light"]),
[data-theme="dark"] {
  --bg: #0E1322;
  --bg-deep: #0A0E1A;
  --well: #0A0E1A;
  --bg-glow-1: rgba(245, 184, 61, .07);
  --bg-glow-2: rgba(168, 139, 255, .09);
  --surface: #161D30;
  --surface-2: #1F2840;
  --surface-3: #2A3452;
  --surface-glass: rgba(244, 239, 228, .06);
  --text: #F4EFE4;
  --text-2: #B9BFCF;
  --text-3: #8F98AE;
  --border: rgba(244, 239, 228, .08);
  --border-strong: rgba(244, 239, 228, .15);
  --edge: rgba(0, 0, 0, .38);
  --btn-2-bg: #2A3452;
  --btn-2-edge: #121827;

  --accent: #F5B83D;          /* brand gold: primary button, focus, the mark's arrow */
  --accent-2: #FFCB62;        /* hover / top of gradient */
  --accent-deep: #B07D12;     /* 3D button lip */
  --accent-ink: #1A1406;      /* text ON gold (10.3:1). Not white. */
  --accent-text: #F5B83D;     /* gold used as text on dark surfaces */
  --accent-soft: rgba(245, 184, 61, .16);

  --good: #4CC38A;
  --bad: #FF6B6B;
  --warn: #FF9F43;
  --info: #6EA8FF;
  --neutral: #9AA3B8;
  --gold: #F5B83D;
  --gold-deep: #B07D12;
  --purple: #A88BFF;

  --xp: #A88BFF;
  --xp-2: #C7B5FF;
  --xp-deep: #6F4DF0;
  --xp-soft: rgba(168, 139, 255, .18);
  --xp-ink: #160F33;          /* text ON --xp (6.8:1) */

  --c-openings: #4FD1A5;   --c-openings-deep: #1F8F6A;
  --c-middlegame: #FF7A45; --c-middlegame-deep: #B8461C;
  --c-endgame: #38C4E8;    --c-endgame-deep: #13809C;
  --c-profile: #A88BFF;    --c-profile-deep: #6F4DF0;

  --shadow-1: 0 1px 0 rgba(244, 239, 228, .04) inset, 0 2px 0 rgba(0, 0, 0, .22), 0 4px 14px rgba(0, 0, 0, .22);
  --shadow-2: 0 14px 34px rgba(0, 0, 0, .45), 0 3px 8px rgba(0, 0, 0, .30);
  --shadow-3: 0 26px 70px rgba(0, 0, 0, .62);
  --hero-ink: #F4EFE4;
}

/* ---------------- light ---------------- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F6F3EC; --bg-deep: #FFFFFF; --well: #ECE7DC;
    --bg-glow-1: rgba(242, 176, 46, .12); --bg-glow-2: rgba(107, 72, 240, .07);
    --surface: #FFFFFF; --surface-2: #F3EFE6; --surface-3: #E4DED1; --surface-glass: rgba(255, 255, 255, .65);
    --text: #141A2E; --text-2: #4A5268; --text-3: #636B82;
    --border: rgba(20, 26, 46, .09); --border-strong: rgba(20, 26, 46, .16); --edge: rgba(20, 26, 46, .14); --btn-2-bg: #FFFFFF; --btn-2-edge: #D5CEBF;
    --accent: #F2B02E; --accent-2: #F7C04F; --accent-deep: #B07D12; --accent-ink: #1A1406; --accent-text: #8A5C00; --accent-soft: rgba(242, 176, 46, .18);
    --good: #127548; --bad: #C02D2D; --warn: #A64B05; --info: #2563D0; --neutral: #636B82; --gold: #F2B02E; --gold-deep: #B07D12; --purple: #6B48F0;
    --xp: #6B48F0; --xp-2: #8E72FF; --xp-deep: #4F2FD0; --xp-soft: rgba(107, 72, 240, .12); --xp-ink: #FFFFFF;
    --c-openings: #0F8A63; --c-openings-deep: #0B6E4F;
    --c-middlegame: #D4501A; --c-middlegame-deep: #A83E12;
    --c-endgame: #0B83A4; --c-endgame-deep: #0A6A85;
    --c-profile: #6B48F0; --c-profile-deep: #4F2FD0;
    --shadow-1: 0 1px 0 rgba(20, 26, 46, .04), 0 2px 0 rgba(20, 26, 46, .05), 0 6px 18px rgba(20, 26, 46, .06);
    --shadow-2: 0 14px 34px rgba(20, 26, 46, .12), 0 3px 8px rgba(20, 26, 46, .06);
    --shadow-3: 0 26px 70px rgba(20, 26, 46, .22);
    --hero-ink: #FFFFFF;
  }
}
:root[data-theme="light"], [data-theme="light"] {
  --bg: #F6F3EC; --bg-deep: #FFFFFF; --well: #ECE7DC;
  --bg-glow-1: rgba(242, 176, 46, .12); --bg-glow-2: rgba(107, 72, 240, .07);
  --surface: #FFFFFF; --surface-2: #F3EFE6; --surface-3: #E4DED1; --surface-glass: rgba(255, 255, 255, .65);
  --text: #141A2E; --text-2: #4A5268; --text-3: #636B82;
  --border: rgba(20, 26, 46, .09); --border-strong: rgba(20, 26, 46, .16); --edge: rgba(20, 26, 46, .14); --btn-2-bg: #FFFFFF; --btn-2-edge: #D5CEBF;
  --accent: #F2B02E; --accent-2: #F7C04F; --accent-deep: #B07D12; --accent-ink: #1A1406; --accent-text: #8A5C00; --accent-soft: rgba(242, 176, 46, .18);
  --good: #127548; --bad: #C02D2D; --warn: #A64B05; --info: #2563D0; --neutral: #636B82; --gold: #F2B02E; --gold-deep: #B07D12; --purple: #6B48F0;
  --xp: #6B48F0; --xp-2: #8E72FF; --xp-deep: #4F2FD0; --xp-soft: rgba(107, 72, 240, .12); --xp-ink: #FFFFFF;
  --c-openings: #0F8A63; --c-openings-deep: #0B6E4F;
  --c-middlegame: #D4501A; --c-middlegame-deep: #A83E12;
  --c-endgame: #0B83A4; --c-endgame-deep: #0A6A85;
  --c-profile: #6B48F0; --c-profile-deep: #4F2FD0;
  --shadow-1: 0 1px 0 rgba(20, 26, 46, .04), 0 2px 0 rgba(20, 26, 46, .05), 0 6px 18px rgba(20, 26, 46, .06);
  --shadow-2: 0 14px 34px rgba(20, 26, 46, .12), 0 3px 8px rgba(20, 26, 46, .06);
  --shadow-3: 0 26px 70px rgba(20, 26, 46, .22);
  --hero-ink: #FFFFFF;
}

/* ---------------- scheme-independent ---------------- */
:root {
  /* type: Manrope (Google Fonts) with the system stack as fallback; tabular figures for every number that matters */
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: var(--font);
  --fs-xs: 12px; --fs-sm: 13.5px; --fs-base: 15.5px; --fs-md: 18px; --fs-lg: 22px; --fs-xl: 28px; --fs-2xl: 36px; --fs-display: 48px;
  --fw-body: 500; --fw-strong: 700; --fw-heavy: 800;

  /* eval bar (same in both themes: it shows the two sides of the board) */
  --eval-white: #F4EFE4;      /* white's share */
  --eval-black: #1B2235;      /* black's share */
  --eval-ink-on-white: #141A2E;
  --eval-ink-on-black: #F4EFE4;
  --eval-mid: #F5B83D;        /* optional 0.0 tick */

  /* move-quality scale (recap badges, accuracy charts) */
  --q-best: #4CC38A;          /* best / excellent */
  --q-good: #9AA3B8;          /* good / book: quiet, neutral */
  --q-inaccuracy: #F5D04C;
  --q-mistake: #FF9F43;
  --q-blunder: #FF6B6B;
  --q-brilliant: #38C4E8;

  /* brand board (optional default for BOARD_THEMES: "Midnight") + analysis arrows */
  --board-light: #E3DDCF;
  --board-dark: #6B7BA4;
  --board-last-move: rgba(245, 184, 61, .42);
  --board-mistake: rgba(255, 107, 107, .55);
  --arrow-best: rgba(245, 184, 61, .92);
  --arrow-played: rgba(255, 107, 107, .80);
}

/* the 3 tokens that changed meaning: gold primary buttons need dark text, XP buttons too in dark mode */
.btn-primary { --btn-fg: var(--accent-ink); }
.btn-xp { --btn-fg: var(--xp-ink); text-shadow: none; }
/* Home's hero uses the brand gold, so its text must be the dark ink too */
#panel-home, [data-accent="home"] { --hero-ink: var(--accent-ink); }
.eval-bar { background: var(--eval-black); }
.eval-bar > i { background: var(--eval-white); }

/* ==========================================================================
   C127: the brand applied to the app (BRAND.md sec. 6). Everything brand-specific lives in THIS file, so removing
   its <link> in index.html brings the old look back in one step.
   ========================================================================== */
:root { --tab-ink: #0E1322; }
:root[data-theme="light"], [data-theme="light"] { --tab-ink: #FFFFFF; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --tab-ink: #FFFFFF; } }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-feature-settings: "tnum" 0; }
.t-num, .pl b, .app-period-btn { font-variant-numeric: tabular-nums; }
h1, h2 { letter-spacing: -.015em; }

/* the mark: R + rook stem + gold best-move arrow (brand/logo-mark.svg) */
.app-logo, .boot-logo {
  background: url("logo-mark.svg") center / cover no-repeat !important;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .28), 0 6px 16px rgba(0, 0, 0, .18) !important;
}
.boot-logo { animation: none; box-shadow: 0 10px 30px rgba(0, 0, 0, .35) !important; }
/* the wordmark: ChessRecaps with a gold R (the same idea as the mark) */
.brand-wordmark { font-weight: 800; letter-spacing: -.035em; }
.brand-wordmark b { display: inline-block; background: none; -webkit-text-fill-color: currentColor; color: var(--text); }
.brand-wordmark b::first-letter { color: var(--accent-text); -webkit-text-fill-color: var(--accent-text); }

/* buttons: gold primary with dark ink, no text shadow; tab-coloured buttons use dark ink on the bright dark-theme accents */
.btn-primary, .app-onb-sites .chip[aria-pressed="true"] { text-shadow: none; }
.btn-tab { --btn-fg: var(--tab-ink); text-shadow: none; }
.btn { letter-spacing: 0; }

/* hero cards: a midnight card (both themes) with a soft glow of the area colour and the one gold button */
.card-hero {
  --hero-ink: #F4EFE4;
  background:
    radial-gradient(70% 95% at 108% -12%, color-mix(in srgb, var(--tab-accent) 34%, transparent) 0%, transparent 70%),
    radial-gradient(60% 80% at -12% 112%, rgba(245, 184, 61, .13) 0%, transparent 70%),
    linear-gradient(160deg, #1D2645 0%, #121a31 58%, #0B0F1C 100%);
  box-shadow: inset 0 0 0 1px rgba(244, 239, 228, .07), 0 4px 0 #060912, var(--shadow-2);
}
.card-hero::before {
  background: conic-gradient(from var(--spin), transparent 0 60%, rgba(245, 184, 61, .70) 72%, color-mix(in srgb, var(--tab-accent) 80%, transparent) 80%, transparent 90%);
  opacity: .5;
}
.card-hero::after { background: linear-gradient(180deg, rgba(244, 239, 228, .06), transparent 40%); }
.card-hero p, .card-hero .muted { color: rgba(244, 239, 228, .80); }
.card-hero .t-eyebrow { color: color-mix(in srgb, var(--tab-accent) 55%, #F4EFE4); }
#panel-home .card-hero .t-eyebrow { color: #F5B83D; }
.card-hero .btn-primary.hero-go {
  --btn-bg: #F5B83D; --btn-fg: #1A1406; --btn-sh: #B07D12; text-shadow: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 var(--press) 0 var(--btn-sh), 0 calc(var(--press) + 6px) 18px rgba(245, 184, 61, .22);
}
.card-hero .btn-primary.hero-go:active { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 0 var(--btn-sh); }
.card-hero .btn-primary:not(.hero-go) { --btn-bg: #F4EFE4; --btn-fg: #141A2E; }
.card-hero .btn-secondary { --btn-bg: rgba(244, 239, 228, .12); --btn-fg: #F4EFE4; --btn-sh: rgba(0, 0, 0, .35); }
.card-hero .progress-bar > i { background: linear-gradient(90deg, #FFCB62, #F5B83D); }
#panel-home, [data-accent="home"] { --hero-ink: #F4EFE4; }

/* the eval bar and clocks use the brand ivory / navy */
.eval-bar { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .3); }
.eval-bar > b { color: var(--eval-ink-on-white); }
.player-strip .clock.is-on { background: var(--eval-white); color: var(--eval-ink-on-white); }

/* selected chips and the nav: gold for "you are here" on Home, the area colour elsewhere */
.app-skip:focus, .app-skip:focus-visible { outline-color: var(--accent); }
.app-nav-item[data-tab="home"][aria-current="page"] { color: var(--accent-text); }
/* the Profile player card and the setup checklist hero: midnight, like every hero */
.pf-hero { background: radial-gradient(420px 260px at 100% 0%, rgba(245, 184, 61, .16), transparent 62%), radial-gradient(380px 260px at 0% 100%, rgba(168, 139, 255, .14), transparent 62%), linear-gradient(160deg, #1D2645 0%, #121a31 58%, #0B0F1C 100%); color: #F4EFE4;
  box-shadow: inset 0 0 0 1px rgba(244, 239, 228, .07), var(--shadow-2); }
.card-ico:not([style]) { color: var(--accent-ink); }
