/* ===================================
   Apple Style Responsive Design
   =================================== */

/* Extra Small Devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    /* Typography Scaling */
    .hero-name {
        font-size: 40px;
        line-height: 1.1;
        letter-spacing: -0.015em;
    }

    .hero-greeting {
        font-size: 17px;
    }

    .hero-subtitle {
        font-size: 17px;
        line-height: 1.6;
        text-align: center;
        display: none; /* 隐藏原始内容 */
    }

    /* Mobile: Show multi-line content */
    .hero-subtitle::after {
        content: "云计算解决方案架构师\A 全栈软件工程师\A 用云计算构建未来";
        display: block;
        font-size: 17px;
        line-height: 1.6;
        text-align: center;
        white-space: pre-wrap;
    }

    .section-title {
        font-size: 40px;
        line-height: 1.1;
    }

    .section-subtitle {
        font-size: 19px;
    }

    /* Spacing */
    .container {
        padding: 0 var(--spacing-md);
    }

    section {
        padding: var(--spacing-lg) 0;
    }

    /* About Section */
    .about-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .profile-placeholder {
        width: 220px;
        height: 220px;
    }

    .about-text {
        font-size: 17px;
    }

    /* Skills */
    .skills-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

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

    /* Timeline Mobile */
    .timeline::before {
        left: 12px;
    }

    .timeline-item {
        width: 100%;
        padding-left: 40px !important;
        padding-right: var(--spacing-md) !important;
        text-align: left !important;
    }

    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        left: 0;
    }

    .timeline-dot {
        left: 6px !important;
        right: auto !important;
    }

    .timeline-content {
        padding: var(--spacing-sm);
    }

    .timeline-title {
        font-size: 19px;
    }

    .timeline-company {
        font-size: 15px;
    }

    .timeline-description {
        font-size: 14px;
    }

    /* Contact */
    .contact-text {
        font-size: 17px;
    }

    .social-links {
        gap: var(--spacing-sm);
    }

    .social-link {
        width: 50px;
        height: 50px;
    }

    /* Navigation - Mobile */
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 48px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: saturate(180%) blur(20px);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        padding: var(--spacing-sm) 0;
        gap: 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-normal);
    }

    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

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

    .nav-link {
        display: block;
        padding: 12px var(--spacing-md);
        line-height: 1.47059;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    /* Hero */
    .hero {
        padding-top: 100px;
        min-height: auto;
    }

    .hero-cta {
        flex-direction: column;
        width: 100%;
    }

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

    /* Scroll Indicator */
    .scroll-indicator {
        display: none;
    }

    /* Buttons */
    .btn {
        font-size: 15px;
        padding: 10px 18px;
    }

    .btn-large {
        font-size: 17px;
        padding: 14px 24px;
    }

    /* Footer */
    .footer {
        padding: var(--spacing-md) 0;
    }

    .footer p {
        font-size: 11px;
        padding: 0 var(--spacing-sm);
    }
}

/* Small Devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .hero-name {
        font-size: 48px;
    }

    .section-title {
        font-size: 48px;
    }

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

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

    .about-content {
        grid-template-columns: 1fr;
    }

    /* Timeline Mobile */
    .timeline::before {
        left: 12px;
    }

    .timeline-item {
        width: 100%;
        padding-left: 40px !important;
        padding-right: var(--spacing-md) !important;
        text-align: left !important;
    }

    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        left: 0;
    }

    .timeline-dot {
        left: 6px !important;
        right: auto !important;
    }

    /* Mobile Navigation */
    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 48px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: saturate(180%) blur(20px);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        padding: var(--spacing-sm) 0;
        gap: 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-normal);
    }

    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

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

    .nav-link {
        display: block;
        padding: 12px var(--spacing-md);
        line-height: 1.47059;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .hero-name {
        font-size: 56px;
    }

    .section-title {
        font-size: 52px;
    }

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

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

    .about-content {
        grid-template-columns: 1fr;
    }

    /* Timeline Tablet */
    .timeline::before {
        left: 20px;
    }

    .timeline-item {
        width: 100%;
        padding-left: 50px !important;
        padding-right: var(--spacing-md) !important;
        text-align: left !important;
    }

    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        left: 0;
    }

    .timeline-dot {
        left: 14px !important;
        right: auto !important;
    }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .hero-name {
        font-size: 64px;
    }

    .section-title {
        font-size: 56px;
    }

    .about-content {
        grid-template-columns: 1fr 1fr;
    }

    .skills-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }

    /* Timeline Desktop */
    .timeline::before {
        left: 50%;
        transform: translateX(-50%);
    }

    .timeline-item {
        width: 50%;
    }

    .timeline-item:nth-child(odd) {
        left: 0;
        padding-right: var(--spacing-lg);
        text-align: right;
    }

    .timeline-item:nth-child(even) {
        left: 50%;
        padding-left: var(--spacing-lg);
    }

    .timeline-dot {
        position: absolute;
    }

    .timeline-item:nth-child(odd) .timeline-dot {
        right: -6px;
    }

    .timeline-item:nth-child(even) .timeline-dot {
        left: -6px;
    }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }

    .hero-name {
        font-size: 64px;
    }

    .section-title {
        font-size: 56px;
    }
}

