/* =====================================================================
 * Brightmore — Floating Glass Header  (v5)
 * Desktop: styled Astra header (transparent glass pill, dropdowns).
 * Mobile:  Astra's off-canvas is fully HIDDEN; a 100% custom drawer
 *          (.bm-nav, built by the mu-plugin JS) replaces it.
 * Front-end only · mu-plugin · delete files to revert.
 * ===================================================================== */

:root {
  --bm-glass:        rgba(15, 15, 30, 0.40);
  --bm-glass-dense:  rgba(10, 10, 24, 0.68);
  --bm-panel:        rgba(15, 15, 30, 0.96);
  --bm-border:       rgba(255, 255, 255, 0.08);
  --bm-overlay:      rgba(255, 255, 255, 0.05);
  --bm-ink:          rgba(255, 255, 255, 0.74);
  --bm-ink-strong:   #ffffff;
  --bm-ink-dim:      rgba(255, 255, 255, 0.42);
  --bm-accent:       #f9a93f;
  --bm-accent-tint:  rgba(249, 154, 35, 0.12);
  --bm-accent-bd:    rgba(249, 154, 35, 0.22);
  --bm-radius:       18px;
  --bm-gap:          16px;
  --bm-ease:         cubic-bezier(0.22, 1, 0.36, 1);
  --bm-blur:         blur(20px) saturate(180%);
}

/* ---- 0. Kill Astra sticky clone ---- */
#ast-fixed-header { display: none !important; }

/* ---- 1. Single fixed transparent header layer ---- */
#masthead.site-header,
.ast-theme-transparent-header #masthead.site-header {
  position: fixed !important;
  inset: 0 0 auto 0; width: 100%;
  background: transparent !important;
  box-shadow: none !important; border: 0 !important;
  z-index: 1000; pointer-events: none; transform: none !important;
}
#masthead.site-header * { pointer-events: auto; }
body.admin-bar #masthead.site-header { top: 32px !important; }
@media (max-width: 782px) { body.admin-bar #masthead.site-header { top: 46px !important; } }
#masthead .ast-main-header-wrap,
#masthead .main-header-bar-wrap,
#masthead .main-header-bar {
  background: transparent !important; box-shadow: none !important;
  border-bottom: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important;
}

/* ---- 2. Floating glass pill ---- */
#masthead .ast-primary-header-bar.main-header-bar {
  position: relative;
  max-width: min(1320px, calc(100% - 2 * var(--bm-gap)));
  margin: var(--bm-gap) auto 0 !important;
  padding: 6px 18px !important;
  border-radius: var(--bm-radius);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.06) 0%, transparent 46%, rgba(255,255,255,0.03) 100%),
    var(--bm-glass) !important;
  -webkit-backdrop-filter: var(--bm-blur); backdrop-filter: var(--bm-blur);
  border: 1px solid var(--bm-border) !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.20), inset 0 0 0 1px rgba(255,255,255,0.03) !important;
  transition: background 0.5s var(--bm-ease), box-shadow 0.5s var(--bm-ease);
}
.bm-scrolled #masthead .ast-primary-header-bar.main-header-bar {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.06) 0%, transparent 46%, rgba(255,255,255,0.03) 100%),
    var(--bm-glass-dense) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.40), inset 0 0 0 1px rgba(255,255,255,0.05) !important;
}
.ast-sticky-main-shrink #masthead .custom-logo { transition: none !important; }
#masthead .ast-primary-header-bar .ast-builder-grid-row,
#masthead .ast-primary-header-bar .site-header-section,
#masthead .ast-primary-header-bar .main-header-menu { align-items: center !important; }
#masthead .ast-primary-header-bar .main-header-menu { flex-wrap: nowrap !important; }

