/* ===== базовые ===== */
.header__nav ul,
.menu .menu__list,
.footer__nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.header__nav li,
.menu .menu__list li,
.footer__nav li {
  position: relative;
  display: block;
}

.header__nav a,
.menu .menu__list a,
.footer__nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: inherit;
  padding: 10px 14px;
}

.footer__nav a {
  color: #FFFFFF;
}

/* стрелка */
.menu-arrow {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  transition: transform 0.25s ease;
  position: relative;
  top: 2px;
}

/* поворот при открытии */
li.is-open > a .menu-arrow {
  transform: rotate(180deg);
}

/* ===== DESKTOP HEADER ===== */
.header__nav li.menu-item-has-children {
  position: relative;
}

/* базовое состояние подменю (hover-анимация) */
.header__nav .sub-menu {
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 220px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  z-index: 1000;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.25s ease,
  transform 0.25s ease,
  visibility 0.25s ease;
  will-change: opacity, transform, visibility;
}

.header__nav li.menu-item-has-children > .sub-menu {
  min-width: 100%;
  width: max-content;
  box-sizing: border-box;
}

/* при наведении — плавное появление */
.header__nav li.menu-item-has-children:hover > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* анимация пунктов внутри */
.header__nav .sub-menu li {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.header__nav li.menu-item-has-children:hover > .sub-menu li {
  opacity: 1;
  transform: translateY(0);
}

.header__nav li.menu-item-has-children:hover > .sub-menu li:nth-child(1) {
  transition-delay: 0.05s;
}

.header__nav li.menu-item-has-children:hover > .sub-menu li:nth-child(2) {
  transition-delay: 0.1s;
}

.header__nav li.menu-item-has-children:hover > .sub-menu li:nth-child(3) {
  transition-delay: 0.15s;
}

.header__nav li.menu-item-has-children:hover > .sub-menu li:nth-child(4) {
  transition-delay: 0.2s;
}

/* ===== MOBILE (≤991px) ===== */
@media (max-width: 768px) {
  .menu .menu__list {
    display: block !important;
    width: 100%;
    height: 100%;
    padding: 10px 10px 20px 10px;
  }

  .menu .menu__list > li {
    background: #081D56;
    padding: 12px 16px;
  }

  .menu .menu__list .sub-menu {
    position: static !important;
    background: #081D56;
    padding-left: 14px;
    margin-top: 4px;
    color: #ffffff80;
  }

  .menu .menu__list .sub-menu a {
    color: #ffffff80;
    font-size: 14px;
  }

  .menu .menu__list .sub-menu li:not(:last-child) a {
    border-bottom: 1px dotted #273866;
  }

  /* убрать hover-анимацию на мобилках для header */
  .header__nav .sub-menu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ===== FOOTER (закрыто по умолчанию + анимация раскрытия) ===== */
.footer__nav .sub-menu {
  padding-left: 14px; /* можно оставить — не ломает max-height */
  margin-top: 0; /* без зазора в закрытом состоянии */
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  visibility: hidden;
  transition: max-height .28s ease,
  opacity .22s ease,
  visibility .28s ease,
  margin-top .28s ease;
}

.footer__nav .menu-item.is-open > .sub-menu {
  max-height: 600px; /* подстрой под свой контент */
  opacity: 1;
  visibility: visible;
  margin-top: 8px;
}

.footer__nav .sub-menu a {
  font-size: 14px;
  color: #ffffff80;
  transition: color 0.3s;
}

.footer__nav .sub-menu a:hover {
  color: #ffffffb5;
}

.footer__nav .sub-menu li:not(:last-child) a {
  border-bottom: 1px dotted #273866;
}

@media (max-width: 768px) {
  .footer__nav .sub-menu a {
    width: unset;
  }

  .footer__nav li {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
}

/* ===== FOOTER group ===== */
.footer__group {
  width: 250px;
}


/* ===== Универсальная стрелка для всех пунктов с подменю ===== */
.header__nav li.menu-item-has-children > a::after,
.menu .menu__list li.menu-item-has-children > a::after,
.footer__nav li.menu-item-has-children > a::after,
.header__lang > li:first-child::after {
  content: "";
  display: inline-block;
  margin-left: 6px;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.25s ease;
  vertical-align: middle;
}

/* ===== Поворот при hover (для десктопа) ===== */
.header__nav li.menu-item-has-children:hover > a::after,
.header__lang:hover > li:first-child::after {
  transform: rotate(225deg) translateY(-3px) translateX(-2px);
}

/* ===== Поворот при открытии (мобайл / футер) ===== */
.menu .menu__list li.is-open > a::after,
.footer__nav li.is-open > a::after {
  transform: rotate(225deg) translateY(-3px) translateX(-2px);
}


.header__lang {
  cursor: pointer;
  flex-shrink: 0;
  font-size: 1.6rem;
  font-style: normal;
  font-weight: 500;
  letter-spacing: .128rem;
  line-height: 2.6rem;
  position: relative;
  text-transform: uppercase
}

@media (hover: hover) {
  .header__lang:hover > li:last-child {
    opacity: 1;
    pointer-events: auto
  }
}

.header__lang.visible > li:last-child {
  opacity: 1;
  pointer-events: auto
}

.header__lang > li:first-child {
  align-items: center;
  display: flex;
  gap: 1rem
}

.header__lang > li:last-child {
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s
}

.header__lang > li:last-child ul {
  background: #fff;
  box-shadow: 0 4px 25.3px #081d561f;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  left: 50%;
  margin-top: 1rem;
  min-width: 10rem;
  padding: 1.6rem;
  position: absolute;
  top: 100%;
  transform: translate(-50%)
}

.header__lang > li:last-child ul .current-menu-item {
  opacity: .5
}

.header__lang > li:last-child ul:after {
  content: "";
  height: 1.3rem;
  left: 0;
  position: absolute;
  right: 0;
  top: -1.2rem
}

.header__lang > li:last-child ul a {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: flex-start
}


@media (min-width: 768px) {
  .header__lang {
    flex-shrink: 0;
    position: relative
  }

  .header__lang > li:first-child {
    font-size: 1.8rem;
    gap: .4rem;
    line-height: 2.8rem
  }
}