/* ============================================================================
   好德财务 · 设计令牌 tokens.css  v1.0
   墨 · 朱 · 素  |  方向：责任型财税服务，可查验的账本感
   ----------------------------------------------------------------------------
   只包含：:root 令牌 / 基础 reset / 基础排版 / 5 个工具类。
   页面级与组件级样式一律写入 site.css（Phase 3），此处不得越界。
   约束：纯静态、无任何外部资源、无 CDN、无 @import、无 @font-face。
   ========================================================================== */

:root {
  /* ── 纸阶 · Surface ladder（分层靠纸色差，不靠阴影） ─────────────────── */
  --hd-paper-0:        #FFFFFF;   /* 卡片、输入框、表格行、深底上的反相块 */
  --hd-paper-100:      #FAF8F4;   /* 页面画布（暖白纸） */
  --hd-paper-200:      #F3EFE7;   /* 交替段底、内嵌面板、表头 */
  --hd-paper-300:      #E9E3D6;   /* 更深一阶：禁用底、进度槽、悬停底色 */

  /* ── 墨阶 · Ink ladder（导航 / 页脚 / 内页信任带 / 主按钮） ──────────── */
  --hd-ink-950:        #100E0B;   /* 仅 footer 底栏等最深处 */
  --hd-ink-900:        #191612;   /* 主墨：nav、footer、信任带、主按钮、h1 */
  --hd-ink-800:        #26221C;   /* 深底上的抬升块（深色卡片） */
  --hd-ink-700:        #352F26;   /* 深底悬停 / 深色分隔 */

  /* ── 朱阶 · Vermilion（取自 logo，实测 #D41A1D，只做小而重的点） ─────── */
  --hd-red-500:        #D41A1D;   /* logo 原色；印章填充、强调词、当前页刻线 */
  --hd-red-600:        #B4161A;   /* 朱的按下态 / 深底上的印章边线 */
  --hd-red-700:        #A3151A;   /* 纸面上的朱色文字（比 500 更耐读） */
  --hd-red-300:        #F0756E;   /* 仅深底上的朱色文字与线框章 */
  --hd-red-wash:       #F8E7E4;   /* 朱的 8% 纸感底，用于高危 chip */

  /* ── 发丝线 · Hairline（1px，替代阴影与边框堆叠） ───────────────────── */
  --hd-line:           #E4DDCF;   /* 纸面默认分隔线 */
  --hd-line-strong:    #CFC6B3;   /* 输入框 / 次级按钮 / 表头底线 */
  --hd-line-dark:      rgba(244, 240, 232, .14);
  --hd-line-dark-strong: rgba(244, 240, 232, .26);

  /* ── 文字阶 · Text（纸面） ─────────────────────────────────────────── */
  --hd-text-1:         #191612;   /* 标题、正文强调   16.9:1 */
  --hd-text-2:         #4A443A;   /* 正文            9.0:1 */
  --hd-text-3:         #6B6459;   /* 说明、图注、占位 5.3:1 */
  --hd-text-4:         #918A7C;   /* 最弱一级，仅大字号/禁用 3.6:1 */

  /* ── 深底文字 · On dark ───────────────────────────────────────────── */
  --hd-on-dark:        #F4F0E8;   /* 深底主文字 */
  --hd-on-dark-2:      #B6AE9F;   /* 深底正文/链接 */
  --hd-on-dark-3:      #8A8272;   /* 深底说明（4.95:1） */

  /* ── 动作色 · Action（动作=最深的墨；深底上反相为素白） ─────────────── */
  --hd-action:         #191612;
  --hd-action-hover:   #352F26;
  --hd-action-active:  #0F0D0A;
  --hd-action-text:    #FBF9F5;
  --hd-action-inverse: #F4F0E8;
  --hd-action-inverse-text: #191612;

  /* ── 语义 · Semantic（去饱和；只做 12px 文字与 3px 竖条，永不填充） ────
     v1.1：--hd-sev-low 由墨灰 (#5A5346) 改为黄褐 (#74631B)。
     原因：checklist 评级是「红/橙/黄/绿」四档语义，墨灰无法映射「黄」档；
           三档 chip 与四档评级必须同一套色，否则题目标「注意(灰)」而出报告说「黄色」。 */
  --hd-sev-high:       #A3151A;  --hd-sev-high-bg: #F8E7E4;  /* 红 · 5.0:1 */
  --hd-sev-mid:        #7A5520;  --hd-sev-mid-bg:  #F6EEE0;  /* 橙 · 6.3:1 */
  --hd-sev-low:        #74631B;  --hd-sev-low-bg:  #F4EFDC;  /* 黄 · 5.6:1 */
  --hd-sev-ok:         #34604F;  --hd-sev-ok-bg:   #E7EFEA;  /* 绿 · 6.2:1 */
  /* 四档面板的发丝边（语义色的 ~25% 纸感描边，替代阴影） */
  --hd-sev-high-line:  #E7C4C0;
  --hd-sev-mid-line:   #E3D2B4;
  --hd-sev-low-line:   #DCD3B4;
  --hd-sev-ok-line:    #C9DAD1;
  --hd-ring-error:     rgba(212, 26, 29, .14);
  --hd-ring-focus:     rgba(25, 22, 18, .10);
  --hd-selection:      #F2D6D3;

  /* ── 字体栈 · 全部为系统字体，file:// 下可用 ────────────────────────── */
  --hd-font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong",
                   "SimSun", "Times New Roman", serif;
  --hd-font-sans:  "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
                   "Hiragino Sans GB", "Noto Sans SC", "Source Han Sans SC",
                   "Segoe UI", system-ui, sans-serif;
  /* 数字专用：Arial/Helvetica 数字天然等宽，任何机器都能对齐小数点 */
  --hd-font-num:   "Helvetica Neue", Helvetica, Arial, "PingFang SC",
                   "Microsoft YaHei", sans-serif;

  /* ── 字号阶梯 · Type scale（CJK：正文下限 16px，标题下限 18px） ─────── */
  --hd-fs-display: clamp(34px, 4.6vw, 52px);  /* 首页主标题 */
  --hd-fs-h1:      clamp(28px, 3.2vw, 38px);  /* 内页信任带标题 */
  --hd-fs-h2:      clamp(23px, 2.4vw, 29px);  /* 段落主标题 */
  --hd-fs-h3:      20px;                      /* 卡片标题 */
  --hd-fs-h4:      17px;                      /* 小标题 / 表内分组标题 */
  --hd-fs-lead:    17px;                      /* 导语 */
  --hd-fs-body:    16px;                      /* 正文 */
  --hd-fs-sm:      14px;                      /* 次级正文、表格 */
  --hd-fs-caption: 13px;                      /* 图注、辅助说明 */
  --hd-fs-micro:   12px;                      /* eyebrow、法务小字 */
  --hd-fs-ui:      15px;                      /* 导航、按钮 */
  --hd-fs-stat:    clamp(28px, 3vw, 38px);    /* 背书带数字 */

  /* ── 行高 · Leading（CJK 需要更松） ─────────────────────────────────── */
  --hd-lh-tight:   1.18;
  --hd-lh-snug:    1.32;
  --hd-lh-normal:  1.55;
  --hd-lh-relaxed: 1.75;   /* 中文正文默认 */
  --hd-lh-loose:   1.9;

  /* ── 字距 · Tracking（CJK 标题正字距是「宋体味」的来源） ────────────── */
  --hd-ls-tight:  -0.005em;
  --hd-ls-0:       0;
  --hd-ls-1:       0.02em;
  --hd-ls-2:       0.06em;
  --hd-ls-3:       0.14em;   /* 小号全大写 eyebrow */
  --hd-ls-4:       0.18em;   /* 中文小标签的疏排 */

  /* ── 间距 · Spacing（4px 基准） ─────────────────────────────────────── */
  --hd-s-1:  4px;   --hd-s-2:  8px;   --hd-s-3: 12px;  --hd-s-4: 16px;
  --hd-s-5: 20px;   --hd-s-6: 24px;   --hd-s-7: 32px;  --hd-s-8: 40px;
  --hd-s-9: 48px;   --hd-s-10: 64px;  --hd-s-11: 80px; --hd-s-12: 96px;
  --hd-section-y: clamp(56px, 7vw, 96px);   /* 段落上下留白 */

  /* ── 栅格 · Grid ───────────────────────────────────────────────────── */
  --hd-container: 1160px;
  --hd-gutter:    clamp(20px, 4vw, 32px);
  --hd-col-gap:     24px;
  /* 断点（媒体查询内请写字面值，CSS 变量不能用于 @media）：
     < 480 | 480–767 | 768–1023 | 1024–1279 | ≥ 1280 */

  /* ── 圆角 · Radius（胶囊只给按钮；卡片 12；表格/表单近方） ──────────── */
  --hd-r-xs:   3px;    /* 印章 —— 几乎方形，像真章 */
  --hd-r-sm:   6px;    /* 小标签、图片 */
  --hd-r-md:   8px;    /* 输入框、表格容器 */
  --hd-r-lg:  12px;    /* 卡片 */
  --hd-r-xl:  16px;    /* 大面板、深墨带内浮层 */
  --hd-r-pill: 999px;  /* 仅按钮 */

  /* ── 阴影 · Elevation（三档：1/2 通用，card 专供卡片） ────────────── */
  --hd-shadow-1: 0 1px 2px rgba(25, 22, 18, .04),
                 0 8px 24px -18px rgba(25, 22, 18, .12);
  --hd-shadow-2: 0 2px 8px rgba(25, 22, 18, .06),
                 0 24px 56px -28px rgba(25, 22, 18, .22);

  /* 卡片专用：纸离桌面 2–3mm 的投影，三层各管一件事 ——
     第 1 层贴边收轮廓（不加会像贴纸），第 2 层是主要可见影，
     第 3 层大范围散开负责「腾空」。超过三层会在纸色上泛灰，像塑料片。 */
  --hd-shadow-card: 0 2px 4px rgba(25, 22, 18, .08),
                    0 10px 24px -10px rgba(25, 22, 18, .13),
                    0 34px 68px -34px rgba(25, 22, 18, .28);
  --hd-shadow-card-hover: 0 3px 6px rgba(25, 22, 18, .09),
                          0 14px 32px -12px rgba(25, 22, 18, .15),
                          0 44px 84px -40px rgba(25, 22, 18, .30);
  /* 深墨卡：视觉重量大，影子要比白卡重一档才撑得住；页眉那块深色面板靠它离地 */
  --hd-shadow-card-dark: 0 4px 10px rgba(25, 22, 18, .14),
                         0 20px 44px -20px rgba(25, 22, 18, .34),
                         0 44px 88px -44px rgba(25, 22, 18, .40);

  /* ── 动效 · Motion ─────────────────────────────────────────────────── */
  --hd-ease:      cubic-bezier(.2, .7, .3, 1);
  --hd-dur-1:     140ms;   /* 颜色/边框 */
  --hd-dur-2:     200ms;   /* 阴影/位移 */
  --hd-dur-3:     320ms;   /* 展开/抽屉 */

  /* ── 层级 / 关键尺寸 ───────────────────────────────────────────────── */
  --hd-z-sticky: 90;   /* 自测粘性工具条：低于 nav(100) */
  --hd-z-nav: 100;  --hd-z-drawer: 200;  --hd-z-modal: 300;
  --hd-nav-h:    72px;  /* 桌面临界值，Phase 3 的 .hd-nav 与 .hd-quizbar top 共用 */
  --hd-nav-h-sm: 60px;  /* <900px */
  --hd-hit:      44px;  /* 最小触控命中区（chip 视觉 36 高，用伪元素撑到 44） */
}

