

/* Only apply the full viewport height on mobile and tablet screens */
@media (max-width: 1024px) {
    .wcf-menu-overlay  {
        height: 100vh !important;
    }
}

/* Keep the desktop dropdown menu behaving normally */
@media (min-width: 1025px) {
    .wcf-menu-overlay  {
        height: auto !important;
    }
}

/* Target tablet and mobile devices only (1024px and below) */
@media (max-width: 1024px) {
    
    /* 1. Set the parent menu item to behave as a grid wrapper for the transition */
    .menu-item {
        display: grid !important;
        grid-template-rows: auto 0fr; /* Row 1 is the main link, Row 2 is the hidden submenu */
        transition: grid-template-rows 0.35s ease-in-out !important;
    }

    /* Active State: Automatically expands the grid row to perfectly match content size */
    .menu-item.active {
        grid-template-rows: auto 1fr;
    }
    
    /* 2. Reset Desktop Positioning & Enable Normal Flow */
    .menu-item .sub-menu {
        grid-row: 2; /* Locks the submenu inside the animating grid row */
        min-height: 0; /* Critical reset to let grid rows collapse completely */
        
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        box-shadow: none !important; /* Removes desktop dropdown shadows */
        float: none !important;
        
        /* Proper Indentation */
        padding-left: 20px !important; 
        
        /* 3. Setup Top-to-Down Slide Animation */
        display: block !important;    /* Overrides display:none so transition works */
        overflow: hidden !important;   /* Keeps hidden items from spilling out */
        opacity: 0 !important;
        visibility: hidden !important;
        
        /* Smooth visibility transitions alongside the grid animation */
        transition: opacity 0.25s ease-in-out, visibility 0.25s, padding 0.35s ease-in-out !important;
    }

    /* Active State adjustments for visibility and internal spacing */
    .menu-item.active .sub-menu {
        opacity: 1 !important;
        visibility: visible !important;
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }
    
    /* Ensures submenu list items stack vertically inside the mobile view */
    .menu-item .sub-menu li {
        display: block !important;
        width: 100% !important;
    }
    
    /* Your existing back link override */
    .mobile-menu-active a.nav-back-link {
        display: none !important;
    }
}