/**
 * fonts.css — 维衡律师 WordPress 主题
 *
 * 原站（weihenglaw.com）字体事实（依据 docs/01-分析报告.md 对 main.css 的提取）：
 *   - 中文正文：'PingFang SC', 'Microsoft YaHei'
 *   - 数字 / 拉丁文：Roboto（原站自托管 woff2）
 *   - 标题（.std-title*、.ys-logo__cn、年份数字等）：中文衬线栈（Songti / SimSun / Noto Serif）
 *
 * 本主题策略：
 *   1. Roboto 自托管，不请求 Google Fonts（国内访问与隐私双重考虑），
 *      以 @font-face 声明 latin 子集，font-display: swap 保证首屏不被字体阻塞。
 *   2. 中文一律不打包字体文件（体积过大且各系统自带版本已足够好看），
 *      走系统栈：macOS/iOS → PingFang SC；Windows → Microsoft YaHei；
 *      国产 Linux → Noto Sans CJK。这样 0 额外请求、0 首屏成本。
 *   3. 标题衬线同理：macOS → Songti SC / STSong；Windows → SimSun 作为兜底，
 *      但优先使用 Noto Serif SC / Source Han Serif（若用户机器已安装）。
 *   4. 若站点需要更统一的标题字形，可在 functions.php 里追加
 *      思源宋体的自托管 @font-face（见文件末尾注释的示例）。
 *
 * @package Zaishangyanfa
 * @since   1.0.0
 */

/* ==========================================================================
   01. Roboto —— 拉丁与数字自托管
   --------------------------------------------------------------------------
   仅声明 400 / 500 / 700 三个字重（原站实际使用范围），
   每字重一个 woff2，latin 子集，理论上单文件 ~15KB。
   若主题包内暂未附带 font 文件，浏览器会静默回退到 --font-fallback-latin，
   不会出现 404 阻塞或排版崩坏（font-display: swap + 无可下载源时直接跳过）。
   ========================================================================== */

