/* -------------------------------------------------------------
   2. HEADER / NAVIGATION
   ------------------------------------------------------------- */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid transparent;
  transition: var(--transition-smooth);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

header.scrolled {
  background: rgba(21, 37, 55, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-card);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  padding: 0 16px;
  max-width: var(--container-max);
  margin: 0 auto;
}

@media (min-width: 768px) {
  .nav-container {
    padding: 0 24px;
  }
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-white);
}
.logo span {
  font-size: 0.9rem;
}

@media (min-width: 768px) {
  .logo {
    font-size: 1.4rem;
    gap: 10px;
  }
}

.logo img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.nav-links {
  display: none;
  gap: 20px;
  position: relative;
}

@media (min-width: 1024px) {
  .nav-links {
    display: flex;
    align-items: center;
    height: 100%;
  }
}

.nav-links a {
  font-size: 0.9rem;
  color: var(--text-white);
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 1;
  transition: var(--transition-fast);
  position: relative;
  padding: 6px 0;
}

.nav-links a:hover {
  opacity: 1;
  color: var(--accent-cyan);
}

.nav-links a.active {
  opacity: 1;
  color: var(--text-white);
}

.nav-disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.nav-links .active-line-indicator {
  position: absolute;
  bottom: 0;
  height: 2.5px;
  background: var(--accent-cyan);
  z-index: 2;
  pointer-events: none;
  left: 0;
  right: 100%;
  opacity: 0;
  transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1), right 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.nav-links .active-line-indicator.no-transition {
  transition: none !important;
}

/* Desktop Hover Navigation Dropdowns */
.nav-dropdown-wrapper {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
}

.nav-arrow {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
  opacity: 1;
}

.nav-dropdown-wrapper:hover .nav-arrow {
  transform: rotate(180deg);
  color: var(--accent-cyan);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: #152537;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  min-width: 220px;
  overflow: hidden;
  padding: 0;
  
  /* Animation properties */
  opacity: 0;
  visibility: hidden;
  max-height: 0; /* Starts collapsed at 0 for smooth slide-down */
  transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              opacity 0.2s ease, 
              visibility 0.2s ease;
  pointer-events: none;
}

.nav-dropdown-wrapper:nth-of-type(1):hover .nav-dropdown-menu {
  max-height: 260px; /* Services content height with headroom */
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.nav-dropdown-wrapper:nth-of-type(2):hover .nav-dropdown-menu {
  max-height: 390px; /* Solutions content height with headroom */
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Invisible hover bridge */
.nav-dropdown-wrapper::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 15px;
  background: transparent;
  display: none;
  z-index: 999;
}

.nav-dropdown-wrapper:hover::after {
  display: block;
}

.nav-links .nav-dropdown-item {
  padding: 10px 20px;
  font-size: 0.85rem;
  color: var(--text-white);
  text-decoration: none;
  transition: var(--transition-fast);
  text-align: left;
  font-weight: 500;
  display: block;
  white-space: nowrap;
}

.nav-links .nav-dropdown-item:hover {
  background: rgba(97, 117, 162, 0.1);
  color: var(--accent-cyan);
}

/* Mobile Accordion submenus */
.mobile-dropdown-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mobile-dropdown-toggle {
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-white);
  width: 100%;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 1;
  transition: var(--transition-fast);
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.mobile-dropdown-toggle:hover {
  opacity: 1;
  color: var(--accent-cyan);
}

.mobile-arrow {
  width: 14px;
  height: 14px;
  transition: transform 0.3s ease;
}

.mobile-dropdown-container.active .mobile-arrow {
  transform: rotate(180deg);
  color: var(--accent-cyan);
}

.mobile-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  text-align: center;

  /* Animation properties */
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 16px;
  margin-top: 0;
  transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.2s ease,
              padding 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              margin-top 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-dropdown-container:nth-of-type(1).active .mobile-dropdown-menu {
  max-height: 420px; /* Services mobile content height with headroom */
  opacity: 1;
  padding: 12px 16px;
  margin-top: 6px;
}

.mobile-dropdown-container:nth-of-type(2).active .mobile-dropdown-menu {
  max-height: 680px; /* Solutions mobile content height with headroom (fixes wrapping clipping) */
  opacity: 1;
  padding: 12px 16px;
  margin-top: 6px;
}

.mobile-submenu-link {
  font-size: 0.85rem;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text-white);
  text-decoration: none;
  opacity: 1;
  transition: var(--transition-fast);
  padding: 6px 24px;
  display: block;
  width: 100%;
  text-align: left;
  white-space: nowrap;
}

