/* ===================================
   字体配置 - CDN优先、本地备用、系统后备
   =================================== */

/* ===================================
   CDN字体配置（优先级1）
   =================================== */

/* Noto Sans SC - 思源黑体（正文） */
@font-face {
  font-family: 'Noto Sans SC';
  src: url('https://cdn.jsdelivr.net/fontsource/fonts/noto-sans-sc:vf@latest/chinese-wght-normal.woff2') format('woff2-variations'),
       url('https://cdn.jsdelivr.net/fontsource/fonts/noto-sans-sc:vf@latest/latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+4E00-9FFF;
}

/* Noto Serif SC - 思源宋体（标题） */
@font-face {
  font-family: 'Noto Serif SC';
  src: url('https://cdn.jsdelivr.net/fontsource/fonts/noto-serif-sc:vf@latest/chinese-wght-normal.woff2') format('woff2-variations'),
       url('https://cdn.jsdelivr.net/fontsource/fonts/noto-serif-sc:vf@latest/latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+4E00-9FFF;
}

/* Fira Code - 代码字体 */
@font-face {
  font-family: 'Fira Code';
  src: url('https://cdn.jsdelivr.net/fontsource/fonts/fira-code:vf@latest/latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  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+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===================================
   本地字体备用配置（优先级2）
   =================================== */

/* Noto Sans SC - 本地备用 */
@font-face {
  font-family: 'Noto Sans SC Local';
  src: url('/fonts/noto-sans-sc-chinese-simplified-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Noto Serif SC - 本地备用 */
@font-face {
  font-family: 'Noto Serif SC Local';
  src: url('/fonts/noto-serif-sc-chinese-simplified-300-normal.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

/* Fira Code - 本地备用 */
@font-face {
  font-family: 'Fira Code Local';
  src: url('/fonts/FiraCode-VF.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

/* ===================================
   字体应用规则
   =================================== */

/* 全局样式 - 正文使用思源黑体 */
body {
  font-family: 'Noto Sans SC', 'Noto Sans SC Local', 'Microsoft YaHei', 'PingFang SC', sans-serif;
}

/* 标题使用思源宋体 */
h1, h2, h3, h4, h5, h6,
.post-title,
.article-title,
.page-title,
.category-title,
.tag-title {
  font-family: 'Noto Serif SC', 'Noto Serif SC Local', 'SimSun', 'STSong', serif;
}

/* 代码块使用Fira Code */
code, pre, 
.highlight, 
.highlight .code, 
.highlight pre,
.code-block,
pre code {
  font-family: 'Fira Code', 'Fira Code Local', 'Consolas', 'Monaco', 'Courier New', monospace !important;
}

/* 行内代码 */
p > code, li > code, td > code {
  font-family: 'Fira Code', 'Fira Code Local', 'Consolas', monospace !important;
}

/* 博客标题特殊样式 */
#site-title, #site-subtitle {
  font-family: 'Noto Serif SC', 'Noto Serif SC Local', 'SimSun', serif;
}

/* 导航栏菜单 */
.nav-menu .nav-menu-item a {
  font-family: 'Noto Sans SC', 'Noto Sans SC Local', 'Microsoft YaHei', sans-serif;
}

/* 侧边栏卡片 */
.card-widget {
  font-family: 'Noto Sans SC', 'Noto Sans SC Local', 'Microsoft YaHei', sans-serif;
}

/* 文章元数据 */
.post-meta {
  font-family: 'Noto Sans SC', 'Noto Sans SC Local', 'Microsoft YaHei', sans-serif;
}

/* 页脚 */
.footer-copyright, .framework-info {
  font-family: 'Noto Sans SC', 'Noto Sans SC Local', 'Microsoft YaHei', sans-serif;
}

/* ===================================
   英文内容保持默认
   =================================== */

:lang(en) {
  font-family: 'Noto Sans SC', 'Arial', 'Helvetica', sans-serif;
}

/* ===================================
   字体加载优化
   =================================== */

/* 优化字体渲染 */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* 代码字体等宽显示 */
code, pre {
  font-feature-settings: "liga" 0;
  font-variant-ligatures: none;
}
