/* ==========================================================================
   Site header — interaction layer for the Elementor-native template
   (figma-templates/redesign/build-header.mjs; Figma "Site header / Option A").

   Bar heights, padding, colours, the logo size, utility links, the CTA button and the
   sticky mobile bar are Elementor settings — edit them in Elementor. This file adds what
   Elementor can't express: stickiness, the transparent-over-hero state, the expert status
   dot, the shortcode parts (desktop nav + dropdowns, mobile menu, ZIP trigger restyle)
   and the menu-cart bag icon. Dynamic markup: inc/site-header.php. Behaviour: js/app.js
   "Header redesign". Breakpoints match staging's Elementor ones: tablet extra ≤1200
   (phone-only utility bar, tighter main bar), tablet ≤1024 (logo · ZIP · cart · menu +
   sticky bottom CTA bar).
   ========================================================================== */

/* Sticky: the Theme Builder wraps the template in .elementor-location-header, which is
   the element that has to stick (a sticky child can't outlive its parent's height). */
.elementor-location-header:has(.nw-header) {
  position: sticky;
  top: 0;
  z-index: 1000;
}
.admin-bar .elementor-location-header:has(.nw-header) { top: 32px; }
@media (max-width: 782px) {
  .admin-bar .elementor-location-header:has(.nw-header) { top: 46px; }
}
@media (max-width: 600px) {
  .admin-bar .elementor-location-header:has(.nw-header) { top: 0; }
}
/* Mini-cart panel (theme-styles.css) sits below the header via this variable. */
body:has(.nw-header) { --miniCartTop: 120px; }

/* Content-sized bar groups. Elementor gives every container --width:100% by default, which
   in a row makes each group as wide as the bar and pushes the rest off-screen. Two classes
   beat that default; a width set in Elementor (element rule, three classes) still wins. */
.e-con.nw-hphone,
.e-con.nw-header__util-right,
.e-con.nw-hlogo,
.e-con.nw-header__actions { --width: auto; }

/* Buttons without a fill of their own (outline / link styles): Elementor's default colour
   scheme would paint them in the kit's accent green. A colour set in Elementor still wins. */
.nw-header .elementor-widget-button .elementor-button { background-color: transparent; }

/* Outline icons (header, footer, redesigned pages): Elementor colours inlined SVG icons
   through `fill`, which turns stroke-only shapes into solid blobs. Keep them outlined. */
:is(.nw-header, .nw-footer, .nw-redesign) svg [stroke]:not([stroke="none"]):not([fill]) { fill: none; }

.nw-header a { text-decoration: none; }
.nw-header .screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Shared icon: a currentColor mask, so one SVG serves light and dark states. */
.nw-header .nw-nav__toggle::after,
.nw-header .nw-header__cart .elementor-button-icon::before,
.nw-header .nw-burger::before,
.nw-header .nw-header__zip .norweh-zip-trigger::before,
.nw-header .nw-header__zip .norweh-zip-caret::after,
.nw-mmenu .nw-ico::before,
.nw-mmenu .nw-mmenu__close::before,
.nw-mmenu .nw-mmenu__toggle::after,
.nw-cta::before {
  content: "";
  flex: none;
  display: inline-block;
  background: currentColor;
  -webkit-mask: var(--nw-icon) center / contain no-repeat;
          mask: var(--nw-icon) center / contain no-repeat;
}

