/* Toast notice pop: a chat window opens (fades in while it grows from .96), and a beat after it has opened a
   message card pops in from slightly low on a bouncy ease: "the app just told you". Waits for .is-live on the
   root (part.js adds it when the scene reaches the middle of the screen) and holds the last frame.

   Markup (classes go on your own markup):
   <div class="tnp" data-tnp>                 root; gets .is-live
     <div class="tnp-win">...chrome...        the window: opens with a TRANSITION (see below)
       <div class="tnp-pop">...card...</div>  a card that pops; more cards: style="--tnp-d: .85s"
     </div>
   </div>

   Measured from the source (Decimals how-it-works, scene 5: hm-slackwin / hm-sw-notif):
   window  opacity 0 -> 1 and scale(.96) -> none, .45s cubic-bezier(.22,1,.36,1); 2.05s into the scene there,
           right after the app icon's act; here --tnp-open-at, default 0s
   card    .65s cubic-bezier(.34,1.4,.5,1): opacity 0, translateY(10px) scale(.94) -> rest; .55s after the
           window starts (2.6s there), i.e. .1s after it has finished opening; here --tnp-pop-at, default .55s
   The window is a transition, not a keyframe animation, as in the source: an animation on an overflow-hidden
   window left mobile compositors refusing to paint its contents; will-change gives it its own layer from the
   start so it isn't served a blank cached tile after the delay. */

.tnp {
  --tnp-open-at: 0s;               /* window starts opening */
  --tnp-open-dur: 0.45s;
  --tnp-open-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --tnp-win-from: 0.96;            /* window starting scale */
  --tnp-pop-at: 0.55s;             /* first card starts popping */
  --tnp-pop-dur: 0.65s;
  --tnp-pop-ease: cubic-bezier(0.34, 1.4, 0.5, 1);
  --tnp-pop-y: 10px;               /* card starts this far low */
  --tnp-pop-from: 0.94;            /* card starting scale */
}

.tnp-win {
  opacity: 0;
  transform: scale(var(--tnp-win-from));
  transition:
    opacity var(--tnp-open-dur) var(--tnp-open-ease) var(--tnp-open-at),
    transform var(--tnp-open-dur) var(--tnp-open-ease) var(--tnp-open-at);
  will-change: opacity, transform;
}
.tnp.is-live .tnp-win { opacity: 1; transform: none; }

.tnp-pop { opacity: 0; }
.tnp.is-live .tnp-pop {
  animation: tnp-pop var(--tnp-pop-dur) var(--tnp-pop-ease) var(--tnp-d, var(--tnp-pop-at)) both;
}
@keyframes tnp-pop {
  from { opacity: 0; transform: translateY(var(--tnp-pop-y)) scale(var(--tnp-pop-from)); }
  to { opacity: 1; transform: none; }
}

/* replay: part.js sets .tnp-snap for one frame so the window snaps shut instead of transitioning out */
.tnp.tnp-snap .tnp-win { transition: none; }

@media (prefers-reduced-motion: reduce) {
  .tnp.is-live .tnp-win { transition: none; }
  .tnp.is-live .tnp-pop { animation: none; opacity: 1; }
}
