/* ==========================================================================
   MOTIQ — Navigation
   Sticky transparent header, mega menu, mobile drawer
   ========================================================================== */

/* ── Main Nav ───────────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 var(--container-padding);
  transition: background var(--duration-normal) ease,
              box-shadow var(--duration-normal) ease,
              backdrop-filter var(--duration-normal) ease;
}

.nav--scrolled {
  background: var(--nav-bg-scrolled);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
  box-shadow: 0 1px 0 var(--border-color);
}

.nav--hero {
  background: transparent;
}

.nav__inner {
  width: 100%;
  max-width: var(--container-2xl);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
}

/* ── Logo ────────────────────────────────────────────────────────────────── */
.nav__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  flex-shrink: 0;
}

.nav__logo-text {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: var(--font-weight-black);
  letter-spacing: -0.03em;
  color: var(--text-primary);
  transition: color var(--duration-normal) ease;
}

.nav--hero .nav__logo-text {
  color: var(--color-white);
}

.nav__logo-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--color-red);
  border-radius: var(--radius-round);
  margin-left: 1px;
  vertical-align: baseline;
}

.nav__logo-maple {
  width: 16px;
  height: 16px;
  fill: var(--color-red);
  margin-left: -2px;
}

/* ── Links ───────────────────────────────────────────────────────────────── */
.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav__link {
  position: relative;
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: var(--transition-base);
}

.nav--hero .nav__link {
  color: rgba(255, 255, 255, 0.75);
}

.nav__link:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.nav--hero .nav__link:hover {
  color: var(--color-white);
  background: rgba(255, 255, 255, 0.1);
}

.nav__link--active {
  color: var(--color-red);
}

.nav__link--active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: var(--color-red);
  border-radius: 1px;
}

/* ── Right actions ──────────────────────────────────────────────────────── */
.nav__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.nav__action-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-round);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-base);
  border: none;
  background: none;
}

.nav--hero .nav__action-btn {
  color: rgba(255, 255, 255, 0.75);
}

.nav__action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav--hero .nav__action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-white);
}

.nav__action-btn svg {
  width: 20px;
  height: 20px;
}

.nav__action-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-round);
  background: var(--color-red);
  color: var(--color-white);
  font-size: 0.55rem;
  font-weight: var(--font-weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Theme toggle */
.theme-toggle {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-round);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition-base);
  border: none;
  background: none;
}

.nav--hero .theme-toggle {
  color: rgba(255, 255, 255, 0.75);
}

.theme-toggle:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav--hero .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-white);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  transition: var(--transition-base);
}

.theme-toggle__sun { display: block; }
.theme-toggle__moon { display: none; }

[data-theme="dark"] .theme-toggle__sun { display: none; }
[data-theme="dark"] .theme-toggle__moon { display: block; }

/* CTA */
.nav__cta {
  margin-left: var(--space-2);
}

/* ── Mobile Hamburger ───────────────────────────────────────────────────── */
.nav__hamburger {
  display: none;
  width: 40px;
  height: 40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  z-index: calc(var(--z-modal) + 1);
}

.nav__hamburger-line {
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: var(--transition-base);
}

.nav--hero .nav__hamburger-line {
  background: var(--color-white);
}

.nav__hamburger--active .nav__hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav__hamburger--active .nav__hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav__hamburger--active .nav__hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Mobile Drawer ──────────────────────────────────────────────────────── */
.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  visibility: hidden;
  opacity: 0;
  transition: var(--transition-base);
}

.mobile-nav--open {
  visibility: visible;
  opacity: 1;
}

.mobile-nav__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.mobile-nav__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 85vw);
  background: var(--bg-primary);
  padding: calc(var(--nav-height) + var(--space-4)) var(--space-6) var(--space-8);
  transform: translateX(100%);
  transition: transform var(--duration-slow) var(--ease-out);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.mobile-nav--open .mobile-nav__panel {
  transform: translateX(0);
}

.mobile-nav__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  border-radius: var(--radius-lg);
  transition: var(--transition-base);
}

.mobile-nav__link:hover {
  background: var(--bg-tertiary);
  color: var(--color-red);
}

.mobile-nav__link svg {
  width: 22px;
  height: 22px;
  opacity: 0.5;
}

.mobile-nav__divider {
  height: 1px;
  background: var(--divider);
  margin: var(--space-4) 0;
}

.mobile-nav__cta {
  margin-top: auto;
  padding-top: var(--space-4);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .nav__links {
    display: none;
  }

  .nav__hamburger {
    display: flex;
  }

  .nav__cta {
    display: none;
  }

  .nav {
    height: var(--nav-height-mobile);
  }
}