/* ---- Utility bar -------------------------------------------------------- */
.nw-header .nw-hphone__label { color: rgba(255, 255, 255, 0.65); }
.nw-header .nw-hphone__link b { font-weight: 600; }
.nw-header .nw-hphone__link a:hover b { text-decoration: underline; }
/* #expert_icon: talk_to_expert() adds .active (office open) or .inactive. */
.nw-header .e-con.nw-hphone__status { display: none; }
.nw-header .e-con.nw-hphone__status.active { display: block; background: #2ab740; box-shadow: 0 0 0 2px rgba(42, 183, 64, 0.25); }
.nw-header .e-con.nw-hphone__status.inactive { display: block; background: rgba(255, 255, 255, 0.35); }

/* ZIP panel trigger ([norweh_zip_panel], inc/regional-pricing.php) restyled as the
   Figma region control: globe · "USA" · chevron. Styling only — no behaviour change. */
.nw-header .nw-header__zip .norweh-zip-trigger {
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  color: inherit;
  font-family: var(--nw-font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}
.nw-header .nw-header__zip--desktop .norweh-zip-trigger { color: var(--nw-white); }
.nw-header .nw-header__zip .norweh-zip-trigger::before { --nw-icon: url(../images/header/icon-globe.svg); width: 14px; height: 14px; }
.nw-header .nw-header__zip .norweh-zip-trigger-flag,
.nw-header .nw-header__zip .norweh-zip-trigger-icon { display: none; }
.nw-header .nw-header__zip .norweh-zip-caret { display: inline-flex; font-size: 0; color: inherit; }
.nw-header .nw-header__zip .norweh-zip-caret::after { --nw-icon: url(../images/header/icon-chev-down.svg); width: 12px; height: 12px; }
.nw-header .nw-header__zip--desktop .norweh-zip-trigger:hover,
.nw-header .nw-header__zip--desktop .norweh-zip-trigger.is-open { background: rgba(255, 255, 255, 0.12); }
.nw-header .nw-header__zip .norweh-zip-panel { color: var(--nw-ink); font-family: var(--nw-font-body); border-radius: 12px; }

/* ---- Main bar ----------------------------------------------------------- */
.nw-header .e-con.nw-header__main { color: var(--nw-ink); transition: background-color 0.25s ease, border-color 0.25s ease; }
/* The light logo sits on top of the colour one; the transparent state swaps them. */
.nw-header .e-con.nw-hlogo { position: relative; }
.nw-header .elementor-element.nw-hlogo__light { position: absolute; inset: 0; opacity: 0; }
.nw-header .nw-hlogo img { display: block; transition: opacity 0.25s ease; }
.nw-header .elementor-element.nw-hlogo__color,
.nw-header .elementor-element.nw-hlogo__light { transition: opacity 0.25s ease; }

/* Desktop navigation ([norweh_header_nav]) */
.nw-header .nw-nav__list { display: flex; align-items: center; gap: 32px; margin: 0; padding: 0; list-style: none; }
.nw-header .nw-nav__item { position: relative; display: flex; align-items: center; gap: 4px; margin: 0; }
.nw-header .nw-nav__link {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: 500 16px/1.6 var(--nw-font-body);
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  cursor: pointer;
}
.nw-header .nw-nav__link:hover,
.nw-header .nw-nav__link[aria-current="page"] { color: inherit; text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }
.nw-header .nw-nav__toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
.nw-header .nw-nav__toggle:hover,
.nw-header .nw-nav__toggle:focus { background: none; color: inherit; }
.nw-header .nw-nav__toggle::after { --nw-icon: url(../images/header/icon-chev-down.svg); width: 14px; height: 14px; transition: transform 0.2s ease; }
.nw-header .nw-nav__item.is-open .nw-nav__toggle::after { transform: rotate(180deg); }
.nw-header .nw-nav__menu {
  position: absolute;
  top: calc(100% + 29px); /* bottom edge of the 84px bar */
  left: -16px;
  z-index: 10;
  display: none;
  flex-direction: column;
  gap: 4px;
  min-width: 200px;
  margin: 0;
  padding: 12px 8px;
  border-radius: 0 0 14px 14px;
  background: var(--nw-white);
  box-shadow: 0 16px 30px rgba(0, 13, 38, 0.09);
  list-style: none;
}
/* Bridge the gap between link and menu so the pointer can travel down to it. */
.nw-header .nw-nav__menu::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 30px; }
.nw-header .nw-nav__item.is-open .nw-nav__menu { display: flex; }
@media (hover: hover) {
  .nw-header .nw-nav__item.has-menu:hover .nw-nav__menu { display: flex; }
  .nw-header .nw-nav__item.has-menu:hover .nw-nav__toggle::after { transform: rotate(180deg); }
}
.nw-header .nw-nav__menu li { margin: 0; }
.nw-header .nw-nav__menu a {
  display: block;
  padding: 12px 40px 12px 16px;
  border-radius: 8px;
  color: var(--nw-navy);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}
.nw-header .nw-nav__menu a:hover,
.nw-header .nw-nav__menu a:focus-visible,
.nw-header .nw-nav__menu a[aria-current="page"] { background: var(--nw-tint); color: var(--nw-navy); }

/* Cart (Elementor menu-cart widget — kept for the mini-cart and live count): the
   Figma bag glyph, drawn in the bar's text colour so it follows the transparent state. */
.nw-header .nw-header__cart .elementor-menu-cart__toggle .elementor-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: none;
  color: inherit;
}
.nw-header .nw-header__cart .elementor-menu-cart__toggle .elementor-button:hover { background: rgba(0, 21, 54, 0.06); }
.nw-header .nw-header__cart .elementor-button-text { display: none; }
.nw-header .nw-header__cart .elementor-button-icon { position: static; display: flex; color: inherit; }
.nw-header .nw-header__cart .elementor-button-icon > i,
.nw-header .nw-header__cart .elementor-button-icon > svg { display: none; }
.nw-header .nw-header__cart .elementor-button-icon::before { --nw-icon: url(../images/header/icon-bag.svg); width: 22px; height: 22px; }
/* Count bubble (Figma Header/Cart badge): a pill that widens with the number. Elementor
   Pro's bubble rule is five classes deep, and the pre-redesign badge in theme-styles.css
   (.elementor-menu-cart__wrapper .elementor-button-icon-qty) fixes it at 20×20 with
   !important height / top / line-height — which stacked two-digit counts — so those are
   overridden with !important here. */
