/* Puddle title (motion kit). Adapted from Tudor's "CSS Dropping Letters" / "Liquid Puddle Text Reveal".
   Letters fall in as droplets and merge into an orange puddle, then the puddle evaporates letter by letter
   and the title is left plain, in the colour set in Elementor.
   Usage in Elementor: Heading widget > Advanced > CSS Classes: m-puddle. Plain text headings only (no links inside). */

.m-puddle {
  --pd-color: #F3763A;   /* puddle colour (Savi orange) */
  --pd-ink: #FBF4EC;     /* letter colour while the puddle is there (knocked out of the orange) */
  --pd-from: 45vh;       /* droplets rise from below, letter by letter (negative = fall from above) */
}

.m-puddle .elementor-heading-title { position: relative; isolation: isolate; }
.m-pd-word { display: inline-flex; white-space: nowrap; }
.m-pd-l { display: inline-block; padding: .1em .2em; margin: -.1em -.2em; will-change: transform; }

/* text layer: cream while the puddle is under it, then back to the heading's own colour */
.m-pd-text { transition: color .5s ease .3s; } /* darken only once the puddle is mostly gone */
.m-pd-ready:not(.m-pd-done) .m-pd-text { color: var(--pd-ink) !important; }

/* puddle layer: each letter becomes a blob, merged by the goo filter */
.m-pd-drops {
  position: absolute; inset: 0; z-index: -1;
  color: var(--pd-color);
  filter: url(#m-pd-filter);
  pointer-events: none; user-select: none;
}
.m-pd-drops .m-pd-l {
  border-radius: 50%;
  background: currentColor;
  box-shadow: var(--pd-sx, 0) var(--pd-sy, 0) 0 var(--pd-sp, .3em) currentColor;
}

/* waiting: hidden below */
.m-pd-ready .m-pd-l { opacity: 0; transform: translateY(var(--pd-from)); }
/* falling in */
.m-pd-play .m-pd-l { animation: m-pd-drop .8s var(--pd-d, 0ms) ease-out forwards; }
/* evaporating: puddle blobs shrink away, text stays */
.m-pd-done .m-pd-drops .m-pd-l { animation: m-pd-pop .55s var(--pd-d2, 0ms) cubic-bezier(.45, 0, .55, 1) forwards; opacity: 1; transform: none; }
.m-pd-done .m-pd-text .m-pd-l { animation: none; opacity: 1; transform: none; }

@keyframes m-pd-drop {
  0%   { transform: translateY(var(--pd-from)); opacity: 0; }
  12%  { opacity: 1; }
  85%  { transform: translateY(-.15em); opacity: 1; } /* overshoot up, then settle */
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes m-pd-pop {
  0%   { transform: scale(1); }
  100% { transform: scale(0); }
}

@media (prefers-reduced-motion: reduce) {
  .m-pd-ready .m-pd-l { opacity: 1; transform: none; animation: none !important; }
  .m-pd-drops { display: none; }
  .m-pd-ready:not(.m-pd-done) .m-pd-text { color: inherit !important; }
}
