/* ============================================================
   Global mega-menu header
   ============================================================ */
.mh { position: relative; z-index: 60; }

/* --- Persistent header ---
   Sticky has to sit on HubSpot's module wrapper, not on .mh-bar. A sticky
   element can only travel inside its own containing block, and both .mh and
   the wrapper are exactly as tall as the header (118px) — so the bar had
   nowhere to stick and scrolled away with the page. The wrapper's parent is
   <body>, which gives it the whole document to travel. The id is
   deterministic: base.html declares the module as "site_header".

   This also needs `html, body { overflow-x: clip }` rather than `hidden` —
   see the sticky-header guard in css/theme.css for why. */
#hs_cos_wrapper_site_header { position: sticky; top: 0; z-index: 60; }

/* --- Utility bar --- */
.mh-utility { background: var(--surface-inverse); border-bottom: 1px solid var(--border-inverse); }
.mh-utility__inner {
  max-width: 1280px; margin: 0 auto; padding: 9px 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 38px;
}
.mh-utility__cities {
  flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font: var(--weight-medium) 11px/1.3 var(--font-eyebrow);
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-inverse-muted);
}
.mh-utility__links { display: flex; flex: 0 0 auto; align-items: center; gap: 18px; }
.mh-utility__links a {
  font: var(--weight-medium) 11px/1.3 var(--font-eyebrow);
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-inverse-muted); text-decoration: none;
}
.mh-utility__links a:hover { color: #fff; }

/* --- Sticky bar --- */
.mh-bar {
  position: relative; z-index: 60;
  /* Translucent at rest so content reads through as it passes underneath.
     saturate() keeps colour behind the glass from going flat and grey. */
  background: rgba(255,255,255,0.68);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
          backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  transition: background 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

/* Once the page has moved, the bar firms up a little and lifts off the content.
   .mh--scrolled is toggled in module.js. */
.mh--scrolled .mh-bar {
  background: rgba(255,255,255,0.86);
  border-bottom-color: transparent;
  box-shadow: 0 1px 0 rgba(15,23,42,0.06), 0 8px 24px -12px rgba(15,23,42,0.18);
}

/* No backdrop-filter (older Firefox, and anywhere it is disabled): fall back to
   a near-opaque bar rather than leaving nav text over raw page content. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .mh-bar,
  .mh--scrolled .mh-bar { background: rgba(255,255,255,0.97); }
}

@media (prefers-reduced-motion: reduce) {
  .mh-bar { transition: none; }
}
.mh-bar__inner {
  position: relative; max-width: 1280px; margin: 0 auto; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 78px;
}
.mh-logo { display: flex; align-items: center; flex: 0 0 auto; }
.mh-logo img { height: 54px; width: auto; display: block; }

/* --- Desktop nav --- */
.mh-nav { display: flex; flex: 1 1 auto; min-width: 0; align-items: center; justify-content: center; gap: 0; }
.mh-item { display: flex; align-items: stretch; }
.mh-item--simple { position: relative; }   /* simple panel aligns under its trigger */
.mh-item--mega { position: static; }        /* mega panel spans the whole bar */

.mh-trigger {
  display: flex; align-items: center; gap: 4px; padding: 13px 7px;
  background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer;
  font: var(--weight-semibold) 12px/1 var(--font-display);
  text-transform: uppercase; letter-spacing: 0.1em; white-space: nowrap;
  color: var(--text-strong); transition: color 140ms var(--ease-standard);
}
.mh-trigger:hover { color: var(--tertiary); }
.mh-caret { font-size: 8px; color: var(--text-muted); transition: transform 140ms var(--ease-standard); }
.mh-item.is-open .mh-trigger { color: var(--tertiary); border-bottom-color: var(--tertiary); }
.mh-item.is-open .mh-caret { transform: rotate(180deg); }
.mh-macc__head[aria-expanded="true"] .mh-caret { transform: rotate(180deg); }
.mh-caret { flex: none; }

/* --- Dropdown panels --- */
.mh-panel { display: none; position: absolute; top: 100%; }
.mh-item.is-open .mh-panel { display: block; }

.mh-panel--mega {
  left: 32px; right: 32px;
  background: #fff; border: 1px solid var(--border-subtle); border-top: 3px solid var(--tertiary);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); box-shadow: var(--shadow-lg); padding: 32px 36px 28px;
}
.mh-mega { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 36px; }
.mh-col { display: flex; flex-direction: column; gap: 10px; }
.mh-col__title {
  font: var(--weight-bold) 11px/1.3 var(--font-eyebrow);
  text-transform: uppercase; letter-spacing: var(--tracking-eyebrow); color: var(--tertiary);
}
.mh-col__links { display: flex; flex-direction: column; gap: 2px; }
.mh-col__links a {
  padding: 6px 0; font: var(--weight-medium) 14.5px/1.35 var(--font-body);
  color: var(--text-body); text-decoration: none;
}
.mh-col__links a:hover { color: var(--brand); }

.mh-promo {
  display: flex; flex-direction: column; gap: 12px; padding: 24px 22px;
  background: var(--surface-inverse); border-radius: var(--radius-md);
}
.mh-promo__eyebrow {
  font: var(--weight-bold) 11px/1.3 var(--font-eyebrow);
  text-transform: uppercase; letter-spacing: var(--tracking-eyebrow); color: var(--tertiary-on-dark);
}
.mh-promo__title { font: var(--weight-semibold) 21px/1.2 var(--font-display); text-transform: uppercase; color: #fff; }
.mh-promo__desc { font: var(--role-body-sm); color: var(--text-inverse-muted); }
.mh-promo__cta { margin-top: auto; font: var(--weight-semibold) 13px/1 var(--font-body); color: #fff; text-decoration: none; }
.mh-promo__cta:hover { color: var(--brand); }

.mh-panel--simple {
  left: 0; min-width: 248px;
  background: #fff; border: 1px solid var(--border-subtle); border-top: 3px solid var(--tertiary);
  border-radius: 0 0 var(--radius-md) var(--radius-md); box-shadow: var(--shadow-lg); padding: 12px;
}
.mh-panel--simple a {
  display: block; padding: 10px 12px; border-radius: var(--radius-sm);
  font: var(--weight-medium) 14.5px/1.35 var(--font-body); color: var(--text-body); text-decoration: none;
}
.mh-panel--simple a:hover { background: var(--surface-hover); color: var(--brand); }

/* --- Right-side actions --- */
.mh-actions { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.mh-search {
  display: flex; align-items: center; gap: 4px; height: 38px; padding: 0 8px 0 6px;
  background: none; border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  transition: border-color 140ms var(--ease-standard);
}
.mh-search:hover { border-color: var(--text-muted); }
.mh-search:focus-within { border-color: var(--brand); }
.mh-search__btn {
  display: flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  padding: 0; background: none; border: none; color: var(--text-muted); cursor: pointer;
  transition: color 140ms var(--ease-standard);
}
.mh-search:focus-within .mh-search__btn, .mh-search__btn:hover { color: var(--brand); }
.mh-search__input {
  width: 104px; min-width: 0; padding: 0; border: none; background: none; outline: none;
  font: var(--weight-medium) 14px/1 var(--font-body); color: var(--text-strong);
}
.mh-search__input::placeholder { color: var(--text-muted); }
/* hide the native search 'X' clear for a cleaner look */
.mh-search__input::-webkit-search-decoration,
.mh-search__input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

/* --- Mobile burger + drawer (hidden on desktop) --- */
.mh-burger { display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 40px; height: 38px; padding: 0 8px; background: none; border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); cursor: pointer; }
.mh-burger span { display: block; height: 2px; background: var(--text-strong); border-radius: 2px; transition: 160ms var(--ease-standard); }
.mh-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mh-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.mh-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mh-mobile { display: none; border-top: 1px solid var(--border-subtle); background: #fff; padding: 8px 20px 24px; max-height: calc(100vh - 78px); overflow-y: auto; }
.mh-macc { border-bottom: 1px solid var(--border-subtle); }
.mh-macc__head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 15px 4px; background: none; border: none; cursor: pointer;
  font: var(--weight-semibold) 13px/1 var(--font-display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-strong);
}
.mh-macc__body { display: flex; flex-direction: column; gap: 2px; padding: 4px 4px 16px; }
.mh-macc__body a { padding: 9px 10px; font: var(--weight-medium) 15px/1.3 var(--font-body); color: var(--text-body); text-decoration: none; border-radius: var(--radius-sm); }
.mh-macc__body a:hover { background: var(--surface-hover); color: var(--brand); }
.mh-macc__group { padding: 12px 10px 4px; font: var(--weight-bold) 10.5px/1.3 var(--font-eyebrow); text-transform: uppercase; letter-spacing: var(--tracking-eyebrow); color: var(--brand); }
.mh-macc__promo { margin-top: 6px; font-weight: var(--weight-semibold); color: var(--brand) !important; }
.mh-mobile__search {
  display: flex; align-items: center; gap: 10px; margin-top: 20px; padding: 13px 4px;
  border-top: 1px solid var(--border-subtle); color: var(--text-muted);
  font: var(--weight-medium) 15px/1 var(--font-body);
}
.mh-mobile__cta { margin-top: 14px; }

/* --- Breakpoints --- */
@media (max-width: 1140px) {
  .mh-nav, .mh-search { display: none; }
  .mh-burger { display: flex; }
  .mh-mobile[data-mh-mobile]:not([hidden]) { display: block; }
  .mh-bar__inner { min-height: 70px; }
  .mh-logo img { height: 48px; }
}
@media (max-width: 620px) {
  .mh-utility__cities { display: none; }
  .mh-actions a.mh-cta { display: none; }   /* CTA lives in the drawer on phones (specific enough to beat .mahdlo-btn) */
  .mh-utility__inner { justify-content: flex-end; }
}
