/* ============================================================================
   立立继开 lilijk — 公司级共享设计令牌（Single Source of Truth）
   ============================================================================
   谁用：官网 lilijk.com / 控制台 mm.lilijk.com / surg / me / MasterBot
   怎么用：
     · 官网：`static/css/tokens.css` 由构建脚本从本文件复制（见 website/tools/build.py）
     · 控制台：`client/src/index.css` 顶部 `@import` 本文件，删掉自己重复的那几段
     · Next.js（surg / me）：`globals.css` 顶部 `@import`
   三层结构（组件**只允许**用 semantic 与 component 层）：
     primitive（--p-*）→ semantic（--surface-* / --text-* / --accent-* …）→ component（--button-* …）
   换肤只改 `[data-theme='dark']` 与 `prefers-color-scheme` 两块，组件零改动。
   结构：primitive（色阶）→ semantic（语义）→ component（接口）。
   标准：WCAG 2.2 AA 起，正文按 AAA 取色；令牌命名遵循 DTCG 的"角色而非外观"。
   生成日期：2026-11-06
   ============================================================================ */

:root {
  color-scheme: light;

  /* ---- primitive：色阶。组件里禁止直接使用 ---------------------------- */
  --p-accent-50: #d1fff3;
  --p-accent-100: #a7fae5;
  --p-accent-200: #87e8d2;
  --p-accent-300: #5ad3b9;
  --p-accent-400: #00ba9f;
  --p-accent-500: #009c85;
  --p-accent-600: #00806c;
  --p-accent-700: #036556;
  --p-accent-800: #084e42;
  --p-accent-900: #093930;
  --p-neutral-0: #ffffff;
  --p-neutral-50: #f8fbfa;
  --p-neutral-100: #f0f3f2;
  --p-neutral-200: #e4e7e6;
  --p-neutral-300: #d3d7d6;
  --p-neutral-400: #b8bbba;
  --p-neutral-500: #959998;
  --p-neutral-600: #737776;
  --p-neutral-700: #545856;
  --p-neutral-800: #373a39;
  --p-neutral-900: #1e2120;
  --p-neutral-950: #0f1110;
  --p-neutral-975: #070908;


  /* ---- 字体：一个字族优先；中文走系统黑体，大标题可用衬线 ---------------- */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Songti SC", "Noto Serif SC", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, monospace;

  /* ---- 字阶：约 1.2 的收敛比例，避免"每级都想要存在感" ---------------- */
  --text-2xs: 11px;   --leading-2xs: 1.45;
  --text-xs: 12px;    --leading-xs: 1.45;
  --text-sm: 13px;    --leading-sm: 1.5;
  --text-base: 15px;  --leading-base: 1.6;
  --text-md: 16px;    --leading-md: 1.6;
  --text-lg: 18px;    --leading-lg: 1.55;
  --text-xl: 21px;    --leading-xl: 1.4;
  --text-2xl: 25px;   --leading-2xl: 1.3;
  --text-3xl: 31px;   --leading-3xl: 1.22;
  --text-4xl: 39px;   --leading-4xl: 1.16;
  --text-5xl: 48px;   --leading-5xl: 1.1;
  --text-6xl: 60px;   --leading-6xl: 1.04;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --tracking-tight: -0.02em;
  --tracking-normal: -0.005em;
  --tracking-wide: 0.08em;

  /* ---- 间距：4 的倍数，8 的节奏 -------------------------------------- */
  --space-0: 0;      --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; --space-20: 80px;
  --space-24: 96px;

  /* ---- 圆角：一套系统；嵌套时外圆角 = 内圆角 + 间距 ------------------- */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 999px;

  /* ---- 动效：短、准、可预期；退出比进入更快 --------------------------- */
  --duration-instant: 80ms;
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --duration-slow: 320ms;
  --duration-page: 420ms;
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);

  /* ---- 布局 ---------------------------------------------------------- */
  --layout-gutter: clamp(16px, 4vw, 48px);
  --layout-max: 1200px;
  --layout-max-wide: 1440px;
  --layout-sidebar: 264px;
  --layout-topbar: 60px;
  --layout-measure: 68ch;

  /* ---- 层级：只用这几档，禁止随手 z-index: 9999 ----------------------- */
  --z-base: 0;
  --z-sticky: 100;
  --z-dropdown: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;

  --shadow-xs: 0 1px 2px rgb(15 17 16 / 0.05);
  --shadow-sm: 0 1px 3px rgb(15 17 16 / 0.07), 0 1px 2px rgb(15 17 16 / 0.05);
  --shadow-md: 0 4px 12px rgb(15 17 16 / 0.08), 0 1px 3px rgb(15 17 16 / 0.06);
  --shadow-lg: 0 16px 40px rgb(15 17 16 / 0.12), 0 4px 12px rgb(15 17 16 / 0.07);

  /* ---- semantic：组件只允许用这一层 ----------------------------------- */
  --surface-base: #f8fbfa;
  --surface-raised: #FFFFFF;
  --surface-sunken: #f0f3f2;
  --surface-overlay: #FFFFFF;
  --surface-inverse: #1e2120;
  --text-primary: #0f1110;
  --text-secondary: #606665;
  --text-tertiary: #6e7473;
  --text-disabled: #9ea5a3;
  --text-on-accent: #FFFFFF;
  --border-subtle: #e4e7e6;
  --border-default: #d3d7d6;
  --border-strong: #868f8c;
  --accent-solid: #00806c;
  --accent-hover: #036556;
  --accent-active: #084e42;
  --accent-subtle: #d1fff3;
  --accent-text: #00806c;
  --success-solid: #008240;
  --success-subtle: #e2f6e6;
  --success-text: #00612e;
  --warning-solid: #906100;
  --warning-subtle: #fceeda;
  --warning-text: #6c4800;
  --danger-solid: #b0423b;
  --danger-subtle: #ffebe8;
  --danger-text: #8b2823;
  --info-solid: #1a6dbc;
  --info-subtle: #e6f2ff;
  --info-text: #005093;
  --focus-ring: #00806c;
  --scrim: rgb(18 20 22 / 0.45);

  /* ---- component：在语义层上派生，不引入新色值 ------------------------ */
  --button-primary-bg: var(--accent-solid);
  --button-primary-bg-hover: var(--accent-hover);
  --button-primary-bg-active: var(--accent-active);
  --button-primary-fg: var(--text-on-accent);
  --button-secondary-bg: var(--surface-raised);
  --button-secondary-border: var(--border-default);
  --input-bg: var(--surface-raised);
  --input-border: var(--border-default);
  --input-border-focus: var(--focus-ring);
  --card-bg: var(--surface-raised);
  --card-border: var(--border-subtle);
  --nav-bg: var(--surface-base);
  --nav-item-active-bg: var(--accent-subtle);
  --nav-item-active-fg: var(--accent-text);
}

