/* Header styles scoped to .site-header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(180deg, rgba(5,8,12,0.92) 0%, rgba(5,8,12,0.88) 60%, rgba(5,8,12,0.82) 100%);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(120,120,160,0.2);
}
.site-header .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
}

/* Brand */
.site-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}
.site-header .brand-mark {
  color: #7d5cff;
  font-size: 1.1rem;
  transform: translateY(1px);
}
.site-header .brand-text {
  font-family: 'VT323', monospace;
  font-size: 1.6rem;
  line-height: 1;
  letter-spacing: 0.5px;
  color: #e8e9ef;
  text-shadow: 0 0 6px rgba(125,92,255,0.35);
}

/* Navigation */
.primary-nav .nav-list {
  display: flex;
  align-items: center;
  gap: clamp(0.6rem, 2.2vw, 1.2rem);
  list-style: none;
  margin: 0;
  padding: 0;
}
.primary-nav a {
  position: relative;
  display: inline-block;
  padding: 0.55rem 0.2rem;
  color: #cfd3e6;
  text-decoration: none;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 600;
}
.primary-nav a:hover,
.primary-nav a:focus-visible {
  color: #ffffff;
}
.primary-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.2rem;
  height: 2px;
  background: linear-gradient(90deg, transparent, #7d5cff 40%, #00e5ff 60%, transparent);
  opacity: 0;
  transform: scaleX(0.5);
  transition: opacity 160ms ease, transform 160ms ease;
}
.primary-nav a:hover::after,
.primary-nav a:focus-visible::after,
.primary-nav a[aria-current="page"]::after {
  opacity: 1;
  transform: scaleX(1);
}

/* Toggle */
.nav-toggle {
  position: relative;
  display: none; /* visible on small screens */
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid rgba(125,92,255,0.35);
  background: rgba(20,24,32,0.6);
  color: #e6e8f2;
  border-radius: 8px;
  cursor: pointer;
}
.nav-toggle:hover,
.nav-toggle:focus-visible {
  border-color: #7d5cff;
  box-shadow: 0 0 0 3px rgba(125,92,255,0.25);
}
.nav-toggle .toggle-label {
  font: 600 0.95rem/1 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
.nav-toggle .toggle-icon {
  width: 0;
  height: 0;
  position: relative;
}
.nav-toggle .toggle-icon::before,
.nav-toggle .toggle-icon::after,
.nav-toggle .toggle-icon { /* middle bar using background */
  content: "";
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #7d5cff, #00e5ff);
  border-radius: 2px;
}
.nav-toggle .toggle-icon { top: 6px; }
.nav-toggle .toggle-icon::before { top: -6px; }
.nav-toggle .toggle-icon::after { top: 6px; }

/* Responsive behavior: progressive enhancement */
@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  /* If JS is enabled, collapse the menu initially on small screens */
  .js .primary-nav { display: none; }
  .js .primary-nav.is-open { display: block; }

  /* full-bleed backdrop while keeping menu items constrained to content width */
  .primary-nav.is-open {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: linear-gradient(180deg, rgba(11,14,19,0.98) 0%, rgba(9,12,18,0.96) 100%);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(125,92,255,0.25);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  }

  /* Constrain the list of links to the site's content width so spacing matches other pages */
  .primary-nav.is-open .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    /* match site container width and padding */
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1rem 1.25rem;
    box-sizing: border-box;
    width: 100%;
  }

  /* make each list item visually separated and full-width within the constrained container */
  .primary-nav.is-open .nav-item {
    border-bottom: 1px solid rgba(255,255,255,0.05);
    width: 100%;
  }
  .primary-nav.is-open .nav-item:last-child {
    border-bottom: none;
  }

  .primary-nav.is-open a { 
    display: block;
    padding: 1rem 0.75rem;
    border-radius: 8px;
    transition: background 200ms ease, color 200ms ease;
    width: 100%;
    box-sizing: border-box;
  }
  .primary-nav.is-open a:hover,
  .primary-nav.is-open a:focus-visible {
    background: rgba(125,92,255,0.12);
    color: #ffffff;
  }
  .primary-nav.is-open a[aria-current="page"] {
    background: rgba(125,92,255,0.15);
    color: #ffffff;
    font-weight: 700;
  }
  .primary-nav.is-open a::after {
    display: none;
  }

  /* ensure the nav does not overlap other fixed elements when open on small screens */
  .site-header + .primary-nav.is-open,
  .site-header + header + .primary-nav.is-open { z-index: 1001; }
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0.5rem;
  padding: 0.6rem 0.8rem;
  z-index: 1100;
  background: #0b0f13;
  color: #fff;
  border: 2px solid #7d5cff;
  border-radius: 8px;
}

/* High-contrast focus utility for any focusable item in header */
.site-header a:focus-visible,
.site-header button:focus-visible {
  outline: 2px solid #7d5cff;
  outline-offset: 2px;
  border-radius: 6px;
}
