.nav-locations {
  position: relative;
}

.nav-locations-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-primary);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.nav-locations-toggle:hover,
.nav-locations-toggle[aria-expanded="true"] {
  color: #9a4c00;
}

.nav-locations-toggle:focus-visible,
.nav-locations-panel a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 5px;
  border-radius: 4px;
}

.nav-locations-toggle svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.nav-locations-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.nav-locations-panel {
  position: absolute;
  top: calc(100% + 1.1rem);
  right: 0;
  z-index: 1;
  width: min(610px, calc(100vw - 2rem));
  max-height: calc(100dvh - 160px);
  overflow-y: auto;
  padding: 1.25rem;
  border: 1px solid rgba(0, 47, 109, 0.13);
  border-top: 3px solid var(--color-accent);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.nav-locations-panel[hidden] {
  display: none;
}

.nav-locations-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-locations-list li {
  margin: 0;
  padding: 0;
}

.nav-locations .nav-locations-link,
.nav-locations-pending {
  display: block;
  padding: 0.7rem 0.8rem;
  border-radius: 8px;
  font-size: 0.84rem;
  line-height: 1.5;
}

.nav-locations .nav-locations-link {
  color: var(--color-primary);
  background: var(--color-bg);
  font-weight: 700;
}

.nav-locations .nav-locations-link:hover,
.nav-locations .nav-locations-link:focus-visible {
  background: #fff3e3;
  color: var(--color-primary);
}

.nav-locations .nav-locations-link[aria-current="page"] {
  box-shadow: inset 3px 0 0 var(--color-accent);
}

.nav-locations-label {
  margin: 1rem 0.8rem 0.25rem;
  color: var(--color-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.nav-locations-pending {
  color: var(--color-muted);
  cursor: default;
}

.footer-links {
  align-items: center;
}

.footer-links .nav-locations-toggle {
  color: #dce7ff;
}

.footer-links .nav-locations-toggle:hover,
.footer-links .nav-locations-toggle[aria-expanded="true"] {
  color: #ffbd63;
}

.footer-links .nav-locations-toggle:focus-visible {
  outline-color: #ffbd63;
}

@media (min-width: 861px) {
  .site-nav > a {
    white-space: nowrap;
  }

  .footer-links .nav-locations-panel {
    top: auto;
    right: auto;
    bottom: calc(100% + 0.8rem);
    left: 0;
    z-index: 5;
  }

  .footer-links .nav-locations-toggle svg {
    transform: rotate(180deg);
  }

  .footer-links .nav-locations-toggle[aria-expanded="true"] svg {
    transform: rotate(0deg);
  }
}

@media (max-width: 860px) {
  .site-header .site-nav {
    position: absolute;
    top: 100%;
    right: 1rem;
    left: 1rem;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
    max-height: calc(100dvh - 140px);
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid rgba(0, 47, 109, 0.15);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow-soft);
  }

  .site-header .site-nav.open {
    display: flex;
  }

  .site-header .nav-toggle {
    display: inline-grid;
    place-items: center;
  }

  .nav-locations-toggle {
    width: 100%;
    justify-content: space-between;
    min-height: 30px;
    text-align: left;
  }

  .nav-locations-panel {
    position: static;
    width: 100%;
    max-height: none;
    margin-top: 0.75rem;
    padding: 0.65rem;
    border: 1px solid rgba(0, 47, 109, 0.12);
    border-radius: 10px;
    box-shadow: none;
  }

  .footer-nav-row {
    align-items: stretch;
    flex-direction: column;
  }

  .footer-links {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.25rem;
  }

  .footer-links > a,
  .footer-links .nav-locations-toggle {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .footer-tools {
    align-self: flex-end;
  }
}

@media (max-width: 600px) {
  .nav-locations-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 0.5rem;
  }

  .nav-locations .nav-locations-link {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 76px;
    padding: 0.65rem 0.35rem;
    font-size: 0.78rem;
    line-height: 1.4;
    text-align: center;
    overflow-wrap: anywhere;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-locations-toggle svg,
  .nav-locations .nav-locations-link {
    transition: none;
  }
}