/* 显式切换优先于系统偏好 */
[data-theme='dark'] {
  color-scheme: dark;

  --p-accent-50: #d1fff3;
  --p-accent-100: #a7fae5;
  --p-accent-200: #87e8d2;
  --p-accent-300: #5ad3b9;
  --p-accent-400: #00ba9f;
  --p-accent-500: #009c85;
  --p-accent-600: #00806c;
  --p-accent-700: #036556;
  --p-accent-800: #084e42;
  --p-accent-900: #093930;
  --p-neutral-0: #ffffff;
  --p-neutral-50: #f8fbfa;
  --p-neutral-100: #f0f3f2;
  --p-neutral-200: #e4e7e6;
  --p-neutral-300: #d3d7d6;
  --p-neutral-400: #b8bbba;
  --p-neutral-500: #959998;
  --p-neutral-600: #737776;
  --p-neutral-700: #545856;
  --p-neutral-800: #373a39;
  --p-neutral-900: #1e2120;
  --p-neutral-950: #0f1110;
  --p-neutral-975: #070908;

  --shadow-xs: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-sm: 0 1px 3px rgb(0 0 0 / 0.45), 0 1px 2px rgb(0 0 0 / 0.35);
  --shadow-md: 0 6px 16px rgb(0 0 0 / 0.5), 0 1px 3px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 20px 48px rgb(0 0 0 / 0.55), 0 6px 16px rgb(0 0 0 / 0.4);

  --surface-base: #0f1110;
  --surface-raised: #161b19;
  --surface-sunken: #070908;
  --surface-overlay: #1e2321;
  --surface-inverse: #f8fbfa;
  --text-primary: #f8fbfa;
  --text-secondary: #898f8e;
  --text-tertiary: #777d7c;
  --text-disabled: #4c5251;
  --text-on-accent: #070908;
  --border-subtle: #272d2b;
  --border-default: #383f3d;
  --border-strong: #5d6563;
  --accent-solid: #00ba9f;
  --accent-hover: #5ad3b9;
  --accent-active: #87e8d2;
  --accent-subtle: #062d26;
  --accent-text: #009c85;
  --success-solid: #45ad69;
  --success-subtle: #0e2b18;
  --success-text: #95daa7;
  --warning-solid: #c68704;
  --warning-subtle: #322004;
  --warning-text: #edbf7b;
  --danger-solid: #de7065;
  --danger-subtle: #391a17;
  --danger-text: #ffb0a6;
  --info-solid: #4e99e8;
  --info-subtle: #10253b;
  --info-text: #9eccff;
  --focus-ring: #5ad3b9;
  --scrim: rgb(0 0 0 / 0.62);
}

