/* ============================================================================
   「暖纸工作台」令牌提案 —— 替换 web/src/styles.css 的 @theme inline / :root / .dark
   参考基调：Intercom「Warm cream editorial spread」(light)
   改编原则：只改语义令牌的**取值**，不改任何组件的 className / variant。
   - 参考的「动作 = 墨块」迁移为 --brand 取墨黑（浅色 #111111 / 深色纸白 #f2efe8）；
   - 参考的「唯一强调色 = 电光紫 #0007cb」迁移到 --brand-ink / --mention；
   - 参考的 4px 全局圆角迁移为 --radius: 0.25rem，其余 --radius-* 由 calc 派生；
   - 参考的冷灰一律换成暖灰（hue 约 40–60），--surface-rail 深色下修回深色（当前是浅色 #e3e5e8）。
   对比度均为 WCAG 2.1 相对亮度公式实算，详见 proposal.md 第 7 节。
   ============================================================================ */

@theme inline {
  --font-heading: var(--font-sans);
  /* 中文回退顺序调整：macOS 优先系统原生 PingFang SC（字形与 hinting 优于 Noto），
     Linux/Windows 再落到 Noto Sans SC / Microsoft YaHei；Geist 无中文字形，仅承担拉丁。 */
  --font-sans:
    "Geist Variable", "gg sans", "PingFang SC", "Noto Sans SC", ui-sans-serif,
    system-ui, "Segoe UI", "Microsoft YaHei", Roboto, Helvetica, Arial,
    sans-serif;
  /* 数字/代码：保持等宽；任务号、消息时间、连接态走这条栈，避免中文字体把数字拉宽。 */
  --font-mono:
    ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
  --color-brand-ink: var(--brand-ink);
  /* 阴影阶梯：参考体系「不靠 elevation、靠色阶」→ 保留存在感但把冷蓝 slate 换成暖黑，
     并把 e1/e2 压到近平面（只剩 1px 暖色描边感），只让 e3/pop 承担浮层分离。 */
  --shadow-e1: 0 1px 0 rgb(24 21 14 / 0.06), 0 0 0 1px rgb(24 21 14 / 0.03);
  --shadow-e2: 0 1px 2px -1px rgb(24 21 14 / 0.06), 0 4px 12px -4px rgb(24 21 14 / 0.08);
  --shadow-e3: 0 8px 24px -10px rgb(24 21 14 / 0.16), 0 2px 6px -2px rgb(24 21 14 / 0.06);
  --shadow-pop: 0 14px 36px -12px rgb(24 21 14 / 0.22), 0 4px 10px -4px rgb(24 21 14 / 0.08);
  --animate-message-in: message-in 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
  --animate-rise-in: rise-in 160ms cubic-bezier(0.22, 1, 0.36, 1) both;
  --animate-drawer-in: drawer-in 240ms cubic-bezier(0.22, 1, 0.36, 1);
  --animate-drawer-overlay-in: drawer-overlay-in 160ms ease-out;
  --animate-drop-in: drop-in 160ms cubic-bezier(0.22, 1, 0.36, 1) both;
  --animate-breathe: breathe 1.2s ease-in-out infinite;
  --color-sidebar-ring: var(--sidebar-ring);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar: var(--sidebar);
  --color-chart-5: var(--chart-5);
  --color-chart-4: var(--chart-4);
  --color-chart-3: var(--chart-3);
  --color-chart-2: var(--chart-2);
  --color-chart-1: var(--chart-1);
  --color-ring: var(--ring);
  --color-input: var(--input);
  --color-border: var(--border);
  --color-destructive: var(--destructive);
  --color-accent-foreground: var(--accent-foreground);
  --color-accent: var(--accent);
  --color-muted-foreground: var(--muted-foreground);
  --color-muted: var(--muted);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-secondary: var(--secondary);
  --color-primary-foreground: var(--primary-foreground);
  --color-primary: var(--primary);
  --color-popover-foreground: var(--popover-foreground);
  --color-popover: var(--popover);
  --color-card-foreground: var(--card-foreground);
  --color-card: var(--card);
  --color-foreground: var(--foreground);
  --color-background: var(--background);
  --color-brand: var(--brand);
  --color-brand-foreground: var(--brand-foreground);
  --color-brand-soft: var(--brand-soft);
  --color-surface-chat-soft: var(--surface-chat-soft);
  --color-surface-chat-selected: var(--surface-chat-selected);
  --color-mention: var(--mention);
  --color-ink: var(--ink);
  --color-surface-rail: var(--surface-rail);
  --color-interactive: var(--interactive);
  --color-channel-icon: var(--channel-icon);
  /* 圆角：--radius 10px → 4px（参考的全局 4px），派生档位收敛到 2.4–10.4px。 */
  --radius-sm: calc(var(--radius) * 0.6);
  --radius-md: calc(var(--radius) * 0.8);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) * 1.4);
  --radius-2xl: calc(var(--radius) * 1.8);
  --radius-3xl: calc(var(--radius) * 2.2);
  --radius-4xl: calc(var(--radius) * 2.6);
}

