/* ======================
   RESPONSIVE NAVIGATION - STANDARDS-COMPLIANT
   Breakpoints: Mobile 0-1024px, Compact Desktop 1025-1279px, Desktop 1280px+
   Accessibility: WCAG 2.1 AA, Keyboard Navigation, Focus Management
   ====================== */

/* Navigation Wrapper - Full Width & Sticky */
.navigationWrapper {
  width: 100%;
  position: sticky;
  top: 0;
  background-color: transparent;
  border-bottom: 1px solid transparent;
  transition: all 0.15s ease;
  z-index: 9999;
  margin-bottom: 0px;
}

/* Base Navigation Bar - Constrained Width */
.navigationBar {
  width: 100%;
  max-width: min(1680px, 100vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: transparent;
  transition: all 0.15s ease;
  box-sizing: border-box;
  
  /* Fluid sizing with clamp() */
  padding: clamp(16px, 2vw, 24px) clamp(20px, 4vw, 120px);
  height: clamp(64px, 8vw, 144px);
  font-family: 'PP Neue Montreal', sans-serif;
  color: #333f5b;
}

.navRightContainer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Scrolled state - Enhanced shadow for elevation */
.navigationWrapper.scrolled {
  background-color: #fafbfd;
  /* backdrop-filter: blur(20px); */
  /* -webkit-backdrop-filter: blur(20px); */
  /* box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08); */
  /* border-bottom: 1px solid rgba(0, 0, 0, 0.05); */
}

.navigationWrapper.scrolled .navigationBar {
  /* Reduced height on scroll for mobile viewport efficiency */
  height: clamp(56px, 7vw, 100px);
  padding: clamp(12px, 1.5vw, 20px) clamp(20px, 4vw, 120px);
}

/* Hide main navigation when mobile menu is open */
.navigationWrapper.mobileMenuOpen {
  display: none;
}

/* ======================
   LOGO SECTION
   ====================== */
.logo {
  flex-shrink: 0;
  z-index: 10;
}

.logo a {
  text-decoration: none;
  color: inherit;
  display: block;
  padding: 8px; /* Minimum 44x44px touch target */
  margin: -8px;
  border-radius: 8px;
  transition: background-color 0.15s ease;
}

.logo a:focus-visible {
  outline: 2px solid #3495ff;
  outline-offset: 2px;
  background-color: rgba(52, 149, 255, 0.1);
}

.logoText {
  font-family: 'P22 Mackinac Pro';
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.2;
  /* Fluid logo sizing */
  font-size: clamp(28px, 2.4vw, 46px);
}

/* ======================
   DESKTOP NAVIGATION (1025px+)
   ====================== */
.desktopNav {
  display: none;
  flex: 1;
  justify-content: center;
  align-items: center;
  /* Fluid gap sizing */
  gap: clamp(16px, 2.6vw, 64px);
}

.desktopCta {
  display: none;
  flex-shrink: 0;
}

/* Mobile CTA - positioned before hamburger menu */
.mobileTopCta {
  display: block;
  flex-shrink: 0;
  margin-right: 12px;
}

.mobileTopCtaButton {
  display: inline-block;
  text-decoration: none;
  color: white;
  background: linear-gradient(135deg, #3495ff 0%, #4a90e2 100%);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobileTopCtaButton:hover {
  background: linear-gradient(135deg, #2885ee 0%, #3980d1 100%);
  transform: translateY(-1px);
}

.mobileTopCtaButton:focus-visible {
  outline: 2px solid #3495ff;
  outline-offset: 2px;
}

.mobileTopCtaButton:active {
  transform: translateY(0);
}

/* Mobile Auth Loading */
.mobileTopAuthLoading {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Show desktop nav on laptop+ sizes */
@media (min-width: 1025px) {
  .desktopNav {
    display: flex;
  }
  
  .desktopCta {
    display: block;
  }
  
  .mobileTopCta {
    display: none;
  }
}

/* Navigation Links */
.navLink {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: color 0.15s ease;
  /* Minimum 44x44px touch target */
  padding: 12px 16px;
  border-radius: 8px;
  /* Fluid font sizing */
  font-size: clamp(14px, 0.95vw, 16px);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.5;
}

.navLink:hover {
  color: #3495ff;
}

.navLink:focus-visible {
  outline: 2px solid #3495ff;
  outline-offset: 2px;
  background-color: rgba(52, 149, 255, 0.1);
}

/* Active page styles */
.navLink.active {
  color: #3495ff;
}

/* ======================
   DROPDOWN (DESKTOP)
   ====================== */
.dropdown {
  position: relative;
}

.dropdownTrigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  /* Minimum 44x44px touch target */
  padding: 12px 16px;
  border-radius: 8px;
  transition: color 0.15s ease;
  /* Fluid font sizing */
  font-size: clamp(14px, 0.95vw, 16px);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.5;
  font-family: inherit;
}

.dropdownTrigger:hover {
  color: #3495ff;
}

.dropdownTrigger:focus-visible {
  outline: 2px solid #3495ff;
  outline-offset: 2px;
  background-color: rgba(52, 149, 255, 0.1);
}

.dropdownIcon {
  transition: transform 0.15s ease;
  color: currentColor;
}

.dropdownIcon.rotated {
  transform: rotate(180deg);
}

.dropdownMenu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  padding: 8px 0;
  min-width: 200px;
  z-index: 10;
  
  /* Smooth animations */
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;

  transition: opacity 0.15s ease, transform 0.15s ease;
}

/* Invisible bridge to prevent hover gap */
.dropdownMenu::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 16px;
  background: transparent;
}

.dropdownItem {
  display: block;
  padding: 12px 20px;
  text-decoration: none;
  color: #333f5b;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  transition: background-color 0.15s ease;
  border-radius: 0;
}

.dropdownItem:hover {
  background-color: rgba(52, 149, 255, 0.08);
  color: #3495ff;
}

.dropdownItem:focus-visible {
  outline: 2px solid #3495ff;
  outline-offset: -2px;
  background-color: rgba(52, 149, 255, 0.1);
}

/* ======================
   CTA BUTTON
   ====================== */
.ctaButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 1.5vw, 22px) clamp(24px, 3vw, 48px);
  background-color: #333f5b;
  color: white;
  text-decoration: none;
  border-radius: 24px;
  font-weight: 500;
  font-size: clamp(14px, 0.95vw, 16px);
  letter-spacing: -0.01em;
  /* line-height: 1.5; */
  transition: all 0.15s ease;
  /* Minimum height for touch targets */
  min-height: 44px;
}

