/* Mobile navigation — Figma: Catalog — Mobile navigation (M / Nav bar, M / Menu link, M / Menu label, M / Account button).
   ≤1100px: the main links leave the bar and a menu button opens .mm, a full-screen panel under the nav bar.
   Links fade and slide in from the right in a quick stagger (--i × 40ms). A chevron item replaces the screen
   with its sub-level; the back arrow in the bar returns. Script: web/js/mobile-nav.js */

/* ---------------------------------------------------------------- bar */
.mm-toggle,
.mm-back {
  display: none;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--nav-text);
  cursor: pointer;
  border-radius: 8px;
}
.mm-toggle svg,
.mm-back svg {
  display: block;
  width: 24px;
  height: 24px;
}
.mm-toggle:focus-visible,
.mm-back:focus-visible {
  outline: 2px solid var(--teal-500);
  outline-offset: -2px;
}
/* two lines → ✕ */
.mm-toggle__icon {
  position: relative;
  display: block;
  width: 24px;
  height: 24px;
}
.mm-toggle__icon span {
  position: absolute;
  left: 4px;
  width: 16px;
  height: 1.8px;
  border-radius: 1px;
  background: currentColor;
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.mm-toggle__icon span:first-child {
  top: 8.1px;
}
.mm-toggle__icon span:last-child {
  top: 14.1px;
}
html.mm-open .mm-toggle__icon span:first-child {
  transform: translateY(3px) rotate(45deg) scaleX(1.06);
}
html.mm-open .mm-toggle__icon span:last-child {
  transform: translateY(-3px) rotate(-45deg) scaleX(1.06);
}
@media (prefers-reduced-motion: reduce) {
  .mm-toggle__icon span {
    transition: none;
  }
}

@media (max-width: 1390px) {
  /* mobile nav up to 1390px: the full desktop nav needs ~1390px */
  .nav-primary__inner {
    position: relative;
    gap: 0;
  }
  /* logo left; [NEW button] · search · menu kept together on the right (M / Nav bar · Closed) */
  .nav-primary__brand {
    display: contents;
  }
  .nav-primary .pcli-mark {
    order: 0;
    margin-right: auto;
  }
  .nav-primary__cta {
    order: 1;
    margin: 0 12px 0 0;
  }
  .nav-primary__brand > .nav-search {
    order: 2;
    margin-left: 0;
    width: 48px;
    height: 48px;
    padding: 0;
    justify-content: center;
  }
  .mm-toggle {
    display: flex;
    order: 3;
  }
  .mm-back:not([hidden]) {
    display: flex;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
  }
  /* open: no logo, no search or NEW button — just ✕ (and ‹ on a sub-level) */
  html.mm-open .pcli-mark,
  html.mm-open .nav-primary__brand > .nav-search,
  html.mm-open .nav-primary__cta {
    visibility: hidden;
  }
}
/* phone bar — 56px, smaller mark, 56px-tall touch targets (M / Nav bar · Closed) */
@media (max-width: 720px) {
  .nav-primary {
    height: 56px;
  }
  .nav-primary.wrap {
    padding-left: 12px;
    padding-right: 0;
  }
  /* M / Menu button: the whole 56px bar height is tappable, out to the right edge of the screen (icon unchanged) */
  .mm-toggle,
  .mm-back:not([hidden]) {
    width: 56px;
    height: 56px;
    border-radius: 0;
  }
  .nav-primary__brand > .nav-search {
    width: 48px;
    height: 56px;
  }
  /* PCLI_mark · mobile variant: 89×32 mark, "for" 10px on its own line, OPTOMETRIC / PHYSICIANS 15px Bold */
  .nav-primary .pcli-mark {
    gap: 7px;
    align-items: flex-end;
  }
  .nav-primary .pcli-mark img {
    width: 89px;
    height: 32px;
    margin: 0 3px;
  }
  .nav-primary .pcli-mark__tag {
    width: 106px;
    max-width: none;
    font-size: 10px;
    line-height: 11.7px;
    letter-spacing: -0.026em;
  }
  .nav-primary .pcli-mark__tag strong {
    display: block;
    font-size: 15px;
    line-height: 12.5px;
  }
  .nav-primary__brand > .nav-search svg {
    width: 20px;
    height: 20px;
  }
  .mm-back:not([hidden]) {
    left: -12px;
  }
}

/* ---------------------------------------------------------------- panel */
html.mm-open {
  overflow: hidden;
}
@media (max-width: 1390px) {
  /* mobile nav up to 1390px: the full desktop nav needs ~1390px */
  html {
    scrollbar-gutter: stable;
  }
} /* no sideways jump of the bar (and ✕) when the scrollbar goes away */
.mm {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: var(--mm-top, 56px);
  z-index: 39;
  background: var(--nav-bg);
  color: var(--nav-text);
  overflow: hidden;
}
.mm[hidden] {
  display: none;
}
@media (min-width: 1391px) {
  .mm {
    display: none !important;
  }
}
.mm__screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 24px 40px;
  -webkit-overflow-scrolling: touch;
}
.mm__screen[hidden] {
  display: none;
}
.mm ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
.mm-group {
  display: flex;
  flex-direction: column;
}
.mm .mm-group--secondary {
  padding-top: 28px;
} /* .mm ul resets padding, so these need the extra class */
.mm .mm-group--more {
  padding-top: 32px;
}
.mm__spacer {
  flex: 1 0 0;
  min-height: 0;
}
.mm__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding-top: 28px;
}

