/* Responsive Design */

/* ============================================
   TABLET AND MOBILE: 768px and below
   ============================================ */

@media (max-width: 768px) {
    :root {
        --font-size-hero: 2.5rem;     /* Reduce hero size for tablet */
        --font-size-h1: 2rem;
        --font-size-h2: 1.5rem;
        --spacing-xl: 3rem;
        --spacing-xxl: 4rem;
    }

    /* Mobile navigation */
    .menu-toggle {
        display: block;
    }

    /* Keep menu toggle black in dark mode */
    [data-theme="dark"] .menu-toggle {
        color: #1a1a1a;
    }

    /* Keep logo pinned to center column even when nav-left is fixed/out of flow */
    .nav-logo {
        grid-column: 2;
    }

    /* Remove active-link underline in dropdown (looks like a separator) */
    .nav-left a.active::after {
        display: none;
    }

    /* Social icons row at bottom of mobile dropdown */
    .nav-mobile-icons {
        display: flex;
        justify-content: center;
        gap: var(--spacing-md);
        padding: var(--spacing-sm) 0 var(--spacing-xs);
    }

    .nav-mobile-icons a {
        display: flex;
        align-items: center;
        color: #ffffff;
    }

    .nav-left {
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        background: #1a1a1a;
        flex-direction: column;
        padding: var(--spacing-md);
        border-bottom: none;
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        z-index: 99;
    }

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

    .nav-left li {
        padding: var(--spacing-xs) 0;
        text-align: center;
    }

    .nav-left a {
        display: block;
        padding: var(--spacing-sm) 0;
        font-size: var(--font-size-h4);
        color: #ffffff;
    }

    /* About page */
    .about-split {
        flex-direction: column-reverse;
    }

    .about-image {
        flex: 0 0 auto;
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
    }

    /* Gallery adjustments */
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

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

    .section-hero {
        min-height: 70vh;
        padding: var(--spacing-xl) 0;
    }

    /* Gallery filter on mobile */
    .gallery-filter {
        flex-direction: column;
        align-items: stretch;
    }

    .dropdown-filter {
        width: 100%;
        min-width: auto;
    }

    /* Lightbox adjustments */
    .lightbox-close {
        top: -40px;
        font-size: 2rem;
    }

    .lightbox-content {
        max-width: 95%;
    }

    .lightbox-image {
        max-height: 60vh;
    }

    /* Featured projects on mobile */
    .featured-projects {
        max-width: 90vw;
    }

    .featured-project img {
        height: 50vh;
    }

    .featured-project-info {
        bottom: var(--spacing-md);
        left: var(--spacing-md);
    }

    .featured-project-info h3 {
        font-size: var(--font-size-h3);
    }

    /* Hero section — stack vertically, left-aligned on mobile */
    .hero-split {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md);
        text-align: left;
    }

    .hero-name {
        align-items: flex-start;
        text-align: left;
        padding-right: 0;
    }

    .hero-name span {
        font-size: 3.5rem;
    }

    .hero-bio {
        text-align: left;
        padding-left: 0;
    }

    .hero-bio p {
        font-size: var(--font-size-h4);
    }

    /* Project pages — single column grid on mobile, full width */
    .project-image-grid {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

    /* All project page images and videos full width on mobile */
    .project-cover img,
    .project-gallery img,
    .project-video img,
    .project-video video {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Carousel — smaller cards on mobile */
    .project-carousel .project-card-link {
        flex: 0 0 75vw;
        min-width: 220px;
    }

    /* Hide social icons from header on mobile — they live in the dropdown */
    .nav-right .nav-icon {
        display: none;
    }

    /* Theme toggle — tuck in closer on mobile */
    .theme-toggle {
        top: 68px;
        right: 12px;
        width: 36px;
        height: 80px;
    }

    /* Responsive iframes — PDF and Figma embeds */
    iframe {
        width: 100% !important;
    }

    .project-gallery iframe,
    .py-lg iframe {
        height: 400px;
    }

    /* About page — resume iframe shorter on mobile */
    .about-resume-iframe {
        height: 600px;
    }

    /* Work page filter — stack label above dropdown */
    .gallery-filter {
        align-items: flex-start;
        gap: var(--spacing-xs);
    }
}

/* ============================================
   SMALL MOBILE: 480px and below
   ============================================ */

@media (max-width: 480px) {
    :root {
        --font-size-hero: 2rem;
        --font-size-h1: 1.75rem;
        --spacing-md: 1.5rem;
    }

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

    .main-nav {
        padding: var(--spacing-sm);
    }

    .nav-logo img {
        height: 28px;
    }

    .btn {
        padding: var(--spacing-sm);
        font-size: var(--font-size-small);
    }

    /* Even more compact spacing on very small screens */
    .gallery-grid {
        gap: var(--spacing-sm);
    }

    .hero-name span {
        font-size: 2.6rem;
    }

    .hero-bio p {
        font-size: var(--font-size-body);
    }

    /* Full-width carousel cards on very small screens */
    .project-carousel .project-card-link {
        flex: 0 0 85vw;
    }

    /* Shorter iframes on small mobile */
    .project-gallery iframe,
    .py-lg iframe {
        height: 300px;
    }
}

/* ============================================
   TABLET LANDSCAPE: 768px to 1024px
   ============================================ */

@media (min-width: 769px) and (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   DESKTOP: 1024px and up
   ============================================ */

@media (min-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   LARGE DESKTOP: 1440px and up
   ============================================ */

@media (min-width: 1440px) {
    :root {
        --max-width-content: 1400px;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Increase tap targets for touch devices */
    .nav-menu a,
    .btn,
    button,
    .project-card {
        min-height: 44px;
        min-width: 44px;
    }

    /* Disable hover effects on touch devices */
    .project-card:hover {
        transform: none;
    }

    .project-card:hover .project-image img {
        transform: none;
    }
}

/* ============================================
   ACCESSIBILITY: REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .site-header,
    .site-footer,
    .menu-toggle,
    .gallery-filter,
    .lightbox {
        display: none;
    }

    body {
        color: black;
        background: white;
    }

    .project-card {
        page-break-inside: avoid;
    }
}
