/* ============================================
   中文字体优化 - chinese-fonts.css
   确保中文字体在各平台上显示最佳效果
   ============================================ */

/* 基础字体栈 - 优先使用系统字体，零下载延迟 */
body,
button,
input,
select,
textarea {
    font-family:
        "PingFang SC",           /* macOS/iOS 系统首选 */
        "Hiragino Sans GB",      /* macOS 备选 */
        "Microsoft YaHei",       /* Windows 系统首选 */
        "WenQuanYi Micro Hei",   /* Linux 常见 */
        "Noto Sans SC",          /* Chrome OS / Android */
        "Source Han Sans SC",    /* Adobe 开源 */
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        sans-serif;
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 标题字体 - 更有力量感的字重 */
h1, h2, h3, h4, h5, h6,
.wp-block-heading,
.post-card-title,
.widget-title,
.single-post-title,
.hero-title {
    font-family:
        "PingFang SC",
        "Noto Sans SC",
        "Microsoft YaHei",
        "Source Han Sans SC",
        system-ui,
        -apple-system,
        sans-serif;
    font-weight: 700;
    letter-spacing: 0.02em;
    font-feature-settings: "kern" 1;
}

/* 中文正文优化 - 更大的行高和字间距 */
.single-post-content p,
.post-card-excerpt,
.author-card-bio {
    line-height: 1.8;
    letter-spacing: 0.03em;
}

/* 中文标点优化 - 避免标点悬挂 */
p {
    hanging-punctuation: first last;
    text-indent: 0;
}

/* 中文段落首行缩进（可选，默认关闭） */
.single-post-content > p:not(:first-child) {
    /* text-indent: 2em; */
}

/* 代码字体栈 */
code,
pre,
kbd,
samp,
.wp-block-code {
    font-family:
        "JetBrains Mono",
        "Fira Code",
        "Source Code Pro",
        "Noto Sans Mono CJK SC",
        "Microsoft YaHei Mono",
        Consolas,
        Monaco,
        monospace;
}

/* 引用文字 */
blockquote,
.wp-block-quote {
    font-family:
        "PingFang SC",
        "Noto Sans SC",
        "Microsoft YaHei",
        serif;
    font-style: normal; /* 中文斜体不好看，改为正常 */
}

/* 数字和英文混排优化 */
.post-card-meta,
.single-post-meta,
.breadcrumb,
.pagination {
    font-variant-numeric: tabular-nums; /* 数字等宽，对齐更好 */
    font-feature-settings: "tnum" 1;
}

/* 中英文之间自动加空格（视觉优化） */
.post-card-title a,
.post-card-excerpt,
.single-post-content p {
    text-autospace: ideograph-alpha;
    text-autospace: ideograph-numeric;
}

/* CJK 断词规则 */
.post-card-title,
.single-post-title,
.widget-title,
h1, h2, h3, h4, h5, h6 {
    word-break: break-all;
    overflow-wrap: break-word;
    line-break: strict;
}

/* 中文段落断行优化 */
body {
    word-break: break-word;
    overflow-wrap: break-word;
    line-break: auto;
}

/* 表格中的中文优化 */
table th,
table td {
    text-align: left;
    word-break: keep-all;
}

/* 小屏幕字号调整 */
@media (max-width: 768px) {
    body {
        font-size: 15px;
    }

    .single-post-content {
        font-size: 16px;
        line-height: 1.85;
    }

    .post-card-excerpt {
        font-size: 14px;
    }
}

/* 繁体中文字体支持 */
[lang="zh-TW"],
[lang="zh-HK"] {
    font-family:
        "PingFang TC",
        "Noto Sans TC",
        "Microsoft JhengHei",
        system-ui,
        sans-serif;
}

/* 日文字体降级 */
[lang="ja"] {
    font-family:
        "Hiragino Kaku Gothic ProN",
        "Noto Sans JP",
        "Yu Gothic",
        system-ui,
        sans-serif;
}
