/* Hoardling colour themes. <html data-theme="..."> comes from the `theme` cookie (themes.py, allow-listed); the picker
   (theme.js) swaps it live. Every block defines EVERY token below with the same names -- a new colour token must be
   added to every theme (tests/test_themes.py parses this file, checks the token list and the contrast minimums:
   text/status tokens >= 4.5:1 on bg, bg-2 and bg-3; focus, mascot, graph kinds, heatmap tops hm4 / hm-ev >= 3:1;
   heatmap ramps bg-3 -> hm1..hm4 and -> hm-ev1..hm-ev: >= 15 L* steps, level 1 >= 2:1 vs bg-3, 3:1 in contrast).
   Swatches in the picker are elements with their own data-theme, so blocks select [data-theme], not only :root.

   Tokens: bg bg-2 bg-3 (page / surface / raised), line, text text-2 muted, star-empty, accent accent-ink (text on
   accent), accent-2 (gold), danger, star, s-<status> x7, g-<graph tag kind> x5, hm1..hm4 (heatmap ramp; hm0 = bg-3),
   hm-ev1 hm-ev2 hm-ev3 hm-ev (Steam-history-only days: hatched ramp by achievements, hm-ev = top), score-bad score-mid score-ok score-good (IGDB rating bands, page + cards: < 50,
   50-69, 70-79, >= 80; text on bg/bg-2/bg-3), focus + focus-w (focus ring), sel-bg sel-text (::selection), mascot
   (empty-state dragon),
   backdrop (dimmed page behind modal dialogs, mixed with transparency in style.css),
   brand-mono (platform logos on profile links: the official mono white on dark themes, black on light; never another value),
   cover-edge, glow, color-scheme. */

/* Ember Dark: the default, and "system" on a dark OS */
:root, [data-theme="ember-dark"] {
  --bg: #15110e; --bg-2: #1f1915; --bg-3: #2a221c; --line: #3a3229;
  --text: #efe6dc; --text-2: #b8ab99; --muted: #968a7a; --star-empty: #4a4036;
  --accent: #ff7a2f; --accent-ink: #1a0d04; --accent-2: #f2b53a; --danger: #ef5a55; --star: #f2b53a;
  --s-want_to_play: #6aa8f0; --s-backlog: #a39a8c; --s-playing: #f2b53a; --s-on_hold: #e08fbf;
  --s-played: #a58de0; --s-completed: #4cc38a; --s-dropped: #ef5a55;
  --g-series: #d9a05b; --g-developer: #7fb0a8; --g-genre: #9a8fb5; --g-theme: #b98a86; --g-similar: #8f8374;
  --score-bad: #ef5a55; --score-mid: #ff8c3a; --score-ok: #e6cf4a; --score-good: #7ccf6a;
  --hm1: #834218; --hm2: #bd6022; --hm3: #f08630; --hm4: #ffbf74; --hm-ev1: #675117; --hm-ev2: #967527; --hm-ev3: #c19d40; --hm-ev: #e7c95f;
  --focus: #ff7a2f; --focus-w: 2px; --sel-bg: #6b3a17; --sel-text: #efe6dc; --mascot: #968a7a; --backdrop: #050302; --brand-mono: #ffffff;
  --cover-edge: inset 0 0 0 1px rgb(255 255 255 / .07);
  --glow: 0 0 0 3px rgb(255 122 47 / .35);
  color-scheme: dark;
}

