/* the inbox loop's end, part one: everything falls straight into the logo (the gravity well).
   The fall speeds up the whole way (ease-in), nearest pieces first; each one keeps its size for most of the fall, draws out a little along
   its path as it gathers speed, then shrinks and fades in the last moment, under the badge. The badge dips like a well taking weight
   as they land, and springs back once the last is in. All gone by ~1.6s. */
.og.og--fall.is-exit [data-og-x]{
  z-index:1;
  animation:og2-fall,og2-shape;
  animation-duration:calc(.7s + .2s * var(--d));
  animation-delay:calc(var(--k) / var(--n) * .7s);
  animation-timing-function:cubic-bezier(.5,.03,.86,.32),linear;
  animation-fill-mode:both}
/* one layer for the whole fall: the panels stop stacking on their own, so a wide piece reaching across the seam stays on top of the
   other panel (and of the seam's line), and only the badge, above everything, covers what lands in it */
.og.og--fall.is-exit{isolation:isolate}
.og.og--fall.is-exit :is(.og-card,.og-bar,.og-grid,.og-seam){z-index:auto}
/* the path: straight to the logo's centre, accelerating */
@keyframes og2-fall{from{translate:0 0}to{translate:var(--tx) var(--ty)}}
/* the shape, about the piece's own centre: stretched along the line of fall (turned onto it with --ang), then gone at the bottom of the well */
@keyframes og2-shape{
  0%{transform:rotate(var(--ang)) scale(1,1) rotate(calc(-1 * var(--ang)));opacity:1;animation-timing-function:cubic-bezier(.5,0,.8,.4)}
  58%{transform:rotate(var(--ang)) scale(1.02,.99) rotate(calc(-1 * var(--ang)));opacity:1;animation-timing-function:cubic-bezier(.4,0,.8,.6)}
  84%{transform:rotate(var(--ang)) scale(.62,.55) rotate(calc(-1 * var(--ang)));opacity:1;animation-timing-function:cubic-bezier(.4,0,.9,.6)}
  100%{transform:rotate(var(--ang)) scale(.1,.08) rotate(calc(-1 * var(--ang)));opacity:0}}

/* the well: the badge sinks a little deeper with each landing (soft beats in step with the arrivals), its face darkening as if pressed in,
   then springs back with the site's spring once the last piece is in */
.og.og--fall.is-exit .og-badge{animation:og2-well 1.98s both}
@keyframes og2-well{
  0%{scale:1;translate:0 0;animation-timing-function:ease-in-out}
  38%{scale:1;translate:0 0;animation-timing-function:cubic-bezier(.3,0,.5,1)}
  44%{scale:.94;translate:0 1px;animation-timing-function:ease-out}
  50%{scale:.96;translate:0 1px;animation-timing-function:cubic-bezier(.3,0,.5,1)}
  56%{scale:.915;translate:0 1.5px;animation-timing-function:ease-out}
  62%{scale:.935;translate:0 1.5px;animation-timing-function:cubic-bezier(.3,0,.5,1)}
  68%{scale:.895;translate:0 2px;animation-timing-function:ease-out}
  73%{scale:.91;translate:0 2px;animation-timing-function:cubic-bezier(.3,0,.5,1)}
  78%{scale:.87;translate:0 2.5px;animation-timing-function:cubic-bezier(.32,1.28,.52,1)}
  100%{scale:1;translate:0 0}}
/* the pressed-in shade: a soft inner shadow from the top edge, so the hollow reads lit from above */
.og.og--fall.is-exit .og-badge::after{content:"";position:absolute;inset:0;border-radius:50%;pointer-events:none;
  box-shadow:inset 0 4px 9px #16232980,inset 0 0 0 1px #3f647040;opacity:0;animation:og2-shade 1.98s both}
@keyframes og2-shade{
  0%,38%{opacity:0;animation-timing-function:ease-in}
  78%{opacity:1;animation-timing-function:ease-out}
  100%{opacity:0}}

/* reduced motion: the shared fallback fades the pieces; the badge keeps still */
@media (prefers-reduced-motion:reduce){
  .og.og--fall.is-exit .og-badge{animation:none}
  .og.og--fall.is-exit .og-badge::after{content:none}}

/* part two, the way back: where each incoming message comes
   out of the logo and springs to its place the moment it starts typing, then reads exactly as before. The arrival times are unchanged.
   --ix/--iy (set by the page) run from the message's resting place to the logo's centre. */

/* the logo sits above the inbox so a message is born from under it, and the inbox no longer clips at its edge; the warm light keeps
   its old edge with a clip of its own instead (the same box the card used to cut it to, corner included) */
.og.og--ret .og-seam{z-index:3}
.og.og--ret .og-after{overflow:visible}
.og.og--ret .og-after::before{clip-path:inset(26.32% 14.12% 0 0 round 0 25px 0 0)}

/* out of the logo: small and close to it, then a quick spring to its place (the site's own curve) */
@keyframes ogRetOut{
  0%{opacity:0;transform:translate(var(--ix),var(--iy)) scale(.16)}
  14%{opacity:1}
  100%{opacity:1;transform:none}}
.og.og--ret:where(:not(.is-exit,.is-full,.is-wiped)) :where(.og-m.is-typing,.og-m.is-on,.og-more.is-on){
  animation:ogRetOut .62s cubic-bezier(.32,1.28,.52,1) backwards;transform-origin:50% 50%}
/* the avatar and dots ride in already shown; the bubble still arrives in place, as before */
.og.og--ret:where(:not(.is-exit,.is-full)) .og-m.is-typing :is(.og-av,.og-typing){transition:none}

/* the logo gives each one out: a small push */
@keyframes ogRetGive{0%{transform:none}30%{transform:scale(1.09)}100%{transform:none}}
.og.og--ret.is-warm.is-giving:not(.is-exit) .og-badge{animation:ogRetGive .55s cubic-bezier(.32,1.28,.52,1)}

@media (prefers-reduced-motion:reduce){
  .og.og--ret :is(.og-m,.og-more,.og-badge){animation:none!important}}

/* part three, the 😭: a loose copy of the emoji (.og-cry, the same glyph at the same size, laid exactly over the one in the text) is
   moved by the page, which works out its whole journey on the real layout: it lets go, falls and tumbles down the inbox under real
   physics to its big bounce on a lower message, where the exit starts, and from that bounce it is drawn into the logo in one
   continuous motion, last of all. Both layers are animated by the page; nothing here but their footing. */
.og-cry{position:absolute;z-index:2;left:0;top:0;white-space:nowrap;pointer-events:none;visibility:hidden;transform-origin:50% 50%;will-change:transform}
.og-cry i,.og-cry b{display:inline-block;font-style:normal;font-weight:inherit;transform-origin:50% 50%}
.og.is-exit .og-cry{z-index:1}
