/* ===== DXDCS Reactive — мгновенная навигация + анимация появления ===== */

/* Плавный "уход" текущего контента при переходе */
.containter-wrapper {
  transition: opacity .2s ease;
}

.containter-wrapper.dxd-leaving {
  opacity: .25;
  pointer-events: none;
}

/* Индикация загрузки */
html.dxd-navigating,
html.dxd-navigating a {
  cursor: progress;
}

/* Тонкая полоса прогресса сверху */
#dxd-progress {
  position: fixed;
  top: var(--navbar-height, 64px);
  left: 0;
  height: 3px;
  width: 0;
  z-index: 105;
  background: linear-gradient(90deg, var(--span), #ff7a7a);
  box-shadow: 0 0 10px var(--span);
  opacity: 0;
  transition: width .2s ease, opacity .3s ease;
  pointer-events: none;
}

#dxd-progress.active {
  opacity: 1;
}

/* Анимация выпадающего появления элементов */
@keyframes dxdDropIn {
  from {
    opacity: 0;
    transform: translateY(-22px) scale(.985);
  }

  60% {
    opacity: 1;
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Главная: каскадное появление блоков левой колонки и правого сайдбара.
   Работает и при первой загрузке, и при PJAX-переходе (новые узлы анимируются заново). */
.container-modules:not(.container-wide) > *:not(.theme__sidebar):not(.popup_modal):not(.modal-window-server):not(dialog):not(script):not(link):not(style),
.dxd__aside > *:not(.modal-window-server) {
  animation: dxdDropIn .6s cubic-bezier(.22, .61, .36, 1) both;
}

/* Оверлеи (фикс-позиция) не должны участвовать в анимации появления —
   иначе их сброшенный transform/opacity делает их видимыми/ломает закрытие */
.container-modules > .theme__sidebar,
.container-modules > .popup_modal,
.container-modules > .modal-window-server,
.container-modules .modal-window-server,
.container-modules > dialog {
  animation: none !important;
}

.container-modules:not(.container-wide) > *:nth-child(1) { animation-delay: .03s; }
.container-modules:not(.container-wide) > *:nth-child(2) { animation-delay: .09s; }
.container-modules:not(.container-wide) > *:nth-child(3) { animation-delay: .15s; }
.container-modules:not(.container-wide) > *:nth-child(4) { animation-delay: .21s; }
.container-modules:not(.container-wide) > *:nth-child(5) { animation-delay: .27s; }
.container-modules:not(.container-wide) > *:nth-child(6) { animation-delay: .33s; }
.container-modules:not(.container-wide) > *:nth-child(7) { animation-delay: .39s; }
.container-modules:not(.container-wide) > *:nth-child(8) { animation-delay: .45s; }
.container-modules:not(.container-wide) > *:nth-child(n+9) { animation-delay: .5s; }

.dxd__aside > *:nth-child(1) { animation-delay: .18s; }
.dxd__aside > *:nth-child(2) { animation-delay: .26s; }
.dxd__aside > *:nth-child(3) { animation-delay: .34s; }
.dxd__aside > *:nth-child(n+4) { animation-delay: .42s; }

/* Лёгкое появление контента на внутренних страницах при переходе (только прозрачность,
   без transform — чтобы не ломать sticky/fixed-элементы внутри страниц, напр. магазина) */
@keyframes dxdFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.container-modules.container-wide.dxd-page-enter {
  animation: dxdFadeIn .35s ease both;
}

@media (prefers-reduced-motion: reduce) {
  .container-modules:not(.container-wide) > *,
  .dxd__aside > *,
  .container-modules.container-wide.dxd-page-enter {
    animation: none;
  }

  .containter-wrapper {
    transition: none;
  }
}
