/*
 * tokens.css - every color Pyxis uses, in one place.
 *
 * Themes (set on <html data-brand="...">):  classic (default), sea, night, violet
 * Modes  (set on <html data-mode="...">):   light, dark
 * theme.js sets both attributes from the person's saved choice before the page paints.
 *
 * The platform colors (--ig blue, --yt orange, --tt green) and status colors are the same in every
 * theme on purpose: they are the colorblind-checked chart colors and must stay distinguishable.
 * Only surfaces, text and the accent (buttons, logo) change between themes.
 *
 * Also the one font, used by every page: Switzer (Fontshare, ITF Free Font License, see fonts/switzer/LICENSE-FFL.txt).
 * Self-hosted because the site's Content-Security-Policy only allows fonts from this site. The variable files cover
 * every weight, so in-between weights like 650 draw exactly. The licence forbids modifying these files (no
 * subsetting or converting) and passing them on to anyone else.
 */

@font-face {
  font-family: "Switzer";
  src: url("/fonts/switzer/Switzer-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Switzer";
  src: url("/fonts/switzer/Switzer-VariableItalic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
:root { --font-sans: "Switzer", system-ui, -apple-system, "Segoe UI", sans-serif; }

/* ---------- Classic, light (the default) ---------- */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f1f0ec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04);

  /* Platform identity (categorical slots 1-3, validated) */
  --ig: #2a78d6;
  --yt: #eb6834;
  --tt: #1baf7a;

  --bar: #52514e;
  --bar-track: #ecebe6;
  --accent: #0b0b0b;
  --accent-ink: #ffffff;

  --good-ink: #006300;
  --good-bg: #e4f1e4;
  --bad-ink: #a8431c;
  --bad-bg: #fbeae2;
  --neutral-bg: #efeee9;
}

/* ---------- Dark mode: platform + status colors (all themes), and Classic surfaces ---------- */
:root[data-mode="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --shadow: none;
  --ig: #3987e5;
  --yt: #d95926;
  --tt: #199e70;
  --bar: #c3c2b7;
  --bar-track: #2c2c2a;
  --accent: #f0efec;
  --accent-ink: #0b0b0b;
  --good-ink: #0ca30c;
  --good-bg: #13291a;
  --bad-ink: #ec835a;
  --bad-bg: #33200f;
  --neutral-bg: #2a2a28;
}

/* If JavaScript is off, follow the visitor's system setting (Classic only) */
@media (prefers-color-scheme: dark) {
  :root:not([data-mode]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
    --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10); --shadow: none;
    --ig: #3987e5; --yt: #d95926; --tt: #199e70;
    --bar: #c3c2b7; --bar-track: #2c2c2a; --accent: #f0efec; --accent-ink: #0b0b0b;
    --good-ink: #0ca30c; --good-bg: #13291a; --bad-ink: #ec835a; --bad-bg: #33200f; --neutral-bg: #2a2a28;
  }
}

/* ---------- Deep Sea: cool white and navy ---------- */
:root[data-brand="sea"] {
  --page: #f3f7fc; --surface: #ffffff; --surface-2: #e8eff8;
  --ink: #0a1f3d; --ink-2: #435670; --muted: #7788a0;
  --grid: #dce5f0; --axis: #b8c6d8; --border: rgba(10, 31, 61, 0.12);
  --bar: #3f5f8a; --bar-track: #e0e9f4; --neutral-bg: #e6edf6;
  --accent: #0b2c5c; --accent-ink: #ffffff;
}
:root[data-brand="sea"][data-mode="dark"] {
  --page: #07111f; --surface: #0d1b30; --surface-2: #142642;
  --ink: #e6eef9; --ink-2: #a3b5cc; --muted: #6f829c;
  --grid: #1a2d49; --axis: #284264; --border: rgba(255, 255, 255, 0.10);
  --bar: #a3b5cc; --bar-track: #1a2d49; --neutral-bg: #162a46;
  --accent: #8fb8ff; --accent-ink: #06152b;
}

/* ---------- Night Sky: star-gold on indigo (cream and navy in light mode) ---------- */
:root[data-brand="night"] {
  --page: #fbf8ee; --surface: #fffdf6; --surface-2: #f3eedd;
  --ink: #14172e; --ink-2: #4d5170; --muted: #85889f;
  --grid: #e8e2cf; --axis: #cfc8b0; --border: rgba(20, 23, 46, 0.12);
  --bar: #4d5170; --bar-track: #eee8d6; --neutral-bg: #f0ebd9;
  --accent: #14172e; --accent-ink: #f4c150;
}
:root[data-brand="night"][data-mode="dark"] {
  --page: #0a0c18; --surface: #12162a; --surface-2: #1a1f38;
  --ink: #f3f1e8; --ink-2: #b9bdd4; --muted: #7c82a3;
  --grid: #232846; --axis: #323859; --border: rgba(255, 255, 255, 0.10);
  --bar: #b9bdd4; --bar-track: #232846; --neutral-bg: #1f2440;
  --accent: #f4c150; --accent-ink: #1a1305;
}

/* ---------- Violet: lavender and bright purple ---------- */
:root[data-brand="violet"] {
  --page: #faf9ff; --surface: #ffffff; --surface-2: #f0eefc;
  --ink: #17142e; --ink-2: #55527a; --muted: #8a87a8;
  --grid: #e6e3f5; --axis: #c9c5e4; --border: rgba(23, 20, 46, 0.11);
  --bar: #55527a; --bar-track: #ebe8f8; --neutral-bg: #eeebfa;
  --accent: #5b4bdb; --accent-ink: #ffffff;
}
:root[data-brand="violet"][data-mode="dark"] {
  --page: #0e0c1f; --surface: #17142f; --surface-2: #201c40;
  --ink: #efedfb; --ink-2: #b3afd6; --muted: #7b77a3;
  --grid: #262250; --axis: #37326a; --border: rgba(255, 255, 255, 0.10);
  --bar: #b3afd6; --bar-track: #262250; --neutral-bg: #221e46;
  --accent: #8b7cff; --accent-ink: #0e0a28;
}
