/* GAG Recipes - 文字清晰度增强样式 */

/* 针对主页英雄区域的特殊优化 */
.hero-section h1,
.hero-title,
.hero-section-enhanced h1 {
    /* 超强字体渲染 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern" 1, "liga" 1;
    
    /* 增强对比度 - 使用深色文字 */
    color: #0f172a !important;
    
    /* 清晰文字阴影效果 - 简化避免遮挡 */
    text-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.08);
    
    /* 字体权重增强 */
    font-weight: 800;
    
    /* 字符间距优化 */
    letter-spacing: -0.02em;
    
    /* 强制使用最佳字体 */
    font-family: 
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Microsoft YaHei UI",
        "Microsoft YaHei",
        "PingFang SC",
        "Hiragino Sans GB",
        "Source Han Sans SC",
        "Noto Sans CJK SC",
        sans-serif;
}

/* 功能卡片标题优化 */
.feature-item h3,
.card h3,
.feature-card h3 {
    /* 清晰渲染 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    
    /* 增强颜色对比 */
    color: #111827;
    
    /* 文字阴影 */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    
    /* 字体权重 */
    font-weight: 700;
    
    /* 字符间距 */
    letter-spacing: -0.01em;
    
    /* 行高优化 */
    line-height: 1.3;
    
    /* 强制最佳字体 */
    font-family: 
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Microsoft YaHei UI",
        "Microsoft YaHei",
        sans-serif;
}

/* 卡片描述文字优化 */
.feature-item p,
.card p,
.feature-card p {
    /* 清晰渲染 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* 颜色对比 */
    color: #374151;
    
    /* 字体权重 */
    font-weight: 500;
    
    /* 行高 */
    line-height: 1.6;
    
    /* 字符间距 */
    letter-spacing: 0.01em;
}

/* 导航菜单文字优化 */
.nav-menu a {
    /* 清晰渲染 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    
    /* 颜色对比 */
    color: #4b5563;
    
    /* 字体权重 */
    font-weight: 600;
    
    /* 字符间距 */
    letter-spacing: 0.005em;
    
    /* 悬停效果 */
    transition: all 0.2s ease;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: #1e40af;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(30, 64, 175, 0.1);
}

/* 按钮文字优化 */
.btn,
.button,
.btn-primary,
.btn-secondary {
    /* 清晰渲染 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    
    /* 字体权重 */
    font-weight: 600;
    
    /* 字符间距 */
    letter-spacing: 0.01em;
    
    /* 文字阴影（白色背景按钮） */
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

/* 深色按钮的文字阴影 */
.btn-primary,
.btn-dark {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* 强制高清显示的文字类 */
.text-ultra-clear {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern" 1, "liga" 1;
    color: #111827;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 大标题专用清晰类 */
.title-ultra-clear {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern" 1, "liga" 1;
    color: #0f172a !important;
    font-weight: 800;
    letter-spacing: -0.02em;
    
    /* 清晰阴影效果 - 简化 */
    text-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.08);
    
    font-family: 
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Microsoft YaHei UI",
        "Microsoft YaHei",
        sans-serif;
}

/* 高分辨率屏幕特殊优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-section h1,
    .hero-title,
    .hero-section-enhanced h1,
    .title-ultra-clear {
        /* 高分辨率屏幕保持抗锯齿 */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        
        /* 优化字符间距 */
        letter-spacing: -0.008em;
        
        /* 简化高分辨率阴影 - 避免文字遮挡 */
        text-shadow: 
            0 1px 2px rgba(0, 0, 0, 0.15),
            0 2px 4px rgba(0, 0, 0, 0.08);
        
        /* 移除过重的描边效果 */
        -webkit-text-stroke: none;
        text-stroke: none;
    }
    
    .feature-item h3,
    .card h3 {
        /* 高分辨率屏幕使用subpixel渲染 */
        -webkit-font-smoothing: subpixel-antialiased;
        
        /* 减少字符间距 */
        letter-spacing: -0.005em;
        
        /* 调整文字阴影 */
        text-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.08);
    }
}

