/* Header Styles - Gaming HUD Design */
.site-header {
  background: rgba(5, 8, 22, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 1.2rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(0, 212, 255, 0.15);
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.4), 0 0 60px rgba(0, 212, 255, 0.05);
  /* Transition only the props that actually change between states — never the
     expensive backdrop-filter. `transition: all` made the browser re-evaluate
     the blur on every scroll frame, which flickered the header. */
  transition: padding 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
  /* Pin the header to its own GPU layer so the backdrop blur is composited in
     sync with the scroll instead of tearing/flickering at the top of the page. */
  transform: translateZ(0);
  will-change: transform;
}

.site-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(57, 255, 20, 0.4), rgba(0, 212, 255, 0.6), rgba(191, 64, 255, 0.4), transparent);
}

.site-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary-blue, #00D4FF), var(--neon-purple, #BF40FF), var(--neon-green, #39FF14), transparent);
  background-size: 200% 100%;
  animation: headerAccentLine 4s linear infinite;
}

@keyframes headerAccentLine {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.site-header.scrolled {
  padding: 0.7rem 0;
  background: rgba(5, 8, 22, 0.92);
  box-shadow: 0 4px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(0, 212, 255, 0.08);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s ease;
  z-index: 2;
}

.logo:hover {
  transform: scale(1.05);
}

.logo img,
.logo-img {
  height: 55px;
  width: auto;
  filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.5));
  transition: all 0.3s ease;
}

.logo:hover img,
.logo:hover .logo-img {
  filter: drop-shadow(0 0 15px rgba(0, 212, 255, 0.8));
}

.logo-text {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #FFFFFF 0%, #00D4FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.logo-highlight {
  background: linear-gradient(135deg, #00D4FF 0%, #0066FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  gap: 5px;
  z-index: 1001;
  position: relative;
}

.mobile-menu-toggle span {
  width: 28px;
  height: 3px;
  background: linear-gradient(90deg, #00D4FF, #0066FF);
  border-radius: 2px;
  transition: all 0.3s ease;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
  background: #00D4FF;
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(8px, -8px);
  background: #00D4FF;
}

.main-nav {
  display: flex;
}

.nav-list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 8px;
  align-items: center;
}

.nav-list a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.05rem;
  transition: all 0.3s ease;
  padding: 10px 16px;
  display: block;
  border-radius: 8px;
  position: relative;
}

.nav-list a::before {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 70%;
  height: 2px;
  background: linear-gradient(90deg, var(--neon-green, #39FF14), var(--primary-blue, #00D4FF), var(--neon-purple, #BF40FF));
  transition: transform 0.3s ease;
  border-radius: 1px;
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
}

.nav-list a:hover {
  color: #00D4FF;
  background: rgba(0, 212, 255, 0.08);
  text-shadow: 0 0 15px rgba(0, 212, 255, 0.6);
}

.nav-list a:hover::before {
  transform: translateX(-50%) scaleX(1);
}

.has-submenu {
  position: relative;
}

.submenu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  background: rgba(10, 14, 39, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  list-style: none;
  margin: 0;
  padding: 12px 0;
  min-width: 200px;
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(0, 212, 255, 0.2);
  display: none;
  z-index: 1001;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
}

.submenu::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.5), transparent);
}

.submenu-open {
  display: block;
  animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.submenu li {
  margin: 0;
}

.submenu a {
  color: rgba(255, 255, 255, 0.9);
  padding: 12px 20px;
  display: block;
  border-radius: 0;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.submenu a::before {
  display: none;
}

.submenu a:hover {
  background: rgba(0, 212, 255, 0.15);
  color: #00D4FF;
  padding-left: 24px;
}

.lang-switch {
  background: rgba(57, 255, 20, 0.08);
  border: 1px solid rgba(57, 255, 20, 0.3);
  border-radius: 6px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 0.9rem;
  color: #39FF14;
  transition: all 0.3s ease;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.lang-switch:hover {
  background: rgba(57, 255, 20, 0.15);
  border-color: rgba(57, 255, 20, 0.6);
  box-shadow: 0 0 25px rgba(57, 255, 20, 0.25);
  color: #39FF14;
  text-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
}

@media (max-width: 768px) {
  .header-container {
    padding: 0 15px;
  }
  
  .site-header {
    padding: 1rem 0;
  }
  
  .logo img,
  .logo-img {
    height: 45px;
  }
  
  .logo-text {
    font-size: 24px;
  }
  
  .mobile-menu-toggle {
    display: flex;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  
  .main-nav {
    position: fixed;
    inset: 0;
    /* Сплошной непрозрачный фон. Раньше был rgba(.98) + backdrop-filter blur(30px):
       blur на полноэкранном оверлее вешал рендер, а на части мобильных браузеров
       не срабатывал — и контент (hero) просвечивал сквозь меню. */
    background: #0a0e27;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 80px 16px;
    opacity: 0;
    visibility: hidden;
    /* анимируем только нужное, не 'all' (иначе дёргался layout/перекомпоновка) */
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
  }
  
  .main-nav.nav-open {
    opacity: 1;
    visibility: visible;
  }

  /* При открытом меню: фон не скроллится, cookie-баннер не торчит поверх оверлея */
  body.menu-open {
    overflow: hidden;
  }

  body.menu-open .cookie-consent {
    display: none !important;
  }

  /* КЛЮЧЕВОЕ: у .site-header есть transform/backdrop-filter/will-change — они делают
     header «containing block» для position:fixed потомков, из-за чего полноэкранный
     .main-nav схлопывался до размера шапки (~160px) и контент просвечивал снизу.
     На время открытого меню убираем их — fixed-оверлей раскрывается на весь вьюпорт. */
  body.menu-open .site-header {
    transform: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    will-change: auto !important;
  }

  .nav-list {
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    width: 90%;
    max-width: 400px;
  }
  
  .nav-list li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .nav-list a {
    padding: 18px;
    font-size: 1.15rem;
    text-align: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  
  .lang-switch {
    padding: 10px 14px;
    font-size: 1rem;
  }
  
  .submenu {
    position: static;
    box-shadow: none;
    background: rgba(0, 212, 255, 0.05);
    margin-top: 0;
    border: none;
    border-radius: 0;
  }
  
  .submenu a {
    padding: 14px 28px;
    color: rgba(255, 255, 255, 0.8);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  
  .submenu a:hover {
    padding-left: 28px;
  }
}

@media (max-width: 480px) {
  .header-container {
    padding: 0 12px;
  }
  
  .site-header {
    padding: 0.9rem 0;
  }
  
  .logo img,
  .logo-img {
    height: 40px;
  }
  
  .logo-text {
    font-size: 22px;
  }
  
  .mobile-menu-toggle span {
    width: 24px;
    height: 2.5px;
  }
  
  .nav-list {
    width: 95%;
    max-width: 350px;
  }
  
  .nav-list a {
    padding: 16px;
    font-size: 1.1rem;
  }
  
  .lang-switch {
    padding: 8px 12px;
    font-size: 0.95rem;
  }
  
  .submenu a {
    padding: 12px 24px;
    font-size: 0.95rem;
  }
}
