/*
 * ┌─────────────────────────────────────────────────────────────────┐
 * │  STEP 11 of 13 (CSS thread) — css/responsive.css                │
 * │                                                                 │
 * │  All breakpoint overrides for the general site layout.          │
 * │  (Tab-specific breakpoints live in components.css.)             │
 * │                                                                 │
 * │  KEY CONCEPT: mobile-first vs desktop-first.                    │
 * │  This file uses desktop-first (max-width) because the site was  │
 * │  designed on desktop. Each media query is a narrowing override. │
 * │  Mobile-first (min-width) is generally preferred for new        │
 * │  projects — you start simple and add complexity as space grows. │
 * │                                                                 │
 * │  KEY CONCEPT: orientation media query.                          │
 * │  @media (max-height: 500px) and (orientation: landscape) targets│
 * │  phones rotated sideways — they have very little vertical space  │
 * │  so the hero is shrunk and the buttons reflow to a row.         │
 * │                                                                 │
 * │  ▶  Next: See css/picks-window.css (Step 12 — CSS thread)      │
 * └─────────────────────────────────────────────────────────────────┘
 */

/* ===================================
   Responsive Design
   =================================== */

/* Large tablets and small desktops: 1024px and down */
@media (max-width: 1024px) {
    .container {
        padding: 0 clamp(1rem, 3vw, 2rem);
    }

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

    .teaching-grid {
        gap: var(--spacing-md);
    }
}

/* Tablets: 768px and down */
@media (max-width: 768px) {
    /* Navigation - Mobile Menu */
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 60px;
        flex-direction: column;
        background-color: var(--primary-color);
        width: 100%;
        text-align: center;
        transition: left var(--transition-medium);
        box-shadow: var(--shadow-lg);
        padding: var(--spacing-md) 0;
        gap: 0;
    }

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

    .nav-link {
        width: 100%;
        justify-content: center;
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .hamburger {
        display: flex;
        /* Ensure hamburger is touch-friendly */
        min-width: 44px;
        min-height: 44px;
    }

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

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

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

    /* Hero Section - Reduce height on mobile */
    .hero {
        min-height: 85vh;
        padding: clamp(1.5rem, 4vw, 3rem) var(--spacing-md);
    }

    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 300px;
    }

    .scroll-indicator {
        display: none; /* Hide on tablet/mobile to save space */
    }

    /* Layout - Single column for most grids */
    .about-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .about-highlights {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

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

    .projects-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

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

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

    .teaching-grid {
        gap: var(--spacing-md);
    }

    /* Spacing adjustments */
    .section {
        padding: clamp(2rem, 5vw, 3rem) 0;
    }

    .section-title {
        margin-bottom: var(--spacing-md);
    }

    .section-intro {
        margin-bottom: var(--spacing-md);
        font-size: 1rem;
    }

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

    /* Lead text */
    .lead {
        font-size: 1.1rem;
    }
}

/* Small tablets and large phones: 640px and down */
@media (max-width: 640px) {
    .container {
        max-width: 100%;
        padding: 0 var(--spacing-sm);
    }

    .hero {
        min-height: 100vh;
        justify-content: flex-start;
        padding-top: 80px;
    }

    .hero-content {
        max-width: 100%;
    }

    /* Single column for all highlight cards */
    .about-highlights {
        grid-template-columns: 1fr;
    }

    /* Ensure all cards are full width */
    .course-card,
    .project-card,
    .pub-item,
    .grant-item,
    .award-card {
        margin-bottom: var(--spacing-sm);
    }

    /* Stats in single column on small screens */
    .project-stats {
        grid-template-columns: 1fr;
    }

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

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

    /* Area tags - stack more naturally */
    .areas-grid {
        justify-content: flex-start;
    }

    .area-tag {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    /* Approach grid */
    .approach-grid {
        grid-template-columns: 1fr;
    }

    /* Publications grid */
    .publications-grid {
        gap: var(--spacing-md);
    }
}

/* Small phones: 480px and down */
@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    /* Further reduce spacing */
    .section {
        padding: var(--spacing-md) 0;
    }

    /* Hero adjustments */
    .hero {
        padding-top: 60px;
    }

    .hero-buttons {
        gap: var(--spacing-xs);
    }

    /* Buttons - ensure they're still touch-friendly but more compact */
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
    }

    /* Navigation */
    .nav-container {
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    .logo {
        font-size: 1.25rem;
    }

    /* Cards - more compact padding */
    .course-card,
    .project-card,
    .pub-item,
    .grant-item,
    .award-card,
    .highlight-card {
        padding: var(--spacing-sm);
    }

    /* Project tech tags - smaller */
    .project-tech span {
        font-size: 0.75rem;
        padding: 3px 8px;
    }

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

    .footer-tagline {
        font-size: 0.85rem;
    }

    /* Stats - slightly smaller */
    .stat h3 {
        font-size: 2rem;
    }

    .stat p {
        font-size: 0.85rem;
    }

    /* Award icons - smaller */
    .award-icon {
        font-size: 2.5rem;
    }

    /* CTA box */
    .cta-box {
        padding: var(--spacing-md);
    }
}

/* Very small phones: 360px and down */
@media (max-width: 360px) {
    .container {
        padding: 0 0.75rem;
    }

    .hero-buttons {
        max-width: 100%;
    }

    .btn {
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
    }

    /* Even more compact cards */
    .course-card,
    .project-card,
    .pub-item,
    .grant-item,
    .award-card {
        padding: 0.75rem;
    }

    /* Smaller stats */
    .stat h3 {
        font-size: 1.75rem;
    }
}

/* Landscape phones: Optimize for horizontal viewing */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: var(--spacing-md);
    }

    .hero-title {
        font-size: clamp(1.5rem, 3vw, 2rem);
        margin-bottom: 0.5rem;
    }

    .hero-subtitle {
        font-size: clamp(1rem, 2vw, 1.25rem);
    }

    .hero-description {
        font-size: 0.9rem;
        margin-bottom: var(--spacing-sm);
    }

    .hero-buttons {
        flex-direction: row;
        gap: var(--spacing-sm);
        margin-top: var(--spacing-sm);
    }

    .scroll-indicator {
        display: none;
    }

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

    .nav-container {
        padding: 0.5rem var(--spacing-md);
    }
}
