/* ==========================================================================
   01 Header / nav (Elementor id a000e3f)
   Measured: 97px tall desktop, 87px tablet, #FFFFFF, z-index 9999.
   Pins at scrollY > 60 (main.js toggles .is-pinned) with NO change to
   background, shadow or height. The only visual change is that it detaches.
   ========================================================================== */

.s-header {
  position: relative;
  z-index: 9999;
  width: 100%;
  background-color: var(--c-white);
  border-bottom: 0 none var(--c-text);
  box-shadow: none;
  font-family: var(--f-body);
  font-size: 15px;
  font-weight: 300;
  line-height: 22.5px;
  color: var(--c-text);
  transition: 0.4s var(--ease), height 0.4s var(--ease),
    background-color 0.4s var(--ease), border-bottom-width 0.4s var(--ease),
    border-bottom-color 0.4s var(--ease);
}

/* State B: scrollY > 60. Same paint, detached from flow, padding collapsed.
   main.js inserts .header-spacer after the header to hold the layout open. */
.s-header.is-pinned {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding-top: 0;
  padding-bottom: 0;
  background-color: var(--c-white);
  box-shadow: none;
}

.s-header__bar {
  width: 100%;
  height: var(--header-h);
  background-color: var(--c-white);
}

.s-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  height: 100%;
  padding-inline: 40px;
}

/* ------------------------------------------------------------------- logo */

.s-header__logo {
  flex: 0 0 auto;
  display: block;
  line-height: 0;
}

.s-header__logo img {
  width: 192px;
  height: 48px;
  object-fit: fill;
  border-radius: 0;
}

/* -------------------------------------------------------------- main menu */

.s-header__nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
}

.s-header__menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 12px;
}

.s-header__item {
  position: relative;
}

.s-header__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--c-forest);
  white-space: nowrap;
  transition: color var(--dur) var(--ease);
}

.s-header__link:hover,
.s-header__link:focus-visible,
.s-header__item--has-sub:hover > .s-header__link,
.s-header__item--has-sub:focus-within > .s-header__link,
.s-header__item--has-sub.is-open > .s-header__link {
  color: var(--c-green);
}

.s-header__caret {
  flex: 0 0 auto;
  width: 12px;
  height: 8px;
  transition: transform var(--dur) var(--ease);
}

.s-header__item--has-sub:hover > .s-header__link .s-header__caret,
.s-header__item--has-sub:focus-within > .s-header__link .s-header__caret,
.s-header__item--has-sub.is-open > .s-header__link .s-header__caret {
  transform: rotate(180deg);
}

/* --------------------------------------------------------- hover dropdown */

.s-header__sub {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  min-width: 270px;
  padding: 10px 0;
  background-color: var(--c-white);
  border-top: 3px solid var(--c-green);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease),
    visibility var(--dur) var(--ease);
}