:root {
  /* 浅色 = 暖奶油纸面：画布 #faf8f4（冷灰 #fcfcfc → 暖），卡片纯白抬升一级。
     实测：画布 vs 卡面 1.06:1，靠色阶而非阴影分层（参考的 elevation 纪律）。 */
  --background: #faf8f4;
  --foreground: #111111;
  --card: #ffffff;
  --card-foreground: #111111;
  --popover: #ffffff;
  --popover-foreground: #111111;
  /* 自己气泡：暖砂色（原 #e8f3fe 飞书浅蓝），文字用墨色 15.05:1。 */
  --message-self: #ece5d5;
  --message-self-foreground: #111111;
  --primary: var(--brand);
  --primary-foreground: var(--brand-foreground);
  /* 次级面 = 亚麻 #f1eee7，与画布 1.09:1，专门给 chrome/分段面用。 */
  --secondary: #f1eee7;
  --secondary-foreground: #111111;
  --muted: #f1eee7;
  /* 次级文字：冷 #5c5e66 → 暖 #585858，在画布/亚麻/纯白上分别 6.71/6.14/7.11:1。 */
  --muted-foreground: #585858;
  /* 他人气泡 / 悬停面：比次级面再深一档 #eeeae1，对画布 1.13:1
     （现状 他人气泡 #ebedef 对画布 #fcfcfc 是 1.14:1，手感保持）。 */
  --accent: #eeeae1;
  --accent-foreground: #111111;
  /* 危险色：飞书红 #da373c → 暖砖红 #b42318（纯白上 6.57:1，自身 10% 底上 5.58:1）。 */
  --destructive: #b42318;
  /* 装饰性发丝线保持低对比（1.38:1），表单控件边界由 --input 承担 ≥3:1。 */
  --border: #dedbd6;
  /* 表单边界：暖石灰 #948e80，白底 3.26:1、画布 3.07:1，满足 WCAG 1.4.11。 */
  --input: #948e80;
  --ring: var(--brand);
  /* 图表：冷中性灰 → 暖中性阶梯（1 浅 → 5 深），不引入第二色相。 */
  --chart-1: #dedbd6;
  --chart-2: #b8b2a4;
  --chart-3: #8a8477;
  --chart-4: #585349;
  --chart-5: #2b2921;
  /* 圆角 10px → 4px：参考「architectural precision」的全局方角。 */
  --radius: 0.25rem;
  /* 动作色 = 墨黑 #111111（参考：填充主按钮永远不是品牌色，是黑块），白字 18.88:1。 */
  --brand: #111111;
  --brand-foreground: #ffffff;
  /* 强调底：唯一带电的一层，电光紫 8% —— 选中项/文本选择用，紫字其上 8.90:1。 */
  --brand-soft: rgb(0 7 203 / 0.08);
  /* 强调前景 = 电光紫 #0007cb（设置弹窗选中导航、链接），画布上 10.46:1。 */
  --brand-ink: #0007cb;
  /** 会话悬停面：暖化，与画布 1.05:1（原 #e8f2ff 冷蓝）。 */
  --surface-chat-soft: #f6f2ea;
  /** 会话选中面：再深一档 1.14:1，墨字 15.59:1（原 #e5ecfc 飞书蓝）。 */
  --surface-chat-selected: #eee9dd;
  /** @提及：与 --brand-ink 同值，保证「强调 = 紫」只有一处定义（原 #3370ff 第三种蓝）。 */
  --mention: #0007cb;
  /* 最深面（视频信箱、深色条带）：暖墨 #111111（原 #060607 冷黑）。 */
  --ink: #111111;
  /* 空间 rail：暖石 #eae6dc，与画布 1.17:1，是画面里最深的表面（原 #e1e8f2 蓝灰）。 */
  --surface-rail: #eae6dc;
  --workspace-background: linear-gradient(180deg, var(--surface-rail), #e2ddd0);
  --workspace-rail-background: transparent;
  --workspace-header-background: var(--background);
  /* 非链接型图标/文字通用色，暖化并保值 7.60:1。 */
  --interactive: #52504a;
  /* 频道图标：暖石灰 3.47:1（≥3:1 图形下限），比原 #80848e 稍亮以抵消暖底。 */
  --channel-icon: #8a8579;
  /* 侧栏从「与画布同 hex」改成暖亚麻 #efece3：与画布 1.11:1，
     会话行悬停面 #e4dfd2 与侧栏 1.13:1，两级侧栏层级首次可见。 */
  --sidebar: #efece3;
  --sidebar-foreground: #111111;
  --sidebar-primary: var(--brand);
  --sidebar-primary-foreground: var(--brand-foreground);
  --sidebar-accent: #e4dfd2;
  --sidebar-accent-foreground: #111111;
  --sidebar-border: #dedbd6;
  --sidebar-ring: var(--ring);
}

.dark {
  /* 深色 = 暖炭纸：画布 #14130d（原 oklch(0.145 0 0) 冷黑）；
     rail 修回深色 #0d0c08（原 #e3e5e8 浅色，会在深色下留一条浅竖带）。 */
  --surface-rail: #0d0c08;
  --workspace-background: linear-gradient(180deg, #0d0c08, #1a1811);
  --workspace-rail-background: color-mix(in oklab, var(--background) 45%, transparent);
  --workspace-header-background: linear-gradient(
    180deg,
    color-mix(in oklab, var(--background), var(--brand) 3%),
    var(--background)
  );
  /* 自己气泡：暖炭棕 #2d2820，纸白字 12.95:1、紫 5.37:1（原 #203b59 冷蓝）。 */
  --message-self: #2d2820;
  --message-self-foreground: #f4f1e8;
  --background: #14130d;
  --foreground: #f4f1e8;
  /* 卡面 #201e16，与画布 1.12:1（色阶分层，不叠阴影）。 */
  --card: #201e16;
  --card-foreground: #f4f1e8;
  --popover: #201e16;
  --popover-foreground: #f4f1e8;
  --secondary: #262319;
  --secondary-foreground: #f4f1e8;
  --muted: #262319;
  /* 次级文字 #a9a397：画布 7.42:1、卡面 6.65:1、次级面 6.26:1。 */
  --muted-foreground: #a9a397;
  /* 他人气泡 / 悬停面：比卡面亮一档 #2a271c（对画布 1.25:1、对卡面 1.12:1）。 */
  --accent: #2a271c;
  --accent-foreground: #f4f1e8;
  /* 危险色在深底要提亮：暖珊瑚 #ff9d8a（画布 9.25:1，20% 底上 5.50:1）。 */
  --destructive: #ff9d8a;
  /* 深色发丝线提到 #3a3629（卡面 1.38:1），不再是半透明白。 */
  --border: #3a3629;
  /* 深色表单边界 #736b56：画布 3.51:1、卡面 3.15:1，满足 1.4.11。 */
  --input: #736b56;
  --ring: var(--brand);
  --chart-1: #3a3629;
  --chart-2: #6b6555;
  --chart-3: #9c9584;
  --chart-4: #c9c2b1;
  --chart-5: #f2efe8;
  /* 深色动作色反转成纸白 #f2efe8，前景暖炭 #14130d（16.20:1）——
     与浅色「墨块」互为镜像，避免深色下出现纯白大块。 */
  --brand: #f2efe8;
  --brand-foreground: #14130d;
  --brand-soft: rgb(139 147 255 / 0.16);
  --brand-ink: #8b93ff;
  --surface-chat-soft: #1b1912;
  --surface-chat-selected: #232017;
  --mention: #8b93ff;
  /* --ink 是「最深表面」（视频信箱/深色条带），深色下**不翻转**，只去蓝调：#0b0a06。 */
  --ink: #0b0a06;
  --sidebar: #232018;
  --sidebar-foreground: #f4f1e8;
  --sidebar-primary: var(--brand);
  --sidebar-primary-foreground: var(--brand-foreground);
  --sidebar-accent: #2e2b20;
  --sidebar-accent-foreground: #f4f1e8;
  --sidebar-border: #3a3629;
  --sidebar-ring: var(--ring);
  /* 深色专属：交互色需向亮侧走，否则贴在炭底上不可读。 */
  --interactive: #a9a397;
  --channel-icon: #948f80;
}
