/* ========================================
   Two Loons Consulting - Responsive
   RUGGED NORTH - Mobile-First Excellence
   ======================================== */

/* ==========================================
   Large Screens (1100px)
   ========================================== */

@media (max-width: 1100px) {
    .services-grid {
        grid-template-columns: 1fr 1fr;
    }

    .service-card.featured {
        grid-row: auto;
    }

    .engineers-showcase {
        grid-template-columns: 1fr;
        max-width: 700px;
        margin: 0 auto;
    }
}

/* ==========================================
   Tablets (900px)
   ========================================== */

@media (max-width: 900px) {
    :root {
        --space-lg: 1.5rem;
        --space-xl: 2.5rem;
        --space-2xl: 4rem;
        --border-thick: 3px;
        --border-heavy: 4px;
    }

    /* Hero */
    .hero {
        min-height: auto;
        padding-top: calc(var(--nav-height) + var(--space-lg));
    }

    .hero-inner {
        display: flex;
        flex-direction: column;
        gap: var(--space-xl);
        width: 100%;
    }

    .hero-content {
        text-align: center;
        width: 100%;
        order: 1;
    }

    .hero-description {
        margin-left: auto;
        margin-right: auto;
        border-left: none;
        padding-left: 0;
        border-top: var(--border-heavy) solid var(--pine-deep);
        border-bottom: var(--border-heavy) solid var(--pine-deep);
        padding: var(--space-sm) 0;
    }

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

    .lake-scene-side {
        order: 0;
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
        display: block;
        flex-shrink: 0;
    }

    .lake-container {
        width: 100%;
        height: 280px;
        display: block;
    }

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

    .about-text {
        text-align: center;
    }

    .about-stats {
        justify-content: center;
    }

    .visual-composition {
        max-width: 300px;
        margin: 0 auto;
    }

    /* Contact */
    .contact-content {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .contact-info {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
        text-align: center;
    }

    .footer-brand {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

/* ==========================================
   Small Tablets (768px)
   ========================================== */

@media (max-width: 768px) {
    /* Navigation - Mobile Menu */
    .nav-links {
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        bottom: 0;
        flex-direction: column;
        background: var(--cream-pure);
        padding: var(--space-xl) var(--space-lg);
        gap: 0;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        border-top: var(--border-thick) solid var(--bark-black);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links.active {
        transform: translateX(0);
    }

    .nav-links li {
        width: 100%;
        border-bottom: 1px solid rgba(18, 16, 14, 0.1);
    }

    .nav-links a {
        display: block;
        padding: 1.25rem 0;
        font-size: 1rem;
        min-height: 56px;
        display: flex;
        align-items: center;
    }

    .nav-cta {
        margin-top: var(--space-md);
        text-align: center;
        justify-content: center;
    }

    .mobile-menu-btn {
        display: flex;
        min-width: 48px;
        min-height: 48px;
        align-items: center;
        justify-content: center;
    }

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

    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }

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

    /* Services */
    .services-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    /* Engineers */
    .engineer-card {
        grid-template-columns: 140px 1fr;
        gap: var(--space-sm);
    }

    .image-accent {
        display: none;
    }

    .engineer-name {
        font-size: 1.5rem;
    }

    /* Forms - Touch-friendly */
    .form-row {
        grid-template-columns: 1fr;
    }

    input, select, textarea {
        font-size: 16px !important; /* Prevents iOS zoom */
        min-height: 48px;
    }

    /* Footer */
    .footer-nav {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-sm);
    }

    .footer-bottom {
        flex-direction: column;
        gap: var(--space-sm);
        text-align: center;
    }
}

/* ==========================================
   Mobile (600px)
   ========================================== */

@media (max-width: 600px) {
    :root {
        --space-lg: 1.25rem;
        --space-xl: 2rem;
        --space-2xl: 3rem;
        --border-thick: 2px;
        --border-heavy: 3px;
    }

    /* Prevent horizontal overflow */
    body {
        overflow-x: hidden;
    }

    section {
        padding: var(--space-xl) var(--space-sm);
    }

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

    /* Lake Scene */
    .lake-scene-side {
        width: 100%;
        max-width: 100%;
        display: block;
    }

    .lake-container {
        width: 100%;
        height: 200px;
        display: block;
    }

    .loon-1 {
        width: 40px;
        height: 27px;
    }

    .loon-2 {
        width: 34px;
        height: 23px;
    }

    /* Typography - Mobile readable */
    .logo-text-large {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

    .section-title {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .hero-description {
        font-size: 1rem;
        line-height: 1.7;
    }

    /* About Section - Mobile */
    .about {
        padding: var(--space-xl) var(--space-sm);
        margin: 0;
    }

    .about-content {
        gap: var(--space-xl);
    }

    .about-body p {
        font-size: 1rem;
        padding-left: var(--space-sm);
        line-height: 1.75;
        border-left-width: 3px;
    }

    .about-body p:first-child {
        font-size: 1.05rem;
    }

    .about-stats {
        flex-direction: row;
        justify-content: flex-start;
        gap: var(--space-xl);
    }

    .stat {
        text-align: left;
    }

    .stat-number {
        font-size: 2.75rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    /* Loon Animation - Mobile scaling */
    .visual-composition {
        max-width: 300px;
        aspect-ratio: 4/5;
    }

    .about-visual::before {
        inset: -12px;
    }

    .loon-scene svg {
        width: 100%;
        height: 100%;
    }

    /* Engineers - Stack on mobile */
    .engineer-card {
        grid-template-columns: 1fr;
        text-align: center;
        padding: var(--space-md);
    }

    .engineer-image-container {
        max-width: 140px;
        margin: 0 auto var(--space-sm);
    }

    .engineer-expertise {
        justify-content: center;
        flex-wrap: wrap;
    }

    .expertise-tag {
        font-size: 0.65rem;
        padding: 0.4rem 0.6rem;
    }

    .engineer-links {
        justify-content: center;
    }

    .meta-label {
        margin: 0 auto;
    }

    .meta-location {
        justify-content: center;
    }

    .engineer-bio {
        font-size: 0.9rem;
        line-height: 1.7;
    }

    /* Buttons - Touch-friendly (min 48px) */
    .btn {
        width: 100%;
        justify-content: center;
        min-height: 52px;
        padding: 1rem 1.5rem;
        font-size: 0.9rem;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
        gap: var(--space-sm);
    }

    /* Service Cards - Mobile */
    .service-card {
        padding: var(--space-md);
    }

    .service-card h3 {
        font-size: 1.25rem;
    }

    .service-card p {
        font-size: 0.9rem;
        line-height: 1.7;
    }

    .service-features li {
        font-size: 0.85rem;
        padding: 0.5rem 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .service-icon {
        width: 56px;
        height: 42px;
    }

    /* Contact - Mobile */
    .contact-info {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .contact-form {
        padding: var(--space-md);
    }

    .info-block {
        text-align: center;
        padding: var(--space-sm);
    }

    .info-block h4 {
        font-size: 0.7rem;
    }

    .info-block a,
    .info-block address,
    .info-block p {
        font-size: 1rem;
    }

    /* Form inputs - Touch-friendly */
    .form-group label {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: 52px;
        padding: 0.875rem 1rem;
        font-size: 16px;
        border-radius: 0;
        -webkit-appearance: none;
    }

    .form-group textarea {
        min-height: 140px;
    }

    .btn-submit {
        min-height: 56px;
        font-size: 1rem;
    }

    /* Footer - Mobile */
    .main-footer {
        padding: var(--space-lg) var(--space-sm) var(--space-sm);
    }

    .footer-nav {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--space-md);
    }

    .footer-col {
        padding-bottom: var(--space-sm);
        border-bottom: 1px solid rgba(196, 154, 74, 0.1);
    }

    .footer-col:last-child {
        border-bottom: none;
    }

    .footer-col h5 {
        margin-bottom: var(--space-xs);
    }

    .footer-col ul {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--space-sm);
    }

    .footer-col a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        padding: 0.5rem;
    }

    .footer-legal {
        flex-wrap: wrap;
        justify-content: center;
    }

    .footer-legal a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        padding: 0.5rem;
    }

    /* Section headers - Mobile */
    .section-header,
    .team-header,
    .contact-header {
        padding: 0 var(--space-xs);
    }

    .section-description,
    .team-intro {
        font-size: 0.95rem;
        line-height: 1.7;
    }
}

/* ==========================================
   Small Mobile (400px)
   ========================================== */

@media (max-width: 400px) {
    :root {
        --space-sm: 0.75rem;
        --space-md: 1rem;
    }

    .logo-text-large {
        font-size: 2.2rem;
    }

    .logo-text {
        font-size: 1.25rem;
    }

    .title-tagline {
        font-size: 0.6rem;
        padding: 0.4rem 0.75rem;
    }

    .section-label {
        font-size: 0.55rem;
        padding: 0.4rem 0.75rem;
    }

    .section-title {
        font-size: 1.75rem;
    }

    /* Service Cards - Compact */
    .service-icon {
        width: 48px;
        height: 36px;
    }

    .service-card {
        padding: var(--space-sm);
    }

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

    /* Stats - Compact */
    .stat-number {
        font-size: 2rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    /* Buttons - Full width, easy tap */
    .btn {
        padding: 0.875rem 1.25rem;
        font-size: 0.85rem;
        min-height: 52px;
    }

    /* Visual Composition - Smaller */
    .visual-composition {
        max-width: 240px;
    }

    /* Engineer cards */
    .engineer-image-container {
        max-width: 120px;
    }

    .engineer-name {
        font-size: 1.25rem;
    }

    /* About text */
    .about-body p {
        font-size: 0.9rem;
        padding-left: var(--space-xs);
    }

    .about-stats {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .stat {
        text-align: center;
    }

    .stat-number {
        font-size: 2.25rem;
    }

    .visual-composition {
        max-width: 260px;
    }

    /* Contact form */
    .contact-form {
        padding: var(--space-sm);
    }
}

/* ==========================================
   Extra Small Mobile (320px)
   ========================================== */

@media (max-width: 320px) {
    .logo-text-large {
        font-size: 1.9rem;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .hero-description {
        font-size: 0.9rem;
    }

    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
    }

    .visual-composition {
        max-width: 200px;
    }

    .stat-number {
        font-size: 1.75rem;
    }
}

/* ==========================================
   Touch Device Optimizations
   ========================================== */

@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects that don't work on touch */
    .btn:hover {
        transform: none;
    }

    .btn:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    .service-card:hover {
        transform: none;
    }

    .nav-links a:hover::after {
        width: 0;
    }

    /* Larger tap targets */
    .social-link {
        width: 48px;
        height: 48px;
    }

    .social-link svg {
        width: 22px;
        height: 22px;
    }

    /* Smooth scrolling for touch */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
}

/* ==========================================
   Landscape Mobile
   ========================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding-top: calc(var(--nav-height) + var(--space-sm));
        padding-bottom: var(--space-md);
    }

    .lake-scene-side {
        display: none;
    }

    .nav-links {
        padding-top: var(--space-sm);
    }
}

/* ==========================================
   Reduced Motion
   ========================================== */

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

    html {
        scroll-behavior: auto;
    }

    .loon-animation * {
        animation: none !important;
    }
}
