/* ═══════════════════════════════════════════════════════════════════════
   TREATMENT: converge
   "the next page could have the cards that move together from the right
    and left side of the page as you scroll. that was a really cool effect
    on this page: deloitte.com/us/en/about.html"

   MEASURED, harness/probe-converge.py, 34 scroll positions on that page:

     DIV.cmp-photo-collage__item   9 distinct transforms  X -199.2 -> +99.6
                                   SCROLL-LINKED
     DIV.cmp-card-reveal__slider   4 distinct             one-shot
     DIV.cmp-expanding-img         5 distinct             one-shot

   So the effect JT picked is the SCROLL-LINKED one: the items travel about
   300px horizontally as a continuous function of scroll and settle at 0.
   It is not a reveal, and building it as one would have produced a snap
   instead of the drift he liked.

   The transform is driven by --p, a 0..1 progress value register.js writes
   on scroll. CSS does the rest, so the JS stays a few lines and the whole
   thing degrades to a static grid with no JS and under reduced motion.

   Scoped to main. The chrome is shared and never varies.
   ═══════════════════════════════════════════════════════════════════════ */

/* ⛔ THE DECK IS NOT ALWAYS CALLED .card-grid.
   verify-live.py measured silos and evaluation at tiles=0: converge had
   nothing to move because those pages build their decks with their own
   class names. Measured from the built HTML:
       silos        .domain-grid  .pub-grid  .treatise-grid
       evaluation   .rgrid.two
       compare      .card-grid.mosaic
   Naming only two of six is why two of three converge pages were inert. */
main .card-grid,main .mosaic,main .domain-grid,main .pub-grid,
main .treatise-grid,main .rgrid,main .grid2,main .flist{--p:1}

@media (prefers-reduced-motion:no-preference){
  html.js-motion[data-treatment="converge"] main .mosaic>*,
  html.js-motion[data-treatment="converge"] main .card-grid>*,
  html.js-motion[data-treatment="converge"] main .domain-grid>*,
  html.js-motion[data-treatment="converge"] main .pub-grid>*,
  html.js-motion[data-treatment="converge"] main .treatise-grid>*,
  html.js-motion[data-treatment="converge"] main .rgrid>*{
    /* --travel is set per item below; (1 - p) runs 1 at entry to 0 at
       settle, so the item arrives rather than snapping. */
    transform:translate3d(calc(var(--travel,0px) * (1 - var(--p,1))),0,0);
    will-change:transform}

  /* Odd items come from the left, even from the right, and the outermost
     travel furthest. Their measured spread was -199 to +100, so the
     distances here are theirs, not a taste call. */
  html.js-motion[data-treatment="converge"] main .mosaic>*:nth-child(1),
  html.js-motion[data-treatment="converge"] main .card-grid>*:nth-child(1),
  html.js-motion[data-treatment="converge"] main .domain-grid>*:nth-child(1),
  html.js-motion[data-treatment="converge"] main .pub-grid>*:nth-child(1),
  html.js-motion[data-treatment="converge"] main .treatise-grid>*:nth-child(1),
  html.js-motion[data-treatment="converge"] main .rgrid>*:nth-child(1){
    --travel:-200px}
  html.js-motion[data-treatment="converge"] main .mosaic>*:nth-child(2),
  html.js-motion[data-treatment="converge"] main .card-grid>*:nth-child(2),
  html.js-motion[data-treatment="converge"] main .domain-grid>*:nth-child(2),
  html.js-motion[data-treatment="converge"] main .pub-grid>*:nth-child(2),
  html.js-motion[data-treatment="converge"] main .treatise-grid>*:nth-child(2),
  html.js-motion[data-treatment="converge"] main .rgrid>*:nth-child(2){
    --travel:100px}
  html.js-motion[data-treatment="converge"] main .mosaic>*:nth-child(3),
  html.js-motion[data-treatment="converge"] main .card-grid>*:nth-child(3),
  html.js-motion[data-treatment="converge"] main .domain-grid>*:nth-child(3),
  html.js-motion[data-treatment="converge"] main .pub-grid>*:nth-child(3),
  html.js-motion[data-treatment="converge"] main .treatise-grid>*:nth-child(3),
  html.js-motion[data-treatment="converge"] main .rgrid>*:nth-child(3){
    --travel:-120px}
  html.js-motion[data-treatment="converge"] main .mosaic>*:nth-child(4),
  html.js-motion[data-treatment="converge"] main .card-grid>*:nth-child(4),
  html.js-motion[data-treatment="converge"] main .domain-grid>*:nth-child(4),
  html.js-motion[data-treatment="converge"] main .pub-grid>*:nth-child(4),
  html.js-motion[data-treatment="converge"] main .treatise-grid>*:nth-child(4),
  html.js-motion[data-treatment="converge"] main .rgrid>*:nth-child(4){
    --travel:170px}
  html.js-motion[data-treatment="converge"] main .mosaic>*:nth-child(5),
  html.js-motion[data-treatment="converge"] main .card-grid>*:nth-child(5),
  html.js-motion[data-treatment="converge"] main .domain-grid>*:nth-child(5),
  html.js-motion[data-treatment="converge"] main .pub-grid>*:nth-child(5),
  html.js-motion[data-treatment="converge"] main .treatise-grid>*:nth-child(5),
  html.js-motion[data-treatment="converge"] main .rgrid>*:nth-child(5){
    --travel:-90px}
  html.js-motion[data-treatment="converge"] main .mosaic>*:nth-child(n+6),
  html.js-motion[data-treatment="converge"] main .card-grid>*:nth-child(n+6),
  html.js-motion[data-treatment="converge"] main .domain-grid>*:nth-child(n+6),
  html.js-motion[data-treatment="converge"] main .pub-grid>*:nth-child(n+6),
  html.js-motion[data-treatment="converge"] main .treatise-grid>*:nth-child(n+6),
  html.js-motion[data-treatment="converge"] main .rgrid>*:nth-child(n+6){
    --travel:130px}

  /* The band's own copy arrives the way theirs does: translate 50px and
     fade, which is exactly @keyframes slide-in-left / slide-in-right. */
  html.js-motion[data-treatment="converge"] main .band-media .band-in>div{
    animation:t-slide-left .55s cubic-bezier(.22,.61,.36,1) both}
  html.js-motion[data-treatment="converge"] main .band-media--flip
    .band-in>div{animation-name:t-slide-right}
}
@keyframes t-slide-left{from{transform:translateX(-50px);opacity:0}
                        to{transform:none;opacity:1}}
@keyframes t-slide-right{from{transform:translateX(50px);opacity:0}
                         to{transform:none;opacity:1}}

/* The grid has to let items overhang while they travel, or the page gains
   a horizontal scrollbar for the whole animation. Measured defect from
   earlier tonight: a 1,651px table did exactly that. */
[data-treatment="converge"] main .mosaic,
[data-treatment="converge"] main .card-grid,
[data-treatment="converge"] main .domain-grid,
[data-treatment="converge"] main .pub-grid,
[data-treatment="converge"] main .treatise-grid,
[data-treatment="converge"] main .rgrid{overflow:visible}
[data-treatment="converge"] main>section{overflow-x:clip}

/* Cards sit on the page rather than in a box: this treatment is about the
   movement, so the chrome around each card is lighter than elsewhere. */
[data-treatment="converge"] main .mosaic>.tile{
  background:#fff;border:1px solid var(--rule-light);border-top-width:3px;
  box-shadow:0 20px 44px -34px rgba(4,20,36,.5)}
[data-treatment="converge"] main .band-media-fig img{
  box-shadow:0 26px 60px -38px rgba(4,20,36,.6)}