.nw-header .nw-header__cart .elementor-menu-cart__toggle .elementor-button-icon .elementor-button-icon-qty[data-counter] {
  position: absolute;
  top: 4px !important;
  left: 24px;
  right: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: auto;
  min-width: 16px;
  height: 16px !important;
  padding: 0 4px;
  border: 0;
  border-radius: 999px;
  line-height: 1 !important;
  white-space: nowrap;
  background: var(--nw-burgundy);
  color: var(--nw-white);
  font: 600 10px/1 var(--nw-font-body);
}
.nw-header .nw-header__cart .elementor-menu-cart__toggle .elementor-button-icon .elementor-button-icon-qty[data-counter="0"] { display: none; }

/* Burger ([norweh_mobile_menu]) */
.nw-header .nw-burger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.59);
  border-radius: 999px;
  background: var(--nw-white);
  color: var(--nw-ink);
  cursor: pointer;
}
.nw-header .nw-burger::before { --nw-icon: url(../images/header/icon-menu.svg); width: 18px; height: 18px; }
.nw-header .nw-burger:hover,
.nw-header .nw-burger:focus { background: var(--nw-white); color: var(--nw-ink); }

/* ---- Transparent over a full-bleed hero ---------------------------------- */
/* body.nw-overlay-header (functions.php: homepage, Book a consultation). The hero's top
   padding (Elementor) reserves the header's height and the header overlaps it until the
   page scrolls (js/app.js toggles .is-scrolled). */
