/* =================== hc-cart-fly — add-to-cart micro-animation ===================
   A gilded dot arcs from the clicked "В корзину" button to the header cart icon,
   which gives a satisfying bump. JS (assets/main.js::animateCartFly) sets the
   --hc-fly-x0/y0 (source) and --hc-fly-x1/y1 (cart) coordinates as absolute px. */

.hc-cart-fly {
  position: fixed;
  left: 0;
  top: 0;
  margin: -9px 0 0 -9px;
  z-index: 3000;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #f3e1c0, var(--hc-accent, #8b7355));
  box-shadow: 0 6px 18px rgba(139, 115, 85, 0.45);
  pointer-events: none;
  will-change: transform, opacity;
  animation: hc-cart-fly 0.72s cubic-bezier(0.55, 0, 0.3, 1) forwards;
}

@keyframes hc-cart-fly {
  0% {
    transform: translate(var(--hc-fly-x0, 0), var(--hc-fly-y0, 0)) scale(1);
    opacity: 1;
  }
  55% {
    transform: translate(
      calc((var(--hc-fly-x0, 0) + var(--hc-fly-x1, 0)) / 2),
      calc(var(--hc-fly-y0, 0) - 46px)
    ) scale(1.12);
    opacity: 1;
  }
  100% {
    transform: translate(var(--hc-fly-x1, 0), var(--hc-fly-y1, 0)) scale(0.28);
    opacity: 0;
  }
}

/* Cart icon "receives" the item */
.hc-hdr__ico--cart-bump {
  animation: hc-cart-bump 0.5s ease;
}

@keyframes hc-cart-bump {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.28); }
  60% { transform: scale(0.92); }
}

@media (prefers-reduced-motion: reduce) {
  .hc-cart-fly { display: none; }
  .hc-hdr__ico--cart-bump { animation: none; }
}