/* ============================================================================
   1. Reset（克制版：只做必要归零）
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--hd-nav-h) + 24px);  /* 锚点/焦点避开固定导航 */
}

body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, fieldset {
  margin: 0;
}
ul, ol { margin: 0; padding-left: 1.15em; }
fieldset { padding: 0; border: 0; }

img, svg, video { display: block; max-width: 100%; height: auto; }

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
table { border-collapse: collapse; border-spacing: 0; }

:focus-visible { outline: 2px solid var(--hd-red-700); outline-offset: 2px; }

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

/* ============================================================================
   2. 基础排版
   注意：不要加 -webkit-font-smoothing: antialiased —— macOS 上中文会变细发虚；
        不要用 300 字重 —— Windows 上中文 300 几乎不可读。
   ========================================================================== */
body {
  font-family: var(--hd-font-sans);
  font-size: var(--hd-fs-body);
  font-weight: 400;
  line-height: var(--hd-lh-relaxed);
  color: var(--hd-text-1);
  background: var(--hd-paper-100);
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--hd-font-serif);
  font-weight: 600;
  color: var(--hd-text-1);
  letter-spacing: var(--hd-ls-1);
  text-wrap: balance;
}

h1 { font-size: var(--hd-fs-h1); line-height: var(--hd-lh-tight); }
h2 { font-size: var(--hd-fs-h2); line-height: var(--hd-lh-snug); }
h3 { font-size: var(--hd-fs-h3); line-height: var(--hd-lh-snug); }
h4 { font-size: var(--hd-fs-h4); line-height: var(--hd-lh-normal); letter-spacing: var(--hd-ls-0); }