body.nw-overlay-header .elementor-location-header:has(.nw-header) { margin-bottom: -120px; }
body.nw-overlay-header .nw-header:not(.is-scrolled) .e-con.nw-header__main { border-color: rgba(255, 255, 255, 0.12); background: transparent; color: var(--nw-white); }
body.nw-overlay-header .nw-header:not(.is-scrolled) .elementor-element.nw-hlogo__color { opacity: 0; }
body.nw-overlay-header .nw-header:not(.is-scrolled) .elementor-element.nw-hlogo__light { opacity: 1; }
body.nw-overlay-header .nw-header:not(.is-scrolled) .nw-header__cta .elementor-button { border-color: transparent; background: var(--nw-white); color: var(--nw-navy); fill: var(--nw-navy); }
body.nw-overlay-header .nw-header:not(.is-scrolled) .nw-header__cta .elementor-button:hover { background: var(--nw-tint); color: var(--nw-navy); }
body.nw-overlay-header .nw-header:not(.is-scrolled) .nw-header__cart .elementor-menu-cart__toggle .elementor-button:hover,
body.nw-overlay-header .nw-header:not(.is-scrolled) .nw-header__zip--mobile .norweh-zip-trigger:hover { background: rgba(255, 255, 255, 0.12); }
body.nw-overlay-header .nw-header:not(.is-scrolled) .nw-burger { border-color: rgba(255, 255, 255, 0.35); background: transparent; color: var(--nw-white); }

/* ---- Mobile menu ([norweh_mobile_menu], Figma 1:304) -------------------- */
.nw-mmenu {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--nw-navy);
  color: var(--nw-white);
  font-family: var(--nw-font-body);
}
.nw-mmenu[hidden] { display: none; }
body.nw-mmenu-open { overflow: hidden; }
.nw-mmenu a { color: inherit; text-decoration: none; }
.nw-mmenu ul { margin: 0; padding: 0; list-style: none; }
.nw-mmenu .screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.nw-mmenu__top { display: flex; align-items: center; justify-content: space-between; flex: none; height: 68px; padding: 0 16px 0 20px; }
.nw-mmenu__logo img { display: block; width: 91.2px; height: 40px; }
.nw-mmenu .nw-mmenu__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: none;
  color: var(--nw-white);
  cursor: pointer;
}
.nw-mmenu .nw-mmenu__close::before { --nw-icon: url(../images/header/icon-close.svg); width: 18px; height: 18px; }
.nw-mmenu .nw-mmenu__close:hover,
.nw-mmenu .nw-mmenu__close:focus { background: rgba(255, 255, 255, 0.12); color: var(--nw-white); }
.nw-mmenu__list { padding: 12px 24px 0 !important; }
.nw-mmenu__item { border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.nw-mmenu .nw-mmenu__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--nw-white);
  font: 600 24px/1.2 var(--nw-font-display);
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.nw-mmenu .nw-mmenu__link:hover,
.nw-mmenu .nw-mmenu__link:focus { background: none; color: var(--nw-white); }
.nw-mmenu .nw-mmenu__toggle::after { --nw-icon: url(../images/header/icon-chev-down.svg); width: 18px; height: 18px; transform: rotate(-90deg); transition: transform 0.2s ease; }
.nw-mmenu .nw-mmenu__toggle[aria-expanded="true"]::after { transform: none; }
.nw-mmenu__sub { display: flex; flex-direction: column; gap: 4px; padding: 0 0 16px !important; }
.nw-mmenu__sub[hidden] { display: none; }
.nw-mmenu__sub a { display: block; padding: 8px 0; color: rgba(255, 255, 255, 0.8); font-size: 16px; line-height: 1.5; }
.nw-mmenu__sub a:hover { color: var(--nw-white); }
.nw-mmenu__utils { display: flex; flex-direction: column; align-items: flex-start; gap: 24px; padding: 28px 24px; }
.nw-mmenu .nw-mmenu__util {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--nw-white);
  font: 500 15px/1.3 var(--nw-font-body);
  text-transform: none;
  cursor: pointer;
}
.nw-mmenu .nw-mmenu__util:hover,
.nw-mmenu .nw-mmenu__util:focus { background: none; color: var(--nw-white); text-decoration: underline; }
.nw-mmenu .nw-ico::before { width: 18px; height: 18px; }
.nw-mmenu .nw-ico--globe::before { --nw-icon: url(../images/header/icon-globe.svg); }
.nw-mmenu .nw-ico--phone::before { --nw-icon: url(../images/header/icon-phone.svg); }
.nw-mmenu .nw-mmenu__phone { gap: 12px; }
.nw-mmenu__phone span { display: flex; flex-direction: column; gap: 4px; font-size: 16px; font-weight: 600; }
.nw-mmenu__phone small { color: rgba(255, 255, 255, 0.65); font-size: 12px; font-weight: 400; }
.nw-mmenu__cta { margin-top: auto; padding: 16px 20px 28px; border-top: 1px solid rgba(255, 255, 255, 0.12); }

