/* Header block — BEM: header__element--modifier */

.header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background-color: var(--color-bg-primary);
  box-shadow: var(--shadow-header);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 14px;
}

.header__logo img {
  height: 36px;
  width: auto;
}

.header__nav {
  display: none;
}

.header__nav-list {
  display: flex;
  align-items: center;
  gap: 28px;
}

.header__nav-item {
  position: relative;
}

.header__nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-main);
  font-weight: var(--font-weight-medium);
  padding-block: 8px;
}

.header__nav-link:hover,
.header__nav-link:focus-visible {
  color: var(--color-heading-gold);
}

.header__nav-item--active > .header__nav-link {
  color: var(--color-heading-gold);
}

.header__nav-caret {
  transition: transform var(--transition-fast);
}

.header__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background-color: var(--color-card-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

.header__nav-item--dropdown:hover .header__dropdown,
.header__nav-item--dropdown:focus-within .header__dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.header__nav-item--dropdown:hover .header__nav-caret,
.header__nav-item--dropdown:focus-within .header__nav-caret {
  transform: rotate(180deg);
}

.header__dropdown-link {
  display: block;
  padding: 10px 12px;
  border-radius: 4px;
  color: var(--color-text-main);
  font-size: var(--font-size-small);
}

.header__dropdown-link:hover,
.header__dropdown-link:focus-visible {
  background-color: var(--color-bg-dark);
  color: var(--color-heading-gold);
}

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

.header__login,
.header__register {
  display: none;
  padding: 10px 18px;
  font-size: var(--font-size-small);
}

.header__flag {
  display: none;
  font-size: 20px;
  line-height: 1;
}

.header__burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  order: 3;
}

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

.header__burger[aria-expanded="true"] .header__burger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.header__burger[aria-expanded="true"] .header__burger-line:nth-child(2) {
  opacity: 0;
}

.header__burger[aria-expanded="true"] .header__burger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.header__mobile-menu {
  display: none;
  flex-direction: column;
  background-color: var(--color-bg-dark);
  padding: 16px var(--container-padding-inline) 24px;
}

.header__mobile-menu.is-open {
  display: flex;
}

.header__mobile-list {
  display: flex;
  flex-direction: column;
}

.header__mobile-link {
  display: block;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(241, 244, 244, 0.08);
  color: var(--color-text-main);
  font-weight: var(--font-weight-medium);
}

.header__mobile-link--sub {
  padding-left: 20px;
  font-size: var(--font-size-small);
}

.header__mobile-link:hover,
.header__mobile-link:focus-visible {
  color: var(--color-heading-gold);
}

.header__mobile-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

@media (min-width: 768px) {
  .header__nav {
    display: block;
  }

  .header__login,
  .header__register {
    display: inline-flex;
  }

  .header__flag {
    display: inline-flex;
  }

  .header__burger {
    display: none;
  }

  .header__mobile-menu,
  .header__mobile-menu.is-open {
    display: none;
  }
}
