/* Specialeyes Eyecare navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: var(--white);
  box-shadow: 0 2px 10px rgba(15, 23, 42, .08);
  overflow: visible;
}

.top-bar {
  border-bottom: 1px solid rgba(148, 163, 184, .35);
  color: var(--muted);
  font-size: .86rem;
}

.top-bar .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .5rem 0;
  flex-wrap: wrap;
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 0;
  overflow: visible;
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 260px;
}

.brand img { height: 44px; width: auto; border-radius: 10px; }
.brand .name { display: flex; flex-direction: column; line-height: 1.1; }
.brand .name strong { color: var(--primary-dark); font-size: 1.05rem; }
.brand .name span { color: var(--muted); font-size: .85rem; }

.nav-toggle {
  display: none;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(148, 163, 184, .5);
  background: var(--white);
  padding: .55rem .75rem;
  border-radius: 12px;
  font-weight: 900;
  cursor: pointer;
}

.nav { overflow: visible; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav > ul {
  display: flex;
  align-items: center;
  gap: 1.15rem;
}

.nav li { position: relative; }
.nav a {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 44px;
  padding: .55rem .7rem;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--primary);
  background: rgba(13, 110, 253, .08);
}

/* .active is already used in the supplied HTML; aria-current also works. */
.nav a.active,
.nav a[aria-current="page"],
.nav a[aria-current="location"] {
  color: var(--primary);
  background: rgba(13, 110, 253, .08);
  box-shadow: inset 0 -3px 0 var(--primary);
}

.nav a:focus-visible,
.nav-toggle:focus-visible,
.nav-cta a:focus-visible {
  outline: 3px solid #f2b544;
  outline-offset: 3px;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.dropdown-wrap { position: relative; }
.dropdown-toggle { display: inline-flex; align-items: center; gap: .35rem; }
.caret { font-size: .9em; opacity: .8; transition: transform 160ms ease; }

/* Explicitly block the submenu so it doesn't inherit the top-level flex row. */
.nav ul.dropdown-menu {
  position: absolute;
  /* Keep the menu connected to the trigger so the hover state doesn't break. */
  top: 100%;
  left: 0;
  z-index: 99999;
  display: block;
  width: 270px;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: var(--white);
  border: 1px solid rgba(148, 163, 184, .35);
  border-radius: 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-10px);
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, transform 220ms ease, visibility 0s linear 220ms;
}

.dropdown-menu a {
  display: flex;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-menu a:hover,
.dropdown-menu a:focus-visible {
  background: rgba(13, 110, 253, .08);
  color: var(--primary);
}

.dropdown-menu a.active,
.dropdown-menu a[aria-current="page"],
.dropdown-menu a[aria-current="location"] {
  box-shadow: inset 3px 0 0 var(--primary);
}

@media (min-width: 961px) {
  .dropdown-wrap:hover > .dropdown-menu,
  .dropdown-wrap:focus-within > .dropdown-menu,
  .dropdown-menu.open {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
    transition: opacity 180ms ease, transform 220ms ease, visibility 0s;
  }

  .dropdown-wrap:hover > .dropdown-toggle .caret,
  .dropdown-wrap:focus-within > .dropdown-toggle .caret {
    transform: rotate(180deg);
  }
}

@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .nav { display: none; width: 100%; }
  .nav.open { display: block; }
  .nav-row { flex-wrap: wrap; align-items: flex-start; }
  .nav > ul { flex-direction: column; align-items: stretch; gap: .25rem; padding: .75rem 0; }
  .nav > ul > li > a { width: 100%; }
  .nav-cta { width: 100%; justify-content: flex-start; gap: .75rem; flex-wrap: wrap; }

  .nav ul.dropdown-menu {
    position: static;
    display: none;
    width: 100%;
    padding: .25rem 0 .35rem .75rem;
    border: 0;
    box-shadow: none;
    opacity: 1;
    transform: none;
    visibility: visible;
    pointer-events: auto;
    transition: none;
  }

  .nav ul.dropdown-menu.open { display: block; }
  .dropdown-menu a { white-space: normal; }
}

@media (max-width: 600px) {
  .brand { min-width: 0; max-width: 100%; }
  .brand .name { min-width: 0; }
}

/* Leave room for the sticky header when jumping to in-page sections. */
main section[id] { scroll-margin-top: 8rem; }

@media (prefers-reduced-motion: reduce) {
  .nav a, .dropdown-menu, .caret { transition: none; }
}
