/* ════════════════════════════════════════════════════════════════
   NAV-UNIFIED.CSS — Tesla × Apple Navigation System
   Transparent on hero → Frosted glass on scroll
   ════════════════════════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --nav-h: 52px;
  --nav-glass-light:  rgba(255, 255, 255, 0.88);
  --nav-glass-dark:   rgba(23, 26, 32, 0.88);
  --nav-blur:         saturate(180%) blur(20px);
}

/* ── Base header ── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  z-index: 9000;
  /* Start transparent (Tesla-style over hero) */
  background: transparent;
  border-bottom: 1px solid transparent;
  transition:
    background 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
    border-color 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Scrolled state → Apple frosted glass ── */
.site-header.scrolled {
  background: var(--nav-glass-light);
  backdrop-filter: var(--nav-blur);
  -webkit-backdrop-filter: var(--nav-blur);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── Dark-hero mode (forced for pages with dark hero) ── */
.site-header.dark-hero:not(.scrolled) {
  background: transparent;
  border-bottom-color: transparent;
}

/* ── Shell (flex row) ── */
.nav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  gap: 1.5rem;
}

/* ── Brand ── */
.brand {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ffffff;
  transition: color 400ms ease;
  line-height: 1;
}

.brand-role {
  font-size: 0.72rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: -0.01em;
  transition: color 400ms ease;
}

/* On scroll: brand switches to dark text */
.site-header.scrolled .brand-name { color: #1d1d1f; }
.site-header.scrolled .brand-role { color: #86868b; }

/* ── Nav links ── */
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  flex: 1;
  justify-content: flex-end;
}

.nav-links a {
  display: inline-block;
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.82);
  border-radius: 6px;
  transition: color 200ms ease, background 200ms ease;
  white-space: nowrap;
}

.nav-links a:hover {
  color: rgba(255, 255, 255, 1);
  background: rgba(255, 255, 255, 0.08);
}

/* On scroll: links switch to dark */
.site-header.scrolled .nav-links a {
  color: #1d1d1f;
}
.site-header.scrolled .nav-links a:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #000000;
}

/* ── Nav CTA pill ── */
.nav-cta {
  display: inline-flex !important;
  align-items: center;
  height: 34px;
  padding: 0 1.1rem !important;
  border-radius: 980px !important;
  background: rgba(255, 255, 255, 0.15) !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
  color: #ffffff !important;
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  backdrop-filter: blur(12px);
  transition: background 200ms ease, border-color 200ms ease !important;
}
.nav-cta:hover {
  background: rgba(255, 255, 255, 0.25) !important;
  border-color: rgba(255, 255, 255, 0.65) !important;
}

/* On scroll: CTA becomes solid blue (Apple style) */
.site-header.scrolled .nav-cta {
  background: #0071e3 !important;
  border-color: transparent !important;
  color: #ffffff !important;
}
.site-header.scrolled .nav-cta:hover {
  background: #0077ed !important;
}

/* ── Mobile menu toggle ── */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background 200ms ease;
}
.menu-toggle:hover { background: rgba(255, 255, 255, 0.1); }
.site-header.scrolled .menu-toggle:hover { background: rgba(0, 0, 0, 0.05); }

.menu-toggle span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: #ffffff;
  border-radius: 2px;
  transition: background 400ms ease, transform 250ms ease, opacity 250ms ease;
  transform-origin: center;
}
.site-header.scrolled .menu-toggle span { background: #1d1d1f; }

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* ── Mobile drawer ── */
@media (max-width: 860px) {
  .menu-toggle { display: flex; }

  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: var(--nav-blur);
    -webkit-backdrop-filter: var(--nav-blur);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0.75rem 1rem 1rem;
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1),
                opacity 300ms ease;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-links a {
    color: #1d1d1f;
    padding: 0.75rem 0.75rem;
    border-radius: 10px;
    font-size: 0.9rem;
  }
  .nav-links a:hover { background: rgba(0,0,0,0.04); }

  .nav-cta {
    margin-top: 0.5rem;
    text-align: center;
    background: #0071e3 !important;
    border-color: transparent !important;
  }
}
