/**
 * 响应式设计增强样式
 * 针对不同屏幕尺寸的优化
 */

/* 超大屏幕 (1920px+) */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }
    
    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
    
    .hero-title {
        font-size: 52px;
    }
    
    .entry-title {
        font-size: 42px;
    }
}

/* 大屏幕 (1200px - 1919px) */
@media (min-width: 1200px) and (max-width: 1919px) {
    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

/* 中等屏幕 (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .container {
        max-width: 960px;
    }
    
    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
    
    .single-post {
        padding: 40px 35px;
    }
    
    .entry-title {
        font-size: 32px;
    }
}

/* 平板横屏 (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .container {
        max-width: 720px;
    }
    
    .header-inner {
        gap: 20px;
    }
    
    .nav-menu {
        gap: 3px;
    }
    
    .nav-menu a {
        padding: 8px 14px;
        font-size: 14px;
    }
    
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
    
    .hero-section {
        padding: 45px 20px;
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .single-post {
        padding: 35px 25px;
    }
    
    .entry-title {
        font-size: 30px;
    }
    
    .entry-content {
        font-size: 16px;
    }
    
    .footer-widgets-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 平板和手机通用移动端样式 (最大 991px) */
@media (max-width: 991px) {
    /* 隐藏桌面端导航和操作 */
    .desktop-nav,
    .desktop-actions {
        display: none !important;
    }
    
    /* 显示移动端菜单按钮和导航 */
    .menu-toggle {
        display: flex;
    }
    
    .mobile-navigation {
        display: block;
    }
    
    .site-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: #fff;
    }
    
    html[data-theme="dark"] .site-header {
        background: rgba(15, 23, 42, 0.98);
    }
    
    body {
        padding-top: 60px;
    }
    
    .header-top {
        padding: 14px 0;
    }
    
    .header-inner {
        gap: 12px;
    }
    
    .site-branding {
        flex: 1;
        min-width: 0;
    }
    
    .site-description {
        display: none;
    }
    
    .site-title {
        font-size: 20px;
    }
    
    /* 移动端折叠菜单 */
    .mobile-navigation {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fff;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }
    
    html[data-theme="dark"] .mobile-navigation {
        background: rgba(15, 23, 42, 0.98);
    }
    
    .mobile-navigation.active {
        transform: translateX(0);
    }
    
    .mobile-nav-inner {
        padding: 20px;
        display: flex;
        flex-direction: column;
        min-height: 100%;
    }
    
    .mobile-nav-menu {
        list-style: none;
        margin: 0;
        padding: 0;
    }
    
    .mobile-nav-menu li {
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    }
    
    html[data-theme="dark"] .mobile-nav-menu li {
        border-bottom-color: rgba(255, 255, 255, 0.08);
    }
    
    .mobile-nav-menu a {
        display: block;
        padding: 16px 0;
        font-size: 17px;
        font-weight: 500;
        color: #333;
        text-decoration: none;
    }
    
    html[data-theme="dark"] .mobile-nav-menu a {
        color: #e2e8f0;
    }
    
    .mobile-nav-menu .sub-menu {
        list-style: none;
        padding-left: 16px;
        margin: 0;
    }
    
    .mobile-nav-menu .sub-menu a {
        font-size: 15px;
        padding: 12px 0;
        color: #666;
    }
    
    html[data-theme="dark"] .mobile-nav-menu .sub-menu a {
        color: #94a3b8;
    }
    
    /* 移动端操作区域 */
    .mobile-nav-actions {
        margin-top: auto;
        padding-top: 24px;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
    
    html[data-theme="dark"] .mobile-nav-actions {
        border-top-color: rgba(255, 255, 255, 0.1);
    }
    
    .mobile-nav-action-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .mobile-nav-label {
        font-size: 15px;
        font-weight: 500;
        color: #666;
    }
    
    html[data-theme="dark"] .mobile-nav-label {
        color: #94a3b8;
    }
    
    /* 移动端复用原有样式，只调整尺寸 */
    .mobile-nav-actions .language-switcher {
        padding: 4px;
        gap: 4px;
    }
    
    .mobile-nav-actions .language-switcher__btn {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    /* 移动端主题切换 - 保持圆形 */
    .mobile-theme-switch {
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 50%;
    }
    
    .mobile-theme-switch .theme-switch__icon--moon {
        display: none;
    }
    
    html[data-theme="dark"] .mobile-theme-switch .theme-switch__icon--sun {
        display: none;
    }
    
    html[data-theme="dark"] .mobile-theme-switch .theme-switch__icon--moon {
        display: inline;
    }
}

/* 平板竖屏 (576px - 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .container {
        max-width: 540px;
    }
    
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .post-card-title {
        font-size: 16px;
    }
    
    .post-card-excerpt {
        font-size: 13px;
    }
    
    .hero-section {
        padding: 35px 15px;
    }
    
    .hero-title {
        font-size: 30px;
    }
    
    .hero-description {
        font-size: 15px;
    }
    
    .single-post {
        padding: 28px 20px;
    }
    
    .entry-title {
        font-size: 26px;
    }
    
    .footer-widgets-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
}

/* 手机横屏 (480px - 575px) */
@media (min-width: 480px) and (max-width: 575px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .post-card-content {
        padding: 15px;
    }
    
    .post-card-title {
        font-size: 15px;
        -webkit-line-clamp: 2;
    }
    
    .post-card-excerpt {
        -webkit-line-clamp: 2;
        font-size: 13px;
    }
    
    .post-card-meta {
        font-size: 11px;
        gap: 8px;
    }
    
    .hero-title {
        font-size: 26px;
    }
    
    .single-post {
        padding: 25px 18px;
    }
    
    .entry-title {
        font-size: 24px;
    }
    
    .entry-content {
        font-size: 15px;
    }
    
    .comments-area {
        padding: 25px 15px;
    }
}

/* 小手机 (最大 479px) */
@media (max-width: 479px) {
    body {
        font-size: 14px;
        padding-top: 56px;
    }
    
    .container {
        padding: 0 12px;
    }
    
    .header-top {
        padding: 12px 0;
    }
    
    .site-title {
        font-size: 18px;
    }
    
    .mobile-navigation {
        top: 56px;
    }
    
    .mobile-nav-inner {
        padding: 16px;
    }
    
    .mobile-nav-menu a {
        padding: 14px 0;
        font-size: 16px;
    }
    
    .search-form {
        flex-direction: column;
        gap: 8px;
    }
    
    .search-field,
    .search-submit {
        width: 100%;
    }
    
    .breadcrumb {
        font-size: 12px;
        padding: 10px 15px;
        margin-bottom: 20px;
    }
    
    .hero-section {
        padding: 25px 15px;
        margin-bottom: 25px;
    }
    
    .hero-title {
        font-size: 22px;
    }
    
    .hero-description {
        font-size: 14px;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .post-card-content {
        padding: 14px;
    }
    
    .post-card-title {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .post-card-excerpt {
        font-size: 13px;
        -webkit-line-clamp: 2;
        margin-bottom: 12px;
    }
    
    .post-card-meta {
        font-size: 11px;
        gap: 10px;
        padding-top: 12px;
    }
    
    .single-post {
        padding: 20px 15px;
        margin-bottom: 25px;
    }
    
    .entry-header {
        margin-bottom: 20px;
    }
    
    .entry-title {
        font-size: 22px;
        margin-bottom: 15px;
    }
    
    .entry-meta {
        font-size: 12px;
        gap: 12px;
    }
    
    .entry-content {
        font-size: 15px;
        line-height: 1.7;
    }
    
    .entry-content h2 {
        font-size: 20px;
    }
    
    .entry-content h3 {
        font-size: 18px;
    }
    
    .entry-content h4 {
        font-size: 16px;
    }
    
    .comments-area {
        padding: 20px 15px;
        margin-top: 25px;
    }
    
    .comments-title {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .comment-body {
        padding: 15px;
    }
    
    .comment-author img {
        width: 36px;
        height: 36px;
    }
    
    .comment-list .children {
        margin-left: 15px;
    }
    
    .pagination-wrapper {
        margin: 25px 0;
    }
    
    .page-numbers a,
    .page-numbers span {
        min-width: 36px;
        height: 36px;
        padding: 0 10px;
        font-size: 14px;
    }
    
    .widget {
        padding: 18px;
        margin-bottom: 18px;
    }
    
    .widget-title {
        font-size: 16px;
    }
    
    .site-footer {
        margin-top: 40px;
    }
    
    .footer-widgets {
        padding: 35px 0 20px;
    }
    
    .footer-widgets-grid {
        gap: 20px;
    }
    
    .footer-bottom {
        padding: 18px 0;
    }
    
    .footer-bottom-inner {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .footer-menu {
        flex-direction: column;
        gap: 10px;
    }
    
    .back-to-top {
        width: 42px;
        height: 42px;
        bottom: 15px;
        right: 15px;
    }
    
    .error-404-inner {
        padding: 30px 20px;
    }
    
    .error-404-title {
        font-size: 72px;
    }
    
    .error-404-subtitle {
        font-size: 24px;
    }
    
    .error-404-text {
        font-size: 14px;
    }
    
    .archive-header,
    .search-header {
        padding: 25px 15px;
        margin-bottom: 25px;
    }
    
    .archive-title,
    .search-title {
        font-size: 24px;
    }
}

/* 超小手机 (最大 360px) */
@media (max-width: 360px) {
    .site-title {
        font-size: 18px;
    }
    
    .hero-title {
        font-size: 20px;
    }
    
    .entry-title {
        font-size: 20px;
    }
    
    .post-card-title {
        font-size: 15px;
    }
    
    .post-card-meta {
        font-size: 10px;
    }
    
    .comment-list .children {
        margin-left: 10px;
    }
}

/* 横屏模式优化 */
@media (max-height: 600px) and (orientation: landscape) {
    .hero-section {
        padding: 20px;
    }
    
    .hero-title {
        font-size: 24px;
    }
    
    .site-main {
        padding: 20px 0;
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    .post-card-thumbnail img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* 移动端分页优化 */
@media (max-width: 767px) {
    .gallery-pagination {
        padding: 8px 0;
    }

    .gallery-pagination ul {
        flex-wrap: wrap;
        gap: 6px;
        justify-content: center;
    }

    .gallery-pagination ul li a,
    .gallery-pagination ul li span {
        min-width: 32px;
        height: 32px;
        padding: 0 8px;
        font-size: 13px;
    }
}

/* 打印优化 */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    .site-header,
    .site-footer,
    .breadcrumb,
    .back-to-top,
    .related-posts,
    .pagination-wrapper,
    .comment-respond,
    .social-share {
        display: none !important;
    }
    
    .single-post,
    .comments-area {
        box-shadow: none !important;
        padding: 0 !important;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    abbr[title]:after {
        content: " (" attr(title) ")";
    }
    
    pre,
    blockquote {
        border: 1px solid #999;
        page-break-inside: avoid;
    }
    
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
    
    h2, h3 {
        page-break-after: avoid;
    }
}

/* 可访问性：减少动画 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 暗色模式支持（预留） */
@media (prefers-color-scheme: dark) {
    /* 未来可以在这里添加暗色模式样式 */
}

