
/*
 * BHR Core v1.5
 * Fix runtime mega-menu dropdowns behaving like giant white sections.
 * Scope: only the dynamically injected MGM Global Header on new/manual pages/posts.
 */

body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm,
body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm-bar,
body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm-top-list,
body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm-top-item{
  overflow:visible !important;
}

body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm{
  position:relative !important;
  z-index:99990 !important;
}

body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm-top-item{
  position:relative !important;
}

/* ALL dropdowns must float over content rather than participate in page layout. */
body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm-dropdown{
  position:absolute !important;
  top:100% !important;
  bottom:auto !important;
  height:auto !important;
  min-height:0 !important;
  max-height:none !important;
  overflow:visible !important;
  z-index:100000 !important;
  margin-top:0 !important;
  box-sizing:border-box !important;
}

/* Compact image dropdowns */
body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm-top-item.hpmm-dropdown-compact > .hpmm-dropdown{
  left:0 !important;
  right:auto !important;
  width:max-content !important;
  min-width:0 !important;
  max-width:min(calc(100vw - 40px), 980px) !important;
  background:#fff !important;
  box-shadow:0 18px 45px rgba(0,0,0,.16) !important;
}

/* Full-width mega dropdowns */
body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm-top-item.hpmm-dropdown-full > .hpmm-dropdown{
  left:50% !important;
  right:auto !important;
  width:100vw !important;
  max-width:100vw !important;
  transform:translateX(-50%) !important;
  background:#fff !important;
  box-shadow:0 18px 45px rgba(0,0,0,.16) !important;
}

/* Prevent internal wrappers from stretching the dropdown vertically. */
body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm-dropdown-inner,
body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm-dropdown .elementor-widget-wrap,
body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm-dropdown .elementor-widget-container{
  height:auto !important;
  min-height:0 !important;
  max-height:none !important;
  overflow:visible !important;
}

/* Image-card grid should size itself only to its content. */
body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm-grid{
  align-items:start !important;
  align-content:start !important;
  height:auto !important;
  min-height:0 !important;
  max-height:none !important;
}

/* Cards must not stretch to fill a white panel. */
body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm-card{
  align-self:start !important;
  height:auto !important;
  min-height:0 !important;
  max-height:none !important;
}

/* Keep the dropdown image cards compact and consistent. */
body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm-top-item.hpmm-dropdown-compact .hpmm-thumb{
  height:125px !important;
  min-height:125px !important;
  max-height:125px !important;
  overflow:hidden !important;
}

body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm-top-item.hpmm-dropdown-compact .hpmm-thumb img{
  width:100% !important;
  height:100% !important;
  object-fit:cover !important;
}

/* Ensure the page itself never paints over the dropdown. */
body.bhr-core-global-header-enabled #content,
body.bhr-core-global-header-enabled main,
body.bhr-core-global-header-enabled .site-main,
body.bhr-core-global-header-enabled .elementor-location-single{
  position:relative !important;
  z-index:1 !important;
}

/* Header always wins the stacking context. */
body.bhr-core-global-header-enabled .bhr-core-runtime-header{
  position:relative !important;
  z-index:99980 !important;
}

/* Mobile menu should return to normal flow instead of floating dropdown behavior. */
@media(max-width:767px){
  body.bhr-core-global-header-enabled .bhr-core-runtime-header .hpmm-dropdown{
    position:static !important;
    top:auto !important;
    left:auto !important;
    right:auto !important;
    width:100% !important;
    max-width:100% !important;
    transform:none !important;
    box-shadow:none !important;
  }
}