.mobile-submenu-link:hover {
  color: var(--accent-cyan);
  opacity: 1;
}

.mobile-menu .mobile-active,
.mobile-menu a.mobile-active {
  color: var(--accent-cyan) !important;
  opacity: 1 !important;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (min-width: 768px) {
  .header-actions {
    gap: 12px;
  }
}

/* Language Switcher Dropdown */
.lang-dropdown-container {
  position: relative;
}

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: #ffffff !important;
  transition: var(--transition-fast);
  border-radius: 4px;
  user-select: none;
}

/* No hover background highlight on the button */
.lang-switcher:hover {
  background: transparent;
}

.lang-arrow {
  width: 14px;
  height: 14px;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
  opacity: 0.85;
}

.lang-dropdown-container.active .lang-arrow {
  transform: rotate(180deg);
  color: var(--accent-cyan);
}

.lang-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: 0.05em;
  line-height: 1;
}



.lang-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: #152537;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  min-width: 130px;
  width: max-content;
  overflow: hidden;
  padding: 0;
  
  /* Animation properties */
  opacity: 0;
  visibility: hidden;
  max-height: 0; /* Starts collapsed at 0 for smooth slide-down */
  transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              opacity 0.2s ease, 
              visibility 0.2s ease;
  pointer-events: none;
}

/* Hover bridge on desktop to prevent dropdown closing when moving mouse over the gap */
@media (min-width: 1024px) {
  .lang-dropdown-container::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 10px;
    background: transparent;
    display: none;
    z-index: 999;
  }
  .lang-dropdown-container:hover::after {
    display: block;
  }
}

.lang-dropdown-menu.active {
  opacity: 1;
  visibility: visible;
  max-height: 140px; /* Expands to exact height for 3 items with headroom */
  pointer-events: auto;
}

/* Hover dropdown on desktop */
@media (min-width: 1024px) {
  .lang-dropdown-container:hover .lang-dropdown-menu {
    opacity: 1;
    visibility: visible;
    max-height: 140px; /* Expands to exact height for 3 items with headroom */
    pointer-events: auto;
  }
  .lang-dropdown-container:hover .lang-arrow {
    transform: rotate(180deg);
    color: var(--accent-cyan);
  }
}

.lang-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px 10px 20px;
  font-size: 0.9rem;
  color: var(--text-light-blue);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
  font-weight: 500;
  user-select: none;
  white-space: nowrap;
}

.lang-dropdown-item:hover {
  background: rgba(97, 117, 162, 0.1);
  color: var(--accent-cyan);
}

.lang-dropdown-item.active {
  background: rgba(97, 117, 162, 0.05);
  color: var(--accent-cyan);
  font-weight: 500;
}

/* Ticker Banner (Removed) */

@media (max-width: 1023px) {
  .lang-switcher {
    font-size: 1rem;
    padding: 8px 12px;
  }
}

/* Mobile Menu Burger */
.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 101;
  padding: 4px;
  color: #ffffff;
  transition: var(--transition-fast);
}

@media (min-width: 1024px) {
  .menu-toggle {
    display: none;
  }
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background-color: currentColor;
  transition: var(--transition-fast);
}

.menu-toggle:hover {
  color: #ffffff;
}

