/* ============================================================================
   方案「暖纸橙墨」主题令牌（slug: hubspot）
   ----------------------------------------------------------------------------
   用法：整段替换 web/src/styles.css 里的 `@theme inline`（原文 styles.css:31-105）
   与 `:root`（原文 :108-159）、`.dark`（原文 :161-203）三块。
   令牌名全部取自现有声明，无新令牌；@theme inline 映射沿用原文，只有乘法链
   会跟随 --radius 的新值变化。
   基调：暖纸（奶油画布 + 羊皮纸侧栏）+ 单一朱橙强调色。
        「橙色（--brand / --brand-soft / --brand-ink / --message-self / --mention）
         只标记『你的动作』」：自己的消息、进行中的任务、主操作、@提及。
   对比度数值均为 WCAG 2.x 相对亮度公式实算，见 proposal.md §7。
   ============================================================================ */

/* ---------------------------------------------------------------------------
   @theme inline —— 沿用原文映射，不改语义；--radius-* 由 --radius 推导，
   因此下面 :root 里 --radius 的新值会自动传导到 rounded-sm/md/lg/xl/2xl/3xl/4xl。
   --------------------------------------------------------------------------- */
@theme inline {
  --font-heading: var(--font-sans);
  --font-sans:
    "Geist Variable", "gg sans", "Noto Sans SC", "PingFang 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);
  --shadow-e1: 0 1px 0 rgb(4 4 5 / 0.08), 0 1.5px 0 rgb(4 4 5 / 0.02);
  --shadow-e2:
    0 2px 4px -1px rgb(15 23 42 / 0.07), 0 6px 16px -4px rgb(15 23 42 / 0.1);
  --shadow-e3:
    0 10px 28px -8px rgb(15 23 42 / 0.16), 0 2px 6px -2px rgb(15 23 42 / 0.06);
  --shadow-pop:
    0 16px 40px -12px rgb(15 23 42 / 0.24), 0 4px 10px -4px rgb(15 23 42 / 0.1);
  --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 0.714rem → lg 11.42px（按钮/输入/下拉）、xl 16px（卡片/侧栏/任务卡） */
  --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);
}

/* ===========================================================================
   浅色（默认）
   表面阶梯：画布 #faf7f2 → 侧栏羊皮纸 #f2ebdd → 卡片暖白 #fffdfb（逐级抬升）
   层级靠纸阶 + 发丝线，不靠阴影（参考 HubSpot 的 border-based elevation）。
   =========================================================================== */
