/*
  Navigation
  A sticky navbar with real wayfinding, a hamburger that morphs into an
  X, and a mobile panel that slides in from the left, carrying the
  theme toggle with it on small screens.
*/

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 16px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-brand span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.navbar-links a {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  position: relative;
  padding-bottom: 4px;
}

.navbar-links a:hover,
.navbar-links a.is-active {
  color: var(--color-text);
}

.navbar-links a.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background-color: var(--color-accent);
  border-radius: 2px;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Hamburger, morphs into an X on open */

.hamburger {
  display: none;
  width: 28px;
  height: 20px;
  border: none;
  background: none;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 210;
}

.hamburger-lines {
  width: 22px;
  height: 14px;
  position: relative;
}

.hamburger-lines span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--color-text);
  border-radius: 2px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, top 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hamburger-lines span:nth-child(1) { top: 0; }
.hamburger-lines span:nth-child(2) { top: 6px; }
.hamburger-lines span:nth-child(3) { top: 12px; }

.hamburger.is-open .hamburger-lines span:nth-child(1) {
  top: 6px;
  transform: rotate(45deg);
}

.hamburger.is-open .hamburger-lines span:nth-child(2) {
  opacity: 0;
}

.hamburger.is-open .hamburger-lines span:nth-child(3) {
  top: 6px;
  transform: rotate(-45deg);
}

/* Mobile slide in panel, opens from the left */

.mobile-nav-scrim {
  position: fixed;
  inset: 0;
  background-color: rgba(14, 14, 15, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 190;
}

.mobile-nav-scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(84vw, 340px);
  background-color: var(--color-bg);
  border-right: 1px solid var(--color-border);
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 90px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.mobile-nav-panel.is-open {
  transform: translateX(0);
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-nav-links a {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  padding-block: 10px;
  border-bottom: 1px solid var(--color-border);
}

.mobile-nav-panel .theme-toggle {
  align-self: flex-start;
}

@media (max-width: 860px) {
  .navbar-links { display: none; }
  .hamburger { display: flex; }
  [data-desktop-toggle] { display: none; }
}

/* ---------- Standalone icon-only theme toggle ---------- */
/* For pages with no full navbar and nothing to navigate to yet
   (login.html, consent.html): a small fixed circular toggle instead
   of forcing a whole navbar structure onto a single-purpose page. */

.icon-theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background-color: var(--color-surface-raised);
  color: var(--color-text);
  transition: border-color 0.2s ease, transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.icon-theme-toggle:active { transform: scale(0.92); }
.icon-theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .icon-theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .icon-theme-toggle .icon-moon { display: block; }
html[data-theme="dark"] .icon-theme-toggle { border-color: rgba(232, 99, 47, 0.3); }

@media (max-width: 400px) {
  .icon-theme-toggle { top: 12px; right: 12px; width: 34px; height: 34px; }
}