/* ═══════════════════════════════════════
   nav.css — Top Navigation Bar
═══════════════════════════════════════ */

#navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
  padding-inline: var(--gap);
  transition: background 0.4s var(--ease),
              backdrop-filter 0.4s var(--ease),
              border-color 0.4s var(--ease),
              box-shadow 0.4s var(--ease);
}

#navbar.scrolled {
  background: rgba(0, 20, 50, 0.72);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] #navbar.scrolled {
  background: rgba(230, 242, 255, 0.80);
}

.nav-inner {
  width: min(var(--max-w), 100%);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* ── Logo / Brand ─────────────────── */
.nav-brand-logo {
  position: relative;
  width: 44px;
  height: 44px;
  display: block;
  flex-shrink: 0;
  text-decoration: none;
}

.nav-af-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--accent);
  opacity: 0.3;
  animation: spin 10s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

.nav-af-inner {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display), sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -.02em;
  z-index: 1;
  transition: background var(--dur), color var(--dur);
}

/* ── Clock ────────────────────────── */
.nav-clock {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  flex-shrink: 0;
  background: var(--bg-card);
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid var(--border);
}

.nav-clock-icon {
  color: var(--accent);
  font-size: 14px;
}

.nav-clock-sep {
  color: var(--text-dim);
}

#nav-clock-time {
  font-size: 0.88rem;
  color: var(--accent);
  letter-spacing: 0.06em;
  line-height: 1;
}

.nav-clock-colon {
  opacity: 1;
  animation: blink 1s step-start infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

#nav-clock-date {
  font-size: 0.62rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* ── Nav links ────────────────────── */
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 36px);
  list-style: none;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
  transition: color var(--dur);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* ── Right controls ───────────────── */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* ── Theme button ─────────────────── */
.theme-pill {
  position: relative;
  width: 54px;
  height: 28px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  overflow: hidden;
  transition: border-color var(--dur), background var(--dur);
}

.theme-pill:hover {
  border-color: var(--border-hover);
}

.pill-icon {
  font-size: 12px;
  z-index: 2;
  transition: opacity var(--dur), color var(--dur);
}

.pill-moon { color: var(--text-muted); }
.pill-sun { color: #f59e0b; opacity: 0.3; }

[data-theme="light"] .pill-moon { opacity: 0.3; color: var(--text-muted); }
[data-theme="light"] .pill-sun { opacity: 1; }

.theme-pill::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  z-index: 1;
  transition: transform var(--dur) cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] .theme-pill::before {
  transform: translateX(26px);
}

/* ── Hamburger (mobile) ───────────── */
#menuBtn {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  transition: border-color var(--dur);
}

#menuBtn:hover { border-color: var(--border-hover); }

#menuBtn span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.3s;
}

#menuBtn.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
#menuBtn.open span:nth-child(2) { opacity: 0; }
#menuBtn.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ── Mobile drawer ────────────────── */
#mobileMenu {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 99;
  background: rgba(0, 24, 56, 0.96);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 24px var(--gap);
  flex-direction: column;
  gap: 20px;
  transform: translateY(-8px);
  opacity: 0;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

[data-theme="light"] #mobileMenu {
  background: rgba(225, 240, 255, 0.96);
}

#mobileMenu.open {
  opacity: 1;
  transform: translateY(0);
}

#mobileMenu a {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color var(--dur);
}

#mobileMenu a:hover { color: var(--accent); }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-clock  { display: none; }
  #menuBtn    { display: flex; }
  #mobileMenu { display: flex; }
}