/* ---------- Header: mobile first ---------- */
.page { container: page / inline-size; }

.site-header {
  position: sticky; top: 0;
  z-index: 50;
  background: var(--color-page);
  transition: box-shadow .25s, background-color .25s;
}
.site-header.is-stuck { background: rgba(255,255,255,.96); box-shadow: 0 6px 20px rgba(20, 46, 82, .1); }
@supports (backdrop-filter: blur(8px)) {
  .site-header.is-stuck { background: rgba(255,255,255,.93); backdrop-filter: blur(14px) saturate(1.4); }
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: .75rem var(--page-gutter);
}
.brand { display: grid; justify-items: center; flex: none; text-decoration: none; }
.brand img { width: clamp(140px, 42vw, 180px); height: auto; transition: width .25s var(--ease); }
.site-header__inner { transition: padding .25s var(--ease); }
.is-stuck .site-header__inner { padding-block: .45rem; }
.is-stuck .brand img { width: clamp(120px, 34vw, 140px); }
.is-stuck .brand__tag { opacity: 0; max-height: 0; margin-top: 0; }
.is-stuck .header-phone, .is-stuck .nav-toggle { height: 44px; }
.is-stuck .nav-toggle { width: 44px; }

/* Phone: compact "Call" pill on phones, full number on desktop */
.header-phone {
  display: inline-flex; align-items: center; gap: .45rem;
  margin-left: auto; height: 48px; padding: 0 1rem;
  border-radius: 14px; background: var(--color-orange); color: #fff;
  font-weight: 600; font-size: 1rem; text-decoration: none;
  box-shadow: 0 6px 16px rgba(244, 119, 22, .28);
}
.header-phone svg { width: 1.2rem; height: 1.2rem; }
.header-phone__full { display: none; }
@container page (min-width: 480px) {
  .header-phone__short { display: none; }
  .header-phone__full { display: inline; }
}
.site-header__inner > .nav-toggle { margin-left: -.4rem; }
@container page (max-width: 360px) {
  .site-header__inner { gap: .75rem; }
  .header-phone { padding: 0 .8rem; gap: .35rem; font-size: .95rem; }
}

.nav-toggle {
  display: grid; place-items: center;
  width: 48px; height: 48px; padding: 0;
  border: 1px solid var(--color-border); border-radius: 14px;
  background: #fff; color: var(--color-navy); cursor: pointer;
}
.nav-toggle svg { width: 24px; height: 24px; }
.nav-toggle__close { display: none !important; }
.nav-open .nav-toggle__open { display: none !important; }
.nav-open .nav-toggle__close { display: block !important; }

.primary-nav {
  display: none;
  position: absolute; inset: 100% 0 auto 0;
  padding: .5rem var(--page-gutter) 1.5rem;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 18px 30px rgba(20, 46, 82, .12);
}
.nav-open .primary-nav { display: block; }

.primary-nav__list { display: grid; }
.primary-nav__link {
  display: flex; align-items: center; gap: .35em; width: 100%;
  padding: .8rem 0;
  border: 0; background: none; text-align: left;
  font: inherit; font-size: 1.05rem; font-weight: 500;
  color: var(--color-navy); text-decoration: none; cursor: pointer;
  position: relative;
}
.primary-nav__link svg { width: 1em; height: 1em; transition: transform .2s var(--ease); }
.submenu-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.primary-nav__link[aria-current] { color: var(--color-orange); }

.submenu { display: none; padding: 0 0 .5rem 1rem; }
.submenu-toggle[aria-expanded="true"] + .submenu { display: grid; }
.submenu a {
  display: block; padding: .55rem 0;
  color: var(--color-text-muted); text-decoration: none; font-weight: 500;
}
.submenu a:hover { color: var(--color-orange); }

.header-cta { margin-top: 1rem; width: 100%; padding: .95rem 1.5rem; font-size: 1.05rem; }

