/* ============================================================
 * Moliere · Wyckoff 教科书 · 设计 Token
 *
 * 视觉骨架：杂志层（衬线 + 留白）+ 终端层（等宽 + 密度）双纪律
 * 参考：Bloomberg Markets 数字版 · Monocle · FT Weekend · IBKR TWS
 *
 * 纪律（非协商）：
 * - 字号 12 档预设；禁止小数像素（11 点 5 / 13 点 5 一类）
 * - 4 主色 + 7 灰阶；禁止其它色相
 * - 1px border 替代 shadow（仅模态可有 shadow-md）
 * - 圆角统一 0 / 2px；禁止 4px+
 * - 字重仅 400 / 500 / 600 三档
 * ============================================================ */

:root {
  /* ─── 印刷感色板 · 杂志层 ──────────────── */
  --ink-100: #fbfaf7;        /* 主纸色（off-white） */
  --ink-200: #f0ede5;        /* 次级纸色（边栏 / 表头） */
  --ink-300: #d4cfc0;        /* 分隔线 */
  --ink-400: #a39c89;        /* 三级文字 */
  --ink-500: #6b6558;        /* 二级文字 */
  --ink-600: #4a463d;        /* 强二级文字 */
  --ink-700: #2a2620;        /* 正文墨色 */
  --ink-900: #14110d;        /* 大标题墨色 */

  /* ─── 4 主色（终端语义） ─── */
  --red-press: #c41220;      /* 印刷红 · 章节号 / 大数字 / 派发 / 危险 */
  --red-down:  #9e1b22;      /* 亏损红（暗调，杂志感） */
  --green-up:  #0f7a47;      /* 收益绿（暗调，杂志感） */
  --blue-link: #1a4d8c;      /* 链接 / BUY / 信息 */
  --orange-warn: #b45309;    /* 警告（仅置信度 / callout） */

  /* ─── 字体栈 ─── */
  --font-serif:   Georgia, "Times New Roman", "Noto Serif SC", "Songti SC", serif;
  --font-display: Georgia, "Times New Roman", "Noto Serif SC", "Songti SC", serif;
  --font-sans:    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-mono:    ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  /* ─── 字号阶梯（12 档预设） ─── */
  --t-micro:    11px;        /* 数据脚注 / 图例 */
  --t-meta:     12px;        /* 边栏元信息 / 章节计数 */
  --t-data:     13px;        /* 表格数据 · tabular-nums */
  --t-caption:  14px;        /* 图说 / 边栏正文 */
  --t-body:     17px;        /* 主体正文（杂志感） */
  --t-lead:     22px;        /* 章节首段 lead */
  --t-h3:       28px;        /* block 标题 */
  --t-quote:    32px;        /* pull-quote */
  --t-h2:       48px;        /* 章节小标题 */
  --t-h1:       96px;        /* 章节大标题 */
  --t-display:  168px;       /* 章节扉页数字 */
  --t-display-xl: 240px;     /* 全集封面巨数字 */

  /* ─── 行高 ─── */
  --lh-tight:   1.05;
  --lh-snug:    1.25;
  --lh-normal:  1.5;
  --lh-relaxed: 1.6;
  --lh-loose:   1.75;

  /* ─── 字重（仅 3 档） ─── */
  --w-regular:  400;
  --w-medium:   500;
  --w-semibold: 600;

  /* ─── 字间距 ─── */
  --tracking-display: -0.03em;   /* 168px / 240px 巨数字 */
  --tracking-tight:   -0.02em;   /* 大标题 */
  --tracking-normal:  0;
  --tracking-wide:    0.05em;
  --tracking-wider:   0.1em;     /* uppercase label */

  /* ─── 12 栏网格 ─── */
  --grid-max:    1680px;         /* 4K 居中上限（避免文本行超过 90ch） */
  --grid-cols:   12;
  --grid-gap:    24px;
  --grid-margin: 64px;           /* 左右页边距 */

  /* ─── 节奏（间距阶梯，倍数 2） ─── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 48px;
  --space-6: 96px;
  --space-7: 160px;              /* 章节扉页上下空间 */

  /* ─── 边框 ─── */
  --border-1:     1px solid var(--ink-300);
  --border-2:     2px solid var(--ink-700);
  --border-3:     3px solid var(--ink-900);
  --border-red:   1px solid var(--red-press);
  --border-red-2: 2px solid var(--red-press);

  /* ─── 圆角（极少使用） ─── */
  --radius-0:  0;
  --radius-sm: 2px;

  /* ─── 阴影（仅模态） ─── */
  --shadow-modal: 0 8px 24px rgba(20, 17, 13, 0.18);

  /* ─── 过渡 ─── */
  --tx-fast: 80ms ease-out;
  --tx-base: 160ms ease-out;
  --tx-slow: 320ms ease-out;

  /* ─── Z 轴 ─── */
  --z-base:    0;
  --z-sticky:  10;
  --z-overlay: 50;
  --z-modal:   100;
  --z-toast:   200;

  /* ─── 终端层（数据卡片 · 表格） ─── */
  --term-row-h:      22px;
  --term-header-h:   24px;
  --term-cell-pad-x: 8px;
  --term-cell-pad-y: 4px;
}

/* ─── 全局重置 ─── */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background: var(--ink-100);
  color: var(--ink-700);
  font-family: var(--font-serif);
  font-size: var(--t-body);
  line-height: var(--lh-relaxed);
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  font-variant-numeric: lining-nums;
}

/* 数字区域强制 tabular-nums */
.tabular,
.num,
[data-num],
table,
.itable,
.datacard-val,
.bignum-val,
.counter-val,
.cover-number {
  font-variant-numeric: tabular-nums lining-nums;
}

/* 链接基线 */
a {
  color: var(--blue-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* 选区颜色（印刷红） */
::selection {
  background: var(--red-press);
  color: var(--ink-100);
}

/* Focus 可见 */
:focus-visible {
  outline: 2px solid var(--blue-link);
  outline-offset: 2px;
}

/* 隐藏滚动条但保留滚动 */
.scroll-thin::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.scroll-thin::-webkit-scrollbar-thumb {
  background: var(--ink-300);
}
.scroll-thin::-webkit-scrollbar-track {
  background: transparent;
}