/* M / Menu link */
.mm-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 0;
  border: 0;
  background: none;
  color: var(--nav-text);
  font: inherit;
  font-weight: 500;
  line-height: normal;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.mm-link--primary {
  font-size: 28px;
  letter-spacing: -0.03em;
}
.mm-link--sub {
  padding: 9px 0;
  font-size: 24px;
  letter-spacing: -0.03em;
}
.mm-link--secondary {
  padding: 8px 0;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: #b6bdc3;
}
.mm-link__chev {
  flex: none;
  width: 20px;
  height: 20px;
  margin-left: auto;
  color: #b6bdc3;
}
.mm-link:hover {
  color: #fff;
}
.mm-link[aria-current='page'] {
  color: var(--teal-500);
}
.mm-link:focus-visible,
.mm-btn:focus-visible {
  outline: 2px solid var(--teal-500);
  outline-offset: 2px;
  border-radius: 4px;
}

/* M / Menu label */
.mm-label {
  margin: 0;
  padding-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  line-height: normal;
  text-transform: uppercase;
  color: #7d868d;
}

/* Submit a referral + M / Account button — 232px, 4px corners, centred */
.mm-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 232px;
  height: 45px;
  padding: 0 22px;
  border-radius: var(--r-sm, 4px);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.mm-btn--referral {
  background: var(--orange-600);
  color: var(--pcli-color-text-on-primary);
}
.mm-btn--account {
  background: rgba(255, 255, 255, 0.15);
  border: 0.5px solid #818181;
  color: var(--nav-text);
}
.mm-btn--account:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ---------------------------------------------------------------- motion: fade + slide from the right, staggered */
.mm-anim {
  opacity: 0;
  transform: translateX(24px);
  transition:
    opacity 0.28s ease,
    transform 0.36s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: calc(var(--i, 0) * 40ms);
}
.mm[data-dir='back'] .mm-anim {
  transform: translateX(-24px);
}
.mm[data-dir='open'] .mm-anim {
  transform: translateY(-12px);
} /* first open: fade down */
.mm__screen.is-in .mm-anim {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .mm-anim {
    transition: none;
    opacity: 1;
    transform: none;
  }
}

/* third level: a state's offices (Locations → Washington) — "Coming soon" note after the city */
.mm-link__note {
  margin-left: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  color: #f58220;
  white-space: nowrap;
}
