/* ================================================================
   MEGA MENU — STATES & POSITIONING ONLY
   Visual styling (colors, backgrounds, borders, shadows, grid,
   typography, item padding) is handled by Tailwind in HTML.
   ================================================================ */

/* ── Desktop: fixed panel centered in viewport ── */
.mega-menu {
    position: fixed;
    top: calc(var(--utility-height) + var(--header-height)); /* 42+70 = 112px */
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 1200;
    overflow: visible;
    width: min(1140px, calc(100vw - 40px)); /* 20px margin each side */
}

/* Invisible bridge fills the gap between the nav link and the panel,
   keeping :hover active as the mouse moves down into the menu */
.mega-menu::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
}

/* Show on hover or JS .active */
.dropdown:hover .mega-menu,
.dropdown.active .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Adjust top when utility bar has collapsed */
body.header-scrolled .mega-menu {
    top: 56px;
}

/* ─────────────────────────────────────────────────────────────
   MOBILE — collapse/expand inside drawer
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .mega-menu {
        position: static !important;
        left: auto !important;
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        max-height: 0 !important;
        overflow: hidden;
        transition: max-height 0.4s ease !important;
        background: rgba(0, 0, 0, 0.15) !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
    .dropdown.active .mega-menu {
        max-height: 2000px !important;
        padding: 8px 0 !important;
    }

    /* Collapse the 5-col service grid to a single column */
    .mega-menu .grid-cols-5 {
        grid-template-columns: 1fr !important;
    }
    /* Remove column dividers on mobile */
    .mega-menu .divide-x > * {
        border-left: none !important;
        border-bottom: 1px solid rgba(255,255,255,0.06);
    }
    /* Hide the banner header on mobile to save space */
    .mega-menu > div:first-child {
        display: none !important;
    }
    /* Tighten column padding */
    .mega-menu .grid > div {
        padding: 10px 16px !important;
    }
    /* Footer CTA row — stack on mobile */
    .mega-menu > div:last-child {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px;
        padding: 12px 16px !important;
    }
    .mega-menu-category {
        padding: 8px 0 !important;
        margin-bottom: 4px !important;
    }
    .mega-menu-item {
        padding: 8px 4px !important;
        white-space: normal;
    }
}

@media (max-width: 480px) {
    .mega-menu-grid {
        padding: 0 8px;
    }
}
