/* ============================================
   秀米记 - 统一字体系统
   本地字体 + 字体层级 + 响应式字体
   排除首页诗句的字体设置
   ============================================ */

/* 本地字体定义 */
@font-face {
    font-family: 'Source Han Sans SC';
    src: url('../fonts/OTF/SimplifiedChinese/SourceHanSansSC-Medium.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* 字体系统变量 */
:root {
    /* 字体族 */
    --font-family-base: 'Source Han Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    
    /* 基础字体大小 - 以16px为基准 */
    --font-size-xs: 12px;      /* 0.75rem - 辅助信息 */
    --font-size-sm: 14px;      /* 0.875rem - 小标题、表单标签 */
    --font-size-md: 16px;      /* 1rem - 正文、表单输入 */
    --font-size-lg: 18px;      /* 1.125rem - 卡片标题 */
    --font-size-xl: 20px;      /* 1.25rem - 页面标题 */
    --font-size-2xl: 24px;     /* 1.5rem - 大标题 */
    --font-size-3xl: 28px;     /* 1.75rem - 特大标题 */
    --font-size-4xl: 32px;     /* 2rem - 超大标题 */
    --font-size-5xl: 36px;     /* 2.25rem - 英雄标题 */
    --font-size-6xl: 48px;     /* 3rem - 巨大标题 */
    
    /* 响应式字体大小 */
    --font-size-hero-mobile: 28px;
    --font-size-hero-tablet: 36px;
    --font-size-hero-desktop: 48px;
    
    /* 行高系统 */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    --line-height-loose: 2;
    
    /* 字重 */
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-black: 900;
    
    /* 字间距 */
    --letter-spacing-tight: -0.025em;
    --letter-spacing-normal: 0;
    --letter-spacing-wide: 0.025em;
    --letter-spacing-wider: 0.05em;
    --letter-spacing-widest: 0.1em;
}

/* 基础字体设置 */
html {
    font-size: 16px; /* 基准字体大小 */
    scroll-behavior: smooth;
}

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

/* 语义化字体类 */
.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-md { font-size: var(--font-size-md); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-3xl); }
.text-4xl { font-size: var(--font-size-4xl); }
.text-5xl { font-size: var(--font-size-5xl); }
.text-6xl { font-size: var(--font-size-6xl); }

/* 字重类 */
.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-black { font-weight: var(--font-weight-black); }

/* 行高类 */
.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); }

/* ============================================
   导航系统字体
   ============================================ */
.nav-brand {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
}

.nav-item {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.nav-dropdown-item {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
}

.nav-btn {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

/* ============================================
   页面标题层级系统
   ============================================ */
.page-title {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
}

.section-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-normal);
}

.sub-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
}

/* ============================================
   表单系统字体
   ============================================ */
.form-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
}

.form-input,
.form-select,
.form-textarea {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
}

.form-hint {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
}

.form-error {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
}

/* ============================================
   按钮系统字体
   ============================================ */
.btn {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
}

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

.btn-lg {
    font-size: var(--font-size-md);
}

/* ============================================
   数据表格字体
   ============================================ */
.data-table th {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-normal);
}

.data-table td {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
}

/* ============================================
   统计卡片字体
   ============================================ */
.stat-label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-tight);
}

.stat-value {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
}

/* ============================================
   通知和提示字体
   ============================================ */
.notification {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
}

.toast,
.alert {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
}

/* ============================================
   页脚字体
   ============================================ */
.footer-copyright {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
}

.footer-link {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
}

/* ============================================
   博客系统字体（排除首页诗句）
   ============================================ */
.blog-title {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
}

.blog-subtitle {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
}

.blog-meta {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
}

.blog-content {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-relaxed);
}

.blog-sidebar-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-normal);
}

.blog-sidebar-content {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
}

/* ============================================
   管理后台字体
   ============================================ */
.admin-header {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
}

.admin-section-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-normal);
}

.admin-data {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
}

/* ============================================
   响应式字体调整
   ============================================ */

/* 平板设备 (768px 及以下) */
@media (max-width: 768px) {
    .page-title {
        font-size: var(--font-size-2xl);
    }
    
    .section-title {
        font-size: var(--font-size-xl);
    }
    
    .card-title {
        font-size: var(--font-size-md);
    }
    
    .nav-brand {
        font-size: var(--font-size-md);
    }
    
    .nav-item {
        font-size: var(--font-size-xs);
    }
    
    .nav-dropdown-item {
        font-size: var(--font-size-xs);
    }
    
    .nav-btn {
        font-size: var(--font-size-xs);
    }
    
    .blog-title {
        font-size: var(--font-size-3xl);
    }
    
    .blog-subtitle {
        font-size: var(--font-size-lg);
    }
}

/* 手机设备 (480px 及以下) */
@media (max-width: 480px) {
    .page-title {
        font-size: var(--font-size-xl);
    }
    
    .section-title {
        font-size: var(--font-size-lg);
    }
    
    .card-title {
        font-size: var(--font-size-sm);
    }
    
    .nav-brand {
        font-size: var(--font-size-sm);
    }
    
    .blog-title {
        font-size: var(--font-size-2xl);
    }
    
    .blog-subtitle {
        font-size: var(--font-size-md);
    }
    
    .stat-label {
        font-size: 10px;
    }
    
    .stat-value {
        font-size: var(--font-size-xs);
    }
}

/* 小屏手机 (360px 及以下) */
@media (max-width: 360px) {
    .page-title {
        font-size: var(--font-size-lg);
    }
    
    .section-title {
        font-size: var(--font-size-md);
    }
    
    .blog-title {
        font-size: var(--font-size-xl);
    }
    
    .nav-brand {
        font-size: var(--font-size-xs);
    }
}

/* ============================================
   特殊元素字体（保持原有设置）
   ============================================ */

/* 首页诗句保持原有字体设置不变 */
.homepage__poetry,
.homepage__verse,
.poetry-text,
.verse-text {
    /* 保持原有字体设置，不应用新字体系统 */
}

/* 代码块字体 */
code,
pre {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-relaxed);
}

/* ============================================
   工具类
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

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

.italic { font-style: italic; }
.underline { text-decoration: underline; }
.no-underline { text-decoration: none; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}