.s-header__item--has-sub:hover > .s-header__sub,
.s-header__item--has-sub:focus-within > .s-header__sub,
.s-header__item--has-sub.is-open > .s-header__sub {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.s-header__sub li {
  position: relative;
}

.s-header__sublink {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 22px;
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--c-text);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.s-header__sublink:hover,
.s-header__sublink:focus-visible {
  background-color: var(--c-offwhite);
  color: var(--c-green);
}

.s-header__caret--right {
  transform: rotate(-90deg);
}

/* nested panel (HVAC Advertising Agency) flies out to the right */
.s-header__sub--nested {
  top: 0;
  left: 100%;
  border-top: 0;
  border-left: 3px solid var(--c-green);
  transform: translateX(10px);
}

.s-header__subitem--has-sub:hover > .s-header__sub--nested,
.s-header__subitem--has-sub:focus-within > .s-header__sub--nested,
.s-header__subitem--has-sub.is-open > .s-header__sub--nested {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.s-header__subitem--has-sub:hover > .s-header__sublink,
.s-header__subitem--has-sub:focus-within > .s-header__sublink {
  background-color: var(--c-offwhite);
  color: var(--c-green);
}

.s-header__subitem--has-sub:hover > .s-header__sublink .s-header__caret--right,
.s-header__subitem--has-sub:focus-within > .s-header__sublink .s-header__caret--right {
  transform: rotate(-90deg);
}

/* --------------------------------------------------------------- CTA button */

.s-header__cta {
  flex: 0 0 auto;
}

.s-header__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 18px 30px;
  background-color: var(--c-green);
  border-radius: 8px;
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.2px;
  text-align: center;
  text-transform: capitalize;
  color: var(--c-white);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.s-header__btn:hover,
.s-header__btn:focus-visible {
  background-color: var(--c-forest);
  color: var(--c-white);
}

/* ===================================================== mobile header (<=767) */

.s-header__bar--mobile {
  height: 87px;
}

.s-header__bar--mobile .s-header__inner {
  padding-inline: 20px;
}

.s-header__bar--mobile .s-header__logo img {
  width: 168px;
  height: 42px;
}

.s-header__hamburger {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 34px;
  background-color: var(--c-green);
  border-radius: 6px;
  color: var(--c-white);
  transition: background-color var(--dur) var(--ease);
}

.s-header__hamburger:hover {
  background-color: var(--c-forest);
}

.s-header__burger-bars {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  width: 18px;
}

.s-header__burger-bars span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: currentColor;
  border-radius: 2px;
}

/* off-canvas panel ---------------------------------------------------------- */

.s-header__panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 9999;
  width: 300px;
  max-width: 85vw;
  height: 100%;
  padding: 0 0 40px;
  background-color: var(--c-white);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  overflow-y: auto;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform var(--dur-slow) var(--ease), visibility var(--dur-slow) var(--ease);
}

.s-header__panel.is-open {
  transform: translateX(0);
  visibility: visible;
}

.s-header__panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--c-border);
}

.s-header__panel-logo img {
  width: 160px;
  height: 40px;
}

.s-header__close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-family: var(--f-display);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  color: var(--c-forest);
}

.s-header__close:hover {
  color: var(--c-green);
}

.s-header__menu-mobile {
  padding: 10px 0;
}

.s-header__mlink {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 20px;
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--c-forest);
}

.s-header__mlink.is-active,
.s-header__mlink:hover,
.s-header__mlink:focus-visible {
  color: var(--c-green);
}

.s-header__msub {
  display: none;
  padding-left: 14px;
  border-left: 2px solid var(--c-border);
  margin-left: 20px;
}

.s-header__mitem--has-sub.is-open > .s-header__msub,
.s-header__mitem--has-sub:focus-within > .s-header__msub {
  display: block;
}

.s-header__mitem--has-sub.is-open > .s-header__mlink .s-header__caret,
.s-header__mitem--has-sub.is-open > .s-header__msublink .s-header__caret {
  transform: rotate(180deg);
}

.s-header__msublink {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 20px 9px 6px;
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--c-text);
}

.s-header__msublink:hover,
.s-header__msublink:focus-visible {
  color: var(--c-green);
}

/* ==================================================== breakpoints ========== */

/* tablet 768 to 1024: 87px tall, nav wraps to two rows, tighter gutters */
@media (min-width: 768px) and (max-width: 1024px) {
  .s-header__bar {
    height: 87px;
  }

  .s-header__inner {
    gap: 12px;
    padding-inline: 20px;
  }

  .s-header__logo img {
    width: 148px;
    height: 37px;
  }

  .s-header__menu {
    gap: 0 6px;
  }

  .s-header__link {
    padding: 4px 8px;
    font-size: 14px;
  }

  .s-header__btn {
    padding: 16px 24px;
    font-size: 15px;
    max-width: 180px;
  }

  .s-header__sub {
    min-width: 240px;
  }

  .s-header__sub--nested {
    top: 100%;
    left: 0;
    border-top: 3px solid var(--c-green);
    border-left: 0;
    transform: translateY(10px);
  }

  .s-header__subitem--has-sub:hover > .s-header__sub--nested,
  .s-header__subitem--has-sub:focus-within > .s-header__sub--nested,
  .s-header__subitem--has-sub.is-open > .s-header__sub--nested {
    transform: translateY(0);
  }
}

/* mobile <=767: the desktop bar is hidden by .hidden-mobile, header is 87px */
@media (max-width: 767px) {
  .s-header {
    height: 87px;
  }

  .s-header__bar--mobile {
    height: 87px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .s-header,
  .s-header__sub,
  .s-header__panel {
    transition: none;
  }
}
