/* Akademiya design tokens (docs/design/visual-refresh.md, section 3). Dark
   first; the light theme keeps the same names and follows the system unless
   the theme button picked one. Components use these role tokens only: raw
   colour values live in this file. scripts/check-tokens.mjs checks the
   contrast of the text and border pairs and that the two light blocks match. */
:root {
  /* ---- colour: surfaces by elevation level (0 bg, 1 surface, 2 raised, 3 overlay) ---- */
  --bg: #090b0c;
  --surface: #101415;
  --raised: #171c1e;
  --overlay: #1d2427;
  /* borders: --line is decorative, --line-input bounds a control (3:1) */
  --line: #252e32;
  --line-input: #66757b;
  --line-strong: #2c373f; /* old name, until components move to --line-input */
  /* text */
  --text: #e6edef;
  --muted: #9eabb0;
  --faint: #808e94;
  /* accent: the one primary, current nav, focus ring, progress */
  --accent: #03fcfc;
  --accent-ink: #001a1a;
  --accent-text: #5fe6e8;
  --accent-soft: rgb(3 252 252 / 0.08);
  /* deltas and warnings only */
  --up: #5fe39a;
  --down: #ff8f7a;
  --warn: #f4c95d;
  --down-ink: #1a0500; /* text on a --down fill (confirm dialogs) */
  /* rarity: items and characters only */
  --r5: #f0b44c; --r4: #b48cf0; --r3: #6fa5d8;
  /* elements: characters only */
  --pyro: #ff8a66; --hydro: #6fb4ff; --electro: #c39bff; --cryo: #8ee3f2;
  --anemo: #74dcbc; --geo: #f0c75e; --dendro: #a6d977; --physical: #b8c0c3;
  /* focus ring */
  --focus: var(--accent);
  /* chart series that aren't characters (Okabe-Ito, colour-blind safe) */
  --series-1: #cc79a7; --series-2: #f0e442; --series-3: #d55e00; --series-4: #56b4e9;
  --series-5: #e69f00; --series-6: #009e73; --series-7: #0072b2;
  /* elevation */
  --shadow-pop: 0 1px 0 rgb(255 255 255 / 0.04) inset, 0 16px 40px -12px rgb(0 0 0 / 0.7);
  --scrim: rgb(0 0 0 / 0.6);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%239eabb0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); /* select chevron, --muted */

  /* ---- type ---- */
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --cond: 'IBM Plex Sans Condensed', 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --num: var(--mono); /* role: numbers */
  --fs-2xs: 0.6875rem;  /* 11px micro-labels, badges */
  --fs-xs: 0.75rem;     /* 12px captions, table heads, eyebrow */
  --fs-sm: 0.8125rem;   /* 13px secondary text, hints, status */
  --fs-md: 0.875rem;    /* 14px UI body, buttons, tables */
  --fs-base: 1rem;      /* 16px prose, panel titles, inputs on touch */
  --fs-lg: 1.125rem;    /* 18px card titles, dialog titles */
  --fs-xl: 1.5rem;      /* 24px page title */
  --fs-num-lg: 1.75rem; /* 28px showcase DPS */
  --fs-num-xl: 2.25rem; /* 36px team DPS */
  --lh-tight: 1.2; --lh-snug: 1.35; --lh-body: 1.5;
  --tracking-label: 0.08em;
  --w-regular: 400; --w-medium: 500; --w-semi: 600;

  /* ---- space (4 px base) ---- */
  --s0: 2px; --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px;
  --pad-panel: var(--s5);
  --pad-card: var(--s3);
  --gap-stack: var(--s5);
  --gap-grid: var(--s3);
  --gap-inline: var(--s2);
  /* control and row heights: desktop density, raised for touch below */
  --ctl-h: 36px;
  --ctl-h-sm: 28px;
  --row-h: 40px;
  --row-h-dense: 32px;

  /* ---- radius and borders ---- */
  --r-sm: 4px;     /* badges, roll pills */
  --r-md: 6px;     /* buttons, inputs, cards */
  --r-lg: 10px;    /* panels, dialogs, drawer, showcase */
  --r-full: 999px; /* avatars, avatar tabs, filter chips */
  --bw: 1px;
  --key: 3px;      /* key line: current nav, selected card */

  --rail: 88px;
  --topbar: 56px;
  color-scheme: dark;
  /* older names, still used by component styles; removed in the review pass */
  --radius: var(--r-md);
  --input: var(--raised); --good: var(--up); --bad: var(--down); --bar: var(--accent); --space: 8px;
}
/* Touch screens and narrow windows keep 44 px targets. */
@media (pointer: coarse), (max-width: 1023px) {
  :root { --ctl-h: 44px; --ctl-h-sm: 40px; --row-h: 48px; --pad-panel: var(--s4); }
}
/* On touch every target, small ones too, stays at least 44 px. */
@media (pointer: coarse) { :root { --ctl-h-sm: 44px; } }

