/* =========================================================================
   Design tokens: fonts, color themes, spacing, type scale.
   Every color in the site comes from a variable defined here.

   How themes work:
   - <html data-theme="dark|light"> picks the mode.
   - <html data-palette="chalkboard|midnight|grape|charcoal|ember"> picks the
     background color family.
   js/theme-init.js sets both before the page draws, from saved settings.
   To add a color theme: copy one palette block for dark AND light, give it a
   new name, then add the name to PALETTES in js/settings.js.
   ========================================================================= */

@font-face {
  font-family: "Lexend";
  src: url("/assets/fonts/lexend.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/assets/fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Fonts */
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Lexend", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;

  /* Type scale */
  --fs-xs: 0.78rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.75rem;
  --fs-2xl: 2.5rem;

  /* Spacing scale (4px steps) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  /* Shape */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --content-width: 1200px;
  --tap: 44px; /* minimum touch target */

  /* Colors shared by every palette */
  --accent: #ffc93c;        /* school-bus yellow: main actions */
  --accent-ink: #1a1405;    /* text on yellow */
  --stage-bg: #05080a;      /* behind the game window */
  --stage-text: #ebf2ee;
  --stage-muted: #b5c7bf;

  /* Category colors (used for small dots and tiles) */
  --cat-arcade: #ffc93c;
  --cat-action: #ff6f5e;
  --cat-puzzle: #6fb7ff;
  --cat-strategy: #b48cff;
  --cat-racing: #ff9b3d;
  --cat-platformer: #5fd39a;
  --cat-adventure: #2ec4b6;
  --cat-simulation: #8fd14f;
  --cat-sports: #f478b8;
  --cat-other: #9db2a9;

  /* Default = dark chalkboard. Same values as the block below, so the page
     still looks right if JavaScript is off. */
  --bg: #0f1916;
  --surface: #16231f;
  --surface-2: #1d2d28;
  --line: #2a3d36;
  --text: #ebf2ee;
  --muted: #9db2a9;
  --accent-2: #ff6f5e;
  --link: #ffd66b;
  --focus: #ffc93c;
  --ok: #5fd39a;
  --danger: #ff8a7a;
  --overlay: rgb(10 18 15 / 0.72);
  --shadow: 0 6px 20px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

/* ---------- Dark mode: shared values ---------- */
:root[data-theme="dark"] {
  --accent-2: #ff6f5e;
  --link: #ffd66b;
  --focus: #ffc93c;
  --ok: #5fd39a;
  --danger: #ff8a7a;
  --shadow: 0 6px 20px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}
/* ---------- Light mode: shared values ---------- */
:root[data-theme="light"] {
  --accent-2: #d6483a;
  --ok: #18794e;
  --danger: #b4291b;
  --shadow: 0 6px 18px rgb(20 20 30 / 0.1);
  color-scheme: light;
}

/* ---------- Palettes, dark ---------- */
:root[data-theme="dark"][data-palette="chalkboard"], :root[data-theme="dark"]:not([data-palette]) {
  --bg: #0f1916; --surface: #16231f; --surface-2: #1d2d28; --line: #2a3d36;
  --text: #ebf2ee; --muted: #9db2a9; --overlay: rgb(10 18 15 / 0.72);
}
:root[data-theme="dark"][data-palette="midnight"] {
  --bg: #0d1220; --surface: #141b2e; --surface-2: #1b2440; --line: #2a3555;
  --text: #ecf0fb; --muted: #a3aed0; --overlay: rgb(9 12 24 / 0.72);
}
:root[data-theme="dark"][data-palette="grape"] {
  --bg: #160f1f; --surface: #20172d; --surface-2: #2a1f3a; --line: #3a2d4f;
  --text: #f1ecf8; --muted: #b8a8cf; --overlay: rgb(18 10 26 / 0.72);
}
:root[data-theme="dark"][data-palette="charcoal"] {
  --bg: #121212; --surface: #1b1b1c; --surface-2: #242426; --line: #333336;
  --text: #efefef; --muted: #ababb0; --overlay: rgb(12 12 12 / 0.72);
}
:root[data-theme="dark"][data-palette="ember"] {
  --bg: #1a0f0d; --surface: #251714; --surface-2: #301f1b; --line: #45302a;
  --text: #f7ece9; --muted: #c9aca4; --overlay: rgb(24 12 10 / 0.72);
}

/* ---------- Palettes, light ---------- */
:root[data-theme="light"][data-palette="chalkboard"], :root[data-theme="light"]:not([data-palette]) {
  --bg: #f3f5f0; --surface: #ffffff; --surface-2: #e9eee8; --line: #cfd9d2;
  --text: #12201b; --muted: #4f6359; --link: #0f6b52; --focus: #0f6b52; --overlay: rgb(18 32 27 / 0.7);
}
:root[data-theme="light"][data-palette="midnight"] {
  --bg: #f1f4fa; --surface: #ffffff; --surface-2: #e5eaf5; --line: #cad3e6;
  --text: #121a2e; --muted: #4b5675; --link: #1f4fb5; --focus: #1f4fb5; --overlay: rgb(18 26 46 / 0.7);
}
:root[data-theme="light"][data-palette="grape"] {
  --bg: #f6f2fa; --surface: #ffffff; --surface-2: #ece4f4; --line: #d8cae6;
  --text: #1d1429; --muted: #5d4d72; --link: #6b3fa0; --focus: #6b3fa0; --overlay: rgb(29 20 41 / 0.7);
}
:root[data-theme="light"][data-palette="charcoal"] {
  --bg: #f4f4f4; --surface: #ffffff; --surface-2: #e9e9ea; --line: #d2d2d4;
  --text: #18181a; --muted: #555559; --link: #8a5300; --focus: #8a5300; --overlay: rgb(24 24 26 / 0.7);
}
:root[data-theme="light"][data-palette="ember"] {
  --bg: #faf3f0; --surface: #ffffff; --surface-2: #f3e6e1; --line: #e3cdc5;
  --text: #24130f; --muted: #6d5049; --link: #a33a22; --focus: #a33a22; --overlay: rgb(36 19 15 / 0.7);
}
