/* tokens.css — 唯一允许定义颜色/字号/间距 token 的文件 */

:root {
  color-scheme: light dark;

  /* —— 文本与背景 —— */
  --ink: #18202a;
  --ink-soft: #5d6978;
  --ink-mute: #8b95a4;
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --bg-elev: #ffffff;
  --line: #d9e0e8;
  --line-soft: #e9eef3;

  /* —— 品牌与语义 —— */
  --accent: #0f766e;
  --accent-soft: #d3eee8;
  --accent-ink: #064e46;
  --link: #0b5cad;
  --link-hover: #0a4a8a;

  --c-warn: #9a3412;
  --c-warn-bg: #fdecd6;
  --c-info: #1d4ed8;
  --c-info-bg: #dde6fb;
  --c-correct: #15803d;
  --c-correct-bg: #d8f0de;
  --c-wrong: #9f1239;
  --c-wrong-bg: #fbe1e7;
  --c-draft: #a16207;
  --c-draft-bg: #fbeec8;
  --c-insight: #6d28d9;
  --c-insight-bg: #ece1fb;

  /* —— 状态色环（mastery 状态机）—— */
  --status-planned: #98a2b3;
  --status-draft: #d97706;
  --status-inprogress: #2563eb;
  --status-verified: #16a34a;

  /* —— 字体 —— */
  --font-cn: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Source Han Sans CN", sans-serif;
  --font-en: "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "SF Mono", "Consolas", monospace;
  --font-stack: var(--font-en), var(--font-cn);

  /* —— 字号 —— */
  --fs-h1: 30px;
  --fs-h2: 22px;
  --fs-h3: 17px;
  --fs-h4: 15px;
  --fs-body: 16px;
  --fs-small: 13px;
  --fs-tiny: 12px;
  --lh-body: 1.72;
  --lh-tight: 1.3;

  /* —— 间距尺度 —— */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;

  /* —— 圆角/阴影 —— */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 4px 12px rgba(15, 23, 42, .08);
  --shadow-lg: 0 10px 24px rgba(15, 23, 42, .12);

  /* —— 布局变量 —— */
  --content-max: 880px;
  --sidebar-w: 280px;
  --toc-w: 220px;
  --breakpoint-md: 900px;
  --breakpoint-lg: 1280px;

  /* —— 动画 —— */
  --t-fast: 120ms ease;
  --t-base: 200ms ease;
}

[data-theme="dark"] {
  --ink: #e6edf3;
  --ink-soft: #9aa5b1;
  --ink-mute: #6f7a87;
  --bg: #0f1419;
  --bg-soft: #161b22;
  --bg-elev: #1c232c;
  --line: #2d333b;
  --line-soft: #232a32;

  --accent: #2dd4bf;
  --accent-soft: #134e48;
  --accent-ink: #99f6e4;
  --link: #58a6ff;
  --link-hover: #79b8ff;

  --c-warn: #fb923c;
  --c-warn-bg: #3a1d09;
  --c-info: #60a5fa;
  --c-info-bg: #0d1f3d;
  --c-correct: #4ade80;
  --c-correct-bg: #0a2918;
  --c-wrong: #fb7185;
  --c-wrong-bg: #38101c;
  --c-draft: #fbbf24;
  --c-draft-bg: #2d1f08;
  --c-insight: #c4b5fd;
  --c-insight-bg: #1f1532;

  --status-planned: #6f7a87;
  --status-draft: #f59e0b;
  --status-inprogress: #60a5fa;
  --status-verified: #4ade80;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 4px 12px rgba(0, 0, 0, .4);
  --shadow-lg: 0 10px 24px rgba(0, 0, 0, .5);
}

/* 系统偏好兜底（用户从未手工切换过时） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --ink: #e6edf3;
    --ink-soft: #9aa5b1;
    --bg: #0f1419;
    --bg-soft: #161b22;
    --bg-elev: #1c232c;
    --line: #2d333b;
    --line-soft: #232a32;
    --accent: #2dd4bf;
    --link: #58a6ff;
  }
}
