/* GAG Recipes - 字体优化样式 */

/* 字体优化基础设置 */
html {
    /* 启用字体平滑 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* 优化文本渲染 */
    text-rendering: optimizeLegibility;
    
    /* 字体特征设置 */
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
    
    /* 字体变体设置 */
    font-variant-ligatures: common-ligatures;
    
    /* 字体显示策略 */
    font-display: swap;
}

body {
    /* 改进的字体栈 - 优先使用系统字体 */
    font-family: 
        /* 系统字体优先 */
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        /* Windows 字体 */
        "Segoe UI",
        "Microsoft YaHei UI",
        "Microsoft YaHei",
        /* macOS 字体 */
        "SF Pro Display",
        "PingFang SC",
        "Hiragino Sans GB",
        /* Android 字体 */
        "Noto Sans CJK SC",
        "Source Han Sans SC",
        /* 通用备用字体 */
        "Helvetica Neue",
        Helvetica,
        Arial,
        sans-serif;
    
    /* 字体大小和行高优化 */
    font-size: 16px;
    line-height: 1.6;
    
    /* 字体权重 */
    font-weight: 400;
    
    /* 字符间距优化 */
    letter-spacing: 0.01em;
    
    /* 词间距优化 */
    word-spacing: 0.02em;
    
    /* 文本颜色对比度优化 */
    color: #1f2937;
}

/* 标题字体优化 */
h1, h2, h3, h4, h5, h6 {
    font-family: 
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Microsoft YaHei UI",
        "Microsoft YaHei",
        "SF Pro Display",
        "PingFang SC",
        "Hiragino Sans GB",
        sans-serif;
    
    /* 标题字体权重 */
    font-weight: 600;
    
    /* 标题行高优化 */
    line-height: 1.3;
    
    /* 标题字符间距 */
    letter-spacing: -0.01em;
    
    /* 标题颜色 */
    color: #111827;
    
    /* 标题文本阴影（提高可读性） */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* 大标题特殊优化 */
h1 {
    font-size: clamp(1.875rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 600;
}

h3 {
    font-size: clamp(1.25rem, 2.5vw, 1.875rem);
    font-weight: 600;
}

/* 段落文字优化 */
p {
    /* 段落行高 */
    line-height: 1.7;
    
    /* 段落间距 */
    margin-bottom: 1.25rem;
    
    /* 段落颜色 */
    color: #374151;
    
    /* 文字对齐优化 */
    text-align: left;
    
    /* 连字符处理 */
    hyphens: auto;
    word-break: break-word;
}

/* 链接文字优化 */
a {
    color: #2563eb;
    text-decoration: none;
    transition: color 0.2s ease;
    
    /* 链接下划线优化 */
    text-decoration-skip-ink: auto;
}

a:hover {
    color: #1d4ed8;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

/* 导航文字优化 */
.nav-menu a {
    font-weight: 500;
    font-size: 0.95rem;
    color: #4b5563;
    letter-spacing: 0.005em;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: #2563eb;
    font-weight: 600;
}

/* 按钮文字优化 */
.btn {
    font-family: inherit;
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    text-align: center;
}

/* 卡片标题优化 */
.card h3,
.feature-item h3,
.recipe-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

/* 小文字优化 */
small,
.text-sm {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
}

/* 代码文字优化 */
code,
pre {
    font-family: 
        "SF Mono",
        "Monaco",
        "Inconsolata",
        "Roboto Mono",
        "Consolas",
        "Courier New",
        monospace;
    
    font-size: 0.9em;
    line-height: 1.4;
}

/* 引用文字优化 */
blockquote {
    font-style: italic;
    font-size: 1.1em;
    line-height: 1.6;
    color: #4b5563;
    border-left: 4px solid #e5e7eb;
    padding-left: 1rem;
    margin: 1.5rem 0;
}

/* 表格文字优化 */
table {
    font-size: 0.9rem;
    line-height: 1.5;
}

th {
    font-weight: 600;
    color: #111827;
}

td {
    color: #374151;
}

/* 表单文字优化 */
input,
textarea,
select {
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #111827;
}

label {
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

/* 响应式字体大小 */
@media (max-width: 768px) {
    body {
        font-size: 15px;
        line-height: 1.6;
    }
    
    h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    p {
        line-height: 1.65;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    h3 {
        font-size: 1.125rem;
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        /* 高分辨率屏幕字体微调 */
        -webkit-font-smoothing: subpixel-antialiased;
        letter-spacing: 0.005em;
    }
    
    h1, h2, h3, h4, h5, h6 {
        -webkit-font-smoothing: antialiased;
    }
}

/* 深色模式字体优化 */
@media (prefers-color-scheme: dark) {
    body {
        color: #f9fafb;
        -webkit-font-smoothing: antialiased;
    }
    
    h1, h2, h3, h4, h5, h6 {
        color: #ffffff;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    }
    
    p {
        color: #d1d5db;
    }
    
    a {
        color: #60a5fa;
    }
    
    a:hover {
        color: #93c5fd;
    }
}

/* 打印样式字体优化 */
@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: "Arial", sans-serif;
        color: #000;
        text-shadow: none;
    }
}

/* 辅助功能优化 */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* 高对比度模式优化 */
@media (prefers-contrast: high) {
    body {
        color: #000;
        background: #fff;
    }
    
    h1, h2, h3, h4, h5, h6 {
        color: #000;
        text-shadow: none;
    }
    
    a {
        color: #0000ff;
        text-decoration: underline;
    }
    
    a:hover {
        color: #ff0000;
    }
}

/* 特殊字体类 */
.font-display {
    font-family: 
        "SF Pro Display",
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.font-mono {
    font-family: 
        "SF Mono",
        "Monaco",
        "Inconsolata",
        "Roboto Mono",
        "Consolas",
        monospace;
}

.text-balance {
    text-wrap: balance;
}

.text-pretty {
    text-wrap: pretty;
}

/* 文字选择优化 */
::selection {
    background-color: #3b82f6;
    color: #ffffff;
    text-shadow: none;
}

::-moz-selection {
    background-color: #3b82f6;
    color: #ffffff;
    text-shadow: none;
}

/* 焦点状态优化 */
:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* 文字图片备用样式 */
.text-image-fallback {
    /* 当图片加载失败时显示的文字样式 */
    font-weight: 600;
    color: #1f2937;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #ffffff 0%, #f9f9f9 100%);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    display: inline-block;
}

