/* Header — лого слева, nav справа; мобильная: два лого + бургер */

.header {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  width: 100%;
  height: 98px;
}

.header__inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
  max-width: 1440px;
  height: 98px;
  margin: 0 auto;
  padding: 0 64px;
  box-sizing: border-box;
  gap: 32px;
}

.header__logos {
  display: flex;
  flex-direction: row;
  flex-shrink: 0;
  align-items: center;
  gap: 24px;
}

.logo {
  flex-shrink: 0;
  display: block;
}

.logo--er {
  width: 141px;
  height: 36px;
}

.logo--er .logo__img {
  display: block;
  width: 141px;
  height: 36px;
  object-fit: contain;
}

.logo--nso {
  width: auto;
  height: 45px;
}

.logo--nso .logo__img {
  display: block;
  width: auto;
  height: 45px;
  max-width: 200px;
  object-fit: contain;
  object-position: left center;
}

.nav {
  flex: 0 1 auto;
  min-width: 0;
  margin-left: auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.nav__list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__list a {
  font-family: "Montserrat", system-ui, sans-serif;
  font-size: 16px;
  font-weight: 500;
  font-style: normal;
  line-height: 140%;
  letter-spacing: -0.01em;
  color: #ffffff;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.nav__list a:hover {
  color: rgba(100, 180, 255, 0.95);
}

.header__menu-toggle {
  display: none;
}

.header__backdrop {
  display: none;
}

.nav__close {
  display: none;
}

.nav__top {
  display: none;
}

.header__logos--drawer {
  display: none;
}

@media (max-width: 1000px) {
  .header {
    height: auto;
    min-height: 0;
  }

  .header--nav-open {
    z-index: 300;
  }

  .header--nav-open .header__inner {
    position: relative;
    z-index: 315;
  }

  .header--nav-open .header__logos:not(.header__logos--drawer),
  .header--nav-open .header__menu-toggle {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .header--nav-open .nav .header__logos--drawer {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .header__inner {
    height: auto;
    min-height: 64px;
    padding: 12px clamp(16px, 5vw, 20px);
    gap: 12px;
  }

  .header__logos:not(.header__logos--drawer) {
    gap: 12px;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .logo--er {
    width: 110px;
    height: 28px;
  }

  .logo--er .logo__img {
    width: 110px;
    height: 28px;
  }

  .logo--nso {
    height: 28px;
  }

  .logo--nso .logo__img {
    height: 36px;
    max-width: 140px;
  }

  .nav {
    position: fixed;
    inset: 0 auto 0 0;
    top: 0;
    left: 0;
    width: min(280px, 82vw);
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 20px 20px 32px;
    box-sizing: border-box;
    background: rgba(12, 13, 22, 0.98);
    border-right: 1px solid #232a6d;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.45);
    z-index: 320;
    overflow-y: auto;
    overscroll-behavior: contain;
    transition: transform 0.28s ease;
    transform: translateX(-100%);
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
  }

  .header--nav-open .nav {
    transform: translateX(0);
  }

  .nav__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 20px;
    gap: 12px;
  }

  .header__logos--drawer {
    display: flex;
    flex: 1;
    min-width: 0;
    gap: 10px;
  }

  .nav__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-bottom: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease;
  }

  .nav__close:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.45);
  }

  .nav__list {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 4px;
    width: 100%;
  }

  .nav__list li {
    width: 100%;
  }

  .nav__list a {
    display: block;
    padding: 14px 8px;
    white-space: nowrap;
    font-size: 17px;
    border-radius: 8px;
  }

  .nav__list a:active {
    background: rgba(255, 255, 255, 0.06);
  }

  .header__menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid #ffffff;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    z-index: 330;
    transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease,
      visibility 0.2s ease;
  }

  .header__menu-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
  }

  .header__menu-toggle:focus-visible {
    outline: 2px solid rgba(100, 180, 255, 0.85);
    outline-offset: 2px;
  }

  .header__menu-toggle-line {
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    transition: transform 0.25s ease, opacity 0.2s ease;
    transform-origin: center;
  }

  .header__backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 310;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, visibility 0.28s ease;
  }

  .header--nav-open .header__backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav,
  .header__backdrop,
  .header__menu-toggle-line {
    transition: none;
  }
}
