/**
 * RESPONSIVE CSS - Mr. Windows Houston
 * Mobile menu, nav fixes, general responsive behavior
 * Version: 3.0
 */

/* ==============================================
   CRITICAL: PREVENT HORIZONTAL SCROLL GLOBALLY
   ============================================== */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* ==============================================
   NAVIGATION - ALWAYS VISIBLE
   ============================================== */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* ==============================================
   MOBILE MENU (< 1024px)
   ============================================== */
@media (max-width: 1023px) {
    .nav-container {
        padding: 0.75rem 1rem;
    }
    
    /* Nav links - hidden by default, shown when menu open */
    .nav-links {
        display: flex !important;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        width: 100%;
        background: white;
        flex-direction: column;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        z-index: 9998;
    }
    
    /* Show menu when open */
    .mobile-menu-open .nav-links {
        max-height: calc(100vh - 56px);
        overflow-y: auto;
        padding: 0.5rem 0;
    }
    
    /* Nav items */
    .nav-item {
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .nav-item:last-child {
        border-bottom: none;
    }
    
    /* Nav links */
    .nav-link {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 1.25rem;
        font-size: 1rem;
        width: 100%;
    }
    
    /* Arrow for dropdown items */
    .nav-item > .nav-link::after {
        content: '▼';
        font-size: 0.6rem;
        color: var(--green);
        transition: transform 0.3s ease;
    }
    
    .nav-item.active > .nav-link::after {
        transform: rotate(180deg);
    }
    
    /* Standalone links - no arrow */
    .nav-links > a.nav-link::after,
    a.nav-calculator::after {
        content: none !important;
    }
    
    /* Calculator link */
    .nav-calculator {
        display: block !important;
        width: 100%;
        padding: 1rem 1.25rem;
        color: var(--green) !important;
        font-weight: 600 !important;
        background: rgba(139, 154, 91, 0.05);
        border-bottom: 1px solid #f0f0f0;
    }
    
    /* Dropdowns */
    .dropdown {
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        display: none;
        background: #f8f9f6;
        width: 100%;
    }
    
    .dropdown.active,
    .nav-item.active .dropdown {
        display: block !important;
    }
    
    .dropdown a {
        display: block;
        padding: 0.875rem 1.25rem 0.875rem 2rem;
        font-size: 0.9375rem;
        border-left: 3px solid transparent;
        background: #f8f9f6;
    }
    
    .dropdown a:hover,
    .dropdown a:active {
        border-left-color: var(--green);
        background: #f0f1ec;
    }
    
    /* Hide desktop nav actions */
    .nav-actions {
        display: none;
    }
    
    /* Mobile CTA in menu */
    .mobile-menu-cta {
        display: block !important;
        width: calc(100% - 2rem);
        margin: 1rem;
        padding: 1rem;
        text-align: center;
        background: var(--green);
        color: white !important;
        font-weight: 600;
        border-radius: 8px;
        text-decoration: none;
    }
    
    /* Hamburger animation */
    .mobile-menu-open .mobile-menu-toggle span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-menu-open .mobile-menu-toggle span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-open .mobile-menu-toggle span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
}

/* ==============================================
   TABLET BREAKPOINT (768px)
   ============================================== */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    .section {
        padding: 3rem 0;
    }
    
    .container {
        padding: 0 1rem;
    }
}

/* ==============================================
   MOBILE BREAKPOINT (640px)
   ============================================== */
@media (max-width: 640px) {
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9375rem;
    }
}

/* ==============================================
   FORM INPUTS - PREVENT iOS ZOOM
   ============================================== */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
select,
textarea {
    font-size: 16px !important;
}

/* ==============================================
   RECAPTCHA - RESPONSIVE
   ============================================== */
.g-recaptcha {
    transform-origin: left top;
}

@media (max-width: 360px) {
    .g-recaptcha {
        transform: scale(0.85);
    }
}

/* ==============================================
   ABOUT PAGE - IMAGE CONSTRAINTS
   ============================================== */
.about-page img,
.story-images img,
.image-grid img {
    max-width: 100% !important;
    height: auto !important;
    object-fit: cover;
}

.story-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 100%;
    overflow: hidden;
}

@media (min-width: 1024px) {
    .story-grid {
        grid-template-columns: 1.2fr 1fr;
        gap: 4rem;
        align-items: start;
    }
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.image-grid img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
}

@media (min-width: 1024px) {
    .image-grid {
        position: sticky;
        top: 80px;
    }
}

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

@media (min-width: 640px) {
    .difference-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

.split-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .split-container {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }
}

/* ==============================================
   UTILITY: OVERFLOW PROTECTION
   ============================================== */
section,
.section,
main {
    overflow-x: hidden;
}

/* ==============================================
   PRINT STYLES
   ============================================== */
@media print {
    .site-footer,
    #main-nav,
    .mobile-menu-toggle {
        display: none;
    }
}
