/* 响应式设计 */

/* 大屏幕 (1200px 及以上) */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
}

/* 中等屏幕 (768px - 1199px) */
@media (max-width: 1199px) {
    .container {
        max-width: 100%;
        padding: 0 1.5rem;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr 280px;
        gap: 1.5rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-stats {
        gap: 2rem;
    }
}

/* 平板 (768px - 1023px) */
@media (max-width: 1023px) {
    .content-wrapper { grid-template-columns: 1fr; gap: 2rem; }
    .sidebar { order: -1; }
    .posts-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .hero-stats {
        gap: 1.5rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
}

/* 手机 (480px - 767px) */
@media (max-width: 767px) {
    .container {
        padding: 0 1rem;
    }
    
    /* 导航栏 */
    .nav-container {
        height: 56px;
    }
    
    .nav-logo a {
        font-size: 1.25rem;
    }
    
    .nav-menu {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        background-color: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: 1rem;
        gap: 0;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
    }
    
    .nav-menu.active {
        transform: translateY(0);
    }
    
    .nav-menu .nav-link {
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-menu .nav-link:last-child {
        border-bottom: none;
    }
    
    .menu-btn {
        display: flex;
    }
    
    /* 首页横幅 */
    .hero-section {
        padding: 4rem 0 !important;
        margin-bottom: 2rem;
        min-height: 400px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .hero-carousel {
        min-height: 450px !important;
    }
    
    .hero-slide {
        min-height: 450px !important;
    }
    
    .hero-section[style*="background-image"] {
        min-height: 450px !important;
    }
    
    .hero-title {
        font-size: 1.75rem;
        margin-bottom: 0.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .stat-item {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .stat-number {
        font-size: 1.25rem;
        margin-bottom: 0;
    }
    
    /* 文章网格 */
    .posts-grid { grid-template-columns: 1fr; gap: 1rem; }
    
    /* 文章列表 */
    .post-item {
        flex-direction: column;
        gap: 1rem;
    }
    
    .post-item-image {
        width: 100%;
        height: 200px;
    }
    
    /* 侧边栏 */
    .widget {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .author-avatar {
        width: 60px;
        height: 60px;
    }
    
    .author-name {
        font-size: 1.125rem;
    }
    
    .author-bio {
        font-size: 0.875rem;
    }
    
    /* 页脚 */
    .footer {
        padding: 2rem 0 1rem;
        margin-top: 2rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .footer-section {
        text-align: center;
    }
    
    /* 搜索框 */
    .search-container {
        padding: 0 0.5rem;
    }
    
    .search-box input {
        font-size: 1rem;
        padding: 0.875rem 2.5rem 0.875rem 0.875rem;
    }
    
    /* 返回顶部按钮 */
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
    
    /* 浮动操作按钮 */
    .floating-actions {
        bottom: 1rem;
        right: 1rem;
        gap: 0.75rem;
    }
    
    .floating-actions .search-btn,
    .floating-actions .theme-btn {
        width: 40px;
        height: 40px;
    }
}

/* 小手机 (320px - 479px) */
@media (max-width: 479px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .nav-container {
        padding: 0 0.75rem;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .hero-subtitle {
        font-size: 0.875rem;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .post-card-content,
    .post-item {
        padding: 1rem;
    }
    
    .widget {
        padding: 0.75rem;
    }
    
    .search-box input {
        font-size: 0.875rem;
        padding: 0.75rem 2rem 0.75rem 0.75rem;
    }
    
    .back-to-top {
        width: 36px;
        height: 36px;
    }
    
    .floating-actions .search-btn,
    .floating-actions .theme-btn {
        width: 36px;
        height: 36px;
    }
}

/* 横屏手机 */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        padding: 2rem 0 !important;
        min-height: 300px !important;
    }
    
    .hero-carousel {
        min-height: 350px !important;
    }
    
    .hero-slide {
        min-height: 350px !important;
    }
    
    .hero-section[style*="background-image"] {
        min-height: 350px !important;
    }
    
    .hero-title {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .hero-subtitle {
        font-size: 0.875rem;
        margin-bottom: 1rem;
    }
    
    .hero-stats {
        flex-direction: row;
        gap: 2rem;
    }
}

/* 高分辨率屏幕 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .post-card-image,
    .post-item-image,
    .recommended-post img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* 打印样式 */
@media print {
    .navbar,
    .sidebar,
    .footer,
    .back-to-top,
    .search-overlay,
    .floating-actions {
        display: none !important;
    }
    
    .main-content {
        min-height: auto;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .hero-section {
        background: none !important;
        color: black !important;
        padding: 2rem 0 !important;
        min-height: 300px !important;
    }
    
    .post-card,
    .post-item {
        border: 1px solid #ccc;
        box-shadow: none;
        break-inside: avoid;
    }
    
    .post-card-image,
    .post-item-image {
        max-width: 200px;
        height: auto;
    }
}

/* 减少动画 (用户偏好) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .post-card:hover,
    .post-item:hover,
    .recommended-post:hover {
        transform: none;
    }
    
    .back-to-top:hover {
        transform: none;
    }
    
    .floating-actions .search-btn:hover,
    .floating-actions .theme-btn:hover {
        transform: none;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --text-muted: #333;
    }
    
    [data-theme="dark"] {
        --border-color: #fff;
        --text-muted: #ccc;
    }
    
    .post-card,
    .post-item,
    .widget {
        border-width: 2px;
    }
}

/* 深色模式自动切换 */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --primary-color: #60a5fa;
        --primary-hover: #3b82f6;
        --secondary-color: #94a3b8;
        --accent-color: #fbbf24;
        
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --bg-tertiary: #334155;
        
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #94a3b8;
        
        --border-color: #334155;
        --border-hover: #475569;
    }
} 