/* 
 * 铁算算盘 44859 论坛官网 - 响应式样式
 * 版本：1.0.0
 * 更新日期：2026-03-07
 */

/* ==================== 平板设备 (768px - 1024px) ==================== */
@media screen and (max-width: 1024px) {
    :root {
        --container-max: 960px;
    }
    
    /* 统计数据 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 论坛分类 */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 友情链接 */
    .links-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 页脚 */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==================== 移动设备 (480px - 767px) ==================== */
@media screen and (max-width: 768px) {
    :root {
        --container-max: 100%;
        --header-height: 60px;
    }
    
    /* 头部导航 */
    .nav-main {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background-color: white;
        flex-direction: column;
        justify-content: flex-start;
        padding: var(--spacing-6);
        transform: translateX(100%);
        transition: transform var(--transition-base);
        z-index: 999;
    }
    
    .nav-main.active {
        transform: translateX(0);
    }
    
    .nav-list {
        flex-direction: column;
        width: 100%;
        gap: var(--spacing-2);
    }
    
    .nav-list a {
        padding: var(--spacing-4) var(--spacing-6);
        font-size: var(--font-size-lg);
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    
    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
    
    /* Hero 横幅 */
    .hero-section {
        padding: var(--spacing-10) 0;
    }
    
    .hero-content h2 {
        font-size: var(--font-size-2xl);
    }
    
    .hero-content p {
        font-size: var(--font-size-base);
    }
    
    .hero-actions {
        flex-direction: column;
        gap: var(--spacing-3);
    }
    
    .hero-actions .btn {
        width: 100%;
    }
    
    /* 统计数据 */
    .stats-section {
        margin-top: 0;
        padding: var(--spacing-8) 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-4);
    }
    
    .stat-number {
        font-size: var(--font-size-2xl);
    }
    
    /* 论坛分类 */
    .categories-section {
        padding: var(--spacing-10) 0;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-4);
    }
    
    .category-card {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-3);
    }
    
    .category-icon {
        margin-bottom: 0;
    }
    
    /* 帖子列表 */
    .posts-section {
        padding: var(--spacing-10) 0;
    }
    
    .post-item {
        flex-direction: column;
    }
    
    .post-icon {
        width: 40px;
        height: 40px;
    }
    
    .post-stats {
        width: 100%;
        justify-content: flex-start;
        gap: var(--spacing-6);
    }
    
    /* 公告区域 */
    .announcement-item {
        flex-wrap: wrap;
    }
    
    .announcement-item time {
        width: 100%;
        margin-top: var(--spacing-2);
    }
    
    /* 友情链接 */
    .links-section {
        padding: var(--spacing-8) 0;
    }
    
    .links-grid {
        grid-template-columns: 1fr;
    }
    
    /* 页脚 */
    .footer {
        padding: var(--spacing-10) 0 var(--spacing-6);
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-6);
    }
    
    .footer-about {
        text-align: center;
    }
    
    .footer-links,
    .footer-contact,
    .footer-qr {
        text-align: center;
    }
    
    .qr-code {
        display: none;
    }
    
    /* 返回顶部 */
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }
}

/* ==================== 小屏手机 (< 480px) ==================== */
@media screen and (max-width: 480px) {
    :root {
        --font-size-base: 0.875rem;
    }
    
    /* 头部 */
    .logo-text h1 {
        font-size: var(--font-size-lg);
    }
    
    .logo-text span {
        display: none;
    }
    
    /* Hero */
    .hero-content h2 {
        font-size: var(--font-size-xl);
    }
    
    /* 统计数据 */
    .stat-number {
        font-size: var(--font-size-xl);
    }
    
    .stat-label {
        font-size: var(--font-size-xs);
    }
    
    /* 版块标题 */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .section-header h3 {
        font-size: var(--font-size-xl);
    }
    
    /* 帖子 */
    .post-title {
        font-size: var(--font-size-base);
    }
    
    .post-meta,
    .post-excerpt {
        font-size: var(--font-size-xs);
    }
    
    /* 公告 */
    .announcement-item h4 {
        font-size: var(--font-size-sm);
    }
}

/* ==================== 横屏模式 ==================== */
@media screen and (max-width: 896px) and (orientation: landscape) {
    .hero-section {
        padding: var(--spacing-8) 0;
    }
    
    .stats-section {
        padding: var(--spacing-6) 0;
    }
}

/* ==================== 高对比度模式 ==================== */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #c62828;
        --gray-900: #000000;
        --gray-50: #ffffff;
    }
    
    .btn {
        border-width: 2px;
    }
}

/* ==================== 减少动画 ==================== */
@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 screen and (max-width: 1024px) {
    .forum-layout {
        grid-template-columns: 1fr;
    }
    
    .forum-sidebar {
        order: 2;
    }
    
    .sidebar-card {
        display: none;
    }
    
    .about-stats {
        grid-template-columns: 1fr;
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 768px) {
    .page-header {
        padding: var(--spacing-8) 0;
    }
    
    .page-header h1 {
        font-size: var(--font-size-2xl);
    }
    
    .page-header p {
        font-size: var(--font-size-base);
    }
    
    .forum-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-left,
    .toolbar-right {
        justify-content: stretch;
    }
    
    .toolbar-right {
        flex-direction: column;
    }
    
    .search-box {
        width: 100%;
    }
    
    .search-box input {
        min-width: 150px;
        flex: 1;
    }
    
    .sort-dropdown select {
        width: 100%;
    }
    
    .category-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: var(--spacing-2);
    }
    
    .tab-btn {
        flex-shrink: 0;
        white-space: nowrap;
    }
}

/* ==================== 打印样式 ==================== */
@media print {
    .header,
    .hero-section,
    .stats-section,
    .back-to-top,
    .footer {
        display: none;
    }
    
    body {
        background: white;
        font-size: 12pt;
        line-height: 1.5;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    a {
        color: #000000;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}