.ctaButton:hover {
  background-color: #3495ff;
  transform: translateY(-1px);
}

.ctaButton:focus-visible {
  outline: 2px solid #3495ff;
  outline-offset: 2px;
}

.ctaButton:active {
  transform: translateY(0);
}

/* ======================
   MOBILE MENU BUTTON (0-1024px)
   ====================== */
.mobileMenuButton {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Minimum 44x44px touch target */
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: #333f5b;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.15s ease;
}

.mobileMenuButton:hover {
  background-color: rgba(52, 149, 255, 0.08);
}

.mobileMenuButton:focus-visible {
  outline: 2px solid #3495ff;
  outline-offset: 2px;
  background-color: rgba(52, 149, 255, 0.1);
}

/* Hide mobile button on desktop */
@media (min-width: 1025px) {
  .mobileMenuButton {
    display: none;
  }

  .dropdown:hover .dropdownMenu,
  .dropdown:focus-within .dropdownMenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }
}

/* ======================
   MOBILE MENU OVERLAY (0-1024px)
   ====================== */
.mobileMenuOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: white;
  z-index: 9998;
  flex-direction: column;
  overflow: hidden; /* Changed to hidden to allow sticky positioning */
  
  /* Smooth slide-in animation */
  animation: slideIn 0.15s ease-out;
}