/* ---------- Header: desktop — mirrors the 1536×768 reference canvas ---------- */
@container page (min-width: 1100px) {
  .site-header {
    --u: clamp(0.716px, 100cqw / 1536, 1.25px);
    position: absolute; top: 0; left: 50%;
    width: calc(1536 * var(--u)); height: calc(84 * var(--u));
    transform: translateX(-50%);
    background: transparent;
  }
  .site-header__inner { display: block; padding: 0; height: 100%; position: relative; }

  .brand { position: absolute; left: calc(72 * var(--u)); top: calc(9 * var(--u)); }
  .brand img { width: calc(218 * var(--u)); }
  .brand__tag { font-size: max(.75rem, calc(14 * var(--u))); margin-top: calc(3 * var(--u)); }

  .nav-toggle { display: none; }

  .header-phone {
    position: absolute; left: calc(932 * var(--u)); top: calc(22 * var(--u));
    height: auto; margin: 0; padding: calc(6 * var(--u)) 0; gap: calc(8 * var(--u));
    background: none; box-shadow: none; border-radius: 0;
    color: var(--color-navy); font-size: calc(18.5 * var(--u)); line-height: 1.4; font-weight: 600; letter-spacing: -.02em;
  }
  .header-phone svg { width: calc(20 * var(--u)); height: calc(20 * var(--u)); color: var(--color-orange); }
  .header-phone:hover { color: var(--color-orange); }
  .header-phone::before {
    content: ""; position: absolute; left: calc(-16 * var(--u)); top: 50%;
    width: 1px; height: calc(22 * var(--u)); transform: translateY(-50%);
    background: var(--color-border);
  }

  .primary-nav {
    display: contents;
  }
  .primary-nav__list {
    position: absolute; left: calc(330 * var(--u)); top: calc(22 * var(--u));
    display: flex; align-items: center; gap: calc(30 * var(--u));
  }
  .primary-nav__link {
    width: auto; padding: calc(6 * var(--u)) 0;
    font-size: calc(18.5 * var(--u)); line-height: 1.4; letter-spacing: -.03em;
  }
  .primary-nav__link svg { width: calc(15 * var(--u)); height: calc(15 * var(--u)); }
  .primary-nav__link[aria-current] { color: var(--color-navy); }
  .primary-nav__link[aria-current]::after,
  .primary-nav__link:not(.submenu-toggle):hover::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: calc(-6 * var(--u));
    height: calc(3 * var(--u)); border-radius: 3px; background: var(--color-orange);
  }
  .primary-nav__link:hover { color: var(--color-navy); }

  .has-submenu { position: relative; }
  .submenu {
    position: absolute; top: calc(100% + 12px); left: -1rem;
    min-width: 15rem; padding: .5rem;
    background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
  }
  .submenu a { padding: .6rem .9rem; border-radius: var(--radius-sm); font-size: .95rem; }
  .submenu a:hover { background: var(--color-surface); }

  .header-cta {
    position: absolute; left: calc(1242 * var(--u)); top: calc(16 * var(--u));
    width: calc(245 * var(--u)); height: calc(52 * var(--u));
    margin: 0; padding: 0;
    font-size: calc(18 * var(--u)); font-weight: 500; letter-spacing: -.02em;
    gap: calc(12 * var(--u));
  }
  .header-cta svg { width: calc(27 * var(--u)); height: calc(27 * var(--u)); }
}

/* ---------- Desktop sticky: same layout, pinned as a compact white bar ---------- */
@container page (min-width: 1100px) {
  .site-header.is-stuck {
    position: fixed; top: 0;
    height: calc(76 * var(--u));
    background: transparent; box-shadow: none; backdrop-filter: none;
    animation: header-in .3s var(--ease);
  }
  .site-header.is-stuck::before {
    content: ""; position: absolute; z-index: -1; top: 0; bottom: 0; left: -50vw; right: -50vw;
    background: rgba(255,255,255,.94); box-shadow: 0 6px 22px rgba(20, 46, 82, .1);
  }
  @supports (backdrop-filter: blur(8px)) {
    .site-header.is-stuck::before { background: rgba(255,255,255,.93); backdrop-filter: blur(14px) saturate(1.4); }
  }
  .site-header.is-stuck .site-header__inner { padding: 0; }
  .is-stuck .brand { top: calc(14 * var(--u)); }
  .is-stuck .brand img { width: calc(185 * var(--u)); }
  .is-stuck .primary-nav__list, .is-stuck .header-phone { top: calc(19 * var(--u)); }
  .is-stuck .header-phone { height: auto; }
  .is-stuck .header-cta { top: calc(12 * var(--u)); }
}
@keyframes header-in { from { transform: translate(-50%, -100%); } to { transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .site-header.is-stuck { animation: none; } }

/* Pages without the full-width hero (privacy, 404): on desktop the header floats over the page,
   so reserve its height. On phones the header is in the normal flow and this is not needed. */
.header-spacer { display: none; }
@container page (min-width: 1100px) {
  .header-spacer { display: block; height: calc(84 * clamp(0.716px, 100cqw / 1536, 1.25px)); }
}