/* Light theme. The same values appear twice, here and in the
   prefers-color-scheme block below (the media query can't share a selector
   list with the attribute one). Change both: check-tokens.mjs diffs them. */
:root[data-theme="light"] {
  --bg: #f4f6f7;
  --surface: #ffffff;
  --raised: #eef2f4;
  --overlay: #ffffff;
  --line: #dde3e7;
  --line-input: #7d8a91;
  --line-strong: #c4cdd3;
  --text: #0d1417;
  --muted: #4b5960;
  --faint: #5b6a71;
  --accent: #007379;
  --accent-ink: #ffffff;
  --accent-text: #006e74;
  --accent-soft: rgb(0 115 121 / 0.08);
  --up: #1f7a45;
  --down: #b3361f;
  --warn: #855d00;
  --down-ink: #ffffff;
  --r5: #8c6000; --r4: #7446b8; --r3: #2f6aa3;
  --pyro: #b83d1a; --hydro: #2268b0; --electro: #7a3fc0; --cryo: #17707f;
  --anemo: #1a7a5e; --geo: #8a660e; --dendro: #437320; --physical: #56636a;
  --shadow-pop: 0 1px 2px rgb(16 24 28 / 0.06), 0 12px 32px -12px rgb(16 24 28 / 0.18);
  --scrim: rgb(16 24 28 / 0.45);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%234b5960' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f6f7;
    --surface: #ffffff;
    --raised: #eef2f4;
    --overlay: #ffffff;
    --line: #dde3e7;
    --line-input: #7d8a91;
    --line-strong: #c4cdd3;
    --text: #0d1417;
    --muted: #4b5960;
    --faint: #5b6a71;
    --accent: #007379;
    --accent-ink: #ffffff;
    --accent-text: #006e74;
    --accent-soft: rgb(0 115 121 / 0.08);
    --up: #1f7a45;
    --down: #b3361f;
    --warn: #855d00;
    --down-ink: #ffffff;
  --down-ink: #ffffff;
    --r5: #8c6000; --r4: #7446b8; --r3: #2f6aa3;
    --pyro: #b83d1a; --hydro: #2268b0; --electro: #7a3fc0; --cryo: #17707f;
    --anemo: #1a7a5e; --geo: #8a660e; --dendro: #437320; --physical: #56636a;
    --shadow-pop: 0 1px 2px rgb(16 24 28 / 0.06), 0 12px 32px -12px rgb(16 24 28 / 0.18);
    --scrim: rgb(16 24 28 / 0.45);
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%234b5960' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%234b5960' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    color-scheme: light;
  }
}
/* The shared palettes (palettes.css, design round 5). palette.js always sets
   data-palette (Settings; default sumi) and data-mode (the theme in effect),
   so Akademiya's roles follow the palette in use; the values above are the
   fallback when scripts don't run. Rarity and chart series keep their own
   values; check-tokens.mjs checks them against every palette's surfaces.
   A palette promises AA for coloured text on --bg and --surface (ink and
   ink-2 on --raised too), so coloured text never sits on --raised.
   These blocks come after the light ones, at the same specificity, so they win. */
:root[data-palette] {
  --text: var(--ink);
  --muted: var(--ink-2);
  --faint: var(--ink-2);
  --overlay: var(--surface); /* popovers and dialogs: coloured text is AA on --surface */
  --input: var(--raised);
  --line-input: var(--line-strong);
  --accent-ink: var(--on-accent);
  --accent-text: var(--accent);
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
  --up: var(--good);
  --down: var(--bad);
  --pyro: var(--c1); --hydro: var(--c2); --dendro: var(--c3); --electro: var(--c4);
  --geo: var(--c5); --anemo: var(--c6); --cryo: var(--c7); --physical: var(--c8);
}
:root[data-palette][data-mode="dark"] { --down-ink: var(--bg); color-scheme: dark; }
:root[data-palette][data-mode="light"] { --down-ink: var(--surface); color-scheme: light; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
