/**
 * Neural Partners Header - Vanilla CSS Implementation
 * Replaces React Header SCSS modules for better performance
 */

/* Header Variables - Centralized */
:root {
  --header-height: 75px;  /* Standardized across all pages */
}

/* Skip Links for Accessibility */
.skip-links {
  position: fixed;
  top: -100px; /* Move completely off screen */
  left: 0;
  right: 0;
  z-index: 10000;
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid transparent; /* Hide border by default */
  transition: all 0.3s ease-in-out;
}

.skip-links:focus-within {
  top: 0; /* Move back into view */
  border-bottom-color: #FF966C; /* Show border only when focused */
}

.skip-link {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: #FF966C;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.skip-link:focus,
.skip-link:hover {
  background: #FF966C;
  color: #000000;
  text-decoration: none;
  outline: 2px solid #ffffff;
  outline-offset: 2px;
  transform: translateY(0);
}

/* Main Header */
.header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100vw !important;
  z-index: 9999 !important;
  background: #0A0A0B;
  backdrop-filter: blur(24px);
  border-bottom: 4px solid;
  border-image: linear-gradient(90deg, #FF966C, #6E56CF) 1;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), backdrop-filter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 20px rgba(0, 0, 0, 0.1);
  opacity: 1;
  height: auto;
  padding: 0; /* No padding by default */
}

/* Transparent header state - applied when scrolling down */
.header--transparent {
  opacity: 0.3 !important;
  backdrop-filter: blur(10px);
}

.header--scrolled {
  background: rgba(10, 10, 11, 0.85);
  border-bottom-color: rgba(107, 114, 128, 0.18);
  box-shadow: 0 2px 40px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(20px);
}


/* Transparency class removed - no longer using transparency on scroll */

.header--hidden {
  opacity: 0.1;
  pointer-events: none;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  width: 100vw;
  max-width: none;
  margin: 0;
  padding: 0 calc(2rem + 20px); /* Remove vertical padding to respect header height */
  transition: min-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Brand Logo */
.header-brand {
  flex-shrink: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
}

.header-logo {
  display: flex;
  align-items: center;
  transition: transform 0.3s ease;
  position: relative;
}

.header-logo img {
  height: 30px;
  width: auto;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Show/hide logos based on header state with smooth transitions */
.header-logo-full {
  display: block;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-logo:hover {
  transform: scale(1.05);
}

.header-logo-container {
  display: flex;
  align-items: center;
}

/* Desktop Navigation */
.header-nav {
  display: none;
  align-items: center;  /* Center align items */
  gap: 2rem;
  height: auto;
  position: relative; /* Enable absolute positioning for structured data */
}

@media (min-width: 768px) {
  .header-nav {
    display: flex;
  }
}

.header-menu {
  display: flex;
  gap: 2.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;  /* Center align items */
  height: auto;
}

.header-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  height: auto;
}

/* Extend hover area for dropdown items */
.header-nav-item--has-dropdown {
  /* padding-bottom: 8px; Removed to improve vertical alignment */
}

.header-link {
  font-family: var(--font-primary);
  font-weight: 300;
  font-size: 0.95rem;
  color: #ffffff;
  text-decoration: none;
  position: relative;
  transition: all 0.3s ease;
  padding: 12px 8px;  /* Match vertical padding with button */
  margin: 0;
  letter-spacing: 0.02em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Nav item main text */
.header-link-text {
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1;
  letter-spacing: 0.08em;
}

/* Nav item subtitle */
.header-link-subtitle {
  font-size: 0.75rem;
  font-weight: 300;
  font-style: italic;
  letter-spacing: 0.07em;
  display: block;
  line-height: 1.1;
  margin-top: 0;
}

.header-link-subtitle::after {
  content: " >>";
  opacity: 0.7;
}

.header-link-subtitle--purple {
  color: #6E56CF !important;  /* lighter purple for better visibility */
}

.header-link-subtitle--orange {
  color: #d97706 !important;  /* neural-orange */
}

.header-link-subtitle--blue {
  color: #00b8d3 !important;  /* neural-blue - corrected */
}

.header-link:hover .header-link-text {
  color: #FF966C;
  transition: color 0.3s ease;
}

.header-link:hover .header-link-subtitle {
  opacity: 0.8;
}

.header-link--neural-engine {
  font-family: var(--font-primary);
  font-weight: var(--font-weight-light);
  font-size: .8rem;
  color: #ff966c;
  text-decoration: none;
  position: relative;
  transition: all .3s ease;
  padding: .5rem 0;
  letter-spacing: .02em;
  line-height: 1.4;
  text-shadow: 0 0 5px rgba(255, 150, 108, .4), 0 0 10px rgba(255, 150, 108, .2);
}

.header-link--neural-engine::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  height: 2px;
  background: linear-gradient(135deg, #ff966c, #ffb84d);
  width: 60%;
  transition: width 0.3s ease;
}

/* Mega Menu - Default Hidden State */
.header-mega-menu {
  position: absolute;
  top: calc(100% - 4px); /* Account for border */
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  width: 600px;
  background: rgba(10, 10, 11, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 100;
  backdrop-filter: blur(20px);
  margin-top: 0px; /* Reduced gap */
  overflow: hidden;
  display: none; /* Force hidden by default */
}

/* Add invisible bridge area to prevent hover gaps */
.header-mega-menu::before {
  content: '';
  position: absolute;
  top: -12px; /* Bridge the gap */
  left: 0;
  right: 0;
  height: 12px;
  background: transparent;
  z-index: -1;
}

/* Mega Menu - Show on Hover with improved timing */
.header-nav-item--has-dropdown:hover .header-mega-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  display: block;
  transition-delay: 0s; /* No delay when showing */
}

/* Add delay when hiding to prevent accidental closes */
.header-mega-menu {
  transition-delay: 0.1s; /* Small delay when hiding */
}

.header-nav-item--has-dropdown:hover .header-mega-menu {
  transition-delay: 0s; /* Cancel delay when showing */
}

.header-mega-menu-content {
  display: flex;
  min-height: 280px;
}

.header-mega-menu-links {
  flex: 1;
  padding: 1.5rem;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.header-mega-menu-title {
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 500;
  color: #ffffff;
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

.header-mega-menu-links-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.header-mega-menu-link {
  display: block;
  padding: 0.5rem 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-family: var(--font-primary);
  font-size: 0.85rem;
  font-weight: var(--font-weight-light);
  line-height: 1.4;
  letter-spacing: 0.01em;
  transition: all 0.3s ease;
  border-radius: 6px;
}

.header-mega-menu-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(4px);
}

/* Mega Menu Card */
.header-mega-menu-card {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-mega-menu-card-link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 200px;
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(255, 150, 108, 0.15), rgba(110, 86, 207, 0.15));
  border-radius: 12px;
  border: 1px solid #FF966C;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  z-index: 2;
}

/* Hero section card sweep effect */
.header-mega-menu-card-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 150, 108, 0.05), transparent);
  transition: left 0.5s ease;
  pointer-events: none;
}

.header-mega-menu-card-link:hover::before {
  left: 100%;
}

.header-mega-menu-card-link:hover {
  transform: translateY(-3px);
  background: rgba(110, 86, 207, 0.1);
  border-color: rgba(110, 86, 207, 0.3);
  box-shadow: 0 8px 32px rgba(110, 86, 207, 0.15);
}

.header-mega-menu-card-link:active {
  transform: translateY(-6px) scale(1.01);
}

/* Neural background effects with proper opacity transitions */
.header-mega-menu-card-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.header-mega-menu-card-link:hover .header-mega-menu-card-background {
  opacity: 1;
}

.header-mega-menu-neural-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.header-mega-menu-card-link:hover .header-mega-menu-neural-grid {
  opacity: 1;
}

.header-mega-menu-neural-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  filter: blur(60px);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.header-mega-menu-card-link:hover .header-mega-menu-neural-glow {
  opacity: 0.3;
}

.header-mega-menu-neural-glow--purple {
  background: radial-gradient(circle, #6E56CF 0%, transparent 70%);
}

.header-mega-menu-neural-glow--orange {
  background: radial-gradient(circle, #FF966C 0%, transparent 70%);
}

.header-mega-menu-neural-glow--blue {
  background: radial-gradient(circle, #74EEDD 0%, transparent 70%);
}

.header-mega-menu-card-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1rem;
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
  margin: auto; /* Center the icon in the available space */
}

.header-mega-menu-card-link:hover .header-mega-menu-card-icon {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(110, 86, 207, 0.3);
}

/* Special styling for Neural Core icon (large size) */
.header-mega-menu-card-icon--large {
  background: none !important;
  border-radius: 0 !important;
  width: 150px !important;
  height: 150px !important;
}

/* Special styling for Neural Labs and Neural Intellect icons (medium size) */
.header-mega-menu-card-icon--medium {
  background: none !important;
  border-radius: 0 !important;
  width: 120px !important;
  height: 120px !important;
}

.header-mega-menu-card-content {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  right: 1rem;
  z-index: 2;
  text-align: left;
}

.header-mega-menu-card-title {
  font-family: var(--font-primary);
  font-size: 0.7rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 0.25rem;
  transition: color 0.3s ease;
}

.header-mega-menu-card-link:hover .header-mega-menu-card-title {
  color: #FF966C;
}

.header-mega-menu-card-subtitle {
  font-family: var(--font-primary);
  font-size: 1rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

/* Responsive adjustments for mega menu cards */
@media (max-width: 1024px) {
  .header-mega-menu-card-icon--large {
    width: 120px !important;
    height: 120px !important;
  }
  
  .header-mega-menu-card-icon--medium {
    width: 100px !important;
    height: 100px !important;
  }
  
  .header-mega-menu-card-title {
    font-size: 1.1rem;
  }
  
  .header-mega-menu-card-subtitle {
    font-size: 0.9rem;
  }
}


/* CTA Container - Stacks structured data above button */
.header-cta-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-left: auto; /* Push to the right side */
  gap: 0; /* No gap between structured data and button */
}

/* Structured Data Links - Above button */
.header-structured-data {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.5);
  padding: 5px 12px 4px; /* Equal padding on left and right for text */
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-top: none; /* Remove top border since it bleeds off */
  border-radius: 0 0 3px 3px; /* Only round bottom corners */
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  line-height: 1;
  white-space: nowrap;
  text-align: center;
  margin-top: -10px; /* Bleed off the top more */
  margin-bottom: 6px; /* Small gap before button */
  margin-right: 10px; /* Container padding on the right */
}

.header-structured-data span {
  font-weight: 600;
  color: #fff;
}

.header-structured-data a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.header-structured-data a:hover {
  color: rgba(255, 255, 255, 0.9);
}

/* CTA Button */
.header-cta {
  margin: 0; /* Reset margins since container handles positioning */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1;
  letter-spacing: 0.03em;
  text-decoration: none;
  color: #0a0a0b;
  background: linear-gradient(rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.95)) padding-box,
              linear-gradient(90deg, #FF966C, #6E56CF) border-box;
  border: 3px solid transparent;
  border-radius: 26px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), inset 0 1px #fffc;
  transition: all 0.2s ease;
  position: relative;
  overflow: visible;
  min-height: 44px;
}

.header-cta:hover {
  transform: translateY(-1px);
  background: linear-gradient(rgba(255, 255, 255, 1), rgba(255, 255, 255, 1)) padding-box,
              linear-gradient(90deg, #FF966C, #6E56CF) border-box;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1),
              0 2px 4px rgba(0, 0, 0, 0.08),
              inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.header-cta:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1),
              inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Mobile Menu - Hidden by default on desktop */
.header-mobile-toggle {
  display: none !important;
  flex-direction: column;
  justify-content: space-around;
  width: 24px;
  height: 24px;
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  z-index: 10001;
  transition: background-color 0.3s ease;
  position: relative;
}

.header-mobile-toggle:hover,
.header-mobile-toggle:focus,
.header-mobile-toggle:active {
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.header-mobile-toggle:focus {
  box-shadow: 0 0 0 2px #FF966C;
}

.header-toggle-line {
  width: 24px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.header-mobile-toggle--active .header-toggle-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.header-mobile-toggle--active .header-toggle-line:nth-child(2) {
  opacity: 0;
}

.header-mobile-toggle--active .header-toggle-line:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

.header-mobile-nav {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: calc(100vh - 60px);
  background: #0A0A0B;
  padding: 2rem;
  transform: translateX(-100%);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 9998;
  overflow-y: auto;
}

.header-mobile-nav--open {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
}

.header-mobile-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.header-mobile-menu > li {
  border-bottom: 1px solid rgba(107, 114, 128, 0.2);
}

.header-mobile-link {
  display: block;
  padding: 1rem 0;
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
  font-size: 1.1rem;
  transition: color 0.3s ease;
}

.header-mobile-link:hover {
  color: #FF966C;
}

.header-mobile-link--neural-engine {
  background: linear-gradient(135deg, #6E56CF, #FF966C);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 600;
}

.header-mobile-submenu {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1rem;
}

.header-mobile-submenu-link {
  display: block;
  padding: 0.75rem 0;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.3s ease;
}

.header-mobile-submenu-link:hover {
  color: #FF966C;
}

.header-mobile-cta {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(107, 114, 128, 0.2);
}

/* Responsive Design */
@media (min-width: 769px) {
  /* Force desktop nav visible on desktop */
  .header-nav {
    display: flex !important;
  }
  
  .header-mobile-toggle {
    display: none !important;
  }
  
  .header-mobile-nav {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .header-nav {
    display: none !important;
  }
  
  .header-mobile-toggle {
    display: flex !important;
  }
  
  /* Mobile always uses compact styles by default */
  .header {
    padding: 0 !important;
  }
  
  .header-inner {
    min-height: 32px !important; /* Always compact height on mobile */
    padding: 0.25rem 1rem !important;
  }
  
  .header-logo img {
    height: 24px !important; /* Always compact size on mobile */
  }
  
  /* Optimize mobile menu spacing to prevent scrolling */
  .header-mobile-nav {
    padding-bottom: 1rem; /* Reduce bottom padding */
  }
  
  .header-mobile-link {
    padding: 0.75rem 0; /* Reduce from 1rem to 0.75rem */
    font-size: 1rem; /* Reduce from 1.1rem to 1rem */
  }
  
  .header-mobile-submenu-link {
    padding: 0.5rem 0; /* Reduce from 0.75rem to 0.5rem */
    font-size: 0.9rem; /* Reduce from 0.95rem to 0.9rem */
  }
  
  .header-mobile-cta {
    margin-top: 1.5rem; /* Reduce from 2rem to 1.5rem */
    padding-top: 1.5rem; /* Reduce from 2rem to 1.5rem */
  }
}

@media (max-width: 1024px) and (min-width: 769px) {
  .header-mega-menu {
    width: 500px;
  }
  
  .header-mega-menu-content {
    min-height: 250px;
  }
  
  .header-mega-menu-links {
    padding: 1.25rem;
  }
}

@media (max-width: 768px) {
  .header-mega-menu {
    display: none !important; /* Force hide mega menu on mobile, use mobile nav instead */
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
  
  .header-nav-item--has-dropdown:hover .header-mega-menu {
    display: none !important; /* Prevent hover from showing mega menu on mobile */
  }
  
  /* Hide structured data container on mobile */
  .header-cta-container {
    flex-direction: row; /* Switch back to row on mobile */
  }
  
  .header-structured-data {
    display: none !important;
  }
  
  /* Reset CTA margin on mobile */
  .header-cta {
    margin-top: 0 !important;
  }
}