/*
 * Features menu in the floating header, shared by the React homepage
 * (src/components/Header.tsx) and the generated static pages
 * (scripts/site-shell.mjs). Opens on hover, keyboard focus or click; the
 * trigger's aria-expanded is kept in sync by the page script. Tokens only.
 */

/* The panel positions against the fixed header, not the trigger, so it
   sits centred under the whole bar. */
.nav-menu {
  position: static;
  display: inline-flex;
  align-items: center;
}

.nav-menu__trigger {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 6px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--color-text-primary);
  cursor: pointer;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.nav-menu__trigger svg {
  width: 12px;
  height: 12px;
  transition: transform 180ms var(--ease-out, ease);
}

.nav-menu[data-open="true"] .nav-menu__trigger svg,
.nav-menu:hover .nav-menu__trigger svg {
  transform: rotate(180deg);
}

.nav-menu__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  display: none;
  width: min(1040px, calc(100vw - 32px));
  padding: 24px 28px 20px;
  text-align: left;
  border: 1px solid var(--color-border-subtle);
  border-radius: 20px;
  background: var(--color-surface-raised);
  box-shadow:
    0 1px 2px var(--color-shadow-subtle),
    0 30px 60px -30px var(--color-shadow-strong);
  transform: translateX(-50%);
}

/* A hover gap would close the menu on the way down: bridge it. */
.nav-menu__panel::before {
  position: absolute;
  top: -12px;
  right: 0;
  left: 0;
  height: 12px;
  content: "";
}

.nav-menu:hover .nav-menu__panel,
.nav-menu:focus-within .nav-menu__panel,
.nav-menu[data-open="true"] .nav-menu__panel {
  display: block;
}

.nav-menu__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px 32px;
}

.nav-menu__hub {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* Header rules give nav anchors 44px rows and centred text; the panel
   resets both so its lists read as lists. */
.site-header__nav .nav-menu__panel a,
.nav-menu__panel a {
  min-height: 0;
  padding: 0;
  text-align: left;
  justify-content: flex-start;
  line-height: 1.3;
}

.nav-menu__panel .nav-menu__all {
  min-height: 36px;
}

.nav-menu__hub-link {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.nav-menu__hub-link:hover {
  text-decoration: underline;
  text-decoration-color: var(--color-signal-underline);
  text-underline-offset: 4px;
}

.nav-menu__hub ul {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-menu__hub li a {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  color: var(--color-text-secondary);
  font-size: 13.5px;
  font-weight: 400;
  text-decoration: none;
}

.nav-menu__hub li a:hover,
.nav-menu__hub li a:focus-visible {
  color: var(--color-text-primary);
  text-decoration: underline;
  text-decoration-color: var(--color-signal-underline);
  text-underline-offset: 4px;
}

.nav-menu__all {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border-subtle);
  width: 100%;
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.nav-menu__all:hover {
  text-decoration: underline;
  text-decoration-color: var(--color-signal-underline);
  text-underline-offset: 4px;
}

@media (max-width: 1000px) {
  .nav-menu__panel {
    display: none !important;
  }
}
