/* ==========================================================================
   Base — reset, document defaults, page shell, shared nav components, and
   low-level utilities. Shared by every page. Depends on tokens.css.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--c-white);
  min-height: 100vh;
  color: var(--c-ink);
  overflow-x: hidden;
}

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

/* Centered vertical page shell used on every page. */
.page {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --- Nav (shared inner structure; each page positions .top-nav itself) --- */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 68px;
  padding: 0 80px;
  width: 100%;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 1280px;
  max-width: 100%;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.nav-brand img { width: 24px; height: 24px; display: block; }

.nav-brand-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--c-ink);
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  font-weight: 500;
  font-size: 13px;
  color: var(--c-gray-600);
  text-decoration: none;
  transition: color 0.18s;
}

.nav-links a:hover { color: var(--c-ink); }
.nav-links a.resume { color: var(--c-purple); }
.nav-links a.resume:hover { color: var(--c-purple-hover); }

/* --- Floating nav (pill; appears on scroll-up, on every page) ----------- */
.floating-nav {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  z-index: 200;
  width: 680px;
  max-width: calc(100vw - 48px);
  height: 56px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--c-border-nav);
  border-radius: 1000px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.10), 0 8px 32px rgba(150, 76, 235, 0.08);
  display: flex;
  align-items: center;
  padding: 0 32px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    border-radius 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-nav.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

/* Docking: when the user scrolls back to the top, the pill widens toward
   the full-width bar while fading, so it reads as morphing into the top
   nav rather than two unrelated crossfading elements. */
.floating-nav.docking {
  width: min(1280px, 100vw - 32px);
  border-radius: var(--radius-card);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-4px);
}

/* --- Hamburger button --------------------------------------------------- */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.nav-hamburger span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--c-ink-soft);
  border-radius: 2px;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.nav-hamburger.open span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* --- Mobile menu drawer -------------------------------------------------- */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  visibility: hidden;
}

.mobile-menu.open { visibility: visible; }

.mobile-menu-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.mobile-menu.open .mobile-menu-backdrop { opacity: 1; }

.mobile-menu-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 260px;
  height: 100%;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  padding: 80px 32px 48px;
  gap: 8px;
  box-shadow: -4px 0 32px rgba(0, 0, 0, 0.10);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0, 0.17, 1);
}

.mobile-menu.open .mobile-menu-panel { transform: translateX(0); }

.mobile-menu-panel a {
  font-size: 17px;
  font-weight: 500;
  color: var(--c-ink-soft);
  text-decoration: none;
  padding: 8px 0;
  border-bottom: 1px solid var(--c-border-nav);
  transition: color 0.15s;
}

.mobile-menu-panel a:last-child { border-bottom: none; }
.mobile-menu-panel a.resume { color: var(--c-purple); }
.mobile-menu-panel a:hover { color: var(--c-purple); }

@media (max-width: 768px) {
  .top-nav { padding: 0 20px; height: 60px; }
  .floating-nav { padding: 0 20px; }
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
}

/* --- Utilities ------------------------------------------------------------ */
/* Replace one-off inline paragraph spacing overrides. */
.u-mt-0 { margin-top: 0; }
.u-mb-0 { margin-bottom: 0; }