/* Ultra Large Devices (1440px and up) */
@media (min-width: 1440px) {
    .hero-name {
        font-size: 80px;
    }

    .section-title {
        font-size: 64px;
    }

    .hero-subtitle {
        font-size: 28px;
    }

    .container {
        max-width: 1400px;
    }
}

/* ===================================
   Touch Device Optimizations
   =================================== */
@media (hover: none) and (pointer: coarse) {
    /* Disable hover effects on touch devices */
    .btn:hover {
        transform: none;
    }

    .skill-card:hover,
    .project-card:hover,
    .social-link:hover {
        transform: none;
    }

    /* Increase touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .nav-link {
        padding: 12px 16px;
    }

    .social-link {
        width: 56px;
        height: 56px;
    }

    /* Improve tap feedback */
    .btn:active {
        transform: scale(0.98);
    }

    .skill-card:active,
    .project-card:active {
        transform: scale(0.99);
    }

    .social-link:active {
        transform: scale(0.95);
    }
}

/* ===================================
   Print Styles
   =================================== */
@media print {
    .navbar,
    .scroll-indicator,
    .hero-cta,
    .footer,
    .hamburger {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .hero {
        height: auto;
        min-height: 50vh;
        padding: var(--spacing-lg) 0;
    }

    section {
        page-break-inside: avoid;
    }

    .project-card,
    .skill-card,
    .timeline-item {
        page-break-inside: avoid;
    }

    a {
        color: var(--accent-blue);
        text-decoration: underline;
    }
}

/* ===================================
   Landscape Orientation for Mobile
   =================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
        padding: var(--spacing-lg) 0;
    }

    .hero-name {
        font-size: 36px;
    }

    .hero-greeting {
        font-size: 17px;
    }

    .hero-subtitle {
        font-size: 17px;
        line-height: 1.6;
        text-align: center;
        display: none; /* 隐藏原始内容 */
    }

    /* Mobile: Show multi-line content */
    .hero-subtitle::after {
        content: "云计算解决方案架构师\A 全栈软件工程师\A 用云计算构建未来";
        display: block;
        font-size: 17px;
        line-height: 1.6;
        text-align: center;
        white-space: pre-wrap;
    }

    section {
        padding: var(--spacing-md) 0;
        min-height: auto;
    }

    .scroll-indicator {
        display: none;
    }

    .navbar {
        height: 44px;
    }

    .nav-container {
        height: 44px;
    }
}

/* ===================================
   High DPI Displays
   =================================== */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    /* Optimize for retina displays */
    .profile-placeholder,
    .project-image-placeholder {
        /* Add higher quality images if available */
    }
}

/* ===================================
   Dark Mode Support (for future)
   =================================== */
@media (prefers-color-scheme: dark) {
    /* Currently using light theme */
    /* Dark mode can be added here in the future */
}

/* ===================================
   Reduced Motion Preference
   =================================== */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .fade-in,
    .slide-left,
    .slide-right,
    .scale-in {
        opacity: 1;
        transform: none;
    }

    .hero-content {
        animation: none;
    }
}

/* ===================================
   Mobile Specific Optimizations
   =================================== */
@media (max-width: 767.98px) {
    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
    }

    /* Optimize font rendering */
    * {
        -webkit-tap-highlight-color: transparent;
    }

    /* Safe area insets for iPhone X+ */
    .navbar {
        padding-top: env(safe-area-inset-top);
    }

    .hero {
        padding-top: calc(120px + env(safe-area-inset-top));
    }
}

/* ===================================
   Tablet Specific Optimizations
   =================================== */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .hero-name {
        font-size: 52px;
    }

    .section-title {
        font-size: 48px;
    }

    .about-content {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   Desktop Touch Devices (Surface, etc.)
   =================================== */
@media (min-width: 1024px) and (hover: none) and (pointer: coarse) {
    .btn {
        padding: 14px 26px;
        min-height: 48px;
    }

    .nav-link {
        padding: 0 16px;
    }

    .social-link {
        width: 60px;
        height: 60px;
    }
}

/* ===================================
   Container Padding Adjustments
   =================================== */
@media (min-width: 576px) {
    .container {
        padding: 0 var(--spacing-lg);
    }
}

@media (min-width: 992px) {
    .container {
        padding: 0 var(--spacing-xl);
    }
}

/* ===================================
   Navigation Responsive Adjustments
   =================================== */
@media (max-width: 991.98px) {
    .nav-container {
        max-width: 100%;
    }
}

@media (min-width: 992px) {
    .nav-container {
        max-width: 1000px;
    }
}