:root {
  /* 画布：#fcfcfc 中性灰白 → #faf7f2 奶油纸。R>G>B，偏暖，降低长时段驻留的冷蓝疲劳。 */
  --background: #faf7f2;
  /* 正文：与参考 Ink #1f1f1f 对齐（原 #060607 在暖底上过于尖锐）。15.42:1。 */
  --foreground: #1f1f1f;
  /* 卡片：撤掉纯白 #ffffff（参考 Don't：不要用 stark white），改暖白 #fffdfb 与画布分层。 */
  --card: #fffdfb;
  --card-foreground: #1f1f1f;
  --popover: #fffdfb;
  --popover-foreground: #1f1f1f;
  /* 自己发的消息 = 参考的 Peach Wash 角色加饱和：#ffcfae，与「他人气泡」拉开 1.18:1。 */
  --message-self: #ffcfae;
  /* 自己气泡文字：焦糖深棕 #3d1607（12.76:1），与橙色底同色系，不用蓝黑。 */
  --message-self-foreground: #3d1607;
  --primary: var(--brand);
  --primary-foreground: var(--brand-foreground);
  /* 次级/强调面 = 暖砂 #f0e9df：既是他人气泡底色，也是 hover 底。 */
  --secondary: #f0e9df;
  --secondary-foreground: #241f1a;
  --muted: #f5f0e8;
  /* 次级文字：参考 Graphite #60605f 暖化到 #5e5a54；画布上 6.41:1，侧栏上 5.77:1。 */
  --muted-foreground: #5e5a54;
  --accent: #f0e9df;
  --accent-foreground: #241f1a;
  /* 危险：冷红 #da373c → 砖红 #c02a26，与橙强调同属暖色系不打架；白字填充 5.83:1。 */
  --destructive: #c02a26;
  /* 分割线/卡片描边：暖发丝线 #e8e0d2（1.23:1，纯装饰，不做控件边界）。 */
  --border: #e8e0d2;
  /* 控件边界：暖褐灰 #ded2bb。注意——它同时被当填充色用（输入区 textarea.tsx:9 的 bg-input/50），
     所以只能停在 1.47:1，无法满足 WCAG 1.4.11 的 3:1（详见 proposal.md §8 风险 R2）。 */
  --input: #ded2bb;
  /* 焦点环 = 品牌橙（原为蓝），全站焦点态自动转橙。 */
  --ring: var(--brand);
  /* 图表/数据序：#1 朱橙（4.69:1）→ #2 深青（8.75:1）→ #3 砂棕 → #4 青灰 → #5 暖灰，
     全部 ≥3:1（图形对象阈值），且 1 与 3 亮度差 1.64:1，相邻可分辨。 */
  --chart-1: #c84000;
  --chart-2: #0f4f4d;
  --chart-3: #a97a3d;
  --chart-4: #6f8480;
  --chart-5: #7d6f5c;
  /* 半径：0.625rem(10px) → 0.714rem(11.42px)，使 rounded-xl（卡片/侧栏/任务卡）= 16px 整，
     对齐参考「16px 卡片圆角」；控件 rounded-lg 落在 11.42px（见 §10 取舍）。 */
  --radius: 0.714rem;
  /* 主色：参考 Sprout Orange #ff4800 沿同色相压暗至 L*≈45 → #c84000。
     白字填充 5.01:1、当文字色 4.69:1，两个用途都过 4.5:1（原 #ff4800 白字仅 3.40:1）。 */
  --brand: #c84000;
  --brand-foreground: #ffffff;
  /* 品牌浅底：橙 10% 叠在纸面上（按钮 outlined、选中导航项、::selection）。 */
  --brand-soft: rgb(200 64 0 / 0.10);
  /* 品牌深调文字：#9c3000，画布 6.93:1、橙浅底上 6.32:1（对应参考 Graphite/Ink 的对比关系）。 */
  --brand-ink: #9c3000;
  /* 引用/AI 回执等浅色消息底：橙 6% 的极浅暖底 #fdeee2，与画布 1.05:1（有意克制）。 */
  --surface-chat-soft: #fdeee2;
  /* 选中会话行：橙 15% 暖底 #f7e0cd，与侧栏 1.11:1 —— 用「品牌橙的低饱和」取代原蓝色选中底。 */
  --surface-chat-selected: #f6dcc5;
  /* @提及：深朱橙 #a83707，画布 6.11:1、他人气泡 5.42:1、自己气泡 5.23:1。
     它取代 chat-mention.ts 里硬编码的 #3370FF（第三种蓝）。 */
  --mention: #a83707;
  /* ink：深色媒体框（rtc-video-frame.tsx:48 的 bg-ink）与反白文字用，跟 --foreground 同步。 */
  --ink: #1f1f1f;
  /* rail：蓝灰 #e1e8f2 → 暖砂 #ece3d3（72px 空间栏，原值与 --border 不同源，此处并入暖纸阶）。 */
  --surface-rail: #ece3d3;
  /* 工作区底：原式第二个色停硬编码了蓝灰 #e1e5f1（styles.css:129），是令牌泄漏点，
     改为同一暖纸阶的两端 #f2eade → #ecdfcb，整条左侧竖带因此彻底去蓝。 */
  --workspace-background: linear-gradient(180deg, #f2eade, #ecdfcb);
  --workspace-rail-background: transparent;
  --workspace-header-background: var(--background);
  /* 图标色：石板灰 #4e5058 → 暖褐灰 #4e4a44（画布 8.23:1）。 */
  --interactive: #4e4a44;
  /* 频道图标：冷灰 #80848e → 暖灰 #7a736a，侧栏上 3.94:1，满足图形 3:1。 */
  --channel-icon: #7a736a;
  /* 侧栏：原来 #fcfcfc = 画布，实测「零层级对比」；改为羊皮纸带 #f2ebdd（与画布 1.11:1）。 */
  --sidebar: #f2ebdd;
  --sidebar-foreground: #1f1f1f;
  --sidebar-primary: var(--brand);
  --sidebar-primary-foreground: var(--brand-foreground);
  /* 侧栏 hover/选中底：暖砂加深 #e8dfcd（与侧栏 1.12:1）。 */
  --sidebar-accent: #e8dfcd;
  --sidebar-accent-foreground: #1f1f1f;
  --sidebar-border: #e0d6c2;
  --sidebar-ring: var(--ring);
}

/* ===========================================================================
   深色
   表面阶梯：画布 #0b1a1c（深青墨，取自参考 Deep Teal #042729 的提亮变体）
             → 侧栏 #061113（更深的竖带）→ 卡片 #122529（抬升面）
   原 .dark 的 --surface-rail 是浅色 #e3e5e8，实测会在深底上留一条浅色竖带；此处修掉。
   =========================================================================== */
.dark {
  --background: #0b1a1c;
  --foreground: #f4efe6;
  --card: #122529;
  --card-foreground: #f4efe6;
  --popover: #122529;
  --popover-foreground: #f4efe6;
  --secondary: #1c3338;
  --secondary-foreground: #f4efe6;
  --muted: #16292d;
  /* 次级文字：暖青灰 #a9b6b4，画布 8.52:1、侧栏 8.81:1。 */
  --muted-foreground: #a9b6b4;
  --accent: #22383b;
  --accent-foreground: #f4efe6;
  /* 危险：粉红 #ff6b66，画布 6.40:1、卡片 5.71:1。 */
  --destructive: #ff6b66;
  /* 分割线：原 10% 白透明在暖深底上偏冷，改实色深青 #2a4448（1.71:1，装饰用）。 */
  --border: #2a4448;
  /* 控件边界 + 填充基色（同浅色，dark:bg-input/30）：深青棕 #33514f。 */
  --input: #33514f;
  --ring: var(--brand);
  --chart-1: #ff7a45;
  --chart-2: #4fb3ae;
  --chart-3: #e0b47c;
  --chart-4: #8fa6a3;
  --chart-5: #bda98f;
  --radius: 0.714rem;
  /* 主色：深色下需要反向——浅橙 #ff7a45（画布 6.89:1），配深焦糖字 #2a1206（6.84:1）。 */
  --brand: #ff7a45;
  --brand-foreground: #2a1206;
  --brand-soft: rgb(255 122 69 / 0.16);
  /* 品牌浅调文字：#ffb08a，画布 10.04:1、橙浅底上 7.04:1。 */
  --brand-ink: #ffb08a;
  --message-self: #3a2418;
  --message-self-foreground: #ffe9dc;
  --surface-chat-soft: #2a2119;
  --surface-chat-selected: #33261c;
  --mention: #ffa06b;
  /* 原值是深蓝黑 oklch(0.16 0.02 258)；改为与侧栏一致的深青墨，视频 letterbox 与反白场景通用。 */
  --ink: #061113;
  --surface-rail: #071416;
  --workspace-background: radial-gradient(
    ellipse at 8% 0%,
    color-mix(in oklab, var(--brand) 10%, var(--muted)),
    var(--muted) 64%
  );
  --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)
  );
  --interactive: #c3cccb;
  --channel-icon: #8d9c9c;
  --sidebar: #061113;
  --sidebar-foreground: #f4efe6;
  --sidebar-primary: var(--brand);
  --sidebar-primary-foreground: var(--brand-foreground);
  --sidebar-accent: #17302f;
  --sidebar-accent-foreground: #f4efe6;
  --sidebar-border: #1e3538;
  --sidebar-ring: var(--ring);
}
