/* ========================================================
   响应式适配
   断点: ≥1200px (桌面), 992-1199 (笔记本), 768-991 (平板), <768 (手机)
   ======================================================== */

/* 大尺寸平板 / 小笔记本 */
@media (max-width: 1199px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 平板 */
@media (max-width: 991px) {
    :root {
        --space-2xl: 4rem;
        --space-xl: 3rem;
    }

    .nav-menu {
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        padding: var(--space-md) var(--space-lg) var(--space-lg);
        background: rgba(10, 10, 15, 0.96);
        backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--color-border);
        transform: translateY(-120%);
        transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
        pointer-events: none;
    }

    .nav-menu.open {
        transform: translateY(0);
        pointer-events: auto;
    }

    .nav-menu li {
        width: 100%;
        text-align: center;
    }

    .nav-link {
        display: block;
        padding: var(--space-md) var(--space-sm);
        font-size: 1rem;
        border-bottom: 1px solid var(--color-divider);
    }
    .nav-menu li:last-child .nav-link {
        border-bottom: none;
    }

    .nav-link::after {
        display: none;
    }

    .nav-link.active {
        color: var(--color-primary-light);
        text-shadow: var(--glow-text);
    }

    .hamburger {
        display: flex;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .about-avatar {
        max-width: 260px;
        margin: 0 auto;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 手机 */
@media (max-width: 767px) {
    :root {
        --space-2xl: 3rem;
        --space-xl: 2.5rem;
        --space-lg: 1.5rem;
    }

    body {
        font-size: 15px;
    }

    .section {
        padding: var(--space-2xl) var(--space-md);
    }

    .hero {
        padding: calc(var(--nav-height) + 1rem) var(--space-md) var(--space-xl);
    }

    .hero-cta {
        flex-direction: column;
        align-items: center;
    }

    .hero-cta .btn {
        width: 100%;
        max-width: 280px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .blog-card {
        padding: var(--space-md);
    }

    .contact-form {
        padding: var(--space-md);
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .form-row .form-field {
        margin-bottom: var(--space-md);
    }

    .hero-subtitle-text {
        font-size: 1rem;
    }

    .hero-description {
        font-size: 0.95rem;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .about-heading-intro {
        font-size: 1.4rem;
    }

    .blog-title {
        font-size: 1.15rem;
    }

    .stat-number {
        font-size: 1.6rem;
    }

    .project-links {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .abilities-grid {
        gap: var(--space-xs);
    }

    .ability-item {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }

    .contact-socials-grid {
        justify-content: flex-start;
    }

    .contact-direct {
        padding: var(--space-md);
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 42px;
        height: 42px;
    }

    /* 手机上降低粒子性能开销 */
    .grid-overlay {
        background-size: 80px 80px;
    }
}

/* 超小手机 */
@media (max-width: 380px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
        padding: var(--space-md);
    }
    .hero-title {
        font-size: 3rem;
    }
}

/* 降低动画 (辅助功能) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.1s !important;
        scroll-behavior: auto !important;
    }

    #particles-canvas {
        display: none;
    }

    .reveal {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* 暗色模式增强（默认已是暗色，这里提供给支持强制深色的浏览器） */
@media (prefers-color-scheme: dark) {
    :root {
        /* 使用默认变量 */
    }
}

/* 打印样式 */
@media print {
    .navbar,
    .back-to-top,
    #particles-canvas,
    .scanlines,
    .grid-overlay,
    .hero-float-orb,
    .scroll-indicator {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    a,
    .gradient-text {
        color: #000 !important;
        -webkit-text-fill-color: #000;
    }

    .section {
        padding: 1rem;
        page-break-inside: avoid;
    }
}
