/**
 * Header and footer.
 *
 * Mobile-first: the desktop navigation is opt-in above 900px, so phones get
 * the smaller ruleset rather than having to override a desktop layout.
 */

/* ---- Header --------------------------------------------------------- */

.zen-header {
  position: relative;
  z-index: 50;
  background: var(--zen-surface, #fff);
}

/* Sticky is applied by JS only after the header has scrolled out of view,
   so the page does not jump on load. */
.zen-header.is-stuck .zen-header__main {
  position: fixed;
  inset-inline: 0;
  top: 0;
  box-shadow: var(--zen-shadow, 0 2px 4px rgba(11,37,69,.06), 0 6px 16px rgba(11,37,69,.1));
}

.zen-header__utility {
  background: var(--zen-blue-900, #0b2545);
  color: #fff;
  font-size: var(--zen-step--1, 0.875rem);
}

.zen-header__utility-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--zen-space-2, 0.5rem) var(--zen-space-4, 1rem);
  padding-block: 0.5rem;
}

.zen-header__note { margin: 0; }

.zen-header__phone {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4em;
  color: #fff;
  text-decoration: none;
}

.zen-header__phone:hover { text-decoration: underline; }
.zen-header__phone-label { opacity: 0.75; }

.zen-header__main {
  background: var(--zen-surface, #fff);
  border-bottom: 1px solid var(--zen-line, #dde3e9);
}

.zen-header__inner {
  display: flex;
  align-items: center;
  gap: var(--zen-space-4, 1rem);
  padding-block: var(--zen-space-3, 0.75rem);
}

.zen-header__brand { margin-inline-end: auto; }

.zen-header__title {
  color: var(--zen-blue-900, #0b2545);
  font-size: var(--zen-step-1, 1.25rem);
  font-weight: 800;
  text-decoration: none;
}

.zen-header__brand img { max-height: 56px; width: auto; height: auto; }

/* ---- Navigation ------------------------------------------------------ */

.zen-nav__list {
  display: flex;
  flex-direction: column;
  gap: var(--zen-space-1, 0.25rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.zen-nav__list a {
  display: block;
  padding: 0.65em 0;
  color: var(--zen-ink, #16222c);
  font-weight: 600;
  text-decoration: none;
}

.zen-nav__list a:hover,
.zen-nav__list .current-menu-item > a {
  color: var(--zen-blue-600, #1560bd);
}

.zen-nav__phone {
  display: block;
  margin-top: var(--zen-space-3, 0.75rem);
  font-weight: 800;
}

.zen-nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  /* 44px minimum so it is reliably tappable. */
  min-height: 44px;
  padding: 0.4em 0.8em;
  border: 1px solid var(--zen-line-2, #c6d0da);
  border-radius: var(--zen-radius, 8px);
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.zen-nav-toggle__bars,
.zen-nav-toggle__bars::before,
.zen-nav-toggle__bars::after {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  transition: transform 200ms, opacity 200ms;
}

.zen-nav-toggle__bars {
  position: relative;
}

.zen-nav-toggle__bars::before,
.zen-nav-toggle__bars::after {
  content: '';
  position: absolute;
  inset-inline-start: 0;
}

.zen-nav-toggle__bars::before { top: -6px; }
.zen-nav-toggle__bars::after { top: 6px; }

.zen-nav-toggle[aria-expanded='true'] .zen-nav-toggle__bars { background: transparent; }
.zen-nav-toggle[aria-expanded='true'] .zen-nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.zen-nav-toggle[aria-expanded='true'] .zen-nav-toggle__bars::after { transform: translateY(-6px) rotate(-45deg); }

/* Mobile panel */
@media (max-width: 899px) {
  .zen-nav {
    display: none;
    order: 10;
    width: 100%;
    padding-block: var(--zen-space-4, 1rem);
    border-top: 1px solid var(--zen-line, #dde3e9);
  }

  .zen-nav.is-open { display: block; }

  .zen-header__cta { order: 9; }
}

@media (min-width: 900px) {
  .zen-nav-toggle { display: none; }
  .zen-nav__phone { display: none; }

  .zen-nav__list {
    flex-direction: row;
    align-items: center;
    gap: var(--zen-space-5, 1.5rem);
  }

  .zen-nav__list a { padding: 0.35em 0; }

  .zen-header__inner { padding-block: var(--zen-space-4, 1rem); }
}

/* ---- Footer ---------------------------------------------------------- */

.zen-footer {
  margin-top: var(--zen-space-7, 3rem);
  background: var(--zen-blue-900, #0b2545);
  color: #dce6f2;
}

.zen-footer a { color: #fff; }

.zen-footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--zen-space-6, 2rem);
  padding-block: var(--zen-space-7, 3rem);
}

.zen-footer__heading {
  margin: 0 0 var(--zen-space-3, 0.75rem);
  color: #fff;
  font-size: var(--zen-step-0, 1rem);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.zen-footer__col--brand .zen-footer__heading {
  font-size: var(--zen-step-1, 1.25rem);
  text-transform: none;
  letter-spacing: 0;
}

.zen-footer__address { margin: 0 0 var(--zen-space-3, 0.75rem); font-style: normal; }

.zen-footer__contact,
.zen-footer__list,
.zen-footer__social,
.zen-footer__legal-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.zen-footer__list li,
.zen-footer__contact li { margin-bottom: 0.45rem; }

.zen-footer__areas { columns: 2; column-gap: var(--zen-space-4, 1rem); }

.zen-footer__hours {
  margin: var(--zen-space-3, 0.75rem) 0;
  font-size: var(--zen-step--1, 0.875rem);
  opacity: 0.85;
}

.zen-footer__social {
  display: flex;
  flex-wrap: wrap;
  gap: var(--zen-space-4, 1rem);
  margin-top: var(--zen-space-3, 0.75rem);
}

.zen-footer__bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: var(--zen-step--1, 0.85rem);
}

.zen-footer__bottom-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--zen-space-3, 0.75rem);
  padding-block: var(--zen-space-4, 1rem);
}

.zen-footer__legal { margin: 0; }

.zen-footer__legal-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--zen-space-4, 1rem);
}

@media print {
  .zen-header__utility,
  .zen-nav-toggle,
  .zen-header__cta,
  .zen-footer { display: none; }
}

/* ---- Dropdown menus --------------------------------------------------- */

.zen-nav__list li { position: relative; }

.zen-nav__list .sub-menu {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Desktop dropdowns are toggled with display rather than visibility. A
   visibility/opacity fade looks nicer but leaves the panel in the layout
   and in the tab order while it is closed; display keeps the closed state
   unambiguous for both the browser and assistive tech. */
@media (min-width: 900px) {
  .zen-nav__list .sub-menu {
    display: none;
    position: absolute;
    inset-inline-start: 0;
    top: 100%;
    z-index: 60;
    min-width: 15rem;
    padding: 0.4rem 0;
    background: var(--zen-surface, #fff);
    border: 1px solid var(--zen-line, #dde3e9);
    border-radius: var(--zen-radius, 8px);
    box-shadow: var(--zen-shadow-lg, 0 8px 24px rgba(11,37,69,.12));
  }

  /* focus-within is what makes these reachable by keyboard with no JS. */
  .zen-nav__list li:hover > .sub-menu,
  .zen-nav__list li:focus-within > .sub-menu {
    display: block;
  }

  /* Third level opens to the side rather than over its parent. */
  .zen-nav__list .sub-menu .sub-menu {
    top: -0.4rem;
    inset-inline-start: 100%;
  }

  .zen-nav__list .sub-menu a {
    padding: 0.5em 1.1em;
    font-weight: 500;
    white-space: nowrap;
  }

  .zen-nav__list .sub-menu a:hover,
  .zen-nav__list .sub-menu a:focus-visible {
    background: var(--zen-blue-050, #f4f8fd);
  }

  /* A caret signals a submenu before anyone has to hover to find out. */
  .zen-nav__list > .menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 0.4em;
    height: 0.4em;
    margin-inline-start: 0.45em;
    border: solid currentColor;
    border-width: 0 1.5px 1.5px 0;
    transform: translateY(-2px) rotate(45deg);
  }
}

/* Mobile has no hover, so nested items are indented and always shown. A tap
   target that hides its children behind a second tap is worse than a
   slightly longer list. */
@media (max-width: 899px) {
  .zen-nav__list .sub-menu {
    display: block;
    padding-inline-start: 1rem;
    border-inline-start: 2px solid var(--zen-line, #dde3e9);
    margin-block: 0.2rem;
  }

  .zen-nav__list .sub-menu a {
    padding: 0.5em 0;
    font-weight: 500;
    color: var(--zen-ink-2, #48555f);
  }
}

/* ---- Fitting nine top-level items ------------------------------------- */

/* Nine top-level items, a logo and a call-to-action do not fit on a 1280px
   laptop at the original spacing. Rather than drop menu items, the nav
   tightens between 900 and 1200px and relaxes above it. */
@media (min-width: 900px) and (max-width: 1199px) {
  .zen-nav__list { gap: var(--zen-space-3, 0.75rem); }
  .zen-nav__list > li > a { font-size: var(--zen-step--1, 0.875rem); }
  .zen-header__cta { padding-inline: 0.9em; font-size: var(--zen-step--1, 0.875rem); }
  .zen-header__brand img { max-height: 44px; }
}

@media (min-width: 1200px) {
  .zen-nav__list { gap: var(--zen-space-4, 1rem); }
  .zen-nav__list > li > a { font-size: var(--zen-step--1, 0.92rem); }
}

/* The nav is allowed to shrink; the logo and button are not, so the menu is
   what gives way rather than the page gaining a horizontal scrollbar. */
@media (min-width: 900px) {
  .zen-header__inner { flex-wrap: nowrap; }
  .zen-nav { min-width: 0; flex: 1 1 auto; }
  .zen-nav__list { flex-wrap: wrap; justify-content: flex-end; }
  .zen-header__brand,
  .zen-header__cta { flex: 0 0 auto; }
}

/* Without a logo uploaded the brand collapses to zero width and the layout
   reads as broken. Keep the site name legible until a logo is set. */
.zen-header__title { white-space: nowrap; }

/* ---- Mobile header wrapping ------------------------------------------- */

/* The header row is a nowrap flex container, so the expanded nav had nowhere
   to go and pushed past the viewport once the menu grew to nine top-level
   items. Letting the row wrap puts the nav on its own line where it belongs. */
@media (max-width: 899px) {
  .zen-header__inner { flex-wrap: wrap; }

  .zen-nav {
    flex: 1 0 100%;
    width: 100%;
    min-width: 0;
  }

  /* Long labels like "Air Conditioner Maintenance" must wrap rather than
     force the panel wider than the screen. */
  .zen-nav__list a { white-space: normal; overflow-wrap: anywhere; }

  /* Three levels of indent would leave almost no room for the text. */
  .zen-nav__list .sub-menu .sub-menu { padding-inline-start: 0.75rem; }
}
