/* ── Navigation ──────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  inset-inline: 0;
  height: var(--nav-height);
  background: oklch(11% 0.02 270 / 20%);
  backdrop-filter: blur(32px) saturate(1.8);
  -webkit-backdrop-filter: blur(32px) saturate(1.8);
  border-bottom: 1px solid oklch(74% 0.2 45 / 6%);
  z-index: 300;
  display: flex;
  align-items: center;
  transition:
    background 0.4s ease,
    border-color 0.4s ease,
    box-shadow 0.4s ease;
}

.nav.scrolled,
.nav:has(~ .main-content) {
  background: oklch(11% 0.02 270 / 35%);
  box-shadow:
    0 4px 30px oklch(0% 0 0 / 20%),
    0 1px 0 oklch(74% 0.2 45 / 8%);
}

:root.light .nav {
  background: oklch(98% 0.005 270 / 35%);
  border-bottom: 1px solid oklch(58% 0.22 45 / 6%);
}

:root.light .nav.scrolled,
:root.light .nav:has(~ .main-content) {
  background: oklch(98% 0.005 270 / 55%);
  box-shadow:
    0 4px 30px oklch(13% 0.02 270 / 6%),
    0 1px 0 oklch(58% 0.22 45 / 8%);
}

/* Gradient line under nav */
.nav::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    oklch(74% 0.2 45 / 40%) 15%,
    oklch(70% 0.24 20 / 50%) 35%,
    oklch(68% 0.22 350 / 50%) 55%,
    oklch(80% 0.17 85 / 40%) 75%,
    transparent 100%
  );
  opacity: 0.6;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
}

.nav-brand {
  font-weight: 700;
  font-size: 15px;
  color: var(--fg);
  margin-inline-end: 24px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: opacity var(--transition);
}

.nav-brand:hover {
  text-decoration: none;
  opacity: 0.85;
}

.nav-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--gradient-primary);
  color: var(--accent-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  font-family: var(--font-mono);
  box-shadow: 0 0 16px oklch(74% 0.2 45 / 20%);
  position: relative;
  overflow: hidden;
}

.nav-brand-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, oklch(100% 0 0 / 20%) 0%, transparent 60%);
}

.nav-links {
  display: flex;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-link {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  position: relative;
  transition:
    color var(--transition),
    background var(--transition);
}

.nav-link:hover {
  color: var(--fg);
  background: oklch(74% 0.2 45 / 6%);
  text-decoration: none;
}

.nav-link.active {
  color: var(--accent);
  background: oklch(74% 0.2 45 / 10%);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: var(--gradient-primary);
}

.nav-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-inline-start: 12px;
}

.nav-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color var(--transition),
    background var(--transition),
    transform var(--transition-fast);
  font-size: 18px;
}

.nav-btn:hover {
  color: var(--accent);
  background: oklch(74% 0.2 45 / 8%);
  transform: scale(1.05);
}

.nav-btn:active {
  transform: scale(0.95);
}

/* ── Mobile nav overlay ──────────────────────────────── */
.nav-mobile-toggle {
  display: none;
}

.nav-mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-height);
  right: 0;
  bottom: 0;
  left: 0;
  background: oklch(11% 0.02 270 / 95%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 290;
  padding: 24px var(--gutter);
  overflow-y: auto;
}

:root.light .nav-mobile-menu {
  background: oklch(98% 0.005 270 / 95%);
}

.nav-mobile-menu.open {
  animation: fadeIn 0.25s var(--ease-out-expo);
}

.nav-mobile-menu .nav-link {
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 500;
  border-radius: var(--radius-md);
}

@media (max-width: 767px) {
  .nav-links {
    display: none;
  }
  .nav-mobile-toggle {
    display: flex;
  }
  .nav-mobile-menu.open {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
}
