/* ------------------------------------------------ nav (liquid glass) */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  color: #fff;
  /* invisible at the very top of the page */
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-bottom: 1px solid transparent;
  box-shadow: none;
  transition:
    background 0.4s ease,
    border-color 0.4s ease,
    box-shadow 0.4s ease,
    -webkit-backdrop-filter 0.4s ease,
    backdrop-filter 0.4s ease;
}
/* frosted glass appears once scrolled (or when the mobile menu is open) */
.nav.scrolled,
.nav.open {
  background: rgba(20, 20, 19, 0.42);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  border-bottom-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 30px rgba(0, 0, 0, 0.16);
}
/* Fallback for browsers without backdrop-filter: near-opaque panel */
@supports not (
  (-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))
) {
  .nav.scrolled,
  .nav.open {
    background: rgba(20, 20, 19, 0.92);
  }
}

.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}
.nav .brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.nav .brand img {
  height: 22px;
  width: auto;
  display: block;
}

.nav ul {
  display: none;
  list-style: none;
  gap: 32px;
}
.nav ul a,
.nav ul button {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.82);
  transition: color 0.3s;
}
.nav ul a:hover {
  color: #fff;
}
@media (min-width: 768px) {
  .nav ul {
    display: flex;
  }
}

/* ----- mobile menu (hamburger + dropdown panel) ----- */
.nav-toggle {
  display: none;
  position: relative;
  width: 26px;
  height: 18px;
  padding: 0;
  cursor: pointer;
  background: none;
  border: 0;
  color: inherit;
}
.nav-toggle span {
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  background: currentColor;
  transition:
    transform 0.3s ease,
    opacity 0.2s ease,
    top 0.3s ease;
}
.nav-toggle span:nth-child(1) {
  top: 2px;
}
.nav-toggle span:nth-child(2) {
  top: 8px;
}
.nav-toggle span:nth-child(3) {
  top: 14px;
}
.nav.open .nav-toggle span:nth-child(1) {
  top: 8px;
  transform: rotate(45deg);
}
.nav.open .nav-toggle span:nth-child(2) {
  opacity: 0;
}
.nav.open .nav-toggle span:nth-child(3) {
  top: 8px;
  transform: rotate(-45deg);
}

@media (max-width: 767px) {
  .nav-toggle {
    display: block;
  }
  .nav.open ul {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 4px 24px 18px;
    background: rgba(20, 20, 19, 0.92);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    backdrop-filter: blur(18px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  }
  .nav.open ul li {
    width: 100%;
  }
  .nav.open ul a,
  .nav.open ul button {
    display: block;
    padding: 15px 0;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .nav.open ul a::after {
    display: none;
  }
}

/* ----- header dropdowns ----- */
/* Base (mobile-first): the submenu is a static, indented sub-list that
     sits inside the open mobile panel. Desktop turns it into a click-open
     frosted panel further down. */
.nav-item-dropdown {
  position: relative;
}
.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: rgba(255, 255, 255, 0.46);
  cursor: pointer;
}
.dropdown-trigger:hover,
.dropdown-trigger:focus-visible,
.nav-item-dropdown.is-open .dropdown-trigger,
.nav-item-dropdown:hover .dropdown-trigger {
  color: rgba(255, 255, 255, 0.66);
}
.dropdown-trigger:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.45);
  outline-offset: 6px;
}
.dropdown-caret {
  width: 6px;
  height: 6px;
  flex: none;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.6;
  transition:
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease;
}
.dropdown-menu a {
  text-decoration: none;
}
/* sub-items don't use the sliding-underline micro-interaction */
.dropdown-menu a::after {
  display: none;
}

@media (max-width: 767px) {
  .nav.open .dropdown-caret {
    display: none;
  }
  .nav.open .dropdown-menu {
    padding-left: 16px;
  }
  .nav.open .dropdown-menu a {
    display: block;
    padding: 13px 0;
    font-size: 12px;
    color: var(--txt-soft);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .nav.open .dropdown-menu a:hover {
    color: var(--txt);
  }
}

@media (min-width: 768px) {
  .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    z-index: 60;
    transform: translate(-50%, 6px);
    margin-top: 16px;
    min-width: 190px;
    display: flex;
    flex-direction: column;
    padding: 6px;
    /* same frosted-glass recipe as the scrolled nav + mobile panel */
    background: rgba(20, 20, 19, 0.92);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.06),
      0 18px 40px rgba(0, 0, 0, 0.28);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.26s ease,
      transform 0.26s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0.26s;
  }
  /* Opaque fallback where backdrop-filter is unsupported */
  @supports not (
    (-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))
  ) {
    .dropdown-menu {
      background: rgba(20, 20, 19, 0.97);
    }
  }
  /* invisible bridge so the cursor doesn't lose hover crossing the gap */
  .dropdown-menu::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -16px;
    height: 16px;
  }
  .nav-item-dropdown.is-open .dropdown-menu,
  .nav-item-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 0);
  }
  .nav-item-dropdown.is-open .dropdown-caret,
  .nav-item-dropdown:hover .dropdown-caret {
    transform: rotate(225deg);
    opacity: 1;
  }
  .dropdown-menu a {
    padding: 10px 14px;
    color: rgba(255, 255, 255, 0.82);
    border-left: 2px solid transparent;
    transition:
      color 0.25s ease,
      background 0.25s ease,
      border-color 0.25s ease;
  }
  .dropdown-menu a:hover,
  .dropdown-menu a:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--signal);
  }
}

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