.menu-toggle.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Mobile Navigation Overlay */
.mobile-menu {
  position: fixed;
  top: 80px;
  left: 0;
  width: 100%;
  background: rgba(21, 37, 55, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 99;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.3s ease,
              visibility 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              padding 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0 40px;
  -webkit-overflow-scrolling: touch;
}

.mobile-menu.active {
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  opacity: 1;
  visibility: visible;
  padding: 28px 40px 40px 40px;
}

header.menu-open {
  background: rgba(21, 37, 55, 0.75) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-bottom-color: var(--border-card) !important;
  box-shadow: none !important;
}

.mobile-menu a {
  font-size: 0.9rem;
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-white);
  opacity: 1;
  transition: var(--transition-fast);
}

.mobile-menu a:hover {
  opacity: 1;
  color: var(--accent-cyan);
}

.mobile-menu .btn {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: #ffffff;
  color: var(--bg-main) !important;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.15);
  text-shadow: none;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: pulse-glow-cta 2s infinite;
}

.mobile-menu .btn:hover {
  animation: none; /* отключаем пульсацию при наведении */
  background: #ffffff;
  color: var(--bg-main) !important;
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.35);
  transform: translateY(-1.5px);
  filter: brightness(0.95);
}

/* Header Icons Group & Buttons */
.header-phone-mobile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--text-white);
  transition: color 0.2s ease, transform 0.2s ease;
  text-decoration: none;
  background: none;
  border: none;
  border-radius: 50%;
  position: relative;
  z-index: 2;
}

.header-phone-mobile svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.header-phone-mobile:hover {
  color: var(--accent-cyan);
  transform: translateY(-1px);
}

@media (min-width: 1024px) {
  .header-phone-mobile {
    display: none;
  }
}

.btn-header-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-weight: 600;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-sans);
  background: #ffffff;
  color: var(--bg-main) !important;
  border: none;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.15);
  text-decoration: none;
  white-space: nowrap;
  text-shadow: none; /* remove header shadow from button text */
  animation: pulse-glow-cta 2s infinite;
}

/* Пульсация по аналогии с плавающей кнопкой чата (chat-toggle-btn) */
@keyframes pulse-glow-cta {
  0% {
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.15), 0 0 0 0 rgba(255, 255, 255, 0.5);
  }
  70% {
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.15), 0 0 0 10px rgba(255, 255, 255, 0);
  }
  100% {
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.15), 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

.btn-header-cta:hover {
  animation: none; /* отключаем пульсацию при наведении */
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.35);
  transform: translateY(-1.5px);
  filter: brightness(0.95);
}

.btn-header-cta:active {
  transform: translateY(0);
}

.header-icons-group {
  display: none;
  align-items: center;
  gap: 12px;
  position: relative;
}

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

.hover-indicator-circle {
  position: absolute;
  width: 40px;
  height: 40px;
  background: var(--text-white);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transform: scale(0);
  transition: 
    transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.2), 
    opacity 0.2s ease;
}

.hover-indicator-circle.sliding {
  transition: 
    left 0.35s cubic-bezier(0.8, -0.2, 0.2, 1.2), 
    top 0.35s cubic-bezier(0.8, -0.2, 0.2, 1.2), 
    transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.2), 
    opacity 0.2s ease;
}

.header-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--text-white);
  transition: color 0.2s ease, transform 0.2s ease;
  text-decoration: none;
  background: none !important;
  border: none !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  position: relative;
  z-index: 2;
}

.header-icon-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  transition: stroke 0.2s ease;
}

.header-icon-btn.indicator-active {
  color: #000000 !important;
}

.header-icon-btn.indicator-active svg {
  stroke: #000000 !important;
}

.header-icon-btn:hover {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}

/* Profile/account icon hidden site-wide (2026-07-06) — to bring it back, delete this rule */
#headerProfileBtn {
  display: none !important;
}
