/* ============================================
   RESPONSIVE BREAKPOINTS
   Thorough mobile optimisation with 
   touch-friendly sizing throughout
   ============================================ */

/* ---- Tablet (≤ 960px) ---- */
@media (max-width: 960px) {
    /* Layout stacks */
    .about-layout {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .disciplines-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

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

    .contact-layout {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    /* Photos */
    .photo-mosaic {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 200px;
    }

    .photo-large {
        grid-column: span 2;
        grid-row: span 1;
    }

    .photo-wide {
        grid-column: span 2;
    }

    /* Research stacks */
    .research-item {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .research-tags {
        justify-content: flex-start;
    }

    /* Slightly tighten section padding */
    .section {
        padding: 5rem 1.5rem;
    }
}

/* ---- Mobile (≤ 680px) ---- */
@media (max-width: 680px) {
    /* ---- Global ---- */
    .section {
        padding: 3.5rem 1.25rem;
    }

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

    .section-title {
        font-size: 2rem;
        letter-spacing: -0.03em;
    }

    .section-subtitle {
        font-size: 0.92rem;
    }

    .section-label {
        font-size: 0.68rem;
        margin-bottom: 0.6rem;
    }

    /* ---- Hero ---- */
    .hero {
        min-height: 100vh;
        min-height: 100dvh;
        padding-top: 56px; /* nav height */
    }

    .hero-content {
        padding: 0 1.25rem;
    }

    .hero-eyebrow {
        font-size: 0.65rem;
        margin-bottom: 1.5rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        line-height: 1.65;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .hero-actions .btn {
        justify-content: center;
        padding: 1rem 1.5rem;
        font-size: 0.9rem;
    }

    .hero-equation {
        font-size: 0.55rem;
        gap: 0.4rem;
    }

    .hero-footer {
        bottom: 1.5rem;
    }

    /* ---- About ---- */
    .about-text p {
        font-size: 0.9rem;
    }

    .about-text p:first-child {
        font-size: 1rem;
    }

    .about-cards {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .metric-card {
        padding: 1rem;
        border-radius: 16px;
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .metric-label {
        font-size: 0.68rem;
    }

    /* ---- Disciplines ---- */
    .disciplines-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .discipline-card {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .discipline-card h3 {
        font-size: 1.1rem;
    }

    .discipline-card p {
        font-size: 0.82rem;
    }

    .discipline-equation {
        font-size: 0.62rem;
    }

    /* ---- Research ---- */
    .research-item {
        padding: 1.25rem 0;
    }

    .research-content h3 {
        font-size: 0.95rem;
    }

    .research-meta {
        font-size: 0.72rem;
    }

    .research-desc {
        font-size: 0.78rem;
    }

    .tag {
        font-size: 0.62rem;
        padding: 0.25rem 0.6rem;
    }

    /* ---- Quote ---- */
    .quote-banner {
        padding: 3.5rem 1.25rem;
    }

    .quote-banner blockquote p {
        font-size: 1.3rem;
    }

    /* ---- Timeline / Experience ---- */
    .timeline {
        padding-left: 2rem;
    }

    .timeline-line {
        left: -1px;
    }

    .timeline-marker {
        left: -2.15rem;
        width: 10px;
        height: 10px;
    }

    .timeline-item {
        padding-bottom: 2.5rem;
    }

    .timeline-item h3 {
        font-size: 1.05rem;
    }

    .timeline-role {
        font-size: 0.82rem;
    }

    .timeline-item p {
        font-size: 0.85rem;
    }

    .timeline-date {
        font-size: 0.65rem;
    }

    /* ---- Projects ---- */
    .project-card {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .project-number {
        font-size: 2.5rem;
        margin-bottom: 0.5rem;
    }

    .project-card h3 {
        font-size: 1rem;
    }

    .project-card p {
        font-size: 0.82rem;
    }

    .project-link {
        font-size: 0.82rem;
    }

    /* ---- Photos ---- */
    .photo-mosaic {
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: 150px;
        gap: 0.6rem;
    }

    .photo-large {
        grid-column: span 2;
        grid-row: span 1;
    }

    .photo-wide {
        grid-column: span 2;
    }

    .photo-item {
        border-radius: 12px;
    }

    /* Show captions on mobile since hover doesn't exist */
    .photo-overlay {
        opacity: 1;
        padding: 1.5rem 0.8rem 0.6rem;
    }

    .photo-location {
        font-size: 0.72rem;
    }

    .photo-country {
        font-size: 0.62rem;
    }

    /* ---- Contact ---- */
    .contact-card {
        padding: 1rem;
        border-radius: 12px;
    }

    .contact-icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }

    .contact-type {
        font-size: 0.68rem;
    }

    .contact-value {
        font-size: 0.82rem;
    }

    .form-group input,
    .form-group textarea {
        padding: 0.9rem 1rem;
        font-size: 1rem; /* Prevent iOS zoom on focus */
        border-radius: 10px;
    }

    .form-group label {
        font-size: 0.72rem;
    }

    .btn-full {
        padding: 1rem 1.5rem;
        font-size: 0.92rem;
    }

    /* ---- Footer ---- */
    .site-footer {
        padding: 1.5rem 1.25rem;
    }

    .footer-inner {
        flex-direction: column;
        gap: 0.8rem;
        text-align: center;
    }

    .footer-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .footer-nav a {
        font-size: 0.72rem;
    }

    /* ---- Scroll progress ---- */
    .scroll-progress {
        top: 56px;
    }

    /* ---- General touch targets ---- */
    a, button {
        min-height: 44px;
        min-width: 44px;
    }

    /* Exclude inline links and tags from min-height */
    .tag,
    .research-tags .tag,
    .project-tags .tag,
    .timeline-skills .tag,
    .nav-links a,
    p a,
    .footer-nav a {
        min-height: auto;
        min-width: auto;
    }
}

/* ---- Small mobile (≤ 420px) ---- */
@media (max-width: 420px) {
    .hero-title {
        font-size: clamp(2.6rem, 13vw, 3.5rem);
    }

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

    .hero-equation {
        display: none;
    }

    .photo-mosaic {
        grid-template-columns: 1fr;
        grid-auto-rows: 180px;
    }

    .photo-large,
    .photo-wide {
        grid-column: span 1;
    }

    .disciplines-grid {
        gap: 0.6rem;
    }

    .discipline-card {
        padding: 1.25rem;
    }

    .contact-card {
        gap: 0.75rem;
    }
}

/* ---- Tall phones / safe areas ---- */
@supports (padding: env(safe-area-inset-bottom)) {
    .site-footer {
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }

    .hero {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

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

    .reveal {
        opacity: 1;
        transform: none;
    }

    .anim-fade-up {
        opacity: 1;
        transform: none;
        animation: none;
    }

    .hero-title {
        animation: none;
        background: none;
        -webkit-text-fill-color: white;
    }

    .scroll-hint {
        animation: none;
    }
}

/* ---- Prefers dark color scheme (already dark, but explicit) ---- */
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
    }
}

/* ---- High contrast mode ---- */
@media (prefers-contrast: high) {
    .nav-links a {
        color: rgba(255, 255, 255, 0.85);
    }

    .section-subtitle,
    .about-text p,
    .discipline-card p,
    .timeline-item p,
    .project-card p {
        color: rgba(255, 255, 255, 0.75);
    }

    .tag {
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
}

/* ---- Print ---- */
@media print {
    nav, .scroll-progress, .hero-bg, .scroll-hint, .card-glow {
        display: none !important;
    }

    .hero {
        min-height: auto;
        background: white;
        color: black;
    }

    .hero-title {
        -webkit-text-fill-color: black;
        background: none;
    }

    .section-dark {
        background: white;
        color: black;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }

    .anim-fade-up {
        opacity: 1;
        transform: none;
    }
}