.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: var(--color-primary);
  height: var(--header-height);
  transition: background-color var(--transition), box-shadow var(--transition);
}

.header.is-scrolled {
  box-shadow: var(--shadow-md);
}

.header__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  height: var(--header-height);
  gap: 24px;
}

.header__logo {
  flex-shrink: 0;
}

.header__logo img {
  display: block;
  height: 44px;
  width: auto;
}

.header__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.header__nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  padding: 8px 4px;
  color: var(--color-white);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  text-align: center;
  position: relative;
  transition: color var(--transition);
}

.header__nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 2px;
  background: var(--color-gold);
  transition: width var(--transition);
}

.header__nav-link:hover {
  color: var(--color-gold-light);
}

.header__nav-link:hover::after {
  width: 100%;
}

.header__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-shrink: 0;
  min-width: 280px;
}

.header__phone {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-white);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  transition: color var(--transition);
}

.header__phone:hover {
  color: var(--color-gold-light);
}

/* Language switcher */
.header__lang {
  flex-shrink: 0;
}

.header__lang-track {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  padding: 3px;
  width: 132px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-pill);
  transition: opacity 0.2s ease;
}

.header__lang-track.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.header__lang-form {
  display: flex;
  flex: 1;
  margin: 0;
  min-width: 0;
}

.header__lang-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.header__lang-segment:hover:not(.is-active) {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.header__lang-segment.is-active {
  background: var(--color-gold);
  color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(217, 164, 65, 0.4);
}

.header__lang-segment:active {
  transform: scale(0.95);
}

.header__lang-name {
  display: none;
}

.header__mobile-lang {
  display: none;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.header__mobile-lang .header__lang-track {
  display: flex;
  width: 100%;
}

.header__mobile-lang .header__lang-form {
  display: flex;
  flex: 1;
}

.header__mobile-lang .header__lang-segment {
  flex: 1;
  min-width: 0;
  height: 44px;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.header__mobile-lang .header__lang-name {
  display: block;
  font-size: 9px; 
  font-weight: 600;
  letter-spacing: 0;
  opacity: 0.8;
}

.header__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
}

.header__burger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-white);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.header__burger.is-active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.header__burger.is-active span:nth-child(2) {
  opacity: 0;
}

.header__burger.is-active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.header__mobile-menu {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: var(--color-primary);
  padding: 24px 20px 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  transform: translateY(-10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
}

.header__mobile-menu.is-open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.header__mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}

.header__mobile-link {
  color: var(--color-white);
  font-size: 18px;
  font-weight: 700;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header__mobile-phone {
  display: inline-flex;
  color: var(--color-gold);
  font-weight: 800;
  font-size: 18px;
}

@media (min-width: 1920px) {
  .header__nav-link {
    min-width: 118px;
    font-size: 16px;
  }
}

@media (max-width: 1200px) {
  .header__nav-link {
    min-width: 96px;
    font-size: 14px;
  }

  .header__actions {
    min-width: 260px;
  }
}

@media (max-width: 1024px) {
  :root {
    --header-height: 72px;
  }

  .header__inner {
    grid-template-columns: auto 1fr;
  }

  .header__nav {
    display: none;
  }

  .header__actions {
    min-width: 0;
    justify-self: end;
  }

  .header__phone span {
    display: none;
  }

  .header__burger {
    display: flex;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 64px;
  }

  .header__logo img {
    height: 36px;
  }

  .header__actions > .header__lang {
    display: none;
  }

  .header__mobile-lang {
    display: block;
  }
}

@media (max-width: 500px) {
  .header__phone {
    display: none;
  }
}

@media (max-width: 375px) {
  .header__inner {
    gap: 12px;
  }

  .header__logo img {
    height: 32px;
  }
}
