/**
 * CRS FINAL OVERRIDES
 * Purpose: Nuclear-level fixes that MUST override all other CSS
 * Load order: MUST be the LAST CSS file in <head>
 * 
 * CRITICAL FIX: Force hide mobile overlay on desktop
 */

/* === DESKTOP: NUCLEAR FORCE HIDE MOBILE OVERLAY === */
@media (min-width: 768px) {
  /* Target all possible states */
  #mobile-nav-overlay,
  .mobile-nav-overlay,
  div.mobile-nav-overlay,
  div[id="mobile-nav-overlay"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -99999px !important;
    top: -99999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
  }
  
  /* Even when active class is applied */
  #mobile-nav-overlay.active,
  .mobile-nav-overlay.active,
  div.mobile-nav-overlay.active,
  div[id="mobile-nav-overlay"].active {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateX(999999px) !important;
  }
  
  /* Hide hamburger menu on desktop */
  #mobile-menu-toggle,
  .mobile-menu-toggle,
  button.mobile-menu-toggle,
  button[id="mobile-menu-toggle"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
  
  /* Ensure desktop header services are visible */
  .header-services {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* === MOBILE: ALLOW MOBILE NAV TO FUNCTION === */
@media (max-width: 767px) {
  /* Hamburger button visible */
  #mobile-menu-toggle,
  .mobile-menu-toggle {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  
  /* Mobile overlay hidden by default */
  #mobile-nav-overlay,
  .mobile-nav-overlay {
    display: none !important;
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }
  
  /* Mobile overlay visible when active */
  #mobile-nav-overlay.active,
  .mobile-nav-overlay.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateX(0) !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    clip: auto !important;
    clip-path: none !important;
    white-space: normal !important;
  }
  
  /* Hide desktop nav on mobile */
  .header-services {
    display: none !important;
  }
}

/* === PREVENT BODY SCROLL WHEN MOBILE MENU OPEN === */
body.mobile-menu-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
}
