/* ==========================================================================
   Header: floating frosted bar. Light glass so the teal logo always reads,
   whatever dark section sits behind it.
   ========================================================================== */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: var(--z-header);
  padding: clamp(1rem, 2.4svh, 1.5rem) var(--gutter) 0.75rem;
  pointer-events: none;
  transition: translate 0.6s var(--ease-out-expo), opacity 0.4s;
}
/* Scrolling down: the bar slides up and away. Scrolling up, keyboard focus or an
   open menu: it comes back. (translate, not transform: a transform on this element
   would trap the fixed full-screen mobile menu inside the header.) */
.site-header.is-hidden { translate: 0 -140%; opacity: 0; transition-duration: 0.45s, 0.3s; }
.site-header:focus-within,
body.menu-open .site-header { translate: none; opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .site-header { transition: none; }
}

.site-header__bar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(100%, var(--container-max));
  margin-inline: auto;
  padding: 0.5rem 0.6rem 0.5rem 1.25rem;
  border-radius: var(--radius-pill);
  position: relative;
  isolation: isolate;
}
/* The glass lives on a pseudo-element: backdrop-filter on the bar itself would
   trap the fixed mobile menu inside the bar instead of the viewport. */
.site-header__bar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: rgb(255 255 255 / 0.84);
  border: 1px solid rgb(255 255 255 / 0.9);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: 0 0.75rem 2rem -1rem rgb(2 18 25 / 0.55);
  transition: box-shadow var(--dur-m) var(--ease-out-expo);
}
.site-header.is-scrolled .site-header__bar::before {
  box-shadow: 0 1rem 2.5rem -0.75rem rgb(2 18 25 / 0.6);
}

.brand { display: block; flex: none; line-height: 0; }
.brand img { width: auto; height: 3.1rem; }

/* ---------- Desktop nav ---------- */
.primary-nav ul { display: flex; gap: clamp(0.25rem, 1.2vw, 1.25rem); }
.primary-nav a:not(.primary-nav__phone) {
  position: relative;
  display: block;
  padding: 0.6rem 0.7rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--teal-700);
  text-decoration: none;
}
.primary-nav a:not(.primary-nav__phone)::after {
  content: "";
  position: absolute;
  left: 0.7rem; right: 0.7rem; bottom: 0.3rem;
  height: 2px;
  background: var(--sand-400);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-out-expo);
}
.primary-nav a:not(.primary-nav__phone):hover::after,
.primary-nav a[aria-current]::after { transform: scaleX(1); }
.primary-nav__phone { display: none; }

/* Contact is a mobile-menu item only; on desktop the quote button covers it */
.nav-mobile-only { display: none; }

.site-header__actions { display: flex; align-items: center; gap: 0.5rem; }

.header-phone { display: none; }

.nav-toggle {
  display: none;
  width: 2.75rem; height: 2.75rem;
  border: 0;
  border-radius: 50%;
  background: var(--teal-700);
  color: var(--cyan-50);
  cursor: pointer;
  place-items: center;
}
.nav-toggle__bars { position: relative; display: block; width: 1.25rem; height: 0.75rem; }
.nav-toggle__bars i {
  position: absolute; left: 0; right: 0; height: 2px; border-radius: 2px;
  background: currentColor;
  transition: transform 0.4s var(--ease-out-expo), top 0.4s var(--ease-out-expo);
}
.nav-toggle__bars i:first-child { top: 0; }
.nav-toggle__bars i:last-child { top: calc(100% - 2px); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars i:first-child { top: calc(50% - 1px); transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars i:last-child { top: calc(50% - 1px); transform: rotate(-45deg); }

@media (min-width: 64em) {
  .header-phone { display: inline-flex; }

  /* Desktop only: nothing in the bar may wrap onto a second line */
  .primary-nav a,
  .header-phone,
  .header-quote { white-space: nowrap; }
}
@media (min-width: 64em) and (max-width: 89.99em) {
  /* Laptop widths: keep the number reachable as an icon-only button */
  .header-phone span { display: none; }
  .header-phone { padding: 0.65rem; }
}

/* ---------- Tablet & mobile: full-screen glass menu ---------- */
@media (max-width: 63.99em) {
  .brand img { height: 2.4rem; }
  .header-phone { display: none; }
  .nav-toggle { display: grid; }
  .header-quote { display: none; }
  .nav-mobile-only { display: block; }

  .js .primary-nav {
    position: fixed;
    inset: 0;
    z-index: -1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2rem;
    padding: 6rem var(--gutter) 3rem;
    overflow-y: auto;
    background: radial-gradient(120% 80% at 80% 0%, rgb(16 140 181 / 0.5), transparent 60%), var(--abyss-900);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-1rem);
    transition: opacity 0.45s var(--ease-out-expo), transform 0.45s var(--ease-out-expo), visibility 0s 0.45s;
  }
  .js .primary-nav.is-open {
    opacity: 1; visibility: visible; transform: none;
    transition-delay: 0s;
  }
  .primary-nav ul { flex-direction: column; gap: 0.25rem; }
  .primary-nav a:not(.primary-nav__phone) {
    padding: 0.4rem 0;
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 11vw, 4rem);
    text-transform: uppercase;
    color: var(--cyan-50);
  }
  .primary-nav a:not(.primary-nav__phone)::after { left: 0; right: auto; width: 3rem; bottom: 0; }
  .primary-nav__phone {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 1.25rem;
    color: var(--sand-400);
    text-decoration: none;
  }
}

@media (max-width: 63.99em) {
  body.menu-open { overflow: hidden; }
}