/* ============================================================
   tokens.css — 设计令牌（CSS 变量）
   主题切换：html[data-theme="dark|light"]
   外观定制：--primary / --radius / --module-gap / --font-size /
             --font-family / --text-spacing 由 core/theme.js 动态写入
   ============================================================ */

:root {
  /* 主色（theme.js 可覆盖） */
  --primary: #5b6cf0;
  --primary-weak: rgba(91, 108, 240, 0.1);
  --primary-strong: #4753c9;

  /* 圆角 / 间距 / 字号 / 行距 / 字体 */
  --radius: 10px;
  --module-gap: 14px;
  --font-size: 14px;
  --text-spacing: 1.6;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  /* 语义色 */
  --success: #10b981;  --success-bg: rgba(16, 185, 129, .12);
  --info: #3b82f6;     --info-bg: rgba(59, 130, 246, .12);
  --warning: #f59e0b;  --warning-bg: rgba(245, 158, 11, .12);
  --danger: #ef4444;   --danger-bg: rgba(239, 68, 68, .12);

  /* 布局尺寸 */
  --header-h: 64px;
  --footer-h: 274px;   /* 页脚高度兜底值：加载后由 me-footer 按实测高度写入（1440 宽实测 274px，原 240px 偏小） */
  --sidebar-w: 220px;
  --sidebar-w-collapsed: 64px;
  --page-max: 1280px;

  /* 动效 */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur-fast: .15s;
  --dur: .25s;
}

/* ── 浅色 ── */
:root[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-card: #ffffff;
  --bg-soft: #eef0f7;
  --bg-hover: #f1f2f8;
  --bg-input: #f4f5f9;
  --border: #e5e7f0;
  --border-strong: #d4d7e6;
  --text: #1d2129;
  --text-2: #4e5566;
  --text-3: #86909c;
  --shadow-sm: 0 1px 3px rgba(20, 24, 60, .06);
  --shadow-md: 0 4px 14px rgba(20, 24, 60, .08);
  --shadow-lg: 0 12px 32px rgba(20, 24, 60, .12);
  --glass: rgba(255, 255, 255, .82);
}

/* ── 深色 ── */
:root[data-theme="dark"] {
  --bg: #0f1117;
  --bg-card: #181b24;
  --bg-soft: #1f2330;
  --bg-hover: #232838;
  --bg-input: #1c202b;
  --border: #2a2f3e;
  --border-strong: #3a4152;
  --text: #e8eaf2;
  --text-2: #b6bccc;
  --text-3: #7d85a3;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .45);
  --glass: rgba(18, 20, 28, .82);
}

/* ── 高对比度 ── */
:root[data-contrast="high"] {
  --border: currentColor;
}

/* ── 减弱动效 ── */
:root[data-reduce-motion="on"] *,
:root[data-reduce-motion="on"] *::before,
:root[data-reduce-motion="on"] *::after {
  animation-duration: .01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
  scroll-behavior: auto !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
