/* 优化字体配置 */

/* 引入Google Fonts - 支持中文的现代字体 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap');

/* 全局字体设置 */
:root {
    /* 主要字体族 - 优先使用Inter，然后是中文字体 */
    --font-family-primary: 'Inter', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    
    /* 等宽字体 - 用于代码和数字 */
    --font-family-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', 'Courier New', monospace;
    
    /* 字体大小 */
    --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-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* 行高 */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* 字间距 */
    --letter-spacing-tight: -0.025em;
    --letter-spacing-normal: 0;
    --letter-spacing-wide: 0.025em;
}

/* 基础字体设置 */
* {
    font-family: var(--font-family-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

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);
    letter-spacing: var(--letter-spacing-normal);
    color: #1f2937;
}

/* 标题字体优化 */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-primary);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
    color: #111827;
}

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

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

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

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

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

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

/* 段落和文本 */
p {
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    color: #374151;
}

/* 小号文本 */
.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }

/* 字重类 */
.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); }

/* 表单元素字体优化 */
input, textarea, select, button {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
}

/* 按钮字体 */
button, .btn {
    font-weight: var(--font-weight-medium);
    letter-spacing: var(--letter-spacing-wide);
}

/* 表格字体 */
table {
    font-size: var(--font-size-sm);
}

th {
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--letter-spacing-wide);
    text-transform: uppercase;
}

/* 代码和等宽字体 */
code, pre, .mono {
    font-family: var(--font-family-mono);
    font-size: 0.9em;
}

/* 数字显示优化 */
.number, .stats-number {
    font-family: var(--font-family-mono);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--letter-spacing-tight);
}

/* 链接字体 */
a {
    font-weight: var(--font-weight-medium);
    text-decoration: none;
}

/* 导航字体 */
nav, .nav {
    font-weight: var(--font-weight-medium);
    letter-spacing: var(--letter-spacing-wide);
}

/* 标签和徽章 */
.badge, .tag, .label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--letter-spacing-wide);
    text-transform: uppercase;
}

/* 响应式字体大小 */
@media (max-width: 768px) {
    :root {
        --font-size-base: 0.9rem;
        --font-size-lg: 1rem;
        --font-size-xl: 1.125rem;
        --font-size-2xl: 1.25rem;
        --font-size-3xl: 1.5rem;
    }
    
    body {
        font-size: var(--font-size-base);
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: subpixel-antialiased;
    }
}

/* 深色模式字体优化 */
@media (prefers-color-scheme: dark) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* 可访问性 - 用户偏好设置 */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}

/* 打印样式字体优化 */
@media print {
    body {
        font-family: 'Times New Roman', serif;
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
    }
    
    h1, h2, h3, h4, h5, h6 {
        font-family: 'Times New Roman', serif;
        color: #000;
    }
}