@font-face {
	font-family: "Roboto";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/roboto-v30-latin-regular.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
		U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122,
		U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Roboto";
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url("../fonts/roboto-v30-latin-500.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
		U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122,
		U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Roboto";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/roboto-v30-latin-700.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
		U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122,
		U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* 斜体在正文引用（blockquote）偶有用到，单独声明一档 */
@font-face {
	font-family: "Roboto";
	font-style: italic;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/roboto-v30-latin-italic.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
		U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122,
		U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ==========================================================================
   02. 自定义属性 —— 字体栈
   --------------------------------------------------------------------------
   注意：main.css 的 :root 里也已声明 --font-sans / --font-serif。
   本文件通过 style.css 与 main.css 之后的加载顺序覆盖为「带 Roboto 前缀」的完整栈。
   main.css 中的值作为降级基线保留，二者不冲突。
   ========================================================================== */

:root {
	/* 拉丁优先：Roboto 命中数字与英文，中文自动落到系统字体 */
	--font-latin: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial,
		sans-serif;

	/* 中文无衬线系统栈：macOS/iOS → PingFang；Windows → YaHei；Linux → Noto */
	--font-cn-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
		"Microsoft YaHei UI", "Source Han Sans SC", "Noto Sans CJK SC",
		"WenQuanYi Micro Hei", sans-serif;

	/* 中文衬线系统栈：macOS → Songti SC；Windows → SimSun；Linux → Noto Serif */
	--font-cn-serif: "Songti SC", "STSong", "Noto Serif SC",
		"Source Han Serif SC", "SimSun", "宋体", serif;

	/* 最终生效栈 */
	--font-sans: var(--font-latin), var(--font-cn-sans);
	--font-serif: "Roboto", "Songti SC", "STSong", "Noto Serif SC",
		"Source Han Serif SC", "SimSun", "宋体", serif;

	/* 等宽（用于代码块、编号） */
	--font-mono: "SFMono-Regular", "SF Mono", Menlo, Consolas,
		"Liberation Mono", monospace;

	/* 数字等宽（年份、金额、统计） */
	--font-numeric: "Roboto", "Helvetica Neue", Arial, sans-serif;
}

/* ==========================================================================
   03. 全局字体落地
   --------------------------------------------------------------------------
   main.css 已在 body 上设置 --font-sans，这里只补「拉丁字形优化」相关的
   font-feature-settings，让数字与英文在正文里更接近原站观感。
   ========================================================================== */

body {
	font-family: var(--font-sans);
	/* 关闭连字以外的自动替换，避免中文全角标点被异体化 */
	font-feature-settings: "kern" 1, "liga" 1;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

/* 标题统一衬线 */
h1,
h2,
h3,
h4,
h5,
.ys-logo__cn,
.std-title1__title,
.std-title2__title,
.wh-team__title,
.wh-detail__title,
.wh-lawyer-hero__name,
.wh-pd__title,
.wh-lb__title {
	font-family: var(--font-serif);
	/* 中文衬线在小字号下会偏细，统一加一点字重补偿（不动 main.css 的 font-weight） */
	font-synthesis-weight: auto;
}

/* 数字/统计/年份：等宽数字 + 表格数字对齐 */
.wh-team__count strong,
.wh-cases__year,
.wh-detail__meta time,
.wh-research__item .wh-research__date,
.wh-honor__year,
.wh-timeline__year,
.wh-track__bar,
.ys-page__cell a {
	font-variant-numeric: tabular-nums lining-nums;
	font-feature-settings: "tnum" 1, "lnum" 1;
}

/* 英文小标（业务领域英文名、栏目英文）使用 Roboto 500 + 宽字距 */
.wh-pcard__en,
.wh-lawyer-hero__en,
.wh-sub,
.ys-logo__en,
.wh-contact__branch-en,
.wh-about__city-en {
	font-family: var(--font-latin);
	font-weight: 500;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

/* 代码块 */
.wh-prose code,
.wh-prose pre,
.wh-prose kbd {
	font-family: var(--font-mono);
}

/* ==========================================================================
   04. 字号可读性兜底
   --------------------------------------------------------------------------
   正文最小 16px（main.css 已保证），这里额外约束「不会小于 12px」，
   防止浏览器最小字号设置为 12 时某些 11px 小标被强行放大而撑破布局。
   ========================================================================== */

.wh-prose {
	font-family: var(--font-sans);
	font-size: var(--text16);
	line-height: 1.95;
}

/* 中文正文首行不缩进（律所风格偏现代排版），但保留段间距 */
.wh-prose p {
	text-indent: 0;
}

/* 中英文混排时给拉丁词留出微弱字距，避免与中文贴死 */
.wh-prose p,
.wh-prose li {
	word-spacing: 0.02em;
}

/* ==========================================================================
   05. 字体加载失败兜底
   --------------------------------------------------------------------------
   若 fonts/ 目录内文件缺失，@font-face 静默失效，回退到系统栈，
   排版不崩、不出现豆腐块。此规则用于显式声明该预期，
   同时也给「用户强制使用系统字体」的偏好一个出口。
   ========================================================================== */

.fonts-fallback body,
body.fonts-fallback {
	--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
		"Microsoft YaHei", sans-serif;
	--font-serif: "Songti SC", "STSong", "SimSun", serif;
}

/* ==========================================================================
   06. 可选：自托管思源宋体（如需统一标题字形，取消注释并放入字体文件）
   --------------------------------------------------------------------------
   思源宋体 SC 单字重 woff2 约 4–6MB（全字符集），建议按 unicode-range
   拆分为多个子集后再启用，否则会严重拖慢首屏。

   @font-face {
   	font-family: "Source Han Serif SC";
   	font-style: normal;
   	font-weight: 600;
   	font-display: swap;
   	src: url("../fonts/source-han-serif-sc-600-subset.woff2") format("woff2");
   	unicode-range: U+4E00-9FFF, U+3000-303F, U+FF00-FFEF;
   }
   ========================================================================== */
