/* ===== 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;
}

/* Полоса прогресса сверху — эффект светового меча (SABER):
   тонкое бело-горячее «ядро» + неоновое свечение + светящееся остриё */
#dxd-progress {
  position: fixed;
  top: var(--navbar-height, 64px);
  left: 0;
  height: 1px;
  width: 0;
  z-index: 105;
  border-radius: 1px;
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0) 0%,
      var(--span) 10%,
      #fff 55%,
      #fff 100%);
  box-shadow:
    0 0 1px #fff,
    0 0 3px var(--span),
    0 0 6px var(--span);
  opacity: 0;
  transition: width .2s ease, opacity .3s ease;
  pointer-events: none;
}

/* Светящееся остриё на переднем крае «клинка» */
#dxd-progress::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 10px;
  height: 1px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 4px 1px #fff,
    0 0 8px 1px var(--span),
    0 0 14px 2px var(--span);
}

#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;
  }
}