/* Show when JS adds this class */
.mobileMenuOverlay.is-open {
  display: flex;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hide mobile menu on desktop */
@media (min-width: 1025px) {
  .mobileMenuOverlay {
    display: none !important;
  }
}

/* Background decorations (from Figma mobile design) */
.mobileMenuBg1 {
  position: fixed;
  width: 243px;
  height: 243px;
  bottom: 247px;
  right: -120px;
  filter: blur(331.73px);
  border-radius: 50%;
  background-color: #f8d194;
  z-index: -1;
  pointer-events: none;
}

.mobileMenuBg2 {
  position: fixed;
  width: 243px;
  height: 243px;
  bottom: 0;
  left: -50px;
  filter: blur(331.73px);
  border-radius: 50%;
  background-color: #3495ff;
  opacity: 0.52;
  z-index: -1;
  pointer-events: none;
}

/* Mobile Menu Header - Sticky at top */
.mobileMenuHeader {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(16px, 4vw, 24px);
  background: white;
  z-index: 10;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  /* Ensure sticky works on all browsers */
  position: -webkit-sticky;
  position: sticky;
  /* Minimum height for touch targets */
  min-height: 64px;
}

/* Enhanced sticky behavior for small screens */
@media (max-width: 767px) {
  .mobileMenuHeader {
    position: sticky;
    position: -webkit-sticky;
    top: 0;
    padding: 16px 20px;
    min-height: 60px;
    /* Force new stacking context */
    transform: translateZ(0);
    /* Ensure it stays above content */
    z-index: 100;
  }
}

.mobileMenuContent {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(24px, 4vw, 32px);
  overflow-y: auto; /* Make content scrollable */
  overflow-x: hidden;
  /* Ensure smooth scrolling on mobile */
  -webkit-overflow-scrolling: touch;
}

/* ======================
   MOBILE NAVIGATION LINKS
   ====================== */
.mobileNavLinks {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mobileNavLink {
  display: block;
  padding: clamp(20px, 4vw, 24px) 0;
  border-bottom: 1px solid #e3e3e5;
  text-decoration: none;
  color: #333f5b;
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  text-transform: capitalize;
  transition: color 0.15s ease;
  /* Ensure minimum touch target */
  min-height: 44px;
  display: flex;
  align-items: center;
}

.mobileNavLink:hover,
.mobileNavLink:focus-visible {
  color: #3495ff;
}

.mobileNavLink:focus-visible {
  outline: 2px solid #3495ff;
  outline-offset: 2px;
  border-radius: 8px;
}

/* First link gets special highlight color */
.mobileNavLink:first-child {
  color: #3495ff;
}

/* Active mobile nav link */
.mobileNavLink.active {
  color: #3495ff;
}

/* ======================
   MOBILE DROPDOWN (ACCORDION)
   ====================== */
.mobileDropdown {
  border-bottom: 1px solid #e3e3e5;
}

.mobileDropdownTrigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(20px, 4vw, 24px) 0;
  background: none;
  border: none;
  text-align: left;
  color: #333f5b;
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  text-transform: capitalize;
  cursor: pointer;
  transition: color 0.15s ease;
  font-family: 'P22 Mackinac Pro';
  /* Ensure minimum touch target */
  min-height: 44px;
}

.mobileDropdownTrigger:hover,
.mobileDropdownTrigger:focus-visible {
  color: #3495ff;
}

.mobileDropdownTrigger:focus-visible {
  outline: 2px solid #3495ff;
  outline-offset: 2px;
  border-radius: 8px;
}

.mobileDropdownIcon {
  transition: transform 0.15s ease;
  color: currentColor;
  flex-shrink: 0;
}

.mobileDropdownIcon.rotated {
  transform: rotate(180deg);
}

.mobileDropdownContent {
  padding-bottom: clamp(16px, 3vw, 24px);
  border-top: 1px solid #f0f0f0;
  animation: slideDown 0.15s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mobileDropdownItem {
  display: block;
  padding: clamp(12px, 2.5vw, 16px) clamp(16px, 3vw, 24px);
  text-decoration: none;
  color: #666;
  font-size: clamp(16px, 3.5vw, 20px);
  font-weight: 500;
  line-height: 1.3;
  transition: color 0.15s ease;
  border-radius: 8px;
  /* Ensure minimum touch target */
  min-height: 44px;
  display: flex;
  align-items: center;
  font-family: 'PP Neue Montreal', sans-serif;
}

.mobileDropdownItem:hover,
.mobileDropdownItem:focus-visible {
  color: #3495ff;
  background-color: rgba(52, 149, 255, 0.05);
}

.mobileDropdownItem:focus-visible {
  outline: 2px solid #3495ff;
  outline-offset: 2px;
}

/* ======================
   MOBILE CTA
   ====================== */
.mobileCta {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vw, 24px) clamp(32px, 6vw, 48px);
  background-color: #333f5b;
  color: white;
  text-decoration: none;
  border-radius: 24px;
  font-weight: 500;
  font-size: clamp(14px, 3vw, 16px);
  letter-spacing: -0.01em;
  line-height: 1.5;
  transition: all 0.15s ease;
  font-family: 'PP Neue Montreal', sans-serif;
  /* Minimum height for touch targets */
  min-height: 56px;
  margin-top: clamp(24px, 5vw, 40px);
}

.mobileCta:hover {
  background-color: #3495ff;
}

.mobileCta:focus-visible {
  outline: 2px solid #3495ff;
  outline-offset: 2px;
}

.mobileCta:active {
  transform: scale(0.98);
}

/* Mobile User Profile */
.mobileUserProfile {
  display: flex;
  justify-content: center;
  margin-top: clamp(24px, 5vw, 40px);
  padding: 0 clamp(20px, 4vw, 32px);
}

/* Auth Loading States */
.authLoading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 44px;
}