p {
  font-size: var(--hd-fs-body);
  line-height: var(--hd-lh-relaxed);
  color: var(--hd-text-2);
  text-wrap: pretty;   /* 避免中文末行孤字；不支持该值的浏览器直接忽略 */
}

/* 正文内链：默认继承墨色 + 纸感下划线；悬停时下划线转朱（朱只做「点」） */
a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: .24em;
  text-decoration-thickness: 1px;
  transition: color var(--hd-dur-1) var(--hd-ease),
              text-decoration-color var(--hd-dur-1) var(--hd-ease);
}
:where(p, li, dd, td) > a {
  text-decoration: underline;
  text-decoration-color: var(--hd-line-strong);
}
:where(p, li, dd, td) > a:hover { text-decoration-color: var(--hd-red-500); }

small { font-size: var(--hd-fs-caption); color: var(--hd-text-3); line-height: var(--hd-lh-normal); }

strong, b { font-weight: 600; }   /* 600 是上限，再粗在 SimSun 上会糊 */

/* 表格基础（组件化的表格写在 site.css） */
table { width: 100%; font-size: var(--hd-fs-sm); line-height: var(--hd-lh-normal); }
caption { font-size: var(--hd-fs-caption); color: var(--hd-text-3); text-align: left; padding-bottom: var(--hd-s-2); }
th { font-weight: 600; text-align: left; color: var(--hd-text-3);
     font-size: var(--hd-fs-micro); letter-spacing: var(--hd-ls-3);
     padding: var(--hd-s-3) var(--hd-s-4); border-bottom: 1px solid var(--hd-line-strong); }
td { padding: var(--hd-s-3) var(--hd-s-4); border-bottom: 1px solid var(--hd-line);
     color: var(--hd-text-2); font-variant-numeric: tabular-nums; }

::selection { background: var(--hd-selection); color: var(--hd-text-1); }

/* ============================================================================
   3. 工具类（只有这五个）
   ========================================================================== */
.hd-container {
  width: 100%;
  max-width: var(--hd-container);
  margin-inline: auto;
  padding-inline: var(--hd-gutter);
}

/* 小号疏排标签：中文靠字距，英文可全大写 */
.hd-eyebrow {
  display: inline-block;
  font-family: var(--hd-font-sans);
  font-size: var(--hd-fs-micro);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: var(--hd-ls-4);
  text-indent: var(--hd-ls-4);   /* 补偿末字后多出的字距 */
  color: var(--hd-text-3);
  text-transform: uppercase;
}

.hd-serif {
  font-family: var(--hd-font-serif);
  font-weight: 600;
  letter-spacing: var(--hd-ls-1);
}

/* 数字一律等宽，保证背书带与表格的竖直对齐 */
.hd-tabular {
  font-family: var(--hd-font-num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: var(--hd-ls-0);
}

.hd-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