/* ---- 3. DESKTOP nav (scoped) ---- */
#masthead .ast-primary-header-bar .main-header-menu > .menu-item,
#masthead .ast-primary-header-bar .main-header-menu .menu-link { border: 0 !important; }
#masthead .ast-primary-header-bar .main-header-menu .menu-link {
  color: var(--bm-ink) !important; font-weight: 500; font-size: 15px; line-height: 1.2;
  white-space: nowrap; border-radius: 11px; padding: 8px 13px !important;
  transition: color 0.25s var(--bm-ease), background 0.25s var(--bm-ease);
}
#masthead .ast-primary-header-bar .main-header-menu > .menu-item { display: flex; align-items: center !important; }
#masthead .ast-primary-header-bar .main-header-menu > .menu-item > .menu-link:hover,
#masthead .ast-primary-header-bar .main-header-menu > .menu-item:hover > .menu-link,
#masthead .ast-primary-header-bar .main-header-menu > .menu-item.focus > .menu-link {
  color: var(--bm-ink-strong) !important; background: var(--bm-overlay) !important;
}
#masthead .ast-primary-header-bar .main-header-menu > .current-menu-item > .menu-link,
#masthead .ast-primary-header-bar .main-header-menu > .current-menu-ancestor > .menu-link {
  color: var(--bm-accent) !important; background: var(--bm-accent-tint) !important;
}
#masthead .ast-primary-header-bar .main-header-menu .sub-menu {
  position: absolute !important; top: 100% !important;
  background: var(--bm-panel) !important;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.10) !important; border-radius: 14px !important;
  box-shadow: 0 20px 40px rgba(0,0,0,0.40) !important; padding: 8px !important;
  min-width: 230px; margin-top: 12px !important; transform-origin: top center;
  opacity: 0 !important; visibility: hidden !important;
  transform: translateY(10px) scale(0.96) !important; animation: none !important;
  /* delay the CLOSE by 0.3s so there's time to reach the submenu */
  transition: opacity 0.2s var(--bm-ease) 0.3s, transform 0.2s var(--bm-ease) 0.3s, visibility 0.2s var(--bm-ease) 0.3s !important;
  /* stays interactive while still visible (the close-delay window) so you can
     catch it; visibility:hidden makes it non-interactive once fully closed. */
  pointer-events: auto;
}
#masthead .ast-primary-header-bar .main-header-menu .menu-item:hover > .sub-menu,
#masthead .ast-primary-header-bar .main-header-menu .menu-item.bm-open > .sub-menu,
#masthead .ast-primary-header-bar .main-header-menu .menu-item.focus > .sub-menu,
#masthead .ast-primary-header-bar .main-header-menu .sub-menu:hover {
  opacity: 1 !important; visibility: visible !important;
  transform: translateY(0) scale(1) !important; animation: none !important; pointer-events: auto;
  /* open INSTANTLY (no delay) */
  transition: opacity 0.2s var(--bm-ease) 0s, transform 0.2s var(--bm-ease) 0s, visibility 0.2s var(--bm-ease) 0s !important;
}
/* invisible hover-bridge across the 12px gap so moving the mouse down to the
   submenu never drops the :hover (the classic dropdown gap problem). */
#masthead .ast-primary-header-bar .main-header-menu .sub-menu::before {
  content: ""; position: absolute; left: 0; right: 0; top: -16px; height: 18px;
  background: transparent;
}
#masthead .ast-primary-header-bar .main-header-menu .sub-menu .menu-item { border: 0 !important; }
#masthead .ast-primary-header-bar .main-header-menu .sub-menu .menu-link {
  color: var(--bm-ink) !important; border-radius: 10px; font-size: 14.5px; padding: 10px 14px !important; margin: 1px 0;
}
#masthead .ast-primary-header-bar .main-header-menu .sub-menu .menu-link:hover {
  color: var(--bm-ink-strong) !important; background: var(--bm-overlay) !important;
}
#masthead .ast-inline-search .search-field {
  background: rgba(255,255,255,0.04) !important; border: 1px solid var(--bm-border) !important;
  border-radius: 11px !important; color: var(--bm-ink-strong) !important; height: 40px; max-width: 180px;
  transition: background 0.25s var(--bm-ease), border-color 0.25s var(--bm-ease);
}
#masthead .ast-inline-search .search-field:focus {
  background: rgba(255,255,255,0.08) !important; border-color: var(--bm-accent) !important;
  box-shadow: 0 0 0 3px rgba(249,154,35,0.15) !important;
}
#masthead .ast-inline-search .search-field::placeholder { color: var(--bm-ink-dim) !important; }
#masthead .ast-search-icon { color: var(--bm-accent) !important; }