/* Ember Light ("daylight lair"); the same values serve "system" on a light OS (keep the two blocks identical) */
[data-theme="ember-light"] {
  --bg: #f7f3ec; --bg-2: #fffdf9; --bg-3: #efe8dc; --line: #ddd3c3;
  --text: #221c15; --text-2: #54493c; --muted: #6b5f51; --star-empty: #d6cbb9;
  --accent: #aa4a18; --accent-ink: #ffffff; --accent-2: #8a5d00; --danger: #c0302b; --star: #8a5d00;
  --s-want_to_play: #1f66b8; --s-backlog: #6b6256; --s-playing: #8a5d00; --s-on_hold: #a8437c;
  --s-played: #6a4bb8; --s-completed: #1a7549; --s-dropped: #c0302b;
  --g-series: #8f5c1c; --g-developer: #3c776e; --g-genre: #64588a; --g-theme: #8c5753; --g-similar: #84786a;
  --score-bad: #c0302b; --score-mid: #a64500; --score-ok: #746100; --score-good: #276e18;
  --hm1: #d7945c; --hm2: #b96522; --hm3: #8f3e01; --hm4: #592200; --hm-ev1: #bba066; --hm-ev2: #97772d; --hm-ev3: #715001; --hm-ev: #472e01;
  --focus: #aa4a18; --focus-w: 2px; --sel-bg: #f2c9a5; --sel-text: #221c15; --mascot: #6b5f51; --backdrop: #2a1f14; --brand-mono: #000000;
  --cover-edge: inset 0 0 0 1px rgb(0 0 0 / .1);
  --glow: 0 0 0 3px rgb(170 74 24 / .3);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  [data-theme="system"] {
    --bg: #f7f3ec; --bg-2: #fffdf9; --bg-3: #efe8dc; --line: #ddd3c3;
    --text: #221c15; --text-2: #54493c; --muted: #6b5f51; --star-empty: #d6cbb9;
    --accent: #aa4a18; --accent-ink: #ffffff; --accent-2: #8a5d00; --danger: #c0302b; --star: #8a5d00;
    --s-want_to_play: #1f66b8; --s-backlog: #6b6256; --s-playing: #8a5d00; --s-on_hold: #a8437c;
    --s-played: #6a4bb8; --s-completed: #1a7549; --s-dropped: #c0302b;
    --g-series: #8f5c1c; --g-developer: #3c776e; --g-genre: #64588a; --g-theme: #8c5753; --g-similar: #84786a;
    --score-bad: #c0302b; --score-mid: #a64500; --score-ok: #746100; --score-good: #276e18;
    --hm1: #d7945c; --hm2: #b96522; --hm3: #8f3e01; --hm4: #592200; --hm-ev1: #bba066; --hm-ev2: #97772d; --hm-ev3: #715001; --hm-ev: #472e01;
    --focus: #aa4a18; --focus-w: 2px; --sel-bg: #f2c9a5; --sel-text: #221c15; --mascot: #6b5f51; --backdrop: #2a1f14; --brand-mono: #000000;
    --cover-edge: inset 0 0 0 1px rgb(0 0 0 / .1);
    --glow: 0 0 0 3px rgb(170 74 24 / .3);
    color-scheme: light;
  }
}

/* Midnight Hoard: blue-black sky, gold as the accent, ember as the second metal */
[data-theme="midnight"] {
  --bg: #0e1220; --bg-2: #151a2c; --bg-3: #1e2539; --line: #2d3550;
  --text: #ebe8df; --text-2: #b5b5c2; --muted: #9196ab; --star-empty: #3a4260;
  --accent: #eebd4e; --accent-ink: #171104; --accent-2: #ff9a62; --danger: #ff6f6a; --star: #eebd4e;
  --s-want_to_play: #7fb4ff; --s-backlog: #a7aabb; --s-playing: #eebd4e; --s-on_hold: #ee9cce;
  --s-played: #b6a1f2; --s-completed: #5fd3a0; --s-dropped: #ff6f6a;
  --g-series: #dcae63; --g-developer: #7fbcc4; --g-genre: #a29bd6; --g-theme: #cc9c9c; --g-similar: #8c92aa;
  --score-bad: #ff6f6a; --score-mid: #ff9a52; --score-ok: #ecd85a; --score-good: #80d878;
  --hm1: #67541d; --hm2: #967728; --hm3: #c69e3e; --hm4: #f2c76a; --hm-ev1: #7f4638; --hm-ev2: #b46747; --hm-ev3: #eb8b55; --hm-ev: #ffc092;
  --focus: #eebd4e; --focus-w: 2px; --sel-bg: #36457a; --sel-text: #ebe8df; --mascot: #9196ab; --backdrop: #03050c; --brand-mono: #ffffff;
  --cover-edge: inset 0 0 0 1px rgb(255 255 255 / .08);
  --glow: 0 0 0 3px rgb(238 189 78 / .35);
  color-scheme: dark;
}

