/* ============================================
   HEADER COMPONENT - ELITE LEVEL
   ============================================
   Performance-optimized header with smooth animations
   - Uses transform/opacity for GPU acceleration
   - Respects prefers-reduced-motion
   - Optimized transitions with will-change
   ============================================ */

/* CSS Custom Properties for animation values */
:root {
  --header-transition-duration: 0.4s;
  --header-transition-timing: cubic-bezier(0.4, 0, 0.2, 1);
  --header-scroll-threshold: 40px;
  --header-mobile-scroll-threshold: 30px;
}

/* Desktop Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  padding: calc(32px + env(safe-area-inset-top)) 0 16px;
  min-height: 94px;
  background: transparent;
  pointer-events: none;
  box-sizing: border-box;
  /* Performance optimizations */
  will-change: padding;
  transform: translateZ(0); /* Force GPU acceleration */
  backface-visibility: hidden;
  /* Smooth transitions */
  transition: padding var(--header-transition-duration) var(--header-transition-timing);
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
  .site-header {
    transition: none;
  }
}

.header-inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 18px 24px;
  min-height: 58px;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  /* Performance optimizations */
  will-change: transform, width, padding, border-radius, background, backdrop-filter;
  transform: translateZ(0);
  backface-visibility: hidden;
  /* Optimized transitions - only animate transform/opacity when possible */
  transition: 
    border-radius var(--header-transition-duration) var(--header-transition-timing),
    padding var(--header-transition-duration) var(--header-transition-timing),
    width var(--header-transition-duration) var(--header-transition-timing),
    background var(--header-transition-duration) var(--header-transition-timing),
    border var(--header-transition-duration) var(--header-transition-timing),
    box-shadow var(--header-transition-duration) var(--header-transition-timing),
    backdrop-filter var(--header-transition-duration) var(--header-transition-timing),
    transform var(--header-transition-duration) var(--header-transition-timing);
}

@media (prefers-reduced-motion: reduce) {
  .header-inner {
    transition: none;
  }
}

.logo {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--white);
  line-height: 1;
  display: flex;
  align-items: center;
  text-decoration: none;
  /* Performance optimization */
  will-change: color;
  transition: color 0.3s var(--header-transition-timing);
}

.logo:hover {
  color: var(--yellow);
}

@media (prefers-reduced-motion: reduce) {
  .logo {
    transition: none;
  }
}

.logo a {
  display: inline-block;
  line-height: 1;
  margin: 0;
  padding: 0;
}

.site-nav {
  display: flex;
  gap: 24px;
  font-weight: 600;
}

.site-nav a {
  text-decoration: none;
  color: var(--white);
  /* Performance optimization */
  will-change: color;
  transition: color 0.3s var(--header-transition-timing);
}

@media (prefers-reduced-motion: reduce) {
  .site-nav a {
    transition: none;
  }
}

/* Floating state - Optimized for performance */
.site-header.is-floating {
  padding: 16px 0 8px;
  min-height: 94px;
}

.site-header.is-floating .header-inner {
  width: min(760px, calc(100% - 32px));
  padding: 10px 24px;
  min-height: 58px;
  border-radius: 999px;
  /* Glass morphism effect with fallback */
  background: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.95); /* Fallback for browsers without backdrop-filter */
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.22);
  /* Backdrop filter with fallback */
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  /* Use @supports for progressive enhancement */
  transform: translateY(0) scale(0.98);
}

/* Enhanced glass effect for modern browsers */
@supports (backdrop-filter: blur(18px)) {
  .site-header.is-floating .header-inner {
    background: rgba(255, 255, 255, 0.18);
  }
}

.site-header.is-floating .logo,
.site-header.is-floating .site-nav a {
  color: var(--black);
}

/* Mobile Header */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: calc(20px + env(safe-area-inset-top)) 0 12px;
  z-index: 40;
  pointer-events: none;
  background: transparent;
  box-sizing: border-box;
  /* Performance optimizations */
  will-change: padding;
  transform: translateZ(0);
  backface-visibility: hidden;
  transition: padding var(--header-transition-duration) var(--header-transition-timing);
}

@media (prefers-reduced-motion: reduce) {
  .mobile-header {
    transition: none;
  }
}

.mobile-header__inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 0 24px;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  /* Performance optimizations */
  will-change: transform, width, padding, border-radius, background, backdrop-filter;
  transform: translateZ(0);
  backface-visibility: hidden;
  transition: 
    border-radius var(--header-transition-duration) var(--header-transition-timing),
    padding var(--header-transition-duration) var(--header-transition-timing),
    width var(--header-transition-duration) var(--header-transition-timing),
    background var(--header-transition-duration) var(--header-transition-timing),
    border var(--header-transition-duration) var(--header-transition-timing),
    box-shadow var(--header-transition-duration) var(--header-transition-timing),
    backdrop-filter var(--header-transition-duration) var(--header-transition-timing),
    transform var(--header-transition-duration) var(--header-transition-timing);
}

@media (prefers-reduced-motion: reduce) {
  .mobile-header__inner {
    transition: none;
  }
}

.mobile-header .logo {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--white);
}

.mobile-header__inner .btn {
  padding: 10px 20px;
  font-size: 14px;
}

.mobile-header.is-solid {
  padding: 16px 0 8px;
}

.mobile-header.is-solid .mobile-header__inner {
  width: min(360px, calc(100% - 24px));
  padding: 10px 18px;
  border-radius: 999px;
  /* Glass morphism with fallback */
  background: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.95); /* Fallback */
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform: translateY(0) scale(0.98);
}

@supports (backdrop-filter: blur(18px)) {
  .mobile-header.is-solid .mobile-header__inner {
    background: rgba(255, 255, 255, 0.18);
  }
}

.mobile-header.is-solid .logo {
  color: var(--black);
}

@media (max-width: 768px) {
  .site-header {
    display: none !important;
  }

  .mobile-header {
    display: block !important;
  }

  .mobile-header .btn-text--desktop {
    display: none;
  }

  .mobile-header .btn-text--mobile {
    display: inline;
  }
}
