/* ── Base & Utilities ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* ── Navbar ───────────────────────────────────────────────── */
#navbar {
  background: transparent;
  transition: background 0.4s ease, box-shadow 0.4s ease, backdrop-filter 0.4s ease;
}
#navbar.scrolled {
  background: rgba(21, 32, 43, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.05), 0 4px 24px rgba(0,0,0,0.2);
}

.nav-link {
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.3s ease;
}
.nav-link:hover::after {
  width: 100%;
}

/* ── Mobile Menu ──────────────────────────────────────────── */
.mobile-link {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s ease, color 0.2s ease;
}
#mobileMenu.open .mobile-link {
  opacity: 1;
  transform: translateY(0);
}
#mobileMenu.open {
  opacity: 1;
  pointer-events: all;
}
#mobileMenu:not(.open) .mobile-link {
  transition-delay: 0s !important;
}

/* staggered mobile links */
#mobileMenu.open .mobile-link:nth-child(1) { transition-delay: 0.06s; }
#mobileMenu.open .mobile-link:nth-child(2) { transition-delay: 0.12s; }
#mobileMenu.open .mobile-link:nth-child(3) { transition-delay: 0.18s; }
#mobileMenu.open .mobile-link:nth-child(4) { transition-delay: 0.24s; }
#mobileMenu.open .mobile-link:nth-child(5) { transition-delay: 0.30s; }

/* ── Scroll Reveal ────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* ── Form Focus Styles ────────────────────────────────────── */
input:focus, textarea:focus {
  box-shadow: 0 0 0 3px rgba(42, 107, 108, 0.12);
}

/* ── Selection ────────────────────────────────────────────── */
::selection {
  background: rgba(42, 107, 108, 0.2);
  color: inherit;
}

/* ── Responsive Tweaks ────────────────────────────────────── */
@media (max-width: 640px) {
  .font-serif { line-height: 1.15; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
