/* Постоянные движения и отклик на наведение. Появление при прокрутке — assets/js/motion.js.
   Класс is-live стоит на блоке, пока он на экране. Всё внутри условия: в системе не отключены анимации. */

@media (prefers-reduced-motion: no-preference) {
  /* Прежнее появление блоков длилось 2,5 секунды и тормозило чтение */
  .styles_animation__F7J3U[data-effect] { --transition-duration: 900ms !important; }

  /* ===== Баннер: слайд собирается по частям ===== */
  .ms-hero__slide.is-active :is(.ms-hero__title, .ms-hero__lead, .ms-hero__actions, .ms-hero__facts li) { animation: ms-rise 900ms cubic-bezier(0.16, 1, 0.3, 1) backwards; }
  .ms-hero__slide.is-active .ms-hero__lead { animation-delay: 90ms; }
  .ms-hero__slide.is-active .ms-hero__actions { animation-delay: 180ms; }
  .ms-hero__slide.is-active .ms-hero__facts li:nth-child(1) { animation-delay: 260ms; }
  .ms-hero__slide.is-active .ms-hero__facts li:nth-child(2) { animation-delay: 340ms; }
  .ms-hero__slide.is-active .ms-hero__facts li:nth-child(3) { animation-delay: 420ms; }
  .ms-hero__slide.is-active .ms-hero__facts li:nth-child(4) { animation-delay: 500ms; }
  .ms-hero__slide.is-active .ms-hero__city img { animation: ms-zoom 9s cubic-bezier(0.2, 0.6, 0.3, 1) backwards; transform-origin: 70% 60%; }
  .ms-hero__slide.is-active .ms-card { animation: ms-turn 1200ms cubic-bezier(0.16, 1, 0.3, 1) backwards; }
  .ms-hero__slide.is-active .ms-tile { animation: ms-pop 600ms cubic-bezier(0.34, 1.5, 0.64, 1) backwards, ms-float 6s ease-in-out infinite alternate paused; }
  .ms-hero.is-live .ms-hero__slide.is-active .ms-tile { animation-play-state: running; }
  .ms-hero__slide.is-active .ms-tile:nth-child(2) { animation-delay: 450ms, -1s; }
  .ms-hero__slide.is-active .ms-tile:nth-child(3) { animation-delay: 570ms, -4s; }
  .ms-hero__slide.is-active .ms-tile:nth-child(4) { animation-delay: 690ms, -2.5s; }
  .ms-hero__slide.is-active .ms-tile:nth-child(5) { animation-delay: 810ms, -5.5s; }
  .ms-hero__slide.is-active .ms-catalog { animation: ms-rise 900ms cubic-bezier(0.16, 1, 0.3, 1) backwards; }
  .ms-hero__slide.is-active .ms-catalog__item.is-picked { animation: ms-choose 900ms ease-in-out 1300ms; }

  /* ===== Блик по мультикарте ===== */
  .ms-card::after { content: ""; position: absolute; inset: -20% auto -20% 0; width: 34%; background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0)); transform: translateX(-160%) skewX(-18deg); pointer-events: none; }
  .is-live .ms-card::after { animation: ms-shine 7s ease-in-out 1.6s infinite; }

  /* ===== Мультикарта: получатель по очереди примеряет бренды ===== */
  .is-live .ms-brands i { animation: ms-choose-turn 9s ease-in-out infinite; }
  .ms-brands i:nth-child(1) { animation-delay: 2.5s !important; }
  .ms-brands i:nth-child(5) { animation-delay: 4s !important; }
  .ms-brands i:nth-child(3) { animation-delay: 5.5s !important; }
  .ms-brands i:nth-child(4) { animation-delay: 7s !important; }
  .ms-brands i:nth-child(2) { animation-delay: 8.5s !important; }
  .ms-brands i:nth-child(6) { animation-delay: 10s !important; }

  /* ===== zakazpodarka.ru: подарки парят, звезда крутится ===== */
  .ms-gift { animation: ms-float 5s ease-in-out infinite alternate paused; }
  .ms-gift--purple { animation-duration: 6.5s; animation-delay: -3s; }
  .ms-gift--coin { animation-duration: 4.2s; animation-delay: -2s; }
  .ms-zp__star { animation: ms-star 90s linear infinite paused; }
  .ms-cta--gift::before { animation: ms-swing 14s ease-in-out infinite alternate paused; }
  .ms-cta--gift::after { animation: ms-swing 9s ease-in-out infinite alternate-reverse paused; }
  .is-live :is(.ms-gift, .ms-zp__star), .ms-cta--gift.is-live::before, .ms-cta--gift.is-live::after { animation-play-state: running; }

  /* ===== Офисы: карта выбранного города мягко приближается к метке ===== */
  .ms-of__map img { transform-origin: 33% 45%; }
  .ms-of__map .is-active img { animation: ms-zoom 1400ms cubic-bezier(0.16, 1, 0.3, 1); }

  /* ===== Кнопки ===== */
  .ms-hero__btn, .ms-p__btn, .ms-cta__btn, .ms-co__btn, .ms-of__go { transition: filter 250ms ease, background-color 250ms ease, scale 250ms cubic-bezier(0.34, 1.5, 0.64, 1); }
  :is(.ms-hero__btn, .ms-p__btn, .ms-cta__btn, .ms-co__btn, .ms-of__go):active { scale: 0.96; }

  @media (hover: hover) {
    :is(.ms-hero__btn, .ms-p__btn, .ms-cta__btn, .ms-co__btn, .ms-of__go):hover:not(:active) { scale: 1.03; }

    /* Карточки-ссылки приподнимаются */
    .ms-co__docs a { transition: border-color 250ms ease, translate 350ms cubic-bezier(0.16, 1, 0.3, 1); }
    a:is(.styles_card__DfrLt, .styles_card__KlUka, .styles_card__r11PJ) { transition: background-color 250ms ease, border-color 250ms ease, box-shadow 250ms ease, translate 350ms cubic-bezier(0.16, 1, 0.3, 1); }
    .tt-ind__card { transition: translate 350ms cubic-bezier(0.16, 1, 0.3, 1); }
    :is(.ms-co__docs a, a.styles_card__DfrLt, a.styles_card__KlUka, a.styles_card__r11PJ, .tt-ind__card):hover { translate: 0 -0.6rem; }

    /* Веер карт раскрывается шире */
    .ms-cta__cards > * { transition: rotate 600ms cubic-bezier(0.16, 1, 0.3, 1); }
    .ms-cta--multicard:hover .ms-cta__cards > i:nth-child(1) { rotate: 9deg; }
    .ms-cta--multicard:hover .ms-cta__cards > i:nth-child(2) { rotate: 4deg; }
    .ms-cta--multicard:hover .ms-cta__cards > .ms-card { rotate: -4deg; }

    /* Квадраты в плитках Gift Project поворачиваются */
    .ms-gp__tiles li::after { transition: rotate 900ms cubic-bezier(0.16, 1, 0.3, 1); }
    .ms-gp__tiles li:hover::after { rotate: 45deg; }
  }
}

@keyframes ms-rise { from { opacity: 0; translate: 0 2.8rem; } }
@keyframes ms-pop { from { opacity: 0; scale: 0.5; } }
@keyframes ms-turn { from { opacity: 0; translate: 0 6rem; rotate: -22deg; } }
@keyframes ms-zoom { from { scale: 1.1; } }
@keyframes ms-float { from { translate: 0 -0.9rem; } to { translate: 0 0.9rem; } }
@keyframes ms-choose { 50% { scale: 1.06; } }
@keyframes ms-choose-turn { 0%, 16%, 100% { scale: 1; } 5%, 11% { scale: 1.16; } }
@keyframes ms-shine { 0% { transform: translateX(-160%) skewX(-18deg); } 22%, 100% { transform: translateX(420%) skewX(-18deg); } }
@keyframes ms-star { from { transform: translate(-50%, -50%) rotate(0); } to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes ms-swing { from { rotate: -8deg; } to { rotate: 10deg; } }
