/* ==========================================================================
   DESKTOP MATRIX: Right-Side Flyouts (Adaptive Layout Structural Base)
   ========================================================================= */
@media (min-width: 769px) {
    /* FUTURE EDITORS: Change or remove these specific class chains if your theme uses custom desktop sub-menu selectors */
    .nb-nav__list > li > .sub-menu > li.menu-item-has-children {
        position: relative !important;
    }
    
    .nb-nav__list > li > .sub-menu > li.menu-item-has-children > .sub-menu {
        position: absolute !important;
        top: -12px !important; 
        left: 100% !important; 
        margin-top: 0 !important;
        margin-left: 5px !important; 
        min-width: 280px !important; 
        
        transform: translateX(15px) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s ease !important;
        display: block !important;
    }
    
    .nb-nav__list > li > .sub-menu > li.menu-item-has-children:hover > .sub-menu {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateX(0) !important;
    }

    #phx-mobile-portal { display: none !important; }
}

/* ==========================================================================
   MOBILE MATRIX: Universal Isolated Adaptive Drawer Configuration
   ========================================================================= */
@media (max-width: 768px) {
    /* FUTURE EDITORS: Mobile hide controls are now handled dynamically via options variables in your admin script dashboard framework */

    /* Base Portal Wrapper with Optimized Containment Layout */
    #phx-mobile-portal {
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100vh;
        z-index: 99999999;
        pointer-events: none;
        
        visibility: hidden;
        content-visibility: hidden; 
        contain: strict; 
    }
    #phx-mobile-portal.phx-active {
        pointer-events: auto;
        visibility: visible;
        content-visibility: visible;
    }

    /* Dark Overlay Backdrop Layout */
    .phx-drawer-overlay {
        position: absolute;
        top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0, 0, 0, 0.5); /* Semi-transparent baseline tint fallback */
        backdrop-filter: blur(4px);
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    #phx-mobile-portal.phx-active .phx-drawer-overlay { opacity: 1; }

    /* The Main Drawer Container */
    .phx-drawer {
        position: absolute;
        top: 0; right: 0; left: auto; 
        width: 85%; max-width: 340px; height: 100%;
        
        /* ADAPTIVE UPDATE: Inherits theme backgrounds naturally instead of locking down explicit dark profiles */
        background-color: var(--wp--preset--color--background, #ffffff);
        color: inherit;
        
        border-left: 1px solid rgba(0, 0, 0, 0.08); 
        transform: translateX(100%); 
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        flex-direction: column;
        overflow: hidden; 
    }
    #phx-mobile-portal.phx-active .phx-drawer { transform: translateX(0); }

    /* Close Controller Layout */
    .phx-drawer-header {
        display: flex; justify-content: flex-end; align-items: center; 
        padding: 24px; border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }
    #phx-drawer-close { background: none; border: none; color: inherit; opacity: 0.7; cursor: pointer; padding: 0; display: flex; }
    #phx-drawer-close:hover { opacity: 1; }

    /* Responsive Link Formatting */
    .phx-drawer-content { flex-grow: 1; position: relative; overflow-y: auto; overflow-x: hidden; }
    .phx-mobile-menu { list-style: none; margin: 0; padding: 0; width: 100%; }
    .phx-mobile-menu li { border-bottom: 1px solid rgba(0, 0, 0, 0.03); width: 100%; }
    
    .phx-mobile-menu li a {
        display: flex; justify-content: space-between; align-items: center;
        padding: 18px 24px; 
        color: inherit; 
        font-size: 1.1rem; 
        font-weight: 600; 
        text-decoration: none;
        
        /* ADAPTIVE UPDATE: Inherits the core active fonts and visual treatments instead of forcing hardcoded uppercase variables */
        font-family: inherit !important; 
        text-transform: inherit !important; 
        letter-spacing: inherit !important; 
    }

    /* Asynchronous Sliding Drawer Panels */
    .phx-mobile-menu .sub-menu {
        position: absolute; top: 0; left: 0; width: 100%; min-height: 100%;
        background-color: var(--wp--preset--color--background, #ffffff);
        z-index: 10;
        transform: translateX(100%); 
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        list-style: none; padding: 0; margin: 0;
        display: block !important;
    }
    
    .phx-mobile-menu .sub-menu.phx-submenu-active {
        transform: translateX(0); 
    }

    /* Navigation Back Button Mechanics Styling */
    .phx-back-btn a { 
        font-size: 0.95rem !important; 
        opacity: 0.8;
        background: rgba(0, 0, 0, 0.02);
        font-family: inherit !important; 
        text-transform: inherit !important;
        letter-spacing: inherit !important;
    }
    
    /* Navigation Hierarchy Trigger Indicators */
    .phx-mobile-menu .menu-item-has-children > a::after {
        content: '→'; opacity: 0.5; font-family: monospace; font-size: 1.2rem; margin-left: 10px;
    }
}