/* ========== 统一字体系统 ========== */
/* 替代混用的字体配置，建立一致的字体层次 */

/* 基础字体配置 */
:root {
    /* 主字体族 - 优先使用系统字体 */
    --font-family-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;

    /* 等宽字体 - 用于代码和数据 */
    --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;

    /* 装饰字体 - 用于特殊标题 */
    --font-family-display: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', serif;

    /* 字体大小系统 */
    --font-size-xs: 0.75rem;     /* 12px */
    --font-size-sm: 0.875rem;    /* 14px */
    --font-size-base: 1rem;      /* 16px */
    --font-size-lg: 1.125rem;    /* 18px */
    --font-size-xl: 1.25rem;     /* 20px */
    --font-size-2xl: 1.5rem;     /* 24px */
    --font-size-3xl: 1.875rem;   /* 30px */
    --font-size-4xl: 2.25rem;    /* 36px */
    --font-size-5xl: 3rem;       /* 48px */

    /* 字体权重 */
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;

    /* 行高系统 */
    --line-height-tight: 1.2;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.6;
    --line-height-loose: 1.8;
}

/* 基础文本样式重置 */
* {
    font-family: var(--font-family-primary);
}

body {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== 标题层次系统 ========== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-primary);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--text-primary);
    margin: 0 0 1rem 0;
}

h1 {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    line-height: 1.1;
}

h2 {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-semibold);
}

h3 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
}

h4 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-medium);
}

h5 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
}

h6 {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
}

/* ========== 正文文本样式 ========== */

p {
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
}

/* 小号文本 */
.text-sm {
    font-size: var(--font-size-sm);
}

.text-xs {
    font-size: var(--font-size-xs);
}

/* 大号文本 */
.text-lg {
    font-size: var(--font-size-lg);
}

.text-xl {
    font-size: var(--font-size-xl);
}

/* ========== 特殊文本样式 ========== */

/* 引用文本 */
.text-muted {
    color: var(--text-secondary);
}

.text-secondary {
    color: var(--text-muted);
}

/* 强调文本 */
.text-primary {
    color: var(--primary-color, #d32f2f);
}

.text-success {
    color: var(--success-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-danger {
    color: var(--danger-color);
}

/* ========== 字体权重工具类 ========== */

.font-light {
    font-weight: var(--font-weight-light);
}

.font-normal {
    font-weight: var(--font-weight-normal);
}

.font-medium {
    font-weight: var(--font-weight-medium);
}

.font-semibold {
    font-weight: var(--font-weight-semibold);
}

.font-bold {
    font-weight: var(--font-weight-bold);
}

/* ========== 特殊字体应用 ========== */

/* 等宽字体 - 用于代码、数据等 */
.font-mono,
code,
pre {
    font-family: var(--font-family-mono);
}

/* 装饰字体 - 用于特殊标题 */
.font-display {
    font-family: var(--font-family-display);
}

/* ========== 响应式字体大小 ========== */

@media (max-width: 768px) {
    :root {
        --font-size-4xl: 1.875rem;   /* 30px */
        --font-size-3xl: 1.5rem;     /* 24px */
        --font-size-2xl: 1.25rem;    /* 20px */
    }

    h1 {
        font-size: var(--font-size-3xl);
    }

    h2 {
        font-size: var(--font-size-2xl);
    }

    h3 {
        font-size: var(--font-size-xl);
    }
}

@media (max-width: 480px) {
    :root {
        --font-size-4xl: 1.5rem;     /* 24px */
        --font-size-3xl: 1.25rem;    /* 20px */
        --font-size-2xl: 1.125rem;   /* 18px */
    }

    body {
        font-size: var(--font-size-sm);
    }
}

/* ========== 中英文混排优化 ========== */

/* 中文字符间距优化 */
.text-chinese {
    font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    letter-spacing: 0.05em;
}

/* 英文字符优化 */
.text-english {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: -0.01em;
}

/* ========== 特殊用途字体样式 ========== */

/* 数字显示 */
.font-numeric {
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum';
}

/* 标题大小写处理 */
.text-uppercase {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.text-capitalize {
    text-transform: capitalize;
}

/* 行高工具类 */
.leading-tight {
    line-height: var(--line-height-tight);
}

.leading-normal {
    line-height: var(--line-height-normal);
}

.leading-relaxed {
    line-height: var(--line-height-relaxed);
}

.leading-loose {
    line-height: var(--line-height-loose);
}