/* === Menu rewrite overrides (external) === */

/* Default: hide submenu; show only when parent has .open */
header nav .dropdown>.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 2000;
  min-width: 12rem;
}

/* When JS toggles .open, force visible */
header nav .dropdown.open>.dropdown-menu {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Safety: allow focus-within to keep open for keyboard users */
header nav .dropdown:focus-within>.dropdown-menu {
  display: block !important;
}

/* Bridge: avoid pixel-gap when moving mouse from parent to submenu */
header nav .dropdown>.dropdown-menu::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}

/* Ensure submenu is clickable and above other content */
header nav .dropdown-menu {
  pointer-events: auto;
  z-index: 3000;
}

/* Respect mobile: if theme moves submenu to static, we don't change it here */
@media (max-width: 768px) {
  header nav .dropdown>.dropdown-menu {
    position: static;
  }
}


/* === Header height reduced to 85% of current (non-destructive override) === */
header {
  transform-origin: top center;
  transform: scaleY(0.85);
}


/* === Desktop-only stacking to ensure desktop menus/submenus never get covered === */
@media (min-width: 768px) {
  header {
    position: sticky;
    top: 0;
    z-index: 999999 !important;
    overflow: visible !important;
  }

  header * {
    position: relative;
    z-index: inherit;
    overflow: visible !important;
  }

  header nav .has-submenu {
    position: relative;
  }

  header nav .submenu {
    position: absolute;
    z-index: 1000000 !important;
    display: none;
  }

  header nav .has-submenu.is-open>.submenu,
  header nav .has-submenu:hover>.submenu {
    display: block;
  }

  /* Desktop content beneath */
  main,
  #content-area,
  #dynamic-content,
  section,
  footer,
  .hero-slider,
  #slideshow-container {
    position: relative;
    z-index: 1 !important;
    overflow: visible;
  }

  #dynamic-content iframe,
  iframe {
    position: relative;
    z-index: 0 !important;
  }
}



/* === Bulletproof DESKTOP menu overlay fix (no clipping, always on top) === */
@media (min-width: 768px) {
  header {
    position: sticky;
    top: 0;
    z-index: 2147483647 !important;
    /* max 32-bit */
    overflow: visible !important;
    transform: none !important;
    filter: none !important;
    perspective: none !important;
    will-change: auto !important;
  }

  header .container,
  header nav,
  header nav * {
    position: relative;
    z-index: inherit;
    overflow: visible !important;
  }

  header nav .has-submenu {
    position: relative;
  }

  header nav .submenu {
    position: absolute;
    display: none;
    z-index: 2147483646 !important;
  }

  header nav .has-submenu.is-open>.submenu,
  header nav .has-submenu:hover>.submenu {
    display: block;
  }

  /* Everything else sits beneath */
  main,
  #content-area,
  #dynamic-content,
  section,
  footer,
  .hero-slider,
  #slideshow-container {
    position: relative;
    z-index: 0 !important;
    overflow: visible !important;
  }

  #dynamic-content iframe,
  iframe {
    position: relative;
    z-index: 0 !important;
    display: block;
    width: 100%;
    min-height: 600px;
    border: none;
  }
}



/* === NEW NAV SYSTEM (scoped) === */
header {
  position: sticky;
  top: 0;
}

header .mega-nav {
  position: relative;
  z-index: 999990;
}

header .mega-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

header .mega-item {
  position: relative;
}

header .mega-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .75rem;
  border-radius: .5rem;
  transition: background .15s ease, color .15s ease;
}

header .mega-link:hover {
  background: rgba(255, 193, 7, .25);
}

header .has-dropdown>.mega-link::after {
  content: '▾';
  font-size: .8em;
  opacity: .85;
  transform: translateY(-1px);
}

/* Dropdown panel */
header .dropdown {
  position: absolute;
  top: calc(100% + .25rem);
  left: 0;
  min-width: 16rem;
  background: #fff;
  color: #1f2937;
  border-radius: .75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
  padding: .5rem;
  display: none;
  z-index: 999991;
}

header .dropdown .dropdown-item {
  display: block;
  padding: .5rem .75rem;
  border-radius: .5rem;
}

header .dropdown .dropdown-item:hover {
  background: rgba(255, 193, 7, .35);
}

/* Open state (desktop) */
@media (min-width: 768px) {
  header .has-dropdown.open>.dropdown {
    display: block;
  }

  /* Ensure everything below stays under the nav */
  #content-area,
  #dynamic-content,
  main,
  section,
  footer,
  #slideshow-container {
    position: relative;
    z-index: 1;
  }

  #dynamic-content iframe,
  iframe {
    position: relative;
    z-index: 0;
  }
}

/* Mobile panel */
#mobile-menu {
  background: #0b1e3a;
  color: #fff;
}

#mobile-menu .mobile-ul {
  list-style: none;
  margin: 0;
  padding: .25rem 0;
}

#mobile-menu .mobile-li {
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

#mobile-menu .mobile-link {
  display: block;
  padding: .75rem 1rem;
}

#mobile-menu .mobile-sub {
  list-style: none;
  margin: 0 0 .5rem 0;
  padding: 0;
}

#mobile-menu .mobile-sub .mobile-link {
  padding: .5rem 2rem;
  opacity: .95;
}

/* Nice subtle animation */
@media (min-width: 768px) {
  header .dropdown {
    transform-origin: top left;
    transform: scale(.98) translateY(-4px);
    opacity: 0;
    transition: .12s ease;
  }

  header .has-dropdown.open>.dropdown {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}



/* ROUTER content area */
#content-area {
  position: relative;
}

#dynamic-content {
  position: relative;
  padding: 0;
}

#dynamic-content iframe {
  width: 100%;
  border: none;
  display: block;
  min-height: 720px;
}



/* === Patch: Content respects page-wrapper === */
html,
body {
  overflow-x: hidden;
}

#content-area,
#dynamic-content,
.tab-menu-content,
.tab-container,
.dashboard-container {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Ensure iframes also respect wrapper */
#content-area iframe,
#dynamic-content iframe {
  width: 100% !important;
  min-width: auto !important;
}