/* One restrained, persistent header across every template. */
html { scroll-padding-top: 82px; }

body .mg-unified-header {
  --mg-header-canvas: #f6f4ee;
  --mg-header-ink: #12343a;
  --mg-header-accent: #14b8c6;
  color: var(--mg-header-ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body .mg-unified-header.legacy-header--inner {
  min-height: 92px;
  padding: 92px 0 0;
  background: var(--mg-header-canvas);
  border-bottom: 1px solid rgba(18, 52, 58, .09);
}

body .mg-unified-header .legacy-top-panel {
  position: fixed;
  z-index: 300;
  top: 0;
  right: 0;
  left: 0;
  background: rgba(246, 244, 238, .97);
  border-bottom: 1px solid rgba(18, 52, 58, .09);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: box-shadow .32s ease, background-color .32s ease;
}

body.admin-bar .mg-unified-header .legacy-top-panel {
  top: var(--wp-admin--admin-bar--height, 32px);
}

body .mg-unified-header .legacy-top-panel.is-compact {
  background: rgba(246, 244, 238, .98);
  box-shadow: 0 12px 28px rgba(18, 52, 58, .10);
}

body .mg-unified-header .legacy-top-panel__grid {
  position: relative;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  width: min(1440px, calc(100vw - 96px));
  max-width: none;
  min-height: 92px;
  margin: 0 auto;
  padding: 9px 0;
  background: transparent;
  box-shadow: none;
  transition: min-height .32s ease, padding .32s ease;
}

body .mg-unified-header .legacy-top-panel.is-compact .legacy-top-panel__grid {
  min-height: 64px;
  padding: 5px 0;
}

body .mg-unified-header .mg-site-logo {
  position: static;
  grid-column: 1;
  display: flex;
  align-items: center;
  width: 272px;
  min-height: 0;
  padding: 7px 10px;
  background: rgba(18, 52, 58, .92);
  border-radius: 7px;
  transition: padding .32s ease;
}

body .mg-unified-header .mg-site-logo img {
  display: block;
  width: 100%;
  height: auto;
  filter: url(img/hero-logo-tone.svg#brand-tone);
}

body .mg-unified-header .legacy-top-panel.is-compact .mg-site-logo {
  padding: 4px 7px;
}

body .mg-unified-header .primary-navigation {
  grid-column: 2;
  justify-self: center;
  margin: 0;
}

body .mg-unified-header .primary-navigation > ul {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: clamp(14px, 1.55vw, 25px);
}

body .mg-unified-header .primary-navigation li { margin: 0; }

body .mg-unified-header .primary-navigation > ul > li > a {
  position: relative;
  display: block;
  padding: 16px 0;
  color: var(--mg-header-ink);
  font-size: .84rem;
  font-weight: 550;
  letter-spacing: -.01em;
  text-transform: none;
  white-space: nowrap;
}

body .mg-unified-header .primary-navigation > ul > li > a::after {
  position: absolute;
  right: 0;
  bottom: 8px;
  left: 0;
  height: 2px;
  background: var(--mg-header-accent);
  border-radius: 2px;
  content: "";
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .22s ease;
}

body .mg-unified-header .primary-navigation .current-menu-item > a,
body .mg-unified-header .primary-navigation a:hover,
body .mg-unified-header .primary-navigation a:focus-visible { color: var(--mg-header-ink); }

body .mg-unified-header .primary-navigation > ul > li > a:hover::after,
body .mg-unified-header .primary-navigation > ul > li > a:focus-visible::after,
body .mg-unified-header .primary-navigation > ul > .current-menu-item > a::after { transform: scaleX(1); }

body .mg-unified-header .primary-navigation .sub-menu {
  top: 100%;
  width: 310px;
  padding: 12px;
  background: rgba(251, 252, 248, .99);
  border: 0;
  border-radius: 20px;
  box-shadow: 0 24px 55px rgba(18, 52, 58, .15);
}

body .mg-unified-header .primary-navigation .sub-menu li,
body .mg-unified-header .primary-navigation .sub-menu li:hover {
  margin: 0;
  padding: 0;
  border: 0;
}

body .mg-unified-header .primary-navigation .sub-menu a {
  display: block;
  padding: 11px 12px;
  color: var(--mg-header-ink);
  border-radius: 12px;
  font-size: .84rem;
  font-weight: 500;
}

body .mg-unified-header .primary-navigation .sub-menu a:hover,
body .mg-unified-header .primary-navigation .sub-menu a:focus-visible {
  background: #e6f4f2;
}

body .mg-unified-header .legacy-header-contact {
  grid-column: 3;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 1px 16px;
  min-width: 0;
  padding: 4px 7px 4px 13px;
  background: rgba(13, 48, 54, .88);
  border-radius: 15px;
  text-align: left;
}

body .mg-unified-header .legacy-header-contact__phone,
body .mg-unified-header.legacy-header--home .legacy-header-contact__phone {
  grid-column: 1;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.025em;
  white-space: nowrap;
}

body .mg-unified-header .legacy-header-contact__phone:hover { color: var(--mg-header-accent); }

/* Keep phone digits visible when a replacement script adds inline fading styles. */
body a[href^="tel:"] small { opacity: 1 !important; }

body .mg-unified-header .legacy-header-contact__callback {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: auto;
  min-width: 145px;
  min-height: 46px;
  max-width: none;
  margin: 0;
  padding: 7px 8px 7px 18px;
  color: #fff;
  background: var(--mg-header-accent);
  border: 0;
  border-radius: 999px;
  font-size: .66rem;
  font-weight: 650;
  letter-spacing: .055em;
  text-transform: uppercase;
}

body .mg-unified-header .legacy-header-contact__callback::after {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #087d89;
  background: #fff;
  border-radius: 50%;
  content: "\2197";
  font-size: 1rem;
}

body .mg-unified-header .legacy-header-contact__callback:hover,
body .mg-unified-header .legacy-header-contact__callback:focus-visible {
  color: #fff;
  background: #087d89;
}

body .mg-unified-header .legacy-header-contact p {
  grid-column: 1;
  margin: 0;
  color: rgba(255, 255, 255, .78);
  font-size: .61rem;
  font-weight: 550;
  letter-spacing: .035em;
  text-transform: uppercase;
  white-space: nowrap;
}

body .mg-unified-header a:focus-visible,
body .mg-unified-header button:focus-visible {
  outline: 3px solid var(--mg-header-accent);
  outline-offset: 4px;
}

@media (max-width: 1380px) {
  body .mg-unified-header .legacy-header-contact__callback { display: none; }
  body .mg-unified-header .legacy-header-contact { display: block; }
}

@media (max-width: 1180px) {
  body .mg-unified-header .legacy-top-panel__grid { width: calc(100vw - 48px); }
}

@media (max-width: 1020px) {
  body .mg-unified-header .legacy-top-panel {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  body .mg-unified-header.legacy-header--inner {
    min-height: 68px;
    padding-top: 68px;
  }

  body .mg-unified-header .legacy-top-panel__grid,
  body .mg-unified-header .legacy-top-panel.is-compact .legacy-top-panel__grid {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 56px;
    gap: 8px;
    width: calc(100vw - 32px);
    min-height: 68px;
    padding: 6px 0 6px 48px;
  }

  body .mg-unified-header .mg-site-logo,
  body .mg-unified-header .legacy-top-panel.is-compact .mg-site-logo {
    position: static;
    grid-column: 1;
    grid-row: 1;
    width: 166px;
    max-width: 100%;
    padding: 5px 7px;
  }

  body .mg-unified-header .menu-toggle {
    position: absolute;
    z-index: 112;
    top: 18px;
    left: 0;
    display: block;
    width: 38px;
    height: 34px;
  }

  body .mg-unified-header .menu-toggle span:not(.screen-reader-text),
  body.menu-open .mg-unified-header .menu-toggle span:not(.screen-reader-text) {
    background: var(--mg-header-ink);
    border-radius: 3px;
  }

  body .mg-unified-header .primary-navigation {
    position: fixed;
    z-index: 100;
    inset: 68px 0 0;
    display: none;
    width: 100%;
    margin: 0;
    overflow-y: auto;
    padding: 24px 24px 44px;
    background: rgba(246, 244, 238, .99);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  body .mg-unified-header .primary-navigation.is-open {
    display: block;
    width: 100%;
    background: rgba(246, 244, 238, .99);
  }

  body .mg-unified-header .primary-navigation > ul,
  body .mg-unified-header .primary-navigation.is-open > ul {
    display: block;
    max-width: 760px;
    margin: 0 auto;
  }

  body .mg-unified-header .primary-navigation > ul > li > a,
  body .mg-unified-header .primary-navigation.is-open > ul > li > a {
    display: block;
    padding: 12px 0;
    color: var(--mg-header-ink);
    font-size: 1.28rem;
    font-weight: 600;
    letter-spacing: -.02em;
    text-transform: none;
  }

  body .mg-unified-header .primary-navigation .sub-menu,
  body .mg-unified-header .primary-navigation.is-open .sub-menu {
    position: static;
    display: block;
    width: auto;
    padding: 0 0 12px 18px;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
  }

  body .mg-unified-header .primary-navigation .sub-menu a,
  body .mg-unified-header .primary-navigation.is-open .sub-menu a {
    color: #5c7074;
  }

  body .mg-unified-header .legacy-header-contact,
  body .mg-unified-header .legacy-top-panel.is-compact .legacy-header-contact {
    position: relative;
    z-index: 111;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    display: block;
    min-width: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
  }

  body .mg-unified-header .legacy-header-contact__phone,
  body .mg-unified-header.legacy-header--home .legacy-header-contact__phone,
  body .mg-unified-header .legacy-top-panel.is-compact .legacy-header-contact__phone {
    color: var(--mg-header-ink);
    font-size: .93rem;
    line-height: 1.25;
  }

  body .mg-unified-header .legacy-header-contact__callback,
  body .mg-unified-header .legacy-header-contact p { display: none; }

  body.menu-open .mg-unified-header .menu-toggle::before { display: none; }
}

@media (max-width: 767px) {
  body .mg-unified-header .legacy-top-panel__grid,
  body .mg-unified-header .legacy-top-panel.is-compact .legacy-top-panel__grid {
    grid-template-rows: 56px;
    gap: 8px;
    width: calc(100vw - 24px);
    min-height: 68px;
    padding: 6px 0 6px 48px;
  }

  body .mg-unified-header .mg-site-logo,
  body .mg-unified-header .legacy-top-panel.is-compact .mg-site-logo { width: 150px; }
}

@media (max-width: 360px) {
  body .mg-unified-header .mg-site-logo,
  body .mg-unified-header .legacy-top-panel.is-compact .mg-site-logo { width: 112px; }

  body .mg-unified-header .legacy-header-contact__phone,
  body .mg-unified-header.legacy-header--home .legacy-header-contact__phone,
  body .mg-unified-header .legacy-top-panel.is-compact .legacy-header-contact__phone {
    font-size: .81rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  body .mg-unified-header .legacy-top-panel,
  body .mg-unified-header .legacy-top-panel__grid,
  body .mg-unified-header .mg-site-logo { transition: none; }
}