/* Light consultation pill (mobile menu). */
.nw-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 24px;
  border-radius: 999px;
  font: 600 15px/1.2 var(--nw-font-body);
  text-decoration: none;
}
.nw-cta::before { --nw-icon: url(../images/header/icon-calendar.svg); width: 18px; height: 18px; }
/* Scoped to the menu so it outranks `.nw-mmenu a { color: inherit }`, which left white
   text (and the currentColor calendar icon) on the white pill. */
.nw-mmenu .nw-cta--light,
.nw-mmenu .nw-cta--light:hover,
.nw-mmenu .nw-cta--light:focus { background: var(--nw-white); color: var(--nw-navy); }
.nw-mmenu .nw-cta--light:hover { background: var(--nw-tint); }

/* ---- Sticky bottom CTA bar (Elementor shows it ≤1024) -------------------- */
.nw-header .e-con.nw-stickycta { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.nw-header .nw-stickycta__call .elementor-button { width: 40px; height: 40px; padding: 0; justify-content: center; }
.nw-header .nw-stickycta__call .elementor-button-text { display: none; }

/* ==========================================================================
   Responsive (structure lives in Elementor; these follow its breakpoints)
   ========================================================================== */
@media (max-width: 1200px) {
  body:has(.nw-header) { --miniCartTop: 112px; }
  body.nw-overlay-header .elementor-location-header:has(.nw-header) { margin-bottom: -112px; }
  .nw-header .nw-hphone__label { display: none; }
  .nw-header .nw-nav__list { gap: 20px; }
  .nw-header .nw-nav__link { font-size: 15px; }
  .nw-header .nw-nav__menu { top: calc(100% + 25px); }
}

@media (max-width: 1024px) {
  body:has(.nw-header) { --miniCartTop: 68px; }
  body.nw-overlay-header .elementor-location-header:has(.nw-header) { margin-bottom: -68px; }
  /* Compact region control: globe only (the full ZIP panel still opens from it). */
  .nw-header .nw-header__zip--mobile .norweh-zip-trigger { justify-content: center; width: 40px; height: 40px; padding: 0; border-radius: 99px; }
  .nw-header .nw-header__zip--mobile .norweh-zip-trigger::before { width: 20px; height: 20px; }
  .nw-header .nw-header__zip--mobile .norweh-zip-trigger-label,
  .nw-header .nw-header__zip--mobile .norweh-zip-caret { display: none; }
  .nw-header .nw-header__zip--mobile .norweh-zip-trigger:hover,
  .nw-header .nw-header__zip--mobile .norweh-zip-trigger.is-open { background: rgba(0, 21, 54, 0.06); }
  /* Room for the fixed CTA bar so it never covers the end of the page — added under the
     footer in the footer's own colour (on the body it showed as a white band below it). */
  body:has(.nw-stickycta) .elementor-location-footer { padding-bottom: 80px; background: var(--nw-ink); }
  /* Pages with their own bottom bar (product add-to-cart) or checkout flow keep it clean. */
  body.single-product .e-con.nw-stickycta,
  body.woocommerce-cart .e-con.nw-stickycta,
  body.woocommerce-checkout .e-con.nw-stickycta,
  body.nw-mmenu-open .e-con.nw-stickycta { display: none; }
  body.single-product:has(.nw-stickycta) .elementor-location-footer,
  body.woocommerce-cart:has(.nw-stickycta) .elementor-location-footer,
  body.woocommerce-checkout:has(.nw-stickycta) .elementor-location-footer { padding-bottom: 0; }
}

@media (min-width: 1025px) {
  .nw-mmenu { display: none !important; }
}