/* 跟随系统（未显式设置 data-theme 时生效） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;

  --p-accent-50: #d1fff3;
  --p-accent-100: #a7fae5;
  --p-accent-200: #87e8d2;
  --p-accent-300: #5ad3b9;
  --p-accent-400: #00ba9f;
  --p-accent-500: #009c85;
  --p-accent-600: #00806c;
  --p-accent-700: #036556;
  --p-accent-800: #084e42;
  --p-accent-900: #093930;
  --p-neutral-0: #ffffff;
  --p-neutral-50: #f8fbfa;
  --p-neutral-100: #f0f3f2;
  --p-neutral-200: #e4e7e6;
  --p-neutral-300: #d3d7d6;
  --p-neutral-400: #b8bbba;
  --p-neutral-500: #959998;
  --p-neutral-600: #737776;
  --p-neutral-700: #545856;
  --p-neutral-800: #373a39;
  --p-neutral-900: #1e2120;
  --p-neutral-950: #0f1110;
  --p-neutral-975: #070908;

  --shadow-xs: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-sm: 0 1px 3px rgb(0 0 0 / 0.45), 0 1px 2px rgb(0 0 0 / 0.35);
  --shadow-md: 0 6px 16px rgb(0 0 0 / 0.5), 0 1px 3px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 20px 48px rgb(0 0 0 / 0.55), 0 6px 16px rgb(0 0 0 / 0.4);

  --surface-base: #0f1110;
  --surface-raised: #161b19;
  --surface-sunken: #070908;
  --surface-overlay: #1e2321;
  --surface-inverse: #f8fbfa;
  --text-primary: #f8fbfa;
  --text-secondary: #898f8e;
  --text-tertiary: #777d7c;
  --text-disabled: #4c5251;
  --text-on-accent: #070908;
  --border-subtle: #272d2b;
  --border-default: #383f3d;
  --border-strong: #5d6563;
  --accent-solid: #00ba9f;
  --accent-hover: #5ad3b9;
  --accent-active: #87e8d2;
  --accent-subtle: #062d26;
  --accent-text: #009c85;
  --success-solid: #45ad69;
  --success-subtle: #0e2b18;
  --success-text: #95daa7;
  --warning-solid: #c68704;
  --warning-subtle: #322004;
  --warning-text: #edbf7b;
  --danger-solid: #de7065;
  --danger-subtle: #391a17;
  --danger-text: #ffb0a6;
  --info-solid: #4e99e8;
  --info-subtle: #10253b;
  --info-text: #9eccff;
  --focus-ring: #5ad3b9;
  --scrim: rgb(0 0 0 / 0.62);
  }
}

/* ---- 基础层：让令牌立刻可用，而不是"一堆变量 + 全部手写" ------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-base);
  font-feature-settings: 'tnum' 1, 'cv05' 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }

::selection { background: var(--accent-subtle); color: var(--accent-text); }

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

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

/* ============================================================================
   品牌层（营销站与控制台共用的「立立继开」识别）
   ----------------------------------------------------------------------------
   品牌主色 = 青绿（#09CBA9 家族）。控制台原来用靛蓝 #4F46E5 作主色 —— 那是历史遗留：
   官网和产品站主色不一致，是「前后台不统一」最刺眼的一处。本层是唯一的品牌色入口。
   ⚠️ 营销场景禁止「渐变文字 + 霓虹发光」；品牌感靠**字重与留白**，不靠滤镜。
   ============================================================================ */
