/* Scroll motion (see motion.js). Every rule sits under html.motion-on, which motion.js adds only when motion
   is welcome; without it the page is exactly as before. Animates opacity and the individual translate /
   scale / rotate properties, which stack on top of each element's own transform. */

/* ---------------------------------------------------------------- one-shot entrances */
html.motion-on [data-m]:not(.is-in){opacity:0}
html.motion-on [data-m].is-in{animation:var(--m-anim) var(--m-dur,1s) cubic-bezier(.16,1,.3,1) var(--d,0ms) both}
html.motion-on [data-m=rise]{--m-anim:m-rise}
html.motion-on [data-m=focus]{--m-anim:m-focus;--m-dur:1.15s}
html.motion-on [data-m=pop]{--m-anim:m-pop;--m-dur:.9s}
html.motion-on [data-m=float]{--m-anim:m-float;--m-dur:1.4s}
@keyframes m-rise{from{opacity:0;translate:0 42px}to{opacity:1;translate:0 0}}
/* A soft focus pull: the words arrive slightly blurred and settle sharp. */
@keyframes m-focus{from{opacity:0;translate:0 22px;filter:blur(8px)}to{opacity:1;translate:0 0;filter:blur(0)}}
@keyframes m-pop{0%{opacity:0;scale:.82;translate:0 26px}60%{opacity:1}100%{opacity:1;scale:1;translate:0 0}}
@keyframes m-float{from{opacity:0;translate:0 60px;rotate:-2deg;scale:.94}to{opacity:1;translate:0 0;rotate:0deg;scale:1}}

/* ---------------------------------------------------------------- words that light up as you read */
html.motion-on [data-m-words] .m-word{opacity:clamp(.16,calc(var(--wp,0) * (var(--n) + 4) - var(--i)),1);transition:opacity .25s linear}

/* ---------------------------------------------------------------- homepage: the first screen hands off */
/* The welcome card recedes (its fade is scrubbed in motion.js) while the wallpaper drifts more slowly than
   the page, so the showcase seems to slide up over it. */
html.motion-home.motion-on .welcome,html.motion-home.motion-on .welcome-account{scale:calc(1 - var(--hero,0) * .08);translate:0 calc(var(--hero,0) * -80px)}
html.motion-home.motion-on .wallpaper{translate:0 calc(var(--hero,0) * 140px);scale:calc(1 + var(--hero,0) * .06)}

/* ---------------------------------------------------------------- homepage: product moments */
/* Life Quest: the crest comes forward out of the smoke, which drifts the other way. It keeps its own dark
   shadow from styles.css; no coloured glow. */
html.motion-on .showcase-lead[data-m-scroll] .showcase-logo{scale:calc(1.18 - var(--enter,0) * .18);opacity:calc(.15 + var(--enter,0) * .85);}
html.motion-on .showcase-lead[data-m-scroll] .showcase-smoke{translate:0 calc((var(--through,0) - .5) * -90px)}

/* PageKeep: the book rises and settles; its ribbon falls into place last. */
html.motion-on [data-m-scroll] .showcase-book{translate:0 calc((1 - var(--enter,0)) * 140px);rotate:calc((1 - var(--enter,0)) * -9deg)}
html.motion-on [data-m-scroll] .showcase-book-mark{transform-origin:top;scale:1 calc(.08 + clamp(0, var(--enter,0) * 1.6 - .6, 1) * .92)}

/* ShiftKeep: the ticket prints up out of the printer as you scroll. */
html.motion-on [data-m-scroll] .showcase-ticket{translate:0 calc((1 - var(--enter,0)) * 92%)}
html.motion-on [data-m-scroll] .showcase-printer{translate:0 calc((1 - var(--enter,0)) * 40px)}

/* FirstCook: the iPad tips up from lying back into place. */
html.motion-on [data-m-scroll].is-light:has(.showcase-ipad){perspective:1100px}
html.motion-on [data-m-scroll] .showcase-ipad{transform-origin:50% 100%;rotate:x calc((1 - var(--enter,0)) * 32deg);translate:0 calc((1 - var(--enter,0)) * 90px)}

