/* JAMES OS v3 — design tokens. Dark (default), light and high-contrast themes.
   Contrast of text/controls on their surfaces is checked by tests/unit/contrast.test.mjs (WCAG 2.2 AA). */
:root {
  --bg: #0B1119;
  --bg-2: #0E1620;
  --surface: #14212D;
  --surface-raised: #1B2D3B;
  --surface-sunk: #0F1923;
  --emerald: #5CE2BE;
  --emerald-ink: #06281F;
  --brass: #D8B16E;
  --brass-ink: #2A1E08;
  --ice: #8FD8EC;
  --text: #F3F7F8;
  --muted: #A9B8C2;
  --faint: #7F919E;
  --danger: #F19191;
  --danger-ink: #330C0C;
  --warning: #F0C47A;
  --outline: #334755;
  --outline-strong: #64808F;
  --focus: #8FD8EC;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px rgba(0,0,0,.35);
  --glow: radial-gradient(1200px 400px at 10% -10%, rgba(216,177,110,.10), transparent 60%), radial-gradient(900px 500px at 110% 0%, rgba(92,226,190,.07), transparent 60%);
  --grid-line: rgba(143,216,236,.045);

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Noto Serif", Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Roboto Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 24px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px;
  --tap: 48px;
  --nav-h: 68px;
  --dur: 180ms;
  --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: dark;
}

:root[data-theme="james-light"] {
  --bg: #F3F0E8;
  --bg-2: #ECE8DE;
  --surface: #FFFFFF;
  --surface-raised: #FBF9F4;
  --surface-sunk: #E8E3D7;
  --emerald: #0B7A5E;
  --emerald-ink: #FFFFFF;
  --brass: #8A6420;
  --brass-ink: #FFFFFF;
  --ice: #1D6A85;
  --text: #0E1A24;
  --muted: #475866;
  --faint: #5F6E79;
  --danger: #B42318;
  --danger-ink: #FFFFFF;
  --warning: #8A5A00;
  --outline: #CBD3D9;
  --outline-strong: #6F7E89;
  --focus: #1D6A85;
  --shadow: 0 1px 2px rgba(14,26,36,.06), 0 8px 24px rgba(14,26,36,.08);
  --glow: radial-gradient(1200px 400px at 10% -10%, rgba(138,100,32,.10), transparent 60%), radial-gradient(900px 500px at 110% 0%, rgba(11,122,94,.07), transparent 60%);
  --grid-line: rgba(14,26,36,.035);
  color-scheme: light;
}

:root[data-theme="high-contrast"] {
  --bg: #000000;
  --bg-2: #000000;
  --surface: #0A0A0A;
  --surface-raised: #141414;
  --surface-sunk: #000000;
  --emerald: #7CFFD9;
  --emerald-ink: #000000;
  --brass: #FFD27A;
  --brass-ink: #000000;
  --ice: #A8EBFF;
  --text: #FFFFFF;
  --muted: #E2E8EC;
  --faint: #C9D2D8;
  --danger: #FFA3A3;
  --danger-ink: #000000;
  --warning: #FFD27A;
  --outline: #8A9AA6;
  --outline-strong: #FFFFFF;
  --focus: #FFFF00;
  --shadow: none;
  --glow: none;
  --grid-line: transparent;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    --bg: #F3F0E8; --bg-2: #ECE8DE; --surface: #FFFFFF; --surface-raised: #FBF9F4; --surface-sunk: #E8E3D7;
    --emerald: #0B7A5E; --emerald-ink: #FFFFFF; --brass: #8A6420; --brass-ink: #FFFFFF; --ice: #1D6A85;
    --text: #0E1A24; --muted: #475866; --faint: #5F6E79; --danger: #B42318; --danger-ink: #FFFFFF; --warning: #8A5A00;
    --outline: #CBD3D9; --outline-strong: #6F7E89; --focus: #1D6A85;
    --shadow: 0 1px 2px rgba(14,26,36,.06), 0 8px 24px rgba(14,26,36,.08);
    --glow: radial-gradient(1200px 400px at 10% -10%, rgba(138,100,32,.10), transparent 60%);
    --grid-line: rgba(14,26,36,.035);
    color-scheme: light;
  }
}

:root[data-motion="reduce"] { --dur: 0ms; }
@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]) { --dur: 0ms; } }

/* Sovereign Dynasty palette. Retain the existing high contrast theme. */
:root:not([data-theme="james-light"]):not([data-theme="high-contrast"]) {--bg:#0B1014;--bg-2:#10171B;--surface:#151D23;--surface-raised:#1D2927;--surface-sunk:#10191D;--text:#F0EEE7;--muted:#9FAAAE;--faint:#98A3A7;--brass:#CEAF78;--emerald:#75C6A3;--outline:#303B3D;--outline-strong:#737F80;--glow:none;--shadow:none;--grid-line:transparent;}
:root[data-theme="james-light"] {--bg:#F5F2EB;--bg-2:#EBE8E0;--surface:#FFFEFA;--surface-raised:#E2EAE1;--surface-sunk:#E8EDE6;--text:#212E27;--muted:#526159;--faint:#59665D;--brass:#86642E;--emerald:#286C50;--outline:#D8DDD5;--outline-strong:#7B897E;--glow:none;--shadow:none;--grid-line:transparent;}
@media(prefers-color-scheme:light){:root[data-theme="system"] {--bg:#F5F2EB;--bg-2:#EBE8E0;--surface:#FFFEFA;--surface-raised:#E2EAE1;--surface-sunk:#E8EDE6;--text:#212E27;--muted:#526159;--faint:#59665D;--brass:#86642E;--emerald:#286C50;--outline:#D8DDD5;--outline-strong:#7B897E;--glow:none;--shadow:none;--grid-line:transparent;}}
:root[data-night="on"]:not([data-theme="high-contrast"]){--bg:#080C0F;--surface:#10181C;--surface-raised:#17211F;--brass:#BBA477;--emerald:#7DB396;--text:#D7D6CF;--dur:0ms;}
