/* =============================================================================
   THEME HEADER + MOBILE MENU
   ============================================================================= */

.theme-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: 1.1rem var(--section-pad-x);
  background: #212121;
  border-bottom: 1px solid transparent;
  transition:
    background-color var(--dur) var(--ease-out),
    border-color var(--dur) var(--ease-out),
    backdrop-filter var(--dur) var(--ease-out),
    padding var(--dur) var(--ease-out);
}

.theme-header.is-scrolled {
  background: #212121;
  border-bottom-color: var(--line-on-dark);
  padding-block: 0.75rem;
}

.theme-header__brand {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  position: relative;
  z-index: calc(var(--z-overlay) + 2);
}

.theme-header__logo {
  height: 1.75rem;
  width: auto;
}

.theme-header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-left: auto;
}

/* wp_nav_menu output — top-level list */
.theme-header__menu {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  list-style: none;
  margin: 0;
  padding: 0;
}

.theme-header__menu li {
  position: relative;
}

.theme-header__menu a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.25rem;
  color: var(--text-on-dark);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.94rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}

.theme-header__menu a:hover,
.theme-header__menu .current-menu-item > a,
.theme-header__menu .current-menu-ancestor > a {
  color: var(--orange-500);
}

.theme-header__menu .menu-item-has-children > a::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--dur-fast) var(--ease-out);
}

.theme-header__menu .sub-menu .menu-item-has-children > a::after {
  display: none;
}

.theme-header__menu .menu-item-has-children:hover > a::after {
  transform: rotate(225deg) translateY(-2px);
}

/* Dropdown sub-menus (Tier 2 + Tier 3) */
.theme-header__menu .sub-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: -1rem;
  /* Sized to the longest entry; the cap matters because html/body clip. */
  width: max-content;
  min-width: 16rem;
  max-width: min(24rem, calc(100vw - 2rem));
  list-style: none;
  margin: 0;
  padding: 0.65rem;
  background: #212121;
  border: 1px solid var(--line-on-dark-str);
  border-radius: var(--radius-md);
  box-shadow: 0 28px 60px -28px rgba(0, 0, 0, 0.7);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition:
    opacity var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    visibility var(--dur-fast) var(--ease-out);
  z-index: var(--z-header);
}

.theme-header__menu li:hover > .sub-menu,
.theme-header__menu li:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.theme-header__menu .sub-menu a {
  display: block;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  border-radius: var(--radius-xs);
}

.theme-header__menu .sub-menu a:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--orange-500);
}

/* Tier 3 — flyout to the right */
.theme-header__menu .sub-menu .sub-menu {
  top: -0.65rem;
  left: 100%;
  margin-left: 0.4rem;
}

.theme-header__menu .sub-menu .menu-item-has-children > a::after {
  margin-left: auto;
  transform: rotate(-45deg);
}

.theme-header__menu .sub-menu .menu-item-has-children:hover > a::after {
  transform: rotate(135deg);
}

/* Header phone — desktop */
.theme-header__phone {
  margin-left: var(--space-md);
  padding: 0.7rem 1.1rem 0.7rem 0.85rem;
  font-size: 0.85rem;
}

.theme-header__phone .theme-phone__icon {
  width: 1.85rem;
  height: 1.85rem;
}

.theme-header__phone .theme-phone__label small {
  font-size: 0.6rem;
}

.theme-header__phone .theme-phone__label strong {
  font-size: 0.95rem;
}

/* Header phone — mobile overlay */
.theme-header__phone--overlay {
  display: none;
}

.theme-header.is-scrolled {
  padding-block: 0.6rem;
}

/* ---------------------------------------------------------------------------
   Mobile breakpoint
   --------------------------------------------------------------------------- */
html.menu-open body {
  height: 100vh;
  overflow: hidden;
}

@media (max-width: 1200px) {
  .theme-header__phone {
    margin-left: 0;
  }
  .theme-header__phone .theme-phone__label strong {
    font-size: 0.8rem;
  }
}