:root {
  --brand: var(--accent-solid);
  --brand-ink: var(--accent-text);          /* 浅底上的品牌文字色（已过 AA） */
  --brand-subtle: var(--accent-subtle);
  --brand-glow: rgb(0 128 108 / 0.18);      /* 只用于极少量焦点/选中态，不做装饰光晕 */
  --brand-ink-on-dark: #23e8c6;             /* 深底上的品牌文字色 */

  /* 统一外壳：官网/控制台/surg/me 的顶栏与内容宽度用同一组 */
  --shell-max: 1200px;
  --shell-wide: 1440px;
  --shell-narrow: 760px;
  --header-h: 64px;
  --header-h-compact: 52px;
}

/* ============================================================================
   控制台兼容层（MasterMaker client 既有命名，tailwind.config.js 消费）
   ----------------------------------------------------------------------------
   client/src/index.css 里那两段 `--surface-50..950` / `--primary-*` 是**空格分隔的 RGB 三元组**，
   Tailwind 用 `rgb(var(--surface-800) / <alpha-value>)` 消费，所以这里必须保持三元组格式。
   映射口径：
     · `--primary-*`  = 品牌青绿阶（本次统一的核心：控制台主色由靛蓝改为品牌色）
     · `--surface-*`  = 保持控制台既有语义（`800` = 卡片面、`50` = 最强墨色），取值只做微调
     · `--state-*`    = 由 semantic 层派生，不再各自造色
   ============================================================================ */
:root {
  /* 品牌主色阶（三元组，供 Tailwind `rgb(var(--primary-500) / <alpha-value>)`）
     ⚠️ 500 起比 semantic 层的 `--accent-*` **深一档**：控制台大量把 `text-primary-500/600`
     当小字号正文色用，青绿本身比原来的靛蓝 700 亮，直接用 accent-500(#009C85) 会掉到 3.4:1
     → 这里取 #00806C(4.69:1) 起，保证白底小字仍过 WCAG AA。 */
  --primary-50: 209 255 243;
  --primary-100: 167 250 229;
  --primary-200: 135 232 210;
  --primary-300: 90 211 185;
  --primary-400: 0 186 159;
  --primary-500: 0 128 108;
  --primary-600: 3 101 86;
  --primary-700: 8 78 66;
  --primary-800: 9 57 48;
  --primary-900: 6 42 36;

  /* 中性面（控制台语义：800 = 卡片、50 = 最强墨） */
  --surface-50: 15 17 16;
  --surface-100: 30 33 32;
  --surface-200: 55 58 57;
  --surface-300: 84 88 86;
  --surface-400: 115 119 118;
  --surface-500: 149 153 152;
  --surface-600: 184 187 186;
  --surface-700: 211 215 214;
  --surface-800: 255 255 255;
  --surface-900: 248 251 250;
  --surface-950: 255 255 255;

  /* 状态（控制台既有命名） */
  --state-pending-bg: 240 243 242;
  --state-pending-fg: 55 58 57;
  --state-running-bg: 209 255 243;
  --state-running-fg: 0 128 108;
  --state-pass-bg: 226 246 230;
  --state-pass-fg: 0 97 46;
  --state-fail-bg: 255 235 232;
  --state-fail-fg: 139 40 35;

  /* 动效别名（控制台既有命名） */
  --motion-fast: var(--duration-fast);
  --motion-base: var(--duration-base);
  --motion-slow: var(--duration-slow);
  --ease-spring-legacy: var(--ease-spring);
}

