/* Watercolor blooms on buttons (made by js/splash.js).
   Each bloom is a flat paint colour cut out by a painted mask (images/decor/bloom-*.svg),
   so any colour works. splash.js varies the shape, size, stretch, turn, strength,
   speed and drift of every one through the custom properties below. */
.splash {
  --rot: 0deg; --sx: 1; --sy: 1; --peak: .9; --dx: 0px; --dy: 0px; --from: .22;
  position: fixed; z-index: 2147483000; pointer-events: none;
  transform: translate(-50%, -50%) rotate(var(--rot)) scale(calc(var(--from) * var(--sx)), calc(var(--from) * var(--sy)));
  mix-blend-mode: multiply; opacity: 0;
  -webkit-mask: url("../images/decor/bloom-1.svg") center / contain no-repeat;
          mask: url("../images/decor/bloom-1.svg") center / contain no-repeat;
  animation: splash-bloom 1.05s cubic-bezier(.2, .75, .3, 1) forwards;
}
.splash.b2 { -webkit-mask-image: url("../images/decor/bloom-2.svg"); mask-image: url("../images/decor/bloom-2.svg"); }
.splash.b3 { -webkit-mask-image: url("../images/decor/bloom-3.svg"); mask-image: url("../images/decor/bloom-3.svg"); }
.splash.b4 { -webkit-mask-image: url("../images/decor/bloom-4.svg"); mask-image: url("../images/decor/bloom-4.svg"); } /* ragged backrun */
.splash.b5 { -webkit-mask-image: url("../images/decor/bloom-5.svg"); mask-image: url("../images/decor/bloom-5.svg"); } /* splatter */
.splash.b6 { -webkit-mask-image: url("../images/decor/bloom-6.svg"); mask-image: url("../images/decor/bloom-6.svg"); } /* drip */
.splash.b7 { -webkit-mask-image: url("../images/decor/bloom-7.svg"); mask-image: url("../images/decor/bloom-7.svg"); } /* ring */
.splash.b8 { -webkit-mask-image: url("../images/decor/bloom-8.svg"); mask-image: url("../images/decor/bloom-8.svg"); } /* smear */

@keyframes splash-bloom {
  0%   { opacity: var(--peak);
         transform: translate(-50%, -50%) rotate(var(--rot)) scale(calc(var(--from) * var(--sx)), calc(var(--from) * var(--sy))); }
  40%  { opacity: calc(var(--peak) * .85); }
  100% { opacity: 0;
         transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot)) scale(var(--sx), var(--sy)); }
}

/* ---------- Bleeds: paint soaking into a button and staying inside it ----------
   (the "Let's be friends" buttons). The button clips the paint to its own pill shape. */
.socials a { position: relative; overflow: hidden; isolation: isolate; }
.socials a > :not(.bleed-wash) { position: relative; z-index: 1; }
.bleed-wash {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  transition: opacity .9s ease;
}
.bleed-wash.dry { opacity: 0; }   /* drying away after the pointer leaves */
.bleed {
  --rot: 0deg; --peak: .55;
  position: absolute; mix-blend-mode: multiply; opacity: 0;
  transform: translate(-50%, -50%) rotate(var(--rot)) scale(.08);
  -webkit-mask: url("../images/decor/bloom-1.svg") center / contain no-repeat;
          mask: url("../images/decor/bloom-1.svg") center / contain no-repeat;
  animation: bleed-in 1.2s cubic-bezier(.15, .7, .25, 1) forwards;
}
.bleed.b2 { -webkit-mask-image: url("../images/decor/bloom-2.svg"); mask-image: url("../images/decor/bloom-2.svg"); }
.bleed.b3 { -webkit-mask-image: url("../images/decor/bloom-3.svg"); mask-image: url("../images/decor/bloom-3.svg"); }
.bleed.b4 { -webkit-mask-image: url("../images/decor/bloom-4.svg"); mask-image: url("../images/decor/bloom-4.svg"); }
.bleed.b7 { -webkit-mask-image: url("../images/decor/bloom-7.svg"); mask-image: url("../images/decor/bloom-7.svg"); }
@keyframes bleed-in {
  0%   { opacity: calc(var(--peak) + .2); transform: translate(-50%, -50%) rotate(var(--rot)) scale(.08); }
  100% { opacity: var(--peak);            transform: translate(-50%, -50%) rotate(var(--rot)) scale(1); }
}

/* a small squish on press, like pressing a brush to paper */
.btn:active, .chip:active, .pill:active, .fab:active, .socials a:active { transform: scale(.97); }

@media (prefers-reduced-motion: reduce) {
  .splash, .bleed-wash { display: none; }
}
