/* ==========================================================================
   MOBILE NAVIGATION
   Works with Phosphors Design System
   ========================================================================== */

/* Hamburger Button */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1001;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary, #f5f5f7);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: center;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

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

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Nav Overlay */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 999;
}

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

/* Mobile Nav Panel */
.mobile-nav {
  position: fixed;
  top: 0;
  right: 0;
  width: min(320px, 85vw);
  height: 100%;
  background: rgba(5, 5, 10, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
  padding: 5rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

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

/* Close Button */
.mobile-nav-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-primary, #f5f5f7);
  cursor: pointer;
  transition: all 0.3s ease;
}

.mobile-nav-close:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(184, 140, 255, 0.3);
}

.mobile-nav-close svg {
  width: 20px;
  height: 20px;
}

/* Nav Links */
.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-nav-links a {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0.875rem 1.25rem;
  color: rgba(245, 245, 247, 0.65);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  border-radius: 8px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.mobile-nav-links a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: linear-gradient(180deg, var(--accent, #b88cff), var(--cyan, #6ee7e7));
  border-radius: 3px;
  transition: height 0.25s ease;
}

.mobile-nav-links a:hover,
.mobile-nav-links a:focus {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary, #f5f5f7);
}

.mobile-nav-links a:hover::before {
  height: 24px;
}

.mobile-nav-links a.active,
.mobile-nav-links a[aria-current="page"] {
  color: var(--accent, #b88cff);
  background: rgba(184, 140, 255, 0.08);
}

.mobile-nav-links a.active::before,
.mobile-nav-links a[aria-current="page"]::before {
  height: 24px;
}

.mobile-nav-links a:focus-visible {
  outline: 2px solid rgba(184, 140, 255, 0.6);
  outline-offset: 2px;
}

/* CTA Link */
.mobile-nav-links a.nav-cta,
.mobile-nav-links a[href*="submit"] {
  margin-top: 0.5rem;
  background: rgba(184, 140, 255, 0.1);
  border: 1px solid rgba(184, 140, 255, 0.25);
  color: var(--accent, #b88cff);
}

.mobile-nav-links a.nav-cta:hover,
.mobile-nav-links a[href*="submit"]:hover {
  background: rgba(184, 140, 255, 0.2);
  border-color: rgba(184, 140, 255, 0.4);
}

/* Footer */
.mobile-nav-footer {
  margin-top: auto;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mobile-nav-footer a {
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  transition: color 0.3s;
}

.mobile-nav-footer a:hover {
  color: var(--text-primary, #f5f5f7);
}

/* Mobile Breakpoint */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }
  
  /* Hide desktop nav */
  header nav:not(.mobile-nav-links),
  .header nav:not(.mobile-nav-links),
  .nav:not(.mobile-nav-links) {
    display: none !important;
  }
  
  /* Header layout on mobile */
  header,
  .header {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 0 !important;
    padding: 0.75rem 1rem !important;
  }
  
  /* Prevent body scroll when menu open */
  body.menu-open {
    overflow: hidden;
  }
}

/* Touch targets */
@media (max-width: 768px) {
  .mobile-nav-links a,
  .hamburger,
  .mobile-nav-close {
    min-height: 48px;
    min-width: 48px;
  }
}

/* Animation for menu items */
.mobile-nav.active .mobile-nav-links a {
  animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateX(20px);
}

.mobile-nav.active .mobile-nav-links li:nth-child(1) a { animation-delay: 0.05s; }
.mobile-nav.active .mobile-nav-links li:nth-child(2) a { animation-delay: 0.1s; }
.mobile-nav.active .mobile-nav-links li:nth-child(3) a { animation-delay: 0.15s; }
.mobile-nav.active .mobile-nav-links li:nth-child(4) a { animation-delay: 0.2s; }
.mobile-nav.active .mobile-nav-links li:nth-child(5) a { animation-delay: 0.25s; }
.mobile-nav.active .mobile-nav-links li:nth-child(6) a { animation-delay: 0.3s; }
.mobile-nav.active .mobile-nav-links li:nth-child(7) a { animation-delay: 0.35s; }
.mobile-nav.active .mobile-nav-links li:nth-child(8) a { animation-delay: 0.4s; }

@keyframes slideIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