/* 低分辨率屏幕优化 */
@media (-webkit-max-device-pixel-ratio: 1.5), (max-resolution: 144dpi) {
    .hero-section h1,
    .hero-title,
    .hero-section-enhanced h1,
    .title-ultra-clear {
        /* 强制抗锯齿 */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        
        /* 简化文字阴影 - 避免过度效果导致遮挡 */
        text-shadow: 
            0 1px 3px rgba(0, 0, 0, 0.3),
            0 2px 6px rgba(0, 0, 0, 0.15);
        
        /* 适中字体权重 */
        font-weight: 800;
        
        /* 移除过重描边 */
        -webkit-text-stroke: none;
        text-stroke: none;
    }
    
    .feature-item h3,
    .card h3 {
        /* 强制抗锯齿 */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        
        /* 增强文字阴影 */
        text-shadow: 
            0 1px 2px rgba(0, 0, 0, 0.15),
            0 2px 4px rgba(0, 0, 0, 0.1);
        
        /* 增加字体权重 */
        font-weight: 800;
    }
}

/* 英雄区域描述文字优化 */
.hero-description {
    color: rgba(71, 85, 105, 0.9) !important;
    text-shadow: none;
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* 英雄区域卡片标题增强 */
.hero-features h3,
.text-hierarchy-3 {
    color: #1e293b !important;
    text-shadow: 
        0 1px 2px rgba(0, 0, 0, 0.08);
    font-weight: 700;
}

/* 移动设备文字优化 */
@media (max-width: 768px) {
    .hero-section h1,
    .hero-title,
    .hero-section-enhanced h1,
    .title-ultra-clear {
        /* 移动设备简化阴影 - 避免过度效果 */
        text-shadow: 
            0 1px 2px rgba(0, 0, 0, 0.15);
        
        /* 移除移动设备过重描边 */
        -webkit-text-stroke: none;
        text-stroke: none;
        
        font-weight: 900;
    }
    
    .hero-section h1,
    .hero-title {
        /* 移动设备字体大小调整 */
        font-size: clamp(1.75rem, 5vw, 2.5rem);
        
        /* 行高调整 */
        line-height: 1.2;
        
        /* 字符间距调整 */
        letter-spacing: -0.01em;
    }
    
    .feature-item h3,
    .card h3 {
        /* 移动设备卡片标题 */
        font-size: clamp(1.125rem, 4vw, 1.5rem);
        line-height: 1.3;
    }
}

/* 文字图片备用样式增强 */
.text-image-replacement {
    /* 图片清晰度 */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    
    /* 最大宽度 */
    max-width: 100%;
    height: auto;
    
    /* 显示方式 */
    display: block;
    margin: 0 auto;
}

/* 文字图片加载失败时的备用样式 */
.text-image-fallback {
    /* 应用所有清晰度增强 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    
    /* 背景增强可读性 */
    background: linear-gradient(135deg, #ffffff 0%, #f9f9f9 100%);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    
    /* 文字样式 */
    color: #1f2937;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    
    /* 边框 */
    border: 1px solid rgba(229, 231, 235, 0.8);
}

/* 调试模式 - 显示字体渲染信息 */
.debug-font-rendering::after {
    content: "Font: " attr(data-font-family) " | Weight: " attr(data-font-weight) " | Smoothing: " attr(data-font-smoothing);
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
    font-family: monospace;
}

/* 强制GPU加速文字渲染 */
.gpu-accelerated-text {
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* 打印样式的文字优化 */
@media print {
    * {
        -webkit-font-smoothing: auto;
        -moz-osx-font-smoothing: auto;
        text-shadow: none !important;
        color: #000 !important;
    }
}

/* 无障碍访问优化 */
@media (prefers-contrast: high) {
    .hero-section h1,
    .hero-title,
    .feature-item h3,
    .card h3 {
        color: #000000;
        text-shadow: none;
        font-weight: 900;
    }
    
    .feature-item p,
    .card p {
        color: #000000;
        font-weight: 600;
    }
}

/* 减少动画偏好的用户 */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}
