/* ========================================
   响应式样式文件
   移动优先设计
   ======================================== */

/* 移动端样式 (默认) */
@media (max-width: 640px) {
    /* 导航栏移动端 */
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background-color: var(--white);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding: var(--spacing-8) 0;
        transition: var(--transition-base);
        box-shadow: var(--shadow-lg);
        border-top: 1px solid var(--gray-200);
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-link {
        font-size: var(--font-size-lg);
        padding: var(--spacing-4) 0;
        width: 100%;
        text-align: center;
        border-bottom: 1px solid var(--gray-200);
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }
    
    /* 容器调整 */
    .container {
        padding: 0 var(--spacing-4);
    }
    
    /* 页面标题 */
    .page-title {
        font-size: var(--font-size-3xl);
    }
    
    .page-subtitle {
        font-size: var(--font-size-base);
    }
    
    /* 英雄区域 */
    .hero {
        padding: 100px 0 60px;
        min-height: 80vh;
        background-attachment: scroll;
    }
    
    .hero-title {
        font-size: var(--font-size-3xl);
    }
    
    .hero-subtitle {
        font-size: var(--font-size-lg);
    }
    
    .hero-description {
        font-size: var(--font-size-base);
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 280px;
    }
    
    /* 社交链接 */
    .social-links {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-4);
    }
    
    .social-link {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
    
    /* 作品网格 */
    .works-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-8);
    }
    
    .work-item {
        margin-bottom: var(--spacing-8);
    }
    
    .work-content {
        padding: var(--spacing-4);
    }
    
    .work-title {
        font-size: var(--font-size-lg);
    }
    
    /* 关于我区域 */
    .about-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-8);
        text-align: center;
    }
    
    .about-text {
        order: 2;
    }
    
    .about-image {
        order: 1;
    }
    
    .about-actions {
        justify-content: center;
    }
    
    /* 页脚 */
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-8);
        text-align: center;
    }
    
    .footer-social {
        justify-content: center;
    }
}

/* 平板端样式 */
@media (min-width: 641px) and (max-width: 1024px) {
    /* 导航栏 */
    .nav-menu {
        gap: var(--spacing-6);
    }
    
    /* 作品网格 */
    .works-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-6);
    }
    
    /* 关于我区域 */
    .about-content {
        gap: var(--spacing-12);
    }
    
    .about-text {
        max-width: 400px;
    }
    
    /* 页脚 */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-8);
    }
}

/* 桌面端样式 */
@media (min-width: 1025px) {
    /* 导航栏悬停效果 */
    .nav-link::before {
        content: '';
        position: absolute;
        bottom: -8px;
        left: 50%;
        width: 0;
        height: 2px;
        background-color: var(--primary-color);
        transition: var(--transition-fast);
        transform: translateX(-50%);
    }
    
    .nav-link:hover::before {
        width: 100%;
    }
    
    /* 作品网格悬停效果 */
    .work-item {
        position: relative;
        overflow: hidden;
    }
    
    .work-item::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
        opacity: 0;
        transition: var(--transition-base);
        z-index: 1;
    }
    
    .work-item:hover::before {
        opacity: 0.1;
    }
    
    /* 按钮悬停效果 */
    .btn {
        position: relative;
        overflow: hidden;
    }
    
    .btn::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
        transition: var(--transition-base);
    }
    
    .btn:hover::before {
        left: 100%;
    }
}

/* 大屏幕样式 */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
    
    .hero-title {
        font-size: var(--font-size-5xl);
    }
    
    .section-title {
        font-size: var(--font-size-4xl);
    }
    
    .works-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 高分辨率屏幕 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* 优化高分辨率屏幕的显示效果 */
    .hero-avatar img,
    .about-img,
    .work-img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* 打印样式 */
@media print {
    .navbar,
    .footer,
    .hero-actions,
    .social-links {
        display: none;
    }
    
    .hero {
        padding: 20px 0;
    }
    
    .page-header {
        padding: 20px 0;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
        background: #fff;
    }
    
    h1, h2, h3, h4, h5, h6 {
        color: #000;
        page-break-after: avoid;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --white: #0f172a;
        --gray-50: #1e293b;
        --gray-100: #334155;
        --gray-200: #475569;
        --gray-300: #64748b;
        --gray-400: #94a3b8;
        --gray-500: #cbd5e1;
        --gray-600: #e2e8f0;
        --gray-700: #f1f5f9;
        --gray-800: #f8fafc;
        --gray-900: #ffffff;
    }
    
    .navbar {
        background-color: rgba(15, 23, 42, 0.95);
        border-bottom-color: var(--gray-200);
    }
    
    .hero {
        background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
    }
    
    .about {
        background-color: var(--gray-50);
    }
    
    .footer {
        background-color: var(--gray-900);
    }
}

/* 减少动画偏好 */
@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-contrast: high) {
    :root {
        --primary-color: #0000ff;
        --gray-600: #000000;
        --gray-800: #000000;
    }
    
    .btn-primary {
        background-color: #0000ff;
        border: 2px solid #000000;
    }
    
    .nav-link {
        font-weight: 700;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link {
        padding: var(--spacing-4) var(--spacing-2);
    }
    
    .work-item:hover {
        transform: none;
    }
    
    .work-item:active {
        transform: scale(0.98);
    }
}

/* 横屏模式 */
@media (orientation: landscape) and (max-height: 500px) {
    .hero {
        padding: 80px 0 40px;
    }
    
    .page-header {
        padding: 100px 0 60px;
    }
    
    .hero-title {
        font-size: var(--font-size-3xl);
    }
    
    .section-title {
        font-size: var(--font-size-2xl);
    }
}

/* 超宽屏幕 */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }
    
    .hero-title {
        font-size: 4rem;
    }
    
    .section-title {
        font-size: 3rem;
    }
    
    .works-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
