/* ouuut-v2 · 设计令牌 (Editorial / Warm Paper / 探险杂志风)
   规范：米纸质感底色，每个主题单信号色，大号衬线标题，等宽眉标。
   分割线：可配置变量，支持随时一键关闭或开启。 */

@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/InstrumentSerif-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/InstrumentSerif-400-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/Geist-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/Geist-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/Geist-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/JetBrainsMono-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/JetBrainsMono-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/JetBrainsMono-700-normal.woff2') format('woff2');
}
/* CJK 标题：Noto Serif 子集（简体 279 字形 / 日文 276 字形，700 Bold，自托管） */
@font-face {
  font-family: 'Noto Serif SC';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/NotoSerifSC-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Noto Serif JP';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/NotoSerifJP-700-normal.woff2') format('woff2');
}
/* CJK 小字：Noto Sans 子集（简中 269 字形 / 日文 258 字形 + ASCII，500 Medium，自托管；2026-10-12 用户令：CJK 小字统一无衬线 12px） */
@font-face {
 font-family: 'Noto Sans SC';
 font-style: normal;
 font-weight: 500;
 font-display: swap;
 src: url('fonts/NotoSansSC-500-normal.woff2') format('woff2');
}
@font-face {
 font-family: 'Noto Sans JP';
 font-style: normal;
 font-weight: 500;
 font-display: swap;
 src: url('fonts/NotoSansJP-500-normal.woff2') format('woff2');
}
/* 字标：Outfit 800（纯几何音波，无突起平滑曲线） */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('fonts/Outfit-800-normal.woff2') format('woff2');
}

/* —— 度量兼容的回退字体（必须是顶层规则；塞进 :root{} 里会被浏览器整条丢弃）——
   Instrument Serif 未到达/被拦截时用 Georgia 顶替，但 Georgia 实测比它宽 32.5%
   （同一串 1230px vs 1630px @89.28px）→ 不缩放的话英文 H1 会先折成 3 行、字体到位后再跳回 2 行，
   既是 CLS 也违反「H1 恒两行」锁（审计 E-03）。
   纯按宽度比算应取 1230/1630 = 75.5%，实测 76% 仍会折行（回退宽度是 Instrument 的 100.7%，行宽越界 5px），
   故收到 72%（≈ Instrument 的 95.4%），宁可略窄也不折行。
   H1 的 line-height 是 0.96 的无单位值，行盒与字体度量无关，故无需 ascent/descent-override。 */
@font-face {
  font-family: 'Serif Fallback';
  src: local('Georgia'), local('Times New Roman'), local('Times');
  size-adjust: 72%;
}

