/* ===================================
   Responsive Design - Mobile First
   =================================== */

/* Tablet Devices (768px and below) */
@media (max-width: 768px) {

    /* Navigation */
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: var(--bg-secondary);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2rem;
        transition: left 0.3s ease;
        backdrop-filter: blur(20px);
    }

    .nav-menu.active {
        left: 0;
    }

    .hamburger {
        display: flex;
    }

    .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(7px, -6px);
    }

    /* Hero Section */
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 3rem;
        padding-top: 2rem;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
        justify-content: center;
    }

    .hero-social {
        justify-content: center;
    }

    .hero-image {
        order: -1;
        /* Image first on mobile? Or after text? Usually after greeting but before buttons, but here simpler to keep it in its grid position or move to top */
    }

    .hero-image-wrapper {
        max-width: 280px;
        margin: 0 auto;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    /* Skills Section */
    .skills-grid {
        grid-template-columns: 1fr;
    }

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

    /* About Section */
    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-image {
        max-width: 400px;
        margin: 0 auto;
    }

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

    /* Testimonials */
    .testimonials-slider {
        grid-template-columns: 1fr;
    }

    .testimonial-card:not(:first-child) {
        display: none;
    }

    /* Contact Section */
    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Footer */
    .footer-content {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }

    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }

    /* Spacing Adjustments */
    section {
        padding: var(--spacing-lg) 0;
    }

    .container {
        padding: 0 var(--spacing-sm);
    }
}

/* Mobile Devices (480px and below) */
@media (max-width: 480px) {

    /* Typography */
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .hero-title .name {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.25rem;
    }

    .hero-image-wrapper {
        max-width: 220px;
    }

    /* Navigation */
    .nav-container {
        padding: 1rem;
    }

    .nav-logo {
        font-size: 1.5rem;
    }

    /* Buttons */
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.9rem;
    }

    /* Hero Section */
    .hero-social {
        flex-wrap: wrap;
    }

    .social-link {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }

    /* Skills */
    .skill-card {
        padding: 1.5rem;
    }

    .skill-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    /* Projects */
    .project-image {
        height: 200px;
    }

    .project-content {
        padding: 1.25rem;
    }

    /* About */
    .about-image-border {
        top: -10px;
        left: -10px;
    }

    /* Contact */
    .contact-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    /* Spacing */
    section {
        padding: 3rem 0;
    }

    .section-title {
        margin-bottom: 0.75rem;
    }

    .section-subtitle {
        margin-bottom: 2rem;
    }
}

/* Large Tablets (992px and below) */
@media (max-width: 992px) {
    .about-stats {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .testimonial-card:nth-child(3) {
        display: none;
    }
}

/* Desktop (1200px and above) */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }

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

/* Ultra-wide Screens (1600px and above) */
@media (min-width: 1600px) {
    .container {
        max-width: 1600px;
    }

    .hero-content {
        max-width: 1000px;
    }
}

/* ===================================
   Print Styles
   =================================== */
@media print {

    .navbar,
    .hero-social,
    .scroll-indicator,
    .testimonials-nav,
    .contact-form,
    .footer {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    section {
        page-break-inside: avoid;
    }
}

/* ===================================
   Reduced Motion
   =================================== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .scroll-line {
        animation: none;
    }

    .marquee-content {
        animation: none;
    }
}

/* ===================================
   Landscape Orientation
   =================================== */
@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 6rem 0 4rem;
    }

    .scroll-indicator {
        display: none;
    }

    section {
        padding: 3rem 0;
    }
}

/* ===================================
   High DPI Screens
   =================================== */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    /* Optimize images and graphics for retina displays */
    .project-image img,
    .about-image img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ===================================
   Touch Device Optimizations
   =================================== */
@media (hover: none) and (pointer: coarse) {

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

    /* Remove hover effects on touch devices */
    .hover-lift:hover,
    .hover-scale:hover,
    .hover-rotate:hover {
        transform: none;
    }

    /* Simplify animations for better performance */
    .project-card:hover .project-image img {
        transform: none;
    }
}