/* HEADER */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--cg-0);
  border-bottom: 2px solid var(--accent);
  transition: background-color 0.25s ease;
}
/* Light mode: the header is the site blue, so its text and controls turn white (GTX-2704) */
html[data-theme="light"] .site-header {
  background: var(--maps-blue);
  --fg-primary: #fff;
  --fg-secondary: var(--cg-80);
  --border-subtle: rgba(255, 255, 255, 0.16);
  --border-strong: rgba(255, 255, 255, 0.32);
  --accent-tint: rgba(227, 117, 0, 0.2);
}
.site-header .container {
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
}
.header-logo {
  padding-left: 12px;
}
.header-logo .wordmark {
  height: 32px;
  width: auto;
  display: block;
  color: var(--fg-primary);
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 44px;
  padding-right: 24px;
}
.header-nav a {
  font-size: 18px;
  font-weight: 500;
  color: var(--fg-secondary);
  letter-spacing: 0.1px;
  padding: 8px 0;
  position: relative;
  transition: color 0.15s ease;
}
.header-nav a:hover {
  color: var(--fg-primary);
}
.header-nav a.active {
  color: var(--fg-primary);
  background: var(--accent-tint);
  box-shadow: inset 0 -2px 0 var(--accent);
  padding: 8px 14px;
}
.header-nav a.active::after {
  content: none;
}

/* THEME TOGGLE */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  overflow: hidden;
  margin-left: 8px;
  background: transparent;
}
.theme-toggle button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--fg-secondary);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    color 0.15s,
    background-color 0.15s;
  padding: 0;
}
.theme-toggle button:hover {
  color: var(--fg-primary);
}
.theme-toggle button.is-active {
  background: var(--accent-tint);
  color: var(--accent);
}
.theme-toggle button svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Hamburger toggle — hidden on desktop, shown via @media (max-width: 768px) */
.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border-strong);
  cursor: pointer;
  padding: 0;
  color: var(--fg-primary);
}
.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 1.5px;
  background: currentColor;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}
.site-header.nav-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.site-header.nav-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.site-header.nav-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* ---- 1280px — condensed horizontal nav (too tight for full spacing) ---- */
@media (max-width: 1280px) {
  .site-header .container {
    height: 88px;
    gap: 20px;
  }
  .header-logo .wordmark {
    height: 30px;
  }
  .header-nav {
    gap: 20px;
  }
  .header-nav a {
    font-size: 16px;
  }
}

/* ---- 900px — hamburger replaces horizontal nav ---- */
@media (max-width: 900px) {
  :root {
    --gutter: clamp(16px, 4.5vw, 32px);
  }

  html {
    scroll-padding-top: 72px;
  }

  .site-header .container {
    height: auto;
    min-height: 72px;
    flex-wrap: wrap;
    gap: 0;
    padding-top: 0;
    padding-bottom: 0;
    align-items: stretch;
  }
  .header-logo {
    height: 72px;
    display: flex;
    align-items: center;
    padding-left: 0;
  }
  .header-logo .wordmark {
    height: 24px;
  }
  .nav-toggle {
    display: flex;
    margin-left: auto;
    align-self: center;
  }
  .header-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
    padding: 8px 0 20px;
    border-top: 1px solid var(--border-subtle);
    padding-right: 0;
  }
  .site-header.nav-open .header-nav {
    display: flex;
  }
  .header-nav a {
    padding: 14px 4px;
    font-size: 17px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .header-nav a.active {
    background: none;
    box-shadow: none;
    color: var(--accent);
    padding: 14px 4px;
  }
  /* On the blue light-mode header, orange text is too low in contrast; white with the orange underline instead */
  html[data-theme="light"] .header-nav a.active {
    color: #fff;
    box-shadow: inset 0 -2px 0 var(--accent);
  }
  .theme-toggle {
    margin-left: 0;
    margin-top: 16px;
    align-self: flex-start;
  }
}
