/* Design tokens. Chrome is neutral ink on warm paper; the data is the only loud thing.
   Series colors are the validated categorical palette: fixed order, light and dark
   steps selected separately, validated against --surface in each mode (never re-order).

   Themes: the light values are the default; `prefers-color-scheme: dark` switches to the
   dark ones unless the visitor forced light; `<html data-theme="dark|light">` (written by
   the server from the `bt_theme` cookie, and by the theme switch) always wins. */

/* Newsreader (variable, optical size axis), self-hosted. SIL Open Font License, see fonts/OFL.txt. */
@font-face {
  font-family: 'Newsreader Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('/static/fonts/newsreader-latin-ext-opsz-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Newsreader Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('/static/fonts/newsreader-latin-opsz-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Flags (🇷🇴, 🏴󠁧󠁢󠁳󠁣󠁴󠁿), self-hosted Twemoji artwork: Windows has no flag emojis and would show
   "RO". Only flag characters use it, so a page without a flag never downloads it.
   CC BY 4.0, see fonts/TWEMOJI-FLAGS.md. */
@font-face {
  font-family: 'Twemoji Country Flags';
  font-display: swap;
  src: url('/static/fonts/twemoji-country-flags.woff2') format('woff2');
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
}

:root {
  color-scheme: light dark;

  --page: #f5f4ef;
  --surface: #fcfcfb;
  --surface-2: #efeee9;
  --surface-3: #e6e5df;
  --line: #e3e2dc;
  --line-strong: #c3c2b7;
  --ink: #111110;
  --ink-2: #4d4c48;
  --muted: #6b6963;
  --focus: #1c5cab;
  --link: #1c5cab;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --danger: #b42318;
  /* A danger fill under white text (buttons, error toasts): at least 4.5:1 with white. */
  --danger-fill: #b42318;
  /* The logo: the light tile and its dark curve, in both themes (and the app's icon). */
  --logo-tile: #f3f2ed;
  --logo-ink: #111110;
  /* The Pro badge: the logo's curve in paper on a warm ochre tile (never a data colour). */
  --pro: #a8580f;
  --pro-ink: #fff8ec;

  /* Categorical series (slot order is the CVD-safety mechanism). */
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --s6: #008300;
  --s7: #4a3aa7;
  --s8: #e34948;
  /* De-emphasis for folded "other options". */
  --s-other: #8f8d86;

  /* Debug playground only: "answer revealed" and the dashed debug frame. */
  --ok: #047857;
  --ok-strong: #059669;
  --ok-ring: #10b981;
  --amber: #f59e0b;
  --amber-strong: #d97706;

  /* Avatar tints (lightness and chroma; the hue comes from the name). */
  --avatar-bg-l: 0.92;
  --avatar-fg-l: 0.35;
  --avatar-fg-c: 0.04;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.08);
  --shadow-lg: 0 10px 24px -4px rgb(0 0 0 / 0.16), 0 4px 8px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 18px 36px -6px rgb(0 0 0 / 0.2), 0 6px 12px -6px rgb(0 0 0 / 0.12);
  --shadow-2xl: 0 28px 60px -10px rgb(0 0 0 / 0.35);

  --font-sans: 'Twemoji Country Flags', system-ui, -apple-system, 'Segoe UI Variable Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Twemoji Country Flags', 'Newsreader Variable', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --page: #0f0f0e;
    --surface: #1a1a19;
    --surface-2: #242422;
    --surface-3: #2e2e2b;
    --line: #2f2f2c;
    --line-strong: #45443f;
    --ink: #f3f2ed;
    --ink-2: #c3c2b7;
    --muted: #9d9b93;
    --focus: #86b6ef;
    --link: #86b6ef;
    --grid: #2c2c2a;
    --axis: #45443f;
    --danger: #f97066;
    --danger-fill: #ce4943;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
    --s6: #008300;
    --s7: #9085e9;
    --s8: #e66767;
    --s-other: #7d7b74;
    --ok: #34d399;
    --pro: #e3a24a;
    --pro-ink: #1c1306;
    --avatar-bg-l: 0.33;
    --avatar-fg-l: 0.9;
    --avatar-fg-c: 0.03;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 24px -4px rgb(0 0 0 / 0.6), 0 4px 8px -4px rgb(0 0 0 / 0.4);
    --shadow-xl: 0 18px 36px -6px rgb(0 0 0 / 0.65), 0 6px 12px -6px rgb(0 0 0 / 0.45);
  }
}

:root[data-theme='light'] {
  color-scheme: light;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --page: #0f0f0e;
  --surface: #1a1a19;
  --surface-2: #242422;
  --surface-3: #2e2e2b;
  --line: #2f2f2c;
  --line-strong: #45443f;
  --ink: #f3f2ed;
  --ink-2: #c3c2b7;
  --muted: #9d9b93;
  --focus: #86b6ef;
  --link: #86b6ef;
  --grid: #2c2c2a;
  --axis: #45443f;
  --danger: #f97066;
  --danger-fill: #ce4943;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --s5: #d55181;
  --s6: #008300;
  --s7: #9085e9;
  --s8: #e66767;
  --s-other: #7d7b74;
  --ok: #34d399;
  --pro: #e3a24a;
  --pro-ink: #1c1306;
  --avatar-bg-l: 0.33;
  --avatar-fg-l: 0.9;
  --avatar-fg-c: 0.03;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 24px -4px rgb(0 0 0 / 0.6), 0 4px 8px -4px rgb(0 0 0 / 0.4);
  --shadow-xl: 0 18px 36px -6px rgb(0 0 0 / 0.65), 0 6px 12px -6px rgb(0 0 0 / 0.45);
}

/* ─── Motion ────────────────────────────────────────────────────────────── */

@keyframes bt-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes bt-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bt-pop {
  0% { opacity: 0; transform: scale(0.92); }
  60% { opacity: 1; transform: scale(1.02); }
  100% { transform: none; }
}

@keyframes bt-draw {
  from { stroke-dashoffset: var(--bt-draw-length, 48); }
  to { stroke-dashoffset: 0; }
}

@keyframes bt-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes bt-breathe {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

@keyframes bt-grow-x {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes bt-spin {
  to { transform: rotate(360deg); }
}
