/* 响应式设计样式 */

/* 大屏幕设备 (1200px 及以上) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }

    .hero-title {
        font-size: 4rem;
    }

    .section-header h2 {
        font-size: 3rem;
    }
}

/* 中等屏幕设备 (768px - 1199px) */
@media (max-width: 1199px) and (min-width: 768px) {
    .container {
        max-width: 960px;
    }

    .hero-title {
        font-size: 3rem;
    }

    .hero-content {
        padding: 0 40px;
    }

    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 平板设备 (768px - 1023px) */
@media (max-width: 1023px) and (min-width: 768px) {
    .container {
        padding: 0 30px;
    }

    .hero-title {
        font-size: 2.8rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .about-content {
        gap: 40px;
    }

    .contact-content {
        gap: 40px;
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 移动设备 (最大 767px) */
@media (max-width: 767px) {
    .container {
        padding: 0 20px;
    }

    .nav-container {
        height: 60px;
    }

    .hero {
        min-height: 80vh;
        padding: 80px 0 40px;
    }

    .hero-title {
        font-size: 2.2rem;
        margin-bottom: 15px;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 25px;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 15px;
    }

    .btn {
        width: 100%;
        text-align: center;
        padding: 15px 24px;
    }

    .section-header h2 {
        font-size: 2rem;
        margin-bottom: 10px;
    }

    .section-header p {
        font-size: 1rem;
    }

    .about-preview,
    .skills,
    .portfolio-preview,
    .contact-preview {
        padding: 60px 0;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .about-stats {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .stat-item {
        padding: 20px 15px;
    }

    .stat-number {
        font-size: 2rem;
    }

    .skills-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .skill-card {
        padding: 30px 20px;
    }

    .skill-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .portfolio-item {
        margin-bottom: 20px;
    }

    .portfolio-image {
        height: 150px;
    }

    .portfolio-info {
        padding: 20px;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .contact-info {
        gap: 20px;
    }

    .contact-item {
        gap: 15px;
    }

    .contact-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .footer {
        padding: 40px 0 20px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
}

/* 小屏幕移动设备 (最大 480px) */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    .section-header h2 {
        font-size: 1.8rem;
    }

    .section-header p {
        font-size: 0.9rem;
    }

    .about-preview,
    .skills,
    .portfolio-preview,
    .contact-preview {
        padding: 40px 0;
    }

    .skill-card {
        padding: 25px 15px;
    }

    .portfolio-info {
        padding: 15px;
    }

    .contact-icon {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }

    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* 超小屏幕设备 (最大 320px) */
@media (max-width: 320px) {
    .hero-title {
        font-size: 1.5rem;
    }

    .hero-subtitle {
        font-size: 0.8rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    .container {
        padding: 0 10px;
    }

    .skill-card,
    .portfolio-item,
    .stat-item {
        margin: 0 5px;
    }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 500px) {
    .hero {
        min-height: 100vh;
        padding: 60px 0;
    }

    .hero-content {
        flex-direction: row;
        gap: 40px;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .hero-background {
        background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><defs><pattern id="grain-hd" width="200" height="200" patternUnits="userSpaceOnUse"><circle cx="100" cy="100" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="200" height="200" fill="url(%23grain-hd)"/></svg>');
    }
}

/* 打印样式 */
@media print {

    .navbar,
    .hero-buttons,
    .back-to-top,
    .footer {
        display: none !important;
    }

    .hero {
        background: white !important;
        color: black !important;
        min-height: auto;
        padding: 20px 0;
    }

    .section-header h2 {
        color: black !important;
    }

    .skill-card,
    .portfolio-item,
    .stat-item {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

/* 无障碍访问优化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .btn-primary {
        background: #000 !important;
        color: #fff !important;
        border: 2px solid #000 !important;
    }

    .skill-fill {
        background: #000 !important;
    }

    .tag {
        background: #000 !important;
        color: #fff !important;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }

    .navbar {
        background: rgba(26, 26, 26, 0.95);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-link {
        color: #e0e0e0;
    }

    .section-header h2 {
        color: #e0e0e0;
    }

    .skill-card,
    .portfolio-item,
    .stat-item {
        background: #2a2a2a;
        border: 1px solid #3a3a3a;
    }

    .about-preview,
    .portfolio-preview {
        background: #1f1f1f;
    }
}