/* nav.css — floating pill nav, scrolled state, mobile drawer */

/* ─── NAV SHELL ──────────────────────────────────────────────
   The nav morphs progressively against scroll position — driven by a
   ScrollTrigger scrub timeline in animations.js (initNavScroll).
   No CSS transitions on .nav / .nav__pill: GSAP sets live values per frame.

   Rest values defined here are the t=0 of the morph; ScrollTrigger interpolates
   them toward the scrolled values inline. The .scrolled class is unused by JS
   but kept as a fallback for prefers-reduced-motion (instant snap to end state).

   Per user directive: color stays #050505 in both states — shape & position morph only.
*/
.nav {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-nav);
  width: 100%;
  max-width: none; /* truly full-width at rest — no inner cap */
  /* GSAP writes top/width/left/x as live values; no CSS transition. */
}

/* ─── NAV BAR ────────────────────────────────────────────────
   Padding values are fixed pixels (no clamp) so GSAP can interpolate
   cleanly between rest and scrolled states. */
.nav__pill {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 16px 36px;
  border-radius: 0;
  background: #050505;
  border: 1px solid transparent;
  border-bottom-color: rgba(245, 245, 240, 0.06);
  /* Zero-alpha placeholder shadow so GSAP can interpolate to the
     scrolled-state two-layer shadow without a discrete jump. */
  box-shadow:
    0 20px 44px -18px rgba(5, 5, 5, 0),
    0 6px 16px -8px rgba(5, 5, 5, 0);
}

/* ─── REDUCED-MOTION FALLBACK ─────────────────────────────────
   Users with reduced-motion preference get a binary snap via .scrolled.
   ScrollTrigger is skipped in JS; this rule sets the end state directly. */
@media (prefers-reduced-motion: reduce) {
  .nav.scrolled {
    top: 18px;
    left: 50%;
    width: 85%;
    transform: translateX(-50%);
  }
  .nav.scrolled .nav__pill {
    padding: 12px 22px;
    border-radius: 14px;
    border-color: rgba(245, 245, 240, 0.10);
    box-shadow:
      0 20px 44px -18px rgba(5, 5, 5, 0.55),
      0 6px 16px -8px rgba(5, 5, 5, 0.35);
  }
}

/* ─── LOGO ───────────────────────────────────────────────── */
.nav__logo {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.4vw, 1.3rem);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-inverse);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── DESKTOP LINKS ──────────────────────────────────────── */
/* Push links + CTA to the right edge; logo anchors the left. */
.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-left: auto; /* push links + CTA to the right edge; logo anchors left */
}

.nav__link {
  font-family: var(--font-body);
  font-size: var(--size-small);
  font-weight: 500;
  color: var(--color-text-inverse);
  position: relative;
  padding-bottom: 2px;
}

/* Underline slide from left on hover */
.nav__link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-text-inverse);
  transition: width var(--dur-feedback) var(--ease-feedback);
}

.nav__link:hover::after,
.nav__link[aria-current="page"]::after {
  width: 100%;
}

/* ─── CTA IN NAV ─────────────────────────────────────────── */
.nav__cta {
  flex-shrink: 0;
}

/* Inverted nav → CTA becomes a cream outline on the charcoal bar.
   Kept transparent (not a solid fill) so the cream cursor stays legible
   while hovering it, and so the bar reads less generic-SaaS. */
.nav__cta .btn-primary {
  background: transparent;
  color: var(--color-text-inverse);
  border-color: var(--color-text-inverse);
}

.nav__cta .btn-primary:hover {
  background: rgba(245, 245, 240, 0.10);
  border-color: var(--color-text-inverse);
}

.nav__cta .btn-primary:focus-visible {
  outline-color: var(--color-text-inverse);
}

/* ─── HAMBURGER BUTTON ───────────────────────────────────── */
.nav__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  z-index: calc(var(--z-drawer) + 10);
  position: relative;
}

.nav__hamburger-line {
  width: 22px;
  height: 1.5px;
  background: var(--color-text-inverse);
  border-radius: 2px;
  transition:
    transform var(--dur-morph) var(--ease-morph),
    opacity var(--dur-feedback) var(--ease-feedback);
  transform-origin: center;
}

/* Hamburger → X state when drawer open */
.nav__hamburger[aria-expanded="true"] .nav__hamburger-line:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.nav__hamburger[aria-expanded="true"] .nav__hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav__hamburger[aria-expanded="true"] .nav__hamburger-line:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* ─── MOBILE OVERLAY ─────────────────────────────────────── */
.nav__overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: var(--z-overlay);
  opacity: 0;
  transition: opacity var(--dur-morph) var(--ease-morph);
}

.nav__overlay.is-open {
  opacity: 1;
}

/* ─── MOBILE DRAWER ──────────────────────────────────────── */
.nav__drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(360px, 100vw);
  height: 100dvh;
  background: var(--color-bg);
  z-index: var(--z-drawer);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-xl) var(--space-lg);
  transform: translateX(100%);
  transition: transform var(--dur-morph) var(--ease-morph);
}

.nav__drawer.is-open {
  transform: translateX(0);
}

.nav__drawer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: auto;
  padding-top: var(--space-xl);
}

.nav__drawer-link {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 2rem;
  color: var(--color-text-primary);
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: color var(--dur-feedback) var(--ease-feedback);
}

.nav__drawer-link:hover {
  color: var(--color-text-secondary);
}

.nav__drawer-cta {
  width: 100%;
  margin-top: var(--space-lg);
}

/* ─── RESPONSIVE: SHOW HAMBURGER, HIDE DESKTOP LINKS ─────── */
@media (max-width: 767px) {
  .nav__links {
    display: none;
  }

  .nav__cta {
    display: none;
  }

  .nav__hamburger {
    display: flex;
  }

  .nav__overlay {
    display: block;
    pointer-events: none;
  }

  .nav__overlay.is-open {
    pointer-events: auto;
  }
}

/* ─── TABLET: COMPRESS LINKS ─────────────────────────────── */
@media (min-width: 768px) and (max-width: 1024px) {
  .nav__pill {
    gap: var(--space-md);
    padding: 11px 14px 11px 20px;
  }
  .nav__links {
    gap: var(--space-sm);
  }
}
