/* ============================================================================
 * Inter 自托管 · WOFF2 子集化  ·  2026-10-15
 *
 * 改造前：5 个 TTF 共 1593 KB，且未子集化（含西里尔/希腊等大量用不到的字形）
 * 改造后：5 个 WOFF2 共 88 KB  →  降 94.5%
 *
 * 实测影响：Slow 4G（1.6Mbps）下首页首屏关键路径原本 994 KB，其中 954 KB 是字体。
 * 单这一项就能省下约 6.2 秒的下载时间。
 *
 * 子集范围：基本拉丁 + 拉丁1补充 + 拉丁扩展A + 常用标点/符号（共 407 字符）
 *   - 覆盖英文站所需的一切，含西欧重音（é ü ñ 等）
 *   - 去掉了越南语 U+1E00-1EFF 与拉丁扩展B（英文站用不到，占了近一半体积）
 *
 * 保留的 OpenType 特性：calt ccmp dnom frac locl numr pnum tnum
 *   ★ tnum 必须保留 —— 设计层用 `font-variant-numeric: tabular-nums`
 *     让表格与统计数字纵向对齐，丢了它数字宽度会不齐
 * ==========================================================================*/

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('inter-400.woff2') format('woff2'),
       url('inter-400.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('inter-500.woff2') format('woff2'),
       url('inter-500.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('inter-600.woff2') format('woff2'),
       url('inter-600.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('inter-700.woff2') format('woff2'),
       url('inter-700.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('inter-800.woff2') format('woff2'),
       url('inter-800.ttf') format('truetype');
}

/* ----------------------------------------------------------------------------
 * 兜底字体「度量对齐」—— 这是 CLS 的根治手段
 *
 * 实测问题：分类页与详情页 CLS = 0.144（Google 阈值 0.1）
 *   归因：layout-shift 事件显示 `MAIN [167 → 194]`，同一时刻 header 高 167 → 194
 *   根因：WebFont 下载完成后，导航文字的字形宽度变了 → 重新折行 → header 多出一行
 *         把整个 <main> 推下去 27px
 *
 * 修法：声明一个仅用于兜底显示的本地字体，用 *-override 把它的度量强行对齐 Inter，
 *       这样字体交换前后「行高」与「字宽」都一致，折行点不变，就不再有位移。
 *       （等价于 Next.js `next/font` 自动做的事）
 *
 * 数值由 fontTools 离线读取 Inter 的 hhea / OS/2 表算出：
 *   unitsPerEm 2048
 *   ascent  1984 / 2048 = 96.88%
 *   descent  494 / 2048 = 24.12%
 *   lineGap    0 / 2048 =  0.00%     → Inter 总行高 121.00%
 *   Arial 总行高 114.99%             → size-adjust = 121.00 / 114.99 = 105.22%
 *
 * 注意：四个字重的 hhea 度量完全一致（1984 / -494 / 0），所以只需声明一次。
 * -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Inter Fallback';
  src: local('Arial'),
       local('Helvetica Neue'),
       local('Helvetica'),
       local('Liberation Sans'),
       local('DejaVu Sans');
  ascent-override: 96.88%;
  descent-override: 24.12%;
  line-gap-override: 0%;
  size-adjust: 105.22%;
}