/* =====================================================================
 * 4. MOBILE — hide Astra's menu, slim header + tagline, custom hamburger
 * ===================================================================== */
.ast-mobile-popup-drawer, .ast-mobile-popup-overlay { display: none !important; }

@media (max-width: 921px) {
  #masthead .ast-primary-header-bar.main-header-bar { padding: 4px 8px 4px 14px !important; }
  #masthead .custom-logo, #masthead .site-logo-img .custom-logo { max-height: 30px !important; width: auto !important; }
  /* hide Astra's own mobile trigger — we use .bm-burger */
  #masthead .ast-mobile-menu-buttons,
  #masthead .ast-button-wrap .menu-toggle,
  #masthead .ast-mobile-menu-trigger-fill,
  #masthead .ast-mobile-menu-trigger-minimal { display: none !important; }
}
/* mobile tagline — standalone fixed element, placed by JS over the header pill */
.bm-mh-tag {
  position: fixed; z-index: 1001; transform: translateY(-50%); display: none;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.2px; color: var(--bm-accent);
  white-space: nowrap; pointer-events: none; opacity: 0.92;
}

/* Stop the floating header from covering the first section's content on mobile.
   Padding goes INSIDE the first section, so its background stays full-bleed
   and only its content drops below the header. */
@media (max-width: 921px) {
  .ast-theme-transparent-header #content .elementor > .e-con-full:first-child,
  .ast-theme-transparent-header #content .elementor > .e-con:first-child,
  .ast-theme-transparent-header #content .elementor > .elementor-section:first-child,
  .ast-theme-transparent-header #content .elementor-section-wrap > .elementor-section:first-child {
    padding-top: 92px !important;
  }
}

/* custom hamburger — standalone FIXED element (placed/toggled by JS, not in Astra's bar) */
.bm-burger {
  display: none; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(20,20,32,0.55); border: 1px solid rgba(255,255,255,0.14);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  color: #fff; cursor: pointer; position: fixed; z-index: 1001;
  top: 26px; right: 26px; padding: 0;
  transition: background 0.2s var(--bm-ease);
}
.bm-burger:hover { background: rgba(40,40,56,0.7); }
.bm-burger-ico { display: inline-flex; align-items: center; justify-content: center; }
.bm-burger-ico svg { width: 24px; height: 24px; display: block; }

/* =====================================================================
 * 4b. CUSTOM DRAWER  (.bm-nav — built fresh by the mu-plugin JS)
 * ===================================================================== */
.bm-nav-overlay {
  position: fixed; inset: 0; z-index: 99998;
  background: rgba(0,0,0,0.62);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity 0.3s var(--bm-ease), visibility 0.3s var(--bm-ease);
}
.bm-nav-overlay.open { opacity: 1; visibility: visible; }

