/*
NRS TABLE OF CONTENTS
NRS-NAV-001 GitHub dropdown aligned with Bionomic global navigation.
NRS-NAV-002 Keyboard/focus and pointer interaction states.
NRS-NAV-003 Mobile navigation layout and touch behavior.
*/

.nav-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-dropdown-toggle {
  appearance: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.nav-menu .nav-dropdown-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--text-soft, #afbfd4);
  background: transparent;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.site-nav-links .nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  color: #afbfd4;
  background: transparent;
  transition: 220ms ease;
  font-size: .94rem;
}

.nav-dropdown-toggle:hover,
.nav-dropdown-toggle:focus-visible,
.nav-dropdown.open > .nav-dropdown-toggle,
.nav-dropdown:focus-within > .nav-dropdown-toggle {
  color: var(--text-main, #eef4ff);
  background: rgba(255,255,255,.06);
  outline: none;
}

.nav-dropdown-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 180ms ease;
}

.nav-dropdown.open .nav-dropdown-chevron,
.nav-dropdown:focus-within .nav-dropdown-chevron {
  transform: rotate(225deg) translate(-2px,-1px);
}

.nav-dropdown-menu {
  position: absolute;
  z-index: 5000;
  top: calc(100% + 8px);
  right: 0;
  width: min(330px, calc(100vw - 32px));
  padding: 8px;
  display: grid;
  gap: 4px;
  border: 1px solid rgba(120,160,210,.20);
  border-radius: 16px;
  background: rgba(7,17,29,.98);
  box-shadow: 0 22px 60px rgba(0,0,0,.42);
  backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px) scale(.985);
  transform-origin: top right;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.nav-dropdown-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -9px;
  height: 9px;
}

.nav-dropdown.open .nav-dropdown-menu,
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.nav-dropdown-menu a,
.site-nav-links .nav-dropdown-menu a {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 2px 12px;
  min-height: 0;
  padding: 11px 12px;
  border-radius: 11px;
  color: #dbe8f8;
  background: transparent;
  text-decoration: none;
  line-height: 1.25;
  text-align: left;
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a:focus-visible,
.site-nav-links .nav-dropdown-menu a:hover,
.site-nav-links .nav-dropdown-menu a:focus-visible {
  color: #fff;
  background: rgba(47,211,255,.08);
  outline: 1px solid rgba(47,211,255,.18);
  text-decoration: none;
}

.nav-dropdown-menu strong {
  font-size: .91rem;
  font-weight: 700;
}

.nav-dropdown-menu small {
  grid-column: 1 / -1;
  color: #8393ab;
  font-size: .76rem;
}

.nav-dropdown-external {
  align-self: center;
  color: #6ee7f9;
  font-size: .82rem;
}

@media (max-width: 900px) {
  .nav-dropdown {
    width: 100%;
    display: block;
  }

  .nav-menu .nav-dropdown-toggle,
  .site-nav-links .nav-dropdown-toggle {
    width: 100%;
    justify-content: flex-start;
    min-height: 46px;
  }

  .nav-dropdown-menu {
    position: static;
    width: 100%;
    margin-top: 4px;
    display: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    box-shadow: none;
    background: rgba(255,255,255,.035);
  }

  .nav-dropdown:hover .nav-dropdown-menu {
    display: none;
  }

  .nav-dropdown.open .nav-dropdown-menu,
  .nav-dropdown:focus-within .nav-dropdown-menu {
    display: grid;
  }
}