.mobileAuthLoading {
  display: flex;
  justify-content: center;
  margin-top: clamp(24px, 5vw, 40px);
  padding: 20px;
}

.loadingSpinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid var(--primary, #333f5b);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ======================
   COMPACT DESKTOP (1025-1279px)
   Tightened spacing for tablet landscape/small laptops
   ====================== */
@media (min-width: 1025px) and (max-width: 1279px) {
  .navigationBar {
    padding: clamp(16px, 2vw, 20px) clamp(32px, 4vw, 60px);
    height: clamp(72px, 8vw, 100px);
  }
  
  .navigationBar.scrolled {
    height: clamp(64px, 7vw, 80px);
    padding: clamp(12px, 1.5vw, 16px) clamp(32px, 4vw, 60px);
  }
  
  .logoText {
    font-size: clamp(32px, 3vw, 42px);
  }
  
  .desktopNav {
    gap: clamp(24px, 3vw, 48px);
  }
  
  .navLink,
  .dropdownTrigger {
    font-size: clamp(14px, 1.2vw, 15px);
    padding: 10px 14px;
  }
  
  .ctaButton {
    padding: clamp(14px, 2vw, 20px) clamp(28px, 4vw, 40px);
    font-size: clamp(14px, 1.2vw, 15px);
  }
}

/* ======================
   LARGE DESKTOP (1921px+)
   Maximum comfortable sizing for ultra-wide displays
   ====================== */
@media (min-width: 1921px) {
  .navigationBar {
    max-width: 1680px;
    padding: 24px 120px;
    height: 144px;
  }
  
  .navigationBar.scrolled {
    height: 100px;
    padding: 20px 120px;
  }
  
  .logoText {
    font-size: 46px;
  }
  
  .desktopNav {
    gap: 64px;
  }
  
  .navLink,
  .dropdownTrigger {
    font-size: 16px;
  }
  
  .ctaButton {
    font-size: 16px;
  }
}

/* ======================
   ACCESSIBILITY & MOTION
   ====================== */

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .navigationBar,
  .navLink,
  .dropdownTrigger,
  .dropdownIcon,
  .mobileDropdownIcon,
  .ctaButton,
  .mobileCta,
  .mobileMenuOverlay,
  .mobileDropdownContent {
    transition: none;
    animation: none;
  }
  
  .dropdownIcon.rotated,
  .mobileDropdownIcon.rotated {
    transform: none;
  }
  
  .ctaButton:hover,
  .mobileCta:active {
    transform: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .navigationBar {
    border-bottom: 2px solid;
  }
  
  .navigationBar.scrolled {
    box-shadow: none;
    border-bottom: 2px solid;
  }
  
  .dropdownMenu {
    border: 2px solid;
    box-shadow: none;
  }
}

/* Skip to main content link (for screen readers) */
.skipLink {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #3495ff;
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 10000;
}

.skipLink:focus {
  top: 6px;
}

.dropdownMenuList
{
    list-style: none;
    padding: 0;
}

.desktopNavList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 2.6vw, 64px); /* same as .desktopNav gap before */
}

