/* Header, primary navigation and mobile menu */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 10, 42, 0.86);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(140, 130, 255, 0.14);
}

.site-header__inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover {
  color: var(--text);
}

.brand__logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.brand__name {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 1.875rem);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav__panel {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-right: 12px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  padding: 0;
}

.nav__links a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 1.0625rem;
  font-weight: 500;
  white-space: nowrap;
}

.nav__links a:hover {
  color: var(--text);
}

/* Secondary audience link: visually set apart from the section links */
.nav__alt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-left: 24px;
  border-left: 1px solid var(--line-strong);
  color: var(--link);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

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

.nav__panel-login {
  display: none;
}

.nav__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line-ghost);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.nav__toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav__toggle-close {
  display: none;
}

.nav__toggle[aria-expanded="true"] .nav__toggle-open {
  display: none;
}

.nav__toggle[aria-expanded="true"] .nav__toggle-close {
  display: block;
}

/* Collapse section links into a menu before they start to crowd the bar */
@media (max-width: 1180px) {
  .nav__toggle {
    display: inline-flex;
  }

  .nav__panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    padding: 8px var(--gutter) 24px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(7, 10, 42, 0.98);
    border-bottom: 1px solid rgba(140, 130, 255, 0.14);
    box-shadow: 0 24px 40px rgba(0, 0, 0, 0.45);
  }

  .nav__panel.is-open {
    display: flex;
  }

  .nav__links {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .nav__links a {
    display: flex;
    align-items: center;
    min-height: 52px;
    border-bottom: 1px solid var(--line);
    font-size: 1.125rem;
  }

  .nav__alt {
    min-height: 52px;
    padding-left: 0;
    border-left: 0;
    border-bottom: 1px solid var(--line);
    font-size: 1.0625rem;
  }
}

@media (max-width: 640px) {
  :root {
    --header-h: 68px;
  }

  .site-header__inner {
    gap: 12px;
  }

  .site-header .brand__logo {
    width: 36px;
    height: 36px;
  }

  .nav {
    gap: 8px;
  }

  .nav__login {
    display: none;
  }

  .nav__panel-login {
    display: flex;
    margin-top: 16px;
  }

  .nav__cta {
    padding: 0 14px;
  }
}

@media (max-width: 420px) {
  .site-header .brand {
    gap: 8px;
  }

  .site-header .brand__name {
    font-size: 1.3125rem;
  }

  .nav__cta {
    gap: 8px;
    padding: 0 12px;
  }
}

@media (max-width: 359px) {
  /* Keep the label for screen readers, hide it visually */
  .nav__cta-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .nav__cta {
    width: 48px;
    padding: 0;
  }
}
