/* ============================================================
   红心输入法 · 品牌令牌  tokens.css
   ------------------------------------------------------------
   唯一取值来源：crates/fcitx5-adapter/cpp/theme/red-heart/theme.conf
                 + docs/prototype/logo.html（标识几何）
   改这里的任何一个值，必须同步：
     · docs/brand/tokens.json
     · docs/brand/BRAND.md 的对照表
     · site/site.css（只消费变量，不改字面量）
   用法：<link rel="stylesheet" href=".../tokens.css">
   ============================================================ */

:root {
  /* ---------- 墨：文字的四个层级 ---------- */
  --rh-ink:        #161823;   /* 正文、标题。对宣纸 17.08:1 */
  --rh-ink-2:      #4a5866;   /* 次级说明。7.05:1 */
  --rh-ink-3:      #65727f;   /* 注脚、单位。4.76:1（AA 下限之上） */

  /* ---------- 纸：三层底 ---------- */
  --rh-paper:      #fffbf0;   /* 宣纸：面板与卡片底 */
  --rh-paper-2:    #f6efe1;   /* 次层：卡片内衬 */
  --rh-page:       #f3eee3;   /* 页面底 */

  /* ---------- 朱砂：两档，不可混用 ---------- */
  --rh-cinnabar:   #ff4c00;   /* ① 界面朱砂：选中候选、光标、强调点。3.23:1 → 只用于图形与大字号 */
  --rh-cinnabar-seal: #e23a16;/* ② 标识朱砂：只给「朱印心」与四款徽标。4.19:1 */

  /* ---------- 辅色 ---------- */
  --rh-rouge:      #9d2933;   /* 胭脂：深一档的红。7.26:1，可承载小字 */
  --rh-indigo:     #425066;   /* 远山：装饰性冷色，不进入正文 */
  --rh-gold:       #eacd76;   /* 鎏金：1.51:1，**只作分割线与点缀，永不用于文字** */

  /* ---------- 深底 ---------- */
  --rh-night:      #1b1e27;   /* 深色任务栏 / 深色分区 */

  /* ---------- 线与影 ---------- */
  --rh-hair:       rgba(22, 24, 35, .12);   /* 发丝线：分区、描边 */
  --rh-hair-soft:  rgba(22, 24, 35, .07);   /* 更弱的线 */
  --rh-shadow-panel: 0 18px 40px -14px rgba(22, 24, 35, .30),
                     0 2px 6px rgba(22, 24, 35, .06);
  --rh-shadow-lift:  0 8px 24px -10px rgba(22, 24, 35, .22);

  /* ---------- 纹理：宣纸颗粒 ---------- */
  --rh-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");

  /* ---------- 字体栈：不下载 webfont，靠系统 CJK ---------- */
  --rh-serif: "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", "SimSun", serif;
  --rh-sans:  "Source Han Sans SC", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --rh-mono:  "Source Han Mono SC", "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  /* ---------- 字号阶梯（1.25 近似，收敛到 8 档） ---------- */
  --rh-fs-display: clamp(52px, 7.2vw, 92px);  /* 首屏主标 */
  --rh-fs-h1:      clamp(32px, 3.6vw, 46px);  /* 章节标题 */
  --rh-fs-h2:      22px;
  --rh-fs-lead:    17px;
  --rh-fs-body:    16px;
  --rh-fs-sm:      13.5px;
  --rh-fs-xs:      12px;
  --rh-fs-mono:    11.5px;                    /* 注脚、编号、单位 */

  /* ---------- 间距：4 的倍数，只用这九个 ---------- */
  --rh-s1: 4px;  --rh-s2: 8px;  --rh-s3: 12px;
  --rh-s4: 16px; --rh-s5: 24px; --rh-s6: 32px;
  --rh-s7: 48px; --rh-s8: 64px; --rh-s9: 88px;

  /* ---------- 圆角：面板 13，卡片 6，胶囊 999 ---------- */
  --rh-r-panel: 13px;
  --rh-r-card:  6px;
  --rh-r-pill:  999px;

  /* ---------- 动效：只允许这两种节奏 ---------- */
  --rh-dur-fast: 140ms;
  --rh-dur-base: 260ms;
  --rh-ease: cubic-bezier(.22, .61, .36, 1);

  /* ---------- 版心 ---------- */
  --rh-measure: 62ch;      /* 正文最大行长 */
  --rh-wrap:    1120px;    /* 页面版心 */
}

/* 深色表面：只反纸与墨，不反朱砂 —— 朱砂在深底上 4.98:1，比在纸上还稳 */
[data-surface="night"] {
  --rh-paper:   #1b1e27;
  --rh-paper-2: #232734;
  --rh-page:    #12141b;
  --rh-ink:     #fffbf0;
  --rh-ink-2:   rgba(255, 251, 240, .72);
  --rh-ink-3:   rgba(255, 251, 240, .52);
  --rh-hair:      rgba(255, 251, 240, .14);
  --rh-hair-soft: rgba(255, 251, 240, .08);
}

@media (prefers-reduced-motion: reduce) {
  :root { --rh-dur-fast: 0ms; --rh-dur-base: 0ms; }
}