:root {
  /* —— 字体栈 —— */
  --font-serif: 'Instrument Serif', 'Serif Fallback', 'Noto Serif SC', 'Noto Serif JP', Georgia, 'Times New Roman', serif;
  --font-sans: 'Geist', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-wordmark: 'Outfit', sans-serif;
  
  /* CJK 字体栈 */
  --font-zh-serif: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', SimSun, serif;
  --font-zh-sans: 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-ja-serif: 'Noto Serif JP', 'Source Han Serif JP', 'Yu Mincho', 'Hiragino Mincho ProN', serif;
  --font-ja-sans: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', Meiryo, sans-serif;

  /* —— 默认主题（无 data-theme 时的兜底）: SAGE 茶白 / 墨绿 ——
     2026-10-14 用户令：只保留两态（sage 浅 / dark 深），按本地时间自动切换，
     由 build.py 的首屏引导脚本落地（白天 sage、夜晚 dark）。 */
  --bg: #E9EDE3;
  --ink: #17211A;
  --muted: #56635A;
  --accent: #2F6B4F;
  --accent-soft: rgba(47, 107, 79, 0.08);
  /* 小字用强调色（≥4.5:1）；大字号/装饰仍用 --accent。默认与 --accent 同值 */
  --accent-ink: var(--accent);
  --surface: rgba(23, 33, 26, 0.045);

  /* 吸顶页头高度：styles.css 的 .nav 与 fx.css 的破框文字层都用它，避免两处写死 72px 漂移 */
  --nav-h: 72px;

  /* —— difference 混合专用源色 ——
     自定义光标走 mix-blend-mode:difference 实现"任何底色都可见"。
     difference 的结果是 |源色 − 底色|，故源色必须恒为纯白：白 vs 浅底 #E9EDE3 → 近黑(可见)，
     白 vs 暗底 #0E0E0C → 近白(可见)。若源色跟着主题走（如用 --ink），亮色主题下会算出近白 → 光标隐形。
     这两个值**与主题无关**，不是主题色，勿替换成 var(--ink)/var(--bg)。 */
  --blend-src: #FFFFFF;
  --blend-inv: #000000;

  /* —— 纯净零线条（靠留白与字阶呼吸分层）—— */
  --line-width: 0px;
  --line-style: solid;
  --line-color: transparent;

  /* —— 版式与留白 (8px 基准) —— */
  --pad: clamp(20px, 4vw, 56px);
  --maxw: 1360px;
  --gap: clamp(24px, 3vw, 48px);
  --sec-y: clamp(5rem, 11vw, 9.5rem);

  /* —— 字号阶梯 (按规范 clamp) —— */
  --fs-eyebrow: 11px;
  --fs-body: 17px;
  --fs-lead: clamp(18px, 1.8vw, 22px);
  /* -- H1 阶梯(锁)：按「品牌两行」实测标定，保证每行不被挤断 --
     实测「最宽一行文本宽 / 字号」比值（含 italic 强调词）：en 7.30 · ja 8.92 · zh 8.01
     单位是 cqw（.hero-top 的容器宽），不是 vw：见 styles.css 里 .hero-top 的说明。
     标定值按「与原设计字号偏差 ≤5%」反推，并留折行余量 ——
     headed 实测（320 档，容器 265px）折行临界：en 16.78 / ja 11.22 / zh 12.50 cqw，
     故取 en 12.7 / ja 10.7 / zh 11.7，余量 24.3% / 4.7% / 6.4%。
     余量按「字号÷容器宽」是定值算，故与视口宽度无关，320 到 899 全档成立。
     此处为 <900px 单栏标定；≥900px 两栏在下方 media 内收窄重标定（那份仍用 vw，实测余量充足） */
  --fs-h1-en: clamp(2rem, 12.7cqw, 6rem);
  --fs-h1-ja: clamp(1.7rem, 10.7cqw, 4.4rem);
  --fs-h1-zh: clamp(1.7rem, 11.7cqw, 4.8rem);
  --fs-h2: clamp(2rem, 4.2vw, 3.8rem);
  --fs-h3: clamp(1.35rem, 2.4vw, 1.9rem);
}

/* ≥900px：Hero 切两栏，文本栏宽收窄到约视口的 45–48%，字号按新栏宽重标定。
   上限按「--maxw 1360 封顶后文本栏最宽 684px」反推，避免超宽屏 vw 继续涨而栏宽不涨导致折行 */
@media (min-width: 900px) {
  :root {
    --fs-h1-en: clamp(2.6rem, 6.2vw, 5.7rem);
    --fs-h1-ja: clamp(1.9rem, 5vw, 4.6rem);
    --fs-h1-zh: clamp(1.9rem, 5.6vw, 5.2rem);
  }
}

/* 主题定义（2026-10-14 用户令：只两态 —— sage 浅 / dark 深，按本地时间自动切换） */
html[data-theme="sage"] {
  --bg: #E9EDE3;
  --ink: #17211A;
  --muted: #56635A;
  --accent: #2F6B4F;
  --accent-soft: rgba(47, 107, 79, 0.08);
  --surface: rgba(23, 33, 26, 0.045);
}

html[data-theme="dark"] {
  --bg: #0E0E0C;
  --ink: #EDEBE4;
  --muted: #A09E96;
  --accent: #FF6A3D;
  --accent-soft: rgba(255, 106, 61, 0.12);
  /* 小字专用强调色必须跟着暗色重定义：浅色版落在 #0E0E0C 上对比度不足（小字需 ≥4.5:1）。
     #F2653A 实测 6.17:1，观感仍贴近 --accent。 */
  --accent-ink: #F2653A;
  --surface: rgba(237, 235, 228, 0.055);
}

/* 分割线自由开关类 (方便本地实时 A/B 对比预览)
   开关由 build.py 的引导脚本写 html[data-lines] 驱动（body 上的旧类无人写入，已删）。 */
html[data-lines="false"] {
  --line-width: 0px !important;
  --line-color: transparent !important;
}