/* Store: the worksheets fan out from a neat stack. */
html.motion-on [data-m-scroll] .showcase-sheets img:nth-child(1){translate:calc((1 - var(--enter,0)) * 70px) calc((1 - var(--enter,0)) * 30px);rotate:calc((1 - var(--enter,0)) * 5deg)}
html.motion-on [data-m-scroll] .showcase-sheets img:nth-child(2){translate:0 calc((1 - var(--enter,0)) * 70px)}
html.motion-on [data-m-scroll] .showcase-sheets img:nth-child(3){translate:calc((1 - var(--enter,0)) * -70px) calc((1 - var(--enter,0)) * 30px);rotate:calc((1 - var(--enter,0)) * -5deg)}

/* FitKeep: the icon turns and settles with a warm glow. */
html.motion-on [data-m-scroll] .showcase-fitkeep{scale:calc(.78 + var(--enter,0) * .22);rotate:calc((1 - var(--enter,0)) * -14deg);box-shadow:0 18px 48px rgba(60,20,85,.32),0 0 calc(var(--enter,0) * 60px) rgba(245,180,0,calc(var(--enter,0) * .35))}

/* ---------------------------------------------------------------- company pages */
/* About: the portrait opens like a window as the founder section arrives. */
html.motion-on .founder-section[data-m-scroll] .founder-portrait{clip-path:inset(calc((1 - var(--enter,0)) * 18%) calc((1 - var(--enter,0)) * 10%) round 28px);scale:calc(1.08 - var(--enter,0) * .08)}
/* Build With Us: the four system cards drift apart from the core once you start leaving the hero. */
html.motion-on .hero-system[data-m-scroll] .card-brand{translate:calc(var(--leave,0) * -70px) calc(var(--leave,0) * -40px)}
html.motion-on .hero-system[data-m-scroll] .card-web{translate:calc(var(--leave,0) * 70px) calc(var(--leave,0) * -40px)}
html.motion-on .hero-system[data-m-scroll] .card-content{translate:calc(var(--leave,0) * -70px) calc(var(--leave,0) * 40px)}
html.motion-on .hero-system[data-m-scroll] .card-growth{translate:calc(var(--leave,0) * 70px) calc(var(--leave,0) * 40px)}

@media print{html.motion-on [data-m]{opacity:1!important;animation:none!important}html.motion-on [data-m-words] .m-word{opacity:1!important}}

/* ---------------------------------------------------------------- PageKeep */
/* Reader photos: three readers rise at different speeds and settle out of a slight fan. */
html.motion-on .reader-story[data-m-scroll] .reader-portraits img:nth-child(1){translate:0 calc((1 - var(--enter,0)) * 110px);rotate:calc((1 - var(--enter,0)) * -5deg)}
html.motion-on .reader-story[data-m-scroll] .reader-portraits img:nth-child(2){translate:0 calc((1 - var(--enter,0)) * 50px)}
html.motion-on .reader-story[data-m-scroll] .reader-portraits img:nth-child(3){translate:0 calc((1 - var(--enter,0)) * 160px);rotate:calc((1 - var(--enter,0)) * 5deg)}
/* Privacy: the PageKeep icon lifts and turns upright as its promise arrives. */
html.motion-on #privacy[data-m-scroll] .privacy-mark{scale:calc(.8 + var(--enter,0) * .2);rotate:calc((1 - var(--enter,0)) * -10deg);translate:0 calc((1 - var(--enter,0)) * 60px)}
/* App screens: the phones rise in a staggered wave, like pages lifting off a stack. */
html.motion-on #screens[data-m-scroll] .gallery figure:nth-child(odd) img{translate:0 calc((1 - var(--enter,0)) * 70px)}
html.motion-on #screens[data-m-scroll] .gallery figure:nth-child(even) img{translate:0 calc((1 - var(--enter,0)) * 140px)}

/* ---------------------------------------------------------------- Simic Solutions Store */
/* The clipboard tips forward off the hero as you scroll away, like a sheet being picked up. */
html.motion-on .store-hero[data-m-scroll] .hero-sheet{translate:0 calc(var(--leave,0) * -50px);rotate:calc(1.5deg - var(--leave,0) * 4deg)}
/* Free printables: the paper previews fan up out of a neat stack as the row arrives. */
html.motion-on .product-row[data-m-scroll] .product-card:nth-child(odd) .file-art img{translate:0 calc((1 - var(--enter,0)) * 40px);rotate:calc((1 - var(--enter,0)) * -4deg)}
html.motion-on .product-row[data-m-scroll] .product-card:nth-child(even) .file-art img{translate:0 calc((1 - var(--enter,0)) * 60px);rotate:calc((1 - var(--enter,0)) * 4deg)}