.bm-nav {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 99999;
  width: min(87vw, 366px);
  background: linear-gradient(180deg, rgba(18,18,30,0.99) 0%, rgba(8,8,18,0.99) 100%);
  -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  border-left: 1px solid rgba(255,255,255,0.07);
  box-shadow: -24px 0 64px rgba(0,0,0,0.55);
  transform: translateX(100%);
  visibility: hidden;                 /* hidden when closed — kills the shadow bleed onto the page */
  transition: transform 0.4s var(--bm-ease), visibility 0s linear 0.4s;
  display: flex; flex-direction: column;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.bm-nav.open { transform: translateX(0); visibility: visible; transition: transform 0.4s var(--bm-ease), visibility 0s linear 0s; }

.bm-nav-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky; top: 0;
  background: linear-gradient(180deg, rgba(18,18,30,0.99), rgba(18,18,30,0.0));
}
.bm-nav-brand { display: flex; align-items: center; gap: 11px; }
.bm-nav-brand img { height: 32px; width: auto; }
.bm-nav-brand strong { display: block; color: #fff; font-size: 16px; font-weight: 700; line-height: 1.15; }
.bm-nav-brand span { display: block; color: var(--bm-accent); font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px; margin-top: 2px; }
.bm-nav-close {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background 0.2s var(--bm-ease);
}
.bm-nav-close:hover { background: rgba(255,255,255,0.12); }
.bm-nav-close svg { width: 18px; height: 18px; }

.bm-nav-list { padding: 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.bm-nav-row {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 12px; border-radius: 13px;
  color: var(--bm-ink); font-size: 15.5px; font-weight: 500;
  text-decoration: none; cursor: pointer; border: 0; background: transparent; width: 100%; text-align: inherit;
  transition: background 0.2s var(--bm-ease), color 0.2s var(--bm-ease);
}
.bm-nav-row:hover, .bm-nav-row:focus { background: rgba(255,255,255,0.05); color: #fff; }
.bm-nav-row.active { background: var(--bm-accent-tint); color: var(--bm-accent); }
.bm-nav-ico {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bm-accent-tint); border: 1px solid var(--bm-accent-bd); color: var(--bm-accent);
}
.bm-nav-ico svg { width: 18px; height: 18px; }
.bm-nav-label { flex: 1; }
.bm-nav-chev { width: 18px; height: 18px; color: var(--bm-ink-dim); transition: transform 0.28s var(--bm-ease); flex: 0 0 auto; }
.bm-nav-group.open > .bm-nav-row .bm-nav-chev { transform: rotate(180deg); }

.bm-nav-sub { max-height: 0; overflow: hidden; transition: max-height 0.32s var(--bm-ease); padding-left: 12px; }
.bm-nav-group.open > .bm-nav-sub { max-height: 560px; }
.bm-nav-sub .bm-nav-row { font-size: 14px; padding: 11px 12px; }
.bm-nav-sub .bm-nav-ico { width: 28px; height: 28px; border-radius: 9px; }
.bm-nav-sub .bm-nav-ico svg { width: 15px; height: 15px; }

.bm-nav-cta {
  margin: 10px 14px 20px; padding: 15px 16px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  background: linear-gradient(135deg, #f9a93f 0%, #f47424 100%);
  color: #fff !important; font-weight: 600; font-size: 15px; text-decoration: none !important;
  box-shadow: 0 8px 22px -6px rgba(244,116,36,0.55);
}
.bm-nav-cta svg { width: 18px; height: 18px; }
/* SVGs that are DIRECT flex-children of a button/link must not shrink to 0 */
.bm-burger svg, .bm-nav-close svg, .bm-nav-cta svg { flex: 0 0 auto; display: block; }
body.bm-nav-open { overflow: hidden; }

/* ---- 5. Fallbacks ---- */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  #masthead .ast-primary-header-bar.main-header-bar { background: rgba(15,15,30,0.92) !important; }
  #masthead .main-header-menu .sub-menu { background: rgba(15,15,30,0.98) !important; }
  .bm-nav { background: #11151c; }
}
@media (prefers-reduced-motion: reduce) {
  #masthead .ast-primary-header-bar.main-header-bar,
  #masthead .main-header-menu .menu-link,
  #masthead .main-header-menu .sub-menu,
  .bm-nav, .bm-nav-overlay { transition: none !important; }
}