/* Den: moss and stone, embers in the hearth */
[data-theme="den"] {
  --bg: #10150f; --bg-2: #171e16; --bg-3: #20291e; --line: #313c2d;
  --text: #e7ebdc; --text-2: #b2baa2; --muted: #919b84; --star-empty: #3f4a39;
  --accent: #ff7d36; --accent-ink: #1a0d04; --accent-2: #e9bb4c; --danger: #f2675c; --star: #e9bb4c;
  --s-want_to_play: #78b2f2; --s-backlog: #a6ac98; --s-playing: #e9bb4c; --s-on_hold: #e897c7;
  --s-played: #b09be8; --s-completed: #62d59c; --s-dropped: #f2675c;
  --g-series: #d9a45f; --g-developer: #84c2a4; --g-genre: #a49bc6; --g-theme: #c79690; --g-similar: #8f9a80;
  --score-bad: #f2675c; --score-mid: #ff8f45; --score-ok: #e6d35a; --score-good: #86d872;
  --hm1: #87451b; --hm2: #c16325; --hm3: #f48933; --hm4: #ffc380; --hm-ev1: #65561d; --hm-ev2: #927b2d; --hm-ev3: #bfa247; --hm-ev: #e5ce62;
  --focus: #ff7d36; --focus-w: 2px; --sel-bg: #3e5a2f; --sel-text: #e7ebdc; --mascot: #919b84; --backdrop: #030502; --brand-mono: #ffffff;
  --cover-edge: inset 0 0 0 1px rgb(255 255 255 / .07);
  --glow: 0 0 0 3px rgb(255 125 54 / .35);
  color-scheme: dark;
}

/* Parchment: warm paper, iron-gall ink, an ember seal */
[data-theme="parchment"] {
  --bg: #f3ead6; --bg-2: #fbf6ea; --bg-3: #e9dcc0; --line: #d2c19e;
  --text: #2a2117; --text-2: #4d4030; --muted: #625240; --star-empty: #cdbb98;
  --accent: #9c3d0e; --accent-ink: #ffffff; --accent-2: #765100; --danger: #a8281f; --star: #765100;
  --s-want_to_play: #1b5aa2; --s-backlog: #605646; --s-playing: #765100; --s-on_hold: #94376e;
  --s-played: #5b40a3; --s-completed: #166640; --s-dropped: #a8281f;
  --g-series: #84521a; --g-developer: #33695f; --g-genre: #5a4e80; --g-theme: #80504b; --g-similar: #7a6c58;
  --score-bad: #a8281f; --score-mid: #9a4100; --score-ok: #6a5800; --score-good: #2a6a18;
  --hm1: #cf8b51; --hm2: #ac5f21; --hm3: #823802; --hm4: #4d1d00; --hm-ev1: #b2975d; --hm-ev2: #8d6e29; --hm-ev3: #674801; --hm-ev: #3d2700;
  --focus: #9c3d0e; --focus-w: 2px; --sel-bg: #e5c08a; --sel-text: #2a2117; --mascot: #625240; --backdrop: #2a2117; --brand-mono: #000000;
  --cover-edge: inset 0 0 0 1px rgb(60 40 10 / .14);
  --glow: 0 0 0 3px rgb(156 61 14 / .3);
  color-scheme: light;
}

/* High contrast: black, white, bright status colours, visible lines and a thick yellow focus ring */
[data-theme="contrast"] {
  --bg: #000000; --bg-2: #0a0a0a; --bg-3: #1a1a1a; --line: #8c8c8c;
  --text: #ffffff; --text-2: #ececec; --muted: #cfcfcf; --star-empty: #6e6e6e;
  --accent: #ffa04d; --accent-ink: #000000; --accent-2: #ffe14d; --danger: #ff8a8a; --star: #ffe14d;
  --s-want_to_play: #8ccaff; --s-backlog: #d4d4d4; --s-playing: #ffe14d; --s-on_hold: #ffa6dc;
  --s-played: #cdbbff; --s-completed: #66f0a8; --s-dropped: #ff8a8a;
  --g-series: #ffc27a; --g-developer: #8fe0d4; --g-genre: #c6bcff; --g-theme: #ffb3ad; --g-similar: #c2c2c2;
  --score-bad: #ff8a8a; --score-mid: #ffae5c; --score-ok: #fff06b; --score-good: #8cff8c;
  --hm1: #98571e; --hm2: #d07729; --hm3: #ffa040; --hm4: #ffdbb3; --hm-ev1: #736721; --hm-ev2: #9f8e2c; --hm-ev3: #ceb642; --hm-ev: #fce066;
  --focus: #ffe14d; --focus-w: 3px; --sel-bg: #ffe14d; --sel-text: #000000; --mascot: #cfcfcf; --backdrop: #000000; --brand-mono: #ffffff;
  --cover-edge: inset 0 0 0 1px rgb(255 255 255 / .35);
  --glow: 0 0 0 3px #ffe14d;
  color-scheme: dark;
}
