/* ── Pen ── */
.demo {
  display: grid;
  justify-items: center;
  gap: var(--space-6);
}

.pulse-btn {
  --size: 120px;
  --ring: 60px;
  --spring: cubic-bezier(0.405, -0.195, 0.165, 1.65); /* slight overshoot */

  position: relative;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--dx-fg);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.pulse-btn > span {
  grid-area: 1 / 1;
  border-radius: 50%;
}
.pulse-btn:focus-visible { outline-offset: 4px; }

.pulse-btn__dot {
  width: 28px;
  height: 28px;
  background: currentColor;
  transition: scale 340ms var(--spring);
}
.pulse-btn__ring {
  width: var(--ring);
  height: var(--ring);
  border: 3px solid currentColor;
  scale: 0.78;
  transition: scale 340ms var(--spring);
}

@media (hover: hover) and (pointer: fine) {
  .pulse-btn:hover .pulse-btn__ring { scale: 0.9; }
}
.pulse-btn:active .pulse-btn__ring { scale: 1.05; }
.pulse-btn:active .pulse-btn__dot { scale: 0.85; }

/* One wave per click, added by JS and removed when it ends */
.pulse-btn__pulse {
  width: var(--ring);
  height: var(--ring);
  border: 2px solid currentColor;
  pointer-events: none;
  animation: pulse 1.1s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
@keyframes pulse {
  from { opacity: 1; scale: 0.95; }
  80%  { opacity: 0; }
  to   { opacity: 0; scale: 2.6; }
}

@media (prefers-reduced-motion: reduce) {
  .pulse-btn__dot,
  .pulse-btn__ring { transition: none; }
  .pulse-btn__pulse { animation-name: pulse-fade; }
  @keyframes pulse-fade {
    from { opacity: 1; scale: 1.2; }
    to   { opacity: 0; scale: 1.2; }
  }
}
