/* Reusable confetti burst component.
 * Particles are spawned by the `confetti` Stimulus controller and animated
 * purely via CSS. The container fills its parent; particles are positioned
 * using % origins and travel to --tx/--ty-up/--ty-down offsets. */

.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.confetti-particle {
  position: absolute;
  display: block;
  border-radius: 1px;
  transform: translate(-50%, -50%);
  animation-name: confetti-fly;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  animation-iteration-count: 1;
  opacity: 0;
}

@keyframes confetti-fly {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(0deg);
  }

  10% {
    opacity: 1;
  }

  55% {
    opacity: 1;
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty-up))) rotate(calc(var(--rot) * 0.55));
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--tx) * 1.15), calc(-50% + var(--ty-up) + var(--ty-down))) rotate(var(--rot));
  }
}

@media (prefers-reduced-motion: reduce) {
  .confetti-particle {
    animation: none;
    opacity: 0;
  }
}

/* Design system demo stage for the confetti component */
.confetti-demo {
  position: relative;
  overflow: hidden;
  min-height: 200px;
  border-radius: var(--radius-md, 6px);
  background: var(--color-bg-subtle, rgba(255, 255, 255, 0.04));
  border: 1px dashed var(--color-border-subtle, rgba(255, 255, 255, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
}

.confetti-demo > .btn {
  position: relative;
  z-index: 1;
}
