/**
 * 设计令牌（design tokens）· 全站唯一真相
 *
 * 本文件是全站颜色、字号、间距、圆角、阴影、层级的**单一来源**。
 * 各页面样式表只允许引用 var(--xxx)，不得再自行定义色值或字号。
 *
 * 背景：改造前 index / pricing / console / admin / developers 五处各自
 * 定义了一套 :root 变量，--green 有 4 个不同取值（#17624c / #126149 /
 * #125d47 / #16624b），--paper 有 4 个取值，行高有 3 种。用户跨页浏览时
 * 主色与底色持续漂移，这是"UI 简陋、布局紊乱"的根因。详见 ADR-0013。
 */

:root {
  /* ---------- 品牌色 ---------- */
  /* 主绿。取原五套值的中位并微调至 WCAG AA：白底对比度 7.2:1 */
  --brand: #16604a;
  --brand-strong: #114a39;   /* hover / active */
  --brand-soft: #e4eee8;     /* 浅底强调块 */
  --brand-ink: #0d3327;      /* 深色文字用的品牌色 */
  --accent: #d9f26a;         /* 柠檬黄，仅用于品牌标记与"推荐"徽章 */
  --accent-ink: #203126;     /* accent 底上的文字色 */

  /* ---------- 中性色 ---------- */
  --ink: #15211d;            /* 正文 */
  --ink-muted: #68736e;      /* 次要说明，白底对比度 4.6:1 */
  --ink-subtle: #8c9691;     /* 占位符等更弱的文字 */
  --line: #dfe5e1;           /* 边框 */
  --line-strong: #c3cec8;    /* 输入框边框，需更明确 */
  --paper: #f4f6f1;          /* 页面底色 */
  --surface: #ffffff;        /* 卡片 */
  --surface-sunken: #f7f9f6; /* 卡片内的次级区块 */
  --surface-dark: #14231e;   /* 侧栏、代码块、toast */
  --surface-dark-ink: #eef4ef;

  /* ---------- 语义色 ---------- */
  --success: #16604a;
  --success-soft: #ddf0e7;
  --warning: #9a6417;
  --warning-soft: #fff8df;
  --warning-line: #d4b84e;
  --danger: #b33b39;
  --danger-soft: #fff0ef;
  --info-soft: #edf4d6;
  --info-line: #9ab735;

  /* ---------- 字体 ---------- */
  --font-sans: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, monospace;

  /* 字号阶梯。改造前 15px 与 16px 混用，此处统一基准为 15px */
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 17px;
  --text-lg: 20px;
  --text-xl: 25px;
  --text-2xl: 32px;
  --text-3xl: clamp(30px, 4.5vw, 40px);
  --text-hero: clamp(34px, 6vw, 58px);

  --leading-tight: 1.15;
  --leading-snug: 1.35;
  --leading-normal: 1.6;

  --weight-normal: 400;
  --weight-medium: 550;
  --weight-bold: 700;
  --weight-black: 800;

  /* ---------- 间距（4px 基准） ---------- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* 页面外边距，随视口收放 */
  --gutter: clamp(16px, 4vw, 52px);

  /* ---------- 圆角 ---------- */
  --radius-sm: 6px;
  --radius: 9px;      /* 按钮、输入框 */
  --radius-md: 12px;
  --radius-lg: 16px;  /* 卡片 */
  --radius-xl: 22px;  /* 首页大卡 */
  --radius-pill: 999px;

  /* ---------- 阴影 ---------- */
  --shadow-sm: 0 1px 2px #15352b0f;
  --shadow: 0 8px 30px #15352b0d;
  --shadow-lg: 0 20px 60px #183b2718;
  --shadow-modal: 0 30px 90px #00000055;

  /* ---------- 焦点环 ---------- */
  /* 改造前四套 CSS 中 focus 共出现 1 次，键盘用户几乎看不到焦点。 */
  --focus-ring: 0 0 0 3px #16604a40;
  --focus-ring-danger: 0 0 0 3px #b33b3940;

  /* ---------- 布局宽度 ---------- */
  --width-page: 1200px;    /* 常规内容页 */
  --width-wide: 1360px;    /* 控制台 / 后台数据页 */
  --width-prose: 900px;    /* 文档类长文 */
  --width-form: 440px;     /* 登录注册卡 */

  /* ---------- 层级 ---------- */
  --z-sticky: 10;
  --z-modal: 100;
  --z-toast: 200;

  /* ---------- 动效 ---------- */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --duration: .18s;
}

/* 尊重系统的减弱动效偏好 */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration: .01ms;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
