/* 流星农跨境法税 · 设计令牌
 * 单一来源：颜色、字号、间距、圆角、阴影、动效。
 * 不引用任何外部字体或 CDN；中文使用系统字体栈。
 */
:root {
  /* 字体：优先系统中文，避免外链与首屏抖动 */
  --bk-font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", "Heiti SC", sans-serif;
  --bk-font-serif: "Songti SC", "SimSun", "Source Han Serif SC", "Noto Serif CJK SC", Georgia, serif;
  --bk-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "PingFang SC", monospace;

  /* 字号阶梯（1.200 Minor Third，正文 17px 便于手机长读） */
  --bk-text-2xs: 11px;
  --bk-text-xs: 12px;
  --bk-text-sm: 13px;
  --bk-text-base: 17px;
  --bk-text-md: 19px;
  --bk-text-lg: 22px;
  --bk-text-xl: 27px;
  --bk-text-2xl: 33px;
  --bk-text-3xl: 40px;
  --bk-leading-tight: 1.3;
  --bk-leading-snug: 1.5;
  --bk-leading-normal: 1.7;
  --bk-leading-loose: 1.9;
  --bk-tracking-wide: 0.08em;

  /* 间距（4px 基准） */
  --bk-space-1: 4px;
  --bk-space-2: 8px;
  --bk-space-3: 12px;
  --bk-space-4: 16px;
  --bk-space-5: 24px;
  --bk-space-6: 32px;
  --bk-space-7: 48px;
  --bk-space-8: 64px;
  --bk-space-9: 96px;

  /* 颜色：石墨墨色为主，暖铜色为强调 */
  --bk-ink: #14181d;
  --bk-ink-soft: #38414b;
  --bk-ink-muted: #5c6773;
  --bk-ink-faint: #8b95a1;
  --bk-line: #e2e6ea;
  --bk-line-strong: #c8cfd6;
  --bk-surface: #ffffff;
  --bk-surface-raised: #fbfcfd;
  --bk-surface-sunken: #f4f6f8;
  --bk-surface-tint: #f7f4ef;
  --bk-accent: #8a5a2b;
  --bk-accent-strong: #6f4620;
  --bk-accent-soft: #f3ebdf;
  --bk-ok: #1c6b4a;
  --bk-ok-soft: #e6f3ec;
  --bk-warn: #8a5a00;
  --bk-warn-soft: #fdf3e0;
  --bk-danger: #9c2b1f;
  --bk-danger-soft: #fbeae7;
  --bk-locked: #7a6a58;
  --bk-locked-soft: #f4f1ec;

  /* 圆角与阴影 */
  --bk-radius-sm: 4px;
  --bk-radius: 8px;
  --bk-radius-lg: 14px;
  --bk-radius-pill: 999px;
  --bk-shadow-1: 0 1px 2px rgba(20, 24, 29, 0.06), 0 1px 1px rgba(20, 24, 29, 0.04);
  --bk-shadow-2: 0 2px 8px rgba(20, 24, 29, 0.07), 0 1px 2px rgba(20, 24, 29, 0.05);
  --bk-shadow-3: 0 12px 32px rgba(20, 24, 29, 0.12);

  /* 版心与节奏 */
  --bk-measure: 42rem;
  --bk-measure-wide: 60rem;
  --bk-shell: 1180px;
  --bk-reading-shell: 1360px;
  --bk-toc-width: 272px;
  --bk-rail-width: 300px;
  --bk-header-height: 60px;

  /* 动效 */
  --bk-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --bk-duration: 160ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bk-ink: #eef1f4;
    --bk-ink-soft: #c8d0d8;
    --bk-ink-muted: #98a3ae;
    --bk-ink-faint: #78838f;
    --bk-line: #2a3138;
    --bk-line-strong: #3b444d;
    --bk-surface: #14181d;
    --bk-surface-raised: #1a1f25;
    --bk-surface-sunken: #101317;
    --bk-surface-tint: #1f1c18;
    --bk-accent: #d9a877;
    --bk-accent-strong: #e8bf94;
    --bk-accent-soft: #2b2419;
    --bk-ok: #6fd0a2;
    --bk-ok-soft: #16302a;
    --bk-warn: #e2b95f;
    --bk-warn-soft: #322a17;
    --bk-danger: #ef8f83;
    --bk-danger-soft: #331d1a;
    --bk-locked: #b3a793;
    --bk-locked-soft: #262320;
    --bk-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
    --bk-shadow-2: 0 2px 10px rgba(0, 0, 0, 0.55);
    --bk-shadow-3: 0 14px 34px rgba(0, 0, 0, 0.6);
  }
}

/* 读者可手动切换字号与主题；JS 在 <html> 上写入 data 属性。 */
html[data-bk-text="large"] { --bk-text-base: 19px; --bk-text-md: 21px; --bk-text-lg: 24px; }
html[data-bk-text="xlarge"] { --bk-text-base: 21px; --bk-text-md: 23px; --bk-text-lg: 26px; }
html[data-bk-theme="light"] {
  --bk-ink: #14181d; --bk-ink-soft: #38414b; --bk-ink-muted: #5c6773; --bk-ink-faint: #8b95a1;
  --bk-line: #e2e6ea; --bk-line-strong: #c8cfd6; --bk-surface: #ffffff;
  --bk-surface-raised: #fbfcfd; --bk-surface-sunken: #f4f6f8; --bk-surface-tint: #f7f4ef;
  --bk-accent: #8a5a2b; --bk-accent-strong: #6f4620; --bk-accent-soft: #f3ebdf;
  --bk-ok: #1c6b4a; --bk-ok-soft: #e6f3ec; --bk-warn: #8a5a00; --bk-warn-soft: #fdf3e0;
  --bk-danger: #9c2b1f; --bk-danger-soft: #fbeae7; --bk-locked: #7a6a58; --bk-locked-soft: #f4f1ec;
}
html[data-bk-theme="dark"] {
  --bk-ink: #eef1f4; --bk-ink-soft: #c8d0d8; --bk-ink-muted: #98a3ae; --bk-ink-faint: #78838f;
  --bk-line: #2a3138; --bk-line-strong: #3b444d; --bk-surface: #14181d;
  --bk-surface-raised: #1a1f25; --bk-surface-sunken: #101317; --bk-surface-tint: #1f1c18;
  --bk-accent: #d9a877; --bk-accent-strong: #e8bf94; --bk-accent-soft: #2b2419;
  --bk-ok: #6fd0a2; --bk-ok-soft: #16302a; --bk-warn: #e2b95f; --bk-warn-soft: #322a17;
  --bk-danger: #ef8f83; --bk-danger-soft: #331d1a; --bk-locked: #b3a793; --bk-locked-soft: #262320;
}

@media (prefers-reduced-motion: reduce) {
  :root { --bk-duration: 0ms; }
  html { scroll-behavior: auto; }
}