@media (max-width: 1023px) {
  .theme-header.is-open::before {
    content: "";
    position: absolute;
    inset: 0;
    background: #212121;
    z-index: calc(var(--z-overlay) + 2);
  }

  .theme-header__nav {
    display: none;
  }

  .theme-header.is-open .theme-header__nav {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #212121;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--space-lg);
    padding: 4.5rem var(--section-pad-x) 2rem;
    z-index: var(--z-overlay);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .theme-header__menu {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
  }

  .theme-header__menu > li {
    border-bottom: 1px solid var(--line-on-dark);
  }

  .theme-header__menu a {
    padding: 1rem 0;
    font-size: 1.1rem;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 700;
  }

  /* No chevron in the mobile menu. It marks a submenu that can be folded away,
     but here every submenu is permanently open (see .sub-menu below), so the
     arrow promises a toggle that does not exist — tapping it does nothing. */
  .theme-header__menu .menu-item-has-children > a::after {
    display: none;
  }

  .theme-header__menu .sub-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0 0 0.75rem 1rem;
    width: auto;
    min-width: 0;
    max-width: none;
  }

  .theme-header__menu .sub-menu .sub-menu {
    margin-left: 0;
    padding-left: 1rem;
  }

  .theme-header__menu .sub-menu a {
    font-family: var(--font-body);
    font-style: normal;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0;
  }

  .theme-header.is-open .theme-header__phone--overlay {
    display: inline-flex;
    align-self: stretch;
    justify-content: center;
    margin-left: 0;
    padding: 1.1rem 1.5rem;
  }
}

@media (max-width: 767px) {
  .theme-header {
    gap: var(--space-sm);
    padding-inline: 1rem;
  }
}

/* ---------------------------------------------------------------------------
   Burger button
   --------------------------------------------------------------------------- */
.theme-burger {
  display: none;
  width: 2.75rem;
  height: 2.75rem;
  margin-left: auto;
  border: 1px solid var(--line-on-dark-str);
  border-radius: var(--radius-sm);
  position: relative;
  z-index: calc(var(--z-overlay) + 2);
}

.theme-burger::before,
.theme-burger::after {
  content: "";
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  height: 2px;
  background: currentColor;
  transition:
    transform var(--dur) var(--ease-out),
    top var(--dur) var(--ease-out);
}
.theme-burger::before {
  top: 1rem;
}
.theme-burger::after {
  top: 1.6rem;
}

.theme-header.is-open .theme-burger::before {
  top: 1.3rem;
  transform: rotate(45deg);
}
.theme-header.is-open .theme-burger::after {
  top: 1.3rem;
  transform: rotate(-45deg);
}

@media (max-width: 1023px) {
  .theme-burger {
    display: block;
  }
}

/* ---------------------------------------------------------------------------
   Emergency button on mobile — the desktop component reduced to its icon
   --------------------------------------------------------------------------- */
@media (max-width: 1023px) {
  .theme-header > .theme-header__phone:not(.theme-header__phone--overlay) {
    display: inline-grid;
    place-items: center;
    position: relative;
    /* Tap target stays 44px even though the circle inside is smaller. */
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    margin-left: auto;
    border-radius: 50%;
    /* Circle and shadow live on the icon, not on the tap target. */
    background: none;
    box-shadow: none;
    /* Stays above the open menu, like the burger. */
    z-index: calc(var(--z-overlay) + 2);
  }

  .theme-header > .theme-header__phone:not(.theme-header__phone--overlay):hover {
    transform: none;
    box-shadow: none;
  }

  .theme-header > .theme-header__phone:not(.theme-header__phone--overlay) .theme-phone__label {
    display: none;
  }

  /* Narrower than the tap target so it does not dominate the burger. */
  .theme-header > .theme-header__phone:not(.theme-header__phone--overlay) .theme-phone__icon {
    width: 2.4rem;
    height: 2.4rem;
    background: var(--orange-500);
    box-shadow: var(--shadow-cta);
  }

  /* The phone takes the auto margin; two would split the pair apart. */
  .theme-burger {
    margin-left: 0;
  }

  /* Without this flex shrinks the buttons below tap size and squashes the logo. */
  .theme-header__brand,
  .theme-header > .theme-header__phone:not(.theme-header__phone--overlay),
  .theme-burger {
    flex: none;
  }
}

/* Below 375px the full-size logo and both buttons do not fit. Fluid rather
   than a breakpoint, which would jump the logo 57px at one width. */
@media (max-width: 374px) {
  .theme-header__logo {
    height: clamp(1.3rem, -1.32rem + 13.09vw, 1.75rem);
  }
}

/* ---------------------------------------------------------------------------
   Hero tile icons
   --------------------------------------------------------------------------- */

/* Font Awesome mixes square and landscape viewBoxes. Fitting them all into one
   square box renders the square ones a quarter taller than the rest, so the row
   is normalised on height instead. */
.hero-box .elementor-icon svg {
  height: 2.5rem;
  width: auto;
}