.desktopNavList > li {
  margin: 0;
  padding: 0;
}


.mobileNavList {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Top-level links = same as .mobileNavLink */
.mobileNavList > li > a {
  display: block;
  padding: clamp(20px, 4vw, 24px) 0;
  border-bottom: 1px solid #e3e3e5;
  text-decoration: none;
  color: #333f5b;
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  text-transform: capitalize;
  transition: color 0.15s ease;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.mobileNavList > li:first-child > a {
  color: #3495ff; /* same as your old first link highlight */
}

/* Submenu (Resources children) = similar to .mobileDropdownItem */
.mobileNavList .sub-menu {
  list-style: none;
  margin: 0;
  padding: 0 0 clamp(16px, 3vw, 24px) clamp(16px, 3vw, 24px);
  border-top: 1px solid #f0f0f0;
}

.mobileNavList .sub-menu li > a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: clamp(12px, 2.5vw, 16px) 0;
  text-decoration: none;
  color: #666;
  font-size: clamp(16px, 3.5vw, 20px);
  font-weight: 500;
  line-height: 1.3;
  transition: color 0.15s ease;
}

.mobileNavList li > a:hover,
.mobileNavList li > a:focus-visible {
  color: #3495ff;
}


/* MOBILE SUBMENU ACCORDION BEHAVIOUR */
@media (max-width: 1024px) {
  /* Submenu is hidden by default */
  .mobileNavList .menu-item-has-children > .sub-menu {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    /* IMPORTANT: no space when closed */
    padding: 0;
    border-top: none;

    transition:
      max-height 0.2s ease,
      opacity 0.2s ease,
      transform 0.2s ease,
      padding 0.2s ease;
  }

  /* When parent li has .is-open → show submenu */
  .mobileNavList .menu-item-has-children.is-open > .sub-menu {
    max-height: 500px; /* big enough to show all items */
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;

    /* restore padding + border only when open */
    padding: 0 0 clamp(16px, 3vw, 24px) clamp(16px, 3vw, 24px);
    border-top: 1px solid #f0f0f0;
  }

  .mobileNavList > .menu-item-has-children > a {
    position: relative;
    padding-right: 32px; /* space for arrow */
  }

  .mobileNavList > .menu-item-has-children > a::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 0;
    width: 12px;
    height: 12px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-50%) rotate(45deg); /* pointing down-right */
    transition: transform 0.2s ease;
  }

  /* Rotate arrow when submenu is open */
  .mobileNavList > .menu-item-has-children.is-open > a::after {
    transform: translateY(-50%) rotate(225deg); /* pointing up-right */
  }
}