[data-theme='dark'], .dark {
  /* ⚠️ 2026-11-06 两条硬约束（不满足则控制台接进来必出事故，来自跨项目盘点）：
     ① 选择器必须同时认 `[data-theme='dark']` 与 **`.dark`** —— 控制台
        （client/src/index.css:63 + ThemeProvider）用的是 `.dark` 类，只写 data-theme 会让
        控制台深色态完全失效；而用户显式选浅色时也不写 data-theme，会被
        prefers-color-scheme 反向套深色。
     ② 这里**故意不覆盖 `--primary-*`** —— 控制台明暗两套用的是同一方向的品牌色阶
        （50 = 最浅 → 900 = 最深），深色态的浅色文字靠 `text-primary-200/300` 取色阶浅端。
        早先把深色阶反转成「50 = 最深」会让控制台 3149 处 `primary-500`、1059 处
        `primary-300`、326 处 `primary-200` 整体翻面（`.btn-primary` 变暗底暗字）。
        深色态只翻中性面，品牌阶沿用 `:root`。 */

  --surface-50: 248 251 250;
  --surface-100: 228 231 230;
  --surface-200: 211 215 214;
  --surface-300: 184 187 186;
  --surface-400: 149 153 152;
  --surface-500: 115 119 118;
  --surface-600: 84 88 86;
  --surface-700: 55 58 57;
  --surface-800: 30 33 32;
  --surface-900: 15 17 16;
  --surface-950: 7 9 8;

  --state-pending-bg: 30 33 32;
  --state-pending-fg: 211 215 214;
  --state-running-bg: 8 78 66;
  --state-running-fg: 135 232 210;
  --state-pass-bg: 6 60 34;
  --state-pass-fg: 138 226 168;
  --state-fail-bg: 66 26 23;
  --state-fail-fg: 255 176 168;
}

/* ============================================================================
   营销站组件层（官网专用；控制台不消费）
   ----------------------------------------------------------------------------
   官网的「大厂感」来自这四件事，而不是渐变与光晕：
     ① 一屏一个焦点；② 区块间距 96–128 与元素间距 ≤24 拉开差距；
     ③ 字重对比（600 标题 / 400 正文）代替字号堆叠；④ 95% 中性色，品牌色只落在必须被点的位置。
   ============================================================================ */
:root {
  --section-gap: clamp(72px, 9vw, 128px);
  --section-gap-sm: clamp(48px, 6vw, 80px);
  --hero-gap: clamp(56px, 8vw, 112px);
  --card-pad: clamp(20px, 2.4vw, 28px);
  --card-pad-sm: 16px;

  --measure: 68ch;
  --measure-tight: 46ch;

  /* 官网专用：极淡的段落底与分隔线，替代原来的玻璃卡片与光晕 */
  --band-bg: var(--surface-sunken);
  --rule: var(--border-subtle);
  --shot-frame: var(--border-default);
  --shot-shadow: var(--shadow-lg);
}
