/* Astra theme tokens. Dark is default; [data-theme="light"] overrides. Contrast checked
   against WCAG AA for body text (>= 4.5:1) on --bg and --panel in both themes. */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-2: #0f1529;
  --panel: #141b33;
  --panel-2: #1a2342;
  --panel-3: #222c52;
  --line: #28335c;
  --line-2: #34407033;
  --text: #e7eaf6;
  --text-2: #c3c9e0;
  --muted: #9aa3c2;
  --faint: #6f7898;
  --accent: #9b8cff;
  --accent-2: #6ee7d8;
  --accent-ink: #0b1020;
  --accent-soft: #9b8cff26;
  --ok: #4ade9a;
  --ok-soft: #4ade9a22;
  --warn: #fbc34a;
  --warn-soft: #fbc34a22;
  --bad: #fb7185;
  --bad-soft: #fb718522;
  --info: #6cb4ff;
  --info-soft: #6cb4ff22;
  --shadow: 0 1px 0 #ffffff08 inset, 0 10px 30px -12px #00000080;
  --focus: 0 0 0 3px #9b8cff66;

  /* code */
  --code-bg: #0d1326;
  --code-head: #121a33;
  --tok-kw: #c4a7ff;
  --tok-str: #9be89b;
  --tok-num: #ffb86b;
  --tok-com: #7a84a8;
  --tok-fn: #7cc7ff;
  --tok-cls: #ffd479;
  --tok-bi: #6ee7d8;
  --tok-dec: #ff9ac1;
  --tok-op: #aab3d4;

  /* scale + type */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.4rem;
  --fs-2xl: 1.85rem;
  --fs-3xl: 2.3rem;
  --lh: 1.65;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --sidebar-w: 300px;
  --reader-w: 880px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6fb;
  --bg-2: #eef0f8;
  --panel: #ffffff;
  --panel-2: #f3f4fa;
  --panel-3: #e8eaf5;
  --line: #dde1ef;
  --line-2: #cfd4e833;
  --text: #171c33;
  --text-2: #2f3654;
  --muted: #555e7e;
  --faint: #7a82a0;
  --accent: #5b47e0;
  --accent-2: #0f8f84;
  --accent-ink: #ffffff;
  --accent-soft: #5b47e01a;
  --ok: #117a4a;
  --ok-soft: #117a4a18;
  --warn: #8a5a00;
  --warn-soft: #d99a0022;
  --bad: #b4233f;
  --bad-soft: #b4233f16;
  --info: #1d63c4;
  --info-soft: #1d63c416;
  --shadow: 0 1px 2px #1a1f3610, 0 8px 24px -14px #1a1f3640;
  --focus: 0 0 0 3px #5b47e055;

  --code-bg: #f7f8fc;
  --code-head: #eceef7;
  --tok-kw: #6b2fd6;
  --tok-str: #1f7a32;
  --tok-num: #b35300;
  --tok-com: #6a7394;
  --tok-fn: #1260b0;
  --tok-cls: #8a5a00;
  --tok-bi: #0b7d73;
  --tok-dec: #b3246b;
  --tok-op: #4a5272;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-md)/var(--lh) var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-2); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
button { font: inherit; color: inherit; }
code, pre, kbd { font-family: var(--mono); }
::selection { background: var(--accent-soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
