/* Слой анимаций поверх темы: только transform/opacity/filter, цвета и раскладку не трогает.
   Всё выключается при prefers-reduced-motion. Классы m-* ставит /js/motion.js. */
@media (prefers-reduced-motion: no-preference) {
  /* ---------- иконки при наведении ---------- */
  .ic { transform-origin: 50% 50%; }
  @media (hover: hover) {
    :is(.btn, .tab, .nav a, .icon-btn, .social, .support-fab, #copy-ip, .chip, .seg button, .select-wrap, .footer-links a, .inherit):hover .ic,
    :is(.feat, .extra, .how-step, .hero-perks li, .card-perks li, .cat-title):hover .ic { animation: m-wiggle 0.55s cubic-bezier(.3, 1.6, .5, 1); }
    /* у разных иконок свой характер */
    :is(a, button, .feat, .extra, .how-step, li):hover .ic:has(use[href$="#i-cart"]) { animation: m-jiggle 0.6s ease; }
    :is(a, button):hover .ic:has(use[href$="#i-copy"]),
    :is(a, button):hover .ic:has(use[href$="#i-plus"]),
    :is(a, button):hover .ic:has(use[href$="#i-minus"]) { animation: m-pop 0.4s cubic-bezier(.3, 1.8, .5, 1); }
    :is(a, button, li, .feat, .how-step, .cat-title):hover .ic:has(use[href$="#i-sparkles"]),
    :is(a, button, li, .feat, .extra):hover .ic:has(use[href$="#i-star"]),
    :is(a, button, li, .feat):hover .ic:has(use[href$="#i-wand"]) { animation: m-twinkle 0.8s ease; }
    :is(a, button):hover .ic:has(use[href$="#i-arrow-right"]) { animation: m-nudge 0.6s ease infinite; }
    :is(a, button):hover .ic:has(use[href$="#i-trash"]) { animation: m-shake 0.45s ease; }
    :is(a, button, li, .how-step):hover .ic:has(use[href$="#i-headset"]) { animation: m-tilt 0.7s ease; }
    :is(a, button, li, .how-step, .feat):hover .ic:has(use[href$="#i-zap"]) { animation: m-flash 0.6s ease; }
    :is(a, button):hover .ic:has(use[href$="#i-x"]) { animation: m-spin 0.45s ease; }
    :is(a, button, .feat, li):hover .ic:has(use[href$="#i-heal"]),
    :is(a, button, .feat, li):hover .ic:has(use[href$="#i-heart"]) { animation: m-beat 0.7s ease; }
    :is(.feat, li, .cat-title, a, button):hover .ic:has(use[href$="#i-gem"]),
    :is(.feat, li, .cat-title, a, button):hover .ic:has(use[href$="#i-crown"]) { animation: m-hop 0.6s cubic-bezier(.3, 1.6, .5, 1); }
    .social:hover .ic { animation: m-hop 0.6s cubic-bezier(.3, 1.6, .5, 1); }
    .feat:hover .feat-ic, .extra:hover .extra-ic, .how-step:hover .how-ic { transform: translateY(-2px) scale(1.08); transition: transform 0.3s cubic-bezier(.3, 1.6, .5, 1); }
  }
  .feat-ic, .extra-ic, .how-ic { transition: transform 0.3s ease; }

  /* ---------- карточки ---------- */
  .card-img { perspective: 700px; }
  .card-img img { will-change: auto; }
  @media (hover: hover) {
    .card:hover .card-img img { animation: m-float 2.4s ease-in-out infinite; }
  }
  .card.m-hide { opacity: 0; transform: translateY(26px) scale(0.98); }
  .card.m-show { animation: m-rise 0.6s cubic-bezier(.2, 1, .3, 1) backwards; animation-delay: var(--m-delay, 0ms); }

  /* картинка в окне товара плавает */
  .pm-left img { animation: m-float 3.2s ease-in-out infinite; }
  .modal:not([hidden]) .modal-box { animation: m-spring-in 0.5s cubic-bezier(.2, 1.3, .4, 1); }
  .modal:not([hidden]) .variant,
  .modal:not([hidden]) .feat,
  .modal:not([hidden]) .extra,
  .modal:not([hidden]) .chip { animation: m-rise 0.45s cubic-bezier(.2, 1, .3, 1) backwards; }
  .modal:not([hidden]) .feat:nth-child(2), .modal:not([hidden]) .variant:nth-child(2), .modal:not([hidden]) .chip:nth-child(2) { animation-delay: 40ms; }
  .modal:not([hidden]) .feat:nth-child(3), .modal:not([hidden]) .variant:nth-child(3), .modal:not([hidden]) .chip:nth-child(3) { animation-delay: 80ms; }
  .modal:not([hidden]) .feat:nth-child(4), .modal:not([hidden]) .chip:nth-child(4) { animation-delay: 120ms; }
  .modal:not([hidden]) .feat:nth-child(5), .modal:not([hidden]) .chip:nth-child(5) { animation-delay: 160ms; }
  .modal:not([hidden]) .feat:nth-child(6) { animation-delay: 200ms; }
  .modal:not([hidden]) .feat:nth-child(7) { animation-delay: 240ms; }
  .modal:not([hidden]) .feat:nth-child(n+8) { animation-delay: 280ms; }
  .modal.m-quiet .variant, .modal.m-quiet .feat, .modal.m-quiet .extra, .modal.m-quiet .chip, .modal.m-quiet .modal-box { animation: none; }
  .variant:active, .chip:active, .tab:active, .btn:active, .qty-btn:active, .seg button:active { transform: scale(0.94); }
  .variant.on .v-label .ic { animation: m-pop 0.4s cubic-bezier(.3, 1.8, .5, 1); }

  /* ---------- корзина ---------- */
  .drawer:not([hidden]) .drawer-box { animation: m-drawer 0.55s cubic-bezier(.2, 1.2, .3, 1); }
  .drawer:not([hidden]) .ci { animation: m-slide-in 0.45s cubic-bezier(.2, 1, .3, 1) backwards; }
  .drawer:not([hidden]) .ci:nth-child(2) { animation-delay: 60ms; }
  .drawer:not([hidden]) .ci:nth-child(3) { animation-delay: 120ms; }
  .drawer:not([hidden]) .ci:nth-child(4) { animation-delay: 180ms; }
  .drawer:not([hidden]) .ci:nth-child(n+5) { animation-delay: 220ms; }
  .drawer.m-quiet .drawer-box, .drawer.m-quiet .ci { animation: none; }
  .ci.m-out { animation: m-out 0.25s ease forwards !important; }
  .btn-cart.m-hit { animation: m-cart-hit 0.6s cubic-bezier(.3, 1.6, .5, 1); }
  .btn-cart.m-hit .ic { animation: m-jiggle 0.6s ease; }
  .badge.m-pop { animation: m-badge 0.5s cubic-bezier(.3, 2, .5, 1); }
  .empty .ic-xl { animation: m-float 3s ease-in-out infinite; }

  /* цены «тикают» при изменении */
  .m-tick { animation: m-tick 0.35s cubic-bezier(.3, 1.8, .5, 1); }
  span.m-tick, b.m-tick { display: inline-block; }

  /* количество */
  .qty-input.bad { animation: m-shake 0.35s ease; }
  .qty-input.m-bump { animation: m-tick 0.3s cubic-bezier(.3, 1.8, .5, 1); }

  /* ---------- прочее ---------- */
  .toast:not([hidden]) { animation: m-toast 0.55s cubic-bezier(.2, 1.4, .4, 1); }
  .toast:not([hidden]) .ic { animation: m-pop 0.5s 0.15s cubic-bezier(.3, 1.8, .5, 1) backwards; }
  #copy-ip.m-copied .ip-copy { animation: m-pop 0.45s cubic-bezier(.3, 1.8, .5, 1); }
  .tab.on .ic { animation: m-pop 0.4s cubic-bezier(.3, 1.8, .5, 1); }
  .support-fab { animation: m-fab-in 0.7s 0.6s cubic-bezier(.2, 1.4, .4, 1) backwards; }
  .support-fab .ic { animation: m-tilt 0.8s 4s ease 3; }
  .feed-item.m-new { animation: m-slide-in 0.5s cubic-bezier(.2, 1, .3, 1) backwards; }
  .how-step { transition: transform 0.3s cubic-bezier(.3, 1.4, .5, 1); }
  @media (hover: hover) { .how-step:hover, .feed-item:hover { transform: translateY(-3px); } .feed-item { transition: transform 0.3s ease; } }
  .eyebrow .ic { animation: m-twinkle 2.6s ease-in-out infinite; }

  /* рябь от нажатия и «полёт» в корзину */
  .m-ripple {
    position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: 0.35;
    transform: translate(-50%, -50%) scale(0); animation: m-ripple 0.6s ease-out forwards; mix-blend-mode: screen;
  }
  .m-fly { position: fixed; z-index: 100; pointer-events: none; border-radius: 14px; object-fit: cover; will-change: transform, opacity; }
}

@keyframes m-wiggle { 0% { transform: rotate(0); } 30% { transform: rotate(-14deg) scale(1.12); } 60% { transform: rotate(10deg) scale(1.08); } 100% { transform: rotate(0); } }
@keyframes m-jiggle { 0%, 100% { transform: translate(0) rotate(0); } 20% { transform: translate(-2px, 0) rotate(-12deg); } 40% { transform: translate(2px, -2px) rotate(10deg); } 60% { transform: translate(-1px, 0) rotate(-6deg); } 80% { transform: translate(1px, 0) rotate(4deg); } }
@keyframes m-pop { 0% { transform: scale(1); } 45% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes m-twinkle { 0% { transform: rotate(0) scale(1); } 40% { transform: rotate(72deg) scale(1.3); filter: drop-shadow(0 0 6px currentColor); } 100% { transform: rotate(144deg) scale(1); } }
@keyframes m-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }
@keyframes m-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-4px) rotate(-6deg); } 40% { transform: translateX(4px) rotate(6deg); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@keyframes m-tilt { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-16deg); } 60% { transform: rotate(12deg); } }
@keyframes m-flash { 0%, 100% { transform: scale(1); filter: none; } 35% { transform: scale(1.25) rotate(-8deg); filter: drop-shadow(0 0 8px currentColor); } }
@keyframes m-spin { to { transform: rotate(180deg); } }
@keyframes m-beat { 0%, 100% { transform: scale(1); } 20% { transform: scale(1.25); } 40% { transform: scale(0.95); } 60% { transform: scale(1.15); } }
@keyframes m-hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-5px) scale(1.12); } 70% { transform: translateY(1px) scale(0.96); } }
@keyframes m-float { 0%, 100% { transform: translateY(0) scale(1.04); } 50% { transform: translateY(-8px) scale(1.06); } }
@keyframes m-rise { from { opacity: 0; transform: translateY(22px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes m-spring-in { 0% { opacity: 0; transform: translateY(30px) scale(0.92); } 60% { opacity: 1; transform: translateY(-4px) scale(1.01); } 100% { transform: none; } }
@keyframes m-drawer { 0% { transform: translateX(100%); } 70% { transform: translateX(-8px); } 100% { transform: none; } }
@keyframes m-slide-in { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes m-out { to { opacity: 0; transform: translateX(40px) scale(0.95); } }
@keyframes m-cart-hit { 0% { transform: scale(1); } 30% { transform: scale(1.18) rotate(-4deg); } 55% { transform: scale(0.94) rotate(3deg); } 100% { transform: scale(1); } }
@keyframes m-badge { 0% { transform: scale(0.4); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes m-tick { 0% { transform: scale(1); } 40% { transform: scale(1.18); filter: brightness(1.5); } 100% { transform: scale(1); } }
@keyframes m-toast { 0% { opacity: 0; transform: translate(-50%, 40px) scale(0.9); } 100% { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes m-fab-in { from { opacity: 0; transform: translateY(30px) scale(0.8); } to { opacity: 1; transform: none; } }
@keyframes m-ripple { to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }
