/*
 * Бургер-меню: выезд панели, плавное затемнение страницы, появление пунктов
 * и вторая колонка «Коллекции».
 *
 * Скорость анимации меняется здесь, в одном месте:
 *   --menu-speed   — выезд/закрытие панели (0.45s = 0,45 секунды)
 *   --menu-stagger — задержка между пунктами при появлении
 */
.menu-panel {
  --menu-speed: 0.45s;
  --menu-stagger: 0.035s;
  --menu-width: min(460px, 100vw);
  --flyout-width: 420px;
  --menu-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  width: auto;
  max-width: 100vw;
  padding: 0;
  background: transparent;
  overflow: visible;
}
.menu-panel[open] {
  display: flex;
  animation: none;
}

/* ---------- Затемнение страницы ---------- */
.menu-panel::backdrop {
  background: rgb(0 0 0 / 0.55);
}
.menu-panel[open]::backdrop {
  animation: menu-backdrop-in var(--menu-speed) ease both;
}
.menu-panel.is-closing::backdrop {
  animation: menu-backdrop-out 0.35s ease both;
}

/* ---------- Основная колонка ---------- */
.menu-main {
  position: relative;
  z-index: 2;
  flex: none;
  width: var(--menu-width);
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  padding: 30px 36px;
}
.menu-panel[open] .menu-main {
  animation: menu-slide-in var(--menu-speed) var(--menu-ease) both;
}
.menu-panel.is-closing .menu-main {
  animation: menu-slide-out 0.35s cubic-bezier(0.55, 0, 0.75, 0.2) 0.08s both;
}

/* Пункты появляются по очереди, когда панель почти выехала */
.menu-main .panel-top,
.menu-main .menu-links > *,
.menu-main .menu-bottom > * {
  animation: menu-item-in 0.45s ease both;
  animation-delay: calc(0.2s + var(--i, 0) * var(--menu-stagger));
}
.menu-main .menu-links > :nth-child(1) { --i: 1; }
.menu-main .menu-links > :nth-child(2) { --i: 2; }
.menu-main .menu-links > :nth-child(3) { --i: 3; }
.menu-main .menu-links > :nth-child(4) { --i: 4; }
.menu-main .menu-links > :nth-child(5) { --i: 5; }
.menu-main .menu-links > :nth-child(6) { --i: 6; }
.menu-main .menu-bottom > :nth-child(1) { --i: 7; }
.menu-main .menu-bottom > :nth-child(2) { --i: 8; }
.menu-main .menu-bottom > :nth-child(3) { --i: 9; }
.menu-main .menu-bottom > :nth-child(4) { --i: 10; }
.menu-main .menu-bottom > :nth-child(5) { --i: 11; }
.menu-panel.is-closing .panel-top,
.menu-panel.is-closing .menu-links > *,
.menu-panel.is-closing .menu-bottom > * {
  animation: menu-item-out 0.18s ease both;
}

/* Пункт «Коллекция» выглядит как остальные ссылки меню */
.menu-flyout-toggle {
  display: block;
  width: 100%;
  padding: 0;
  text-align: left;
  font-size: inherit;
  line-height: inherit;
}
.menu-flyout-toggle:hover {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 5px;
}
.menu-flyout-toggle[aria-expanded="true"] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

/* ---------- Вторая колонка «Коллекции» ---------- */
.menu-flyout {
  position: relative;
  z-index: 1;
  flex: none;
  display: flex;
  flex-direction: column;
  width: var(--flyout-width);
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border-left: 1px solid var(--line);
  /* Заголовок колонки на одной линии с первым пунктом меню */
  padding: 99px 36px 36px;
  animation: flyout-in 0.5s var(--menu-ease) both;
}
.menu-flyout[hidden] {
  display: none !important;
}
.menu-flyout > * {
  animation: menu-item-in 0.4s ease 0.14s both;
}
.menu-flyout > :nth-child(3) { animation-delay: 0.19s; }
.menu-flyout > :nth-child(4) { animation-delay: 0.24s; }
.menu-flyout.is-leaving {
  animation: flyout-out 0.3s ease both;
}
.menu-flyout.is-leaving > * {
  animation: menu-item-out 0.15s ease both;
}
.menu-panel.is-closing .menu-flyout {
  animation: menu-item-out 0.2s ease both;
}

.menu-flyout h2 {
  margin: 0 0 22px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0;
}
.menu-flyout-links {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
  line-height: 1.5;
}
.menu-flyout-links a[aria-current="true"],
.menu-flyout-links a:hover {
  text-decoration: underline;
  text-underline-offset: 5px;
}
.menu-flyout-all {
  display: inline-block;
  margin-top: 10px;
  color: #6b6b6b;
}
.menu-flyout-empty {
  margin: 0;
  max-width: 280px;
  color: #6b6b6b;
  font-size: 15px;
  line-height: 1.5;
}
.menu-flyout-picture {
  display: block;
  margin-top: 40px;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--stone);
}
.menu-flyout-picture img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition:
    opacity 0.25s ease,
    transform 0.8s var(--menu-ease);
}
.menu-flyout-picture:hover img {
  transform: scale(1.03);
}
.menu-flyout-picture img.is-swapping {
  opacity: 0;
}
.menu-flyout-back {
  display: none;
}

/* ---------- Планшет и телефон: колонка въезжает поверх меню ---------- */
@media (max-width: 899px) {
  .menu-panel {
    --flyout-width: var(--menu-width);
  }
  .menu-flyout {
    position: absolute;
    z-index: 3;
    inset: 0 auto 0 0;
    width: var(--menu-width);
    padding: 30px 36px;
    border-left: 0;
    animation: flyout-slide-in 0.4s var(--menu-ease) both;
  }
  .menu-flyout.is-leaving {
    animation: flyout-slide-out 0.3s ease-in both;
  }
  .menu-flyout-back {
    display: block;
    align-self: flex-start;
    margin: 0 0 45px;
    padding: 0;
    font-size: 15px;
  }
  .menu-flyout-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .menu-flyout-toggle::after {
    content: "›";
    font-size: 22px;
    line-height: 1;
  }
}
@media (max-width: 767px) {
  .menu-main,
  .menu-flyout {
    padding: 24px;
  }
}

/* ---------- Ключевые кадры ---------- */
@keyframes menu-backdrop-in {
  from { background: rgb(0 0 0 / 0); }
}
@keyframes menu-backdrop-out {
  to { background: rgb(0 0 0 / 0); }
}
@keyframes menu-slide-in {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}
@keyframes menu-slide-out {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}
@keyframes menu-item-in {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: none; }
}
@keyframes menu-item-out {
  to { opacity: 0; }
}
@keyframes flyout-in {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
@keyframes flyout-out {
  from { clip-path: inset(0 0 0 0); }
  to { clip-path: inset(0 100% 0 0); }
}
@keyframes flyout-slide-in {
  from { transform: translateX(100%); }
  to { transform: none; }
}
@keyframes flyout-slide-out {
  to { transform: translateX(100%); }
}

/* Если в системе включено «Уменьшение движения» — без анимации */
@media (prefers-reduced-motion: reduce) {
  .menu-panel *,
  .menu-panel::backdrop {
    animation: none !important;
  }
}
