/* ==========================================================================
   header.css — SITE HEADER & MAIN NAVIGATION
   <header id="site-header"> → .site-logo, #site-navigation, #nav-toggle, #nav-menu
   Mobile styles are the default. The horizontal menu starts at 1024px
   (css/responsive.css). That matches SITE_CONFIG.desktopNavMinWidth.
   ========================================================================== */

#site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--color-bg-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: var(--border-width) solid var(--color-border-subtle);
  transition: box-shadow var(--transition-base);
}

/* Added by navigation.js after the page is scrolled */
#site-header.is-scrolled {
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  gap: var(--space-sm);
}

#site-navigation {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

/* Logo / site name link */
.site-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: var(--button-min-height);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-heading);
  color: var(--color-text-primary);
  text-decoration: none;
}

.site-logo:hover,
.site-logo:focus-visible {
  color: var(--color-text-primary);
  text-decoration: none;
}

.site-logo-text {
  color: var(--color-text-primary);
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
  .site-logo-text,
  .footer-brand {
    background-image: var(--gradient-neon);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

/* Hamburger button (mobile only) */
#nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: var(--border-width) solid var(--color-border-default);
}

.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-text-primary);
  border-radius: var(--radius-pill);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.nav-toggle-bar {
  position: relative;
}

.nav-toggle-bar::before,
.nav-toggle-bar::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle-bar::before { top: -6px; }
.nav-toggle-bar::after  { top: 6px; }

#nav-toggle[aria-expanded="true"] .nav-toggle-bar {
  background: transparent;
}

#nav-toggle[aria-expanded="true"] .nav-toggle-bar::before {
  transform: translateY(6px) rotate(45deg);
}

#nav-toggle[aria-expanded="true"] .nav-toggle-bar::after {
  transform: translateY(-6px) rotate(-45deg);
}

/* Menu list */
#nav-menu {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-md);
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: var(--button-min-height);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--color-text-primary);
  background: var(--color-bg-card-hover);
  text-decoration: none;
}

/* Current page link (set with aria-current="page" in each HTML file) */
.nav-link[aria-current="page"] {
  color: var(--color-text-primary);
  background: color-mix(in srgb, var(--color-accent-primary) 16%, transparent);
  box-shadow: inset 0 0 0 var(--border-width) var(--color-border-accent);
}

/* --------------------------------------------------------------------------
   Collapsible mobile menu — only when JavaScript is running.
   Without JS, the menu stays visible so every link remains usable.
   -------------------------------------------------------------------------- */
.js #nav-toggle {
  display: inline-flex;
}

.js #nav-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: var(--z-mobile-menu);
  flex-direction: column;
  flex-wrap: nowrap;
  gap: var(--space-2xs);
  width: 100%;
  max-width: 100%;
  max-height: calc(100dvh - var(--header-height));
  margin: 0;
  padding: var(--space-sm) var(--page-gutter) var(--space-md);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--color-bg-secondary);
  border-bottom: var(--border-width) solid var(--color-border-accent);
  box-shadow: var(--shadow-lg);
}

.js #nav-menu .nav-link {
  width: 100%;
  padding-inline: var(--space-md);
  white-space: normal;
}

.js #nav-menu.is-open {
  display: flex;
}
