/* ==========================================================================
   字体配置文件 - HarmonyOS Sans SC & Source Han Sans SC
   ========================================================================== */

/**
 * HarmonyOS Sans SC 字体族配置（中文版）
 * 支持多种字重，优化加载性能
 */

/* HarmonyOS Sans SC Regular (实际使用Regular字体文件) */
@font-face {
  font-family: 'HarmonyOS Sans SC';
  src: url('../font/HarmonyOS_Sans_SC_Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap; /* 优化字体加载体验 */
}

/* 将Regular字重映射为不同权重 */
@font-face {
  font-family: 'HarmonyOS Sans SC';
  src: url('../font/HarmonyOS_Sans_SC_Regular.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'HarmonyOS Sans SC';
  src: url('../font/HarmonyOS_Sans_SC_Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   思源黑体配置（英文版）
   ========================================================================== */

/**
 * Source Han Sans SC 字体族配置
 * 用于英文版页面
 */

/* Source Han Sans SC Regular */
@font-face {
  font-family: 'Source Han Sans SC';
  src: url('../font/SourceHanSansSC-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Source Han Sans SC';
  src: url('../font/SourceHanSansSC-Regular.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Source Han Sans SC';
  src: url('../font/SourceHanSansSC-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* 如果您有其他字重的字体文件，可以在这里添加 */
/*
@font-face {
  font-family: 'HarmonyOS Sans SC';
  src: url('../font/HarmonyOS_Sans_SC_Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'HarmonyOS Sans SC';
  src: url('../font/HarmonyOS_Sans_SC_Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
*/

/* ==========================================================================
   全局字体应用
   ========================================================================== */

/**
 * 全局字体栈配置 - 中文版（默认）
 * 优先使用 HarmonyOS Sans SC，提供完整的后备字体链
 */
body,
html,
* {
  font-family: 'HarmonyOS Sans SC', 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', 'STHeiti', 'WenQuanYi Micro Hei', 'Helvetica Neue', Arial, sans-serif !important;
}

/* 保持 layui 图标字体不被覆盖 */
.layui-icon,
.layui-layer .layui-icon,
.layui-layer-ico,
[class^="layui-icon-"],
[class*=" layui-icon-"] {
  font-family: "layui-icon" !important;
}

/**
 * 英文版字体配置
 * 当 body 有 lang-en 类时，切换为思源黑体
 */
body.lang-en,
body.lang-en *,
html.lang-en,
html.lang-en * {
  font-family: 'Source Han Sans SC', 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', 'STHeiti', 'WenQuanYi Micro Hei', 'Helvetica Neue', Arial, sans-serif !important;
}

/* 英文版也需要保持 layui 图标字体不被覆盖 */
body.lang-en .layui-icon,
body.lang-en .layui-layer .layui-icon,
body.lang-en .layui-layer-ico,
body.lang-en [class^="layui-icon-"],
body.lang-en [class*=" layui-icon-"],
html.lang-en .layui-icon,
html.lang-en .layui-layer .layui-icon,
html.lang-en .layui-layer-ico,
html.lang-en [class^="layui-icon-"],
html.lang-en [class*=" layui-icon-"] {
  font-family: "layui-icon" !important;
}

/* 确保特定元素也使用正确的字体 */
h1, h2, h3, h4, h5, h6,
p, span, div, a, button,
input, textarea, select,
.wp-block-heading,
.wp-block-paragraph {
  font-family: inherit;
}

/* 代码相关元素保持等宽字体 */
code, pre, kbd, samp,
.wp-block-code,
.wp-block-preformatted {
  font-family: 'Fira Code', 'Source Code Pro', 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace !important;
}

/* ==========================================================================
   字体权重映射
   ========================================================================== */

/**
 * 标准化不同字重的映射关系
 */
.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ==========================================================================
   浏览器兼容性优化
   ========================================================================== */

/**
 * 针对不同浏览器的字体渲染优化
 */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
