/* ==========================================================================
   Motion + layout pass. Loaded last; overrides editions.css where noted.
   Anatomy per chapter:
     .chap-bg    sticky scene, pinned behind the whole chapter (115lvh, feathered top)
     .chap-door  100svh, title left and vertically centred, scrolls over the scene
     .chap-body  opaque sheet that slides up over the scene, with windows at the
                 stage and the card visuals (cut by motion.js)
   Timings: reveal .5s/1s + .1s stagger, door words .966s, pill .36s in / .26s out,
   ring letters .9s + 26ms stagger, pill label typed at about 30ms a letter.
   ========================================================================== */

/* ---------- no-JS: nothing stays hidden waiting for a reveal ---------- */
html:not(.js) [data-rv],html:not(.js) [data-split] .ch,html:not(.js) .hero-index{opacity:1;transform:none;filter:none}

/* ---------- top bar: a light scrim only, the scenes run up to the edge ---------- */
.nav::before{inset:-1px 0 -46px;background:linear-gradient(to bottom,rgba(9,9,9,.58) 0,rgba(9,9,9,.3) 52%,transparent 100%)}
/* desktop: no bar behind the links once scrolled, the page runs under them */
@media(min-width:768px){.nav.is-stuck{background:none;backdrop-filter:none;-webkit-backdrop-filter:none}}
/* ---------- top bar arrives ---------- */
@keyframes nav-in{from{opacity:0;transform:translateY(-100%)}to{opacity:1;transform:none}}
.js .nav>*{animation:nav-in 1s var(--ease) both}
.js .nav>*:nth-child(2){animation-delay:.06s}
.js .nav>*:nth-child(3){animation-delay:.12s}

/* ---------- hero ---------- */
/* ring: longer settle, like a flywheel coming to rest */
.ring.intro{animation:hero-ring-intro 4.5s cubic-bezier(.2,.9,.3,.986) forwards}
/* ring letters arrive one after another while the ring spins up */
@keyframes ltr-in{from{opacity:0;transform:translate3d(0,.6em,0) rotateX(-75deg)}to{opacity:1;transform:none}}
.ring.intro .ltr{backface-visibility:hidden;-webkit-backface-visibility:hidden;transform-origin:50% 100%;animation:ltr-in .9s cubic-bezier(.16,1,.3,1) both;animation-delay:calc(.2s + var(--li,0) * 26ms)}
/* field eases back from a slight push-in */
@keyframes hero-field-in{from{transform:scale(1.2)}to{transform:scale(1)}}
.js .hero>.liquid-canvas{transform-origin:50% 50%;animation:hero-field-in 2s cubic-bezier(.25,1,.5,1) .3s both}
/* index: three chapter columns in one row on every width, lead line above on phones */
.hero-index{transition:opacity .9s var(--ease) .2s}
.fx.hero-exited .hero-index{opacity:0;transition:opacity .2s;pointer-events:none}
@media(max-width:900px){
  .hero-index{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px 14px}
  .hero-index .hi-lead{grid-column:1/-1;max-width:none}
}
@media(max-width:560px){
  .hero-index{grid-template-columns:repeat(3,minmax(0,1fr));font-size:13px;gap:12px 10px;margin-top:20px}
  .hero-index ul{gap:7px}
  .hero-index a{color:rgba(255,255,255,.8)}
}
/* the hero holds, then the first chapter rises over it: 160svh of scroll in all, as on the reference */
.fx .hero-pin{height:260svh}
.pinm .hero-pin{height:calc(var(--hero-h,100svh) + 160svh)}
.fx .hero-pin+.chap,.pinm .hero-pin+.chap{margin-top:-100svh}
.pinm .hero{position:sticky;top:min(0px,calc(100svh - var(--hero-h,100svh)))}

/* ---------- chapter scene: pinned for the whole chapter ---------- */
.chap{--door-h:100svh;--arc:0px;overflow:clip;view-timeline-name:--chap;view-timeline-axis:block}
.chap-bg{
  position:sticky;top:-15lvh;height:115lvh;margin-bottom:-115lvh;width:100%;z-index:0;
  overflow:clip;pointer-events:none;background:var(--scene-css,#111);
  -webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 13.04%);
          mask-image:linear-gradient(to bottom,transparent 0,#000 13.04%);
}
/* still gradients: shown until the still arrives, and if it never does. Each scene keeps its dark side on the left,
   so the frame is anchored right of centre (--op) and the door copy sits on the quiet part */
#content{--scene-css:radial-gradient(58% 60% at 74% 46%,#4a2f7a 0,#1a1638 46%,#070710 100%);--op:72% 50%}
#followup{--scene-css:radial-gradient(52% 56% at 76% 46%,#4b2f9a 0,#15143a 48%,#06060f 100%);--op:76% 50%}
@media(min-width:768px){#followup .chap-door::before{background:linear-gradient(90deg,rgba(9,9,9,.5) 0,rgba(9,9,9,.48) 32%,rgba(9,9,9,.4) 46%,rgba(9,9,9,.12) 58%,transparent 68%)}}
#visibility{--scene-css:radial-gradient(44% 56% at 70% 56%,#2f8f6c 0,#0b3a38 44%,#030b0b 100%);--op:72% 50%}
.chap-bg .scene{position:absolute;inset:0;width:100%;height:100%;display:block;overflow:hidden}
/* a still under a video; both lean in with scroll speed (--sv) and drift against the pointer (--mx, --my), set by bg.js */
.scene img,.scene video{
  position:absolute;left:-2.5%;top:-2.5%;width:105%;height:105%;object-fit:cover;object-position:var(--op,50% 50%);display:block;opacity:0;
  transform:translate3d(calc(var(--mx,0) * -9px),calc(var(--my,0) * -7px),0) scale(calc(1 + var(--sv,0) * .05));
}
.scene img{transition:opacity .7s linear}
.scene img.on{opacity:1}
.scene video{transition:opacity .9s linear}
.scene.live video{opacity:1}
/* fine grain over the loop: hides what the codec smooths away */
.chap-bg::after{content:"";position:absolute;inset:0;pointer-events:none;opacity:.5;background:url(/assets/bg/grain.png?v=r3b) 0 0/128px 128px}
@keyframes chap-par{from{transform:translate3d(0,-4lvh,0) scale(1.08)}to{transform:translate3d(0,4lvh,0) scale(1.08)}}
@supports (animation-timeline:view()){
  @media(prefers-reduced-motion:no-preference){
    .chap-bg .scene{animation:chap-par linear both;animation-timeline:--chap;animation-range:cover}
  }
}

/* ---------- door: title rides over the scene (overrides the arc + scrim version) ---------- */
.chap .chap-door{
  position:relative;z-index:1;height:auto;min-height:100svh;display:flex;align-items:center;
  padding:96px 0;background:none;overflow:visible;isolation:auto;
}
.chap .chap-door::after{display:none}
.chap .door-inner{padding-bottom:0}
.chap .door-inner::before{display:none}
/* the door carries the scrim for its own copy, so the field itself stays untouched for the windows below */
.chap .chap-door::before{
  content:"";position:absolute;inset:0;z-index:0;pointer-events:none;
  background:linear-gradient(90deg,rgba(9,9,9,.44) 0,rgba(9,9,9,.3) 24%,rgba(9,9,9,.08) 42%,transparent 54%);
  -webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 26%,#000 68%,transparent 100%);mask-image:linear-gradient(to bottom,transparent 0,#000 26%,#000 68%,transparent 100%);
}
.chap .door-inner{z-index:1}
.chap .door-eyebrow{margin-bottom:18px;text-shadow:0 1px 14px rgba(0,0,0,.5)}
.chap .door-title{
  font-size:clamp(64px,34px + 5.96vw,120px);line-height:.96;letter-spacing:-.07em;
  text-shadow:0 2px 40px rgba(0,0,0,.35);
}
.chap .door-sub{
  margin-top:clamp(24px,4.4vw,64px);font-size:clamp(18px,1.7vw,24px);line-height:1.1;letter-spacing:-.03em;
  color:#fff;max-width:30ch;text-shadow:0 1px 18px rgba(0,0,0,.45);
}
/* word-by-word rise; .dw is the clip, .dw-i moves */
.dw{display:inline-block;overflow:clip;overflow-clip-margin:.12em;vertical-align:top;padding-bottom:.08em;margin-bottom:-.08em}
.dw-i{display:inline-block;transform:translateY(calc(100% + .1em));will-change:transform}
.chap-door[data-in="true"] .dw-i{animation:dw-in .966s cubic-bezier(.14,1,.34,1) both;animation-delay:calc(var(--wi,0) * 60ms)}
.chap-door[data-in="false"] .dw-i{animation:dw-out .5s cubic-bezier(.66,0,.86,0) both}
@keyframes dw-in{from{transform:translateY(calc(100% + .1em))}to{transform:none}}
@keyframes dw-out{from{transform:none}to{transform:translateY(calc(-100% - 1px))}}

/* ---------- crisp arches at the sheet edges, deeper the faster the page moves ----------
   --arch-k (set by motion.js from scroll velocity): .25 at rest, 1 at speed.
   Top of a sheet: the sheet bulges up into the scene. Between chapters: the next
   scene bulges up into the sheet above it. */
.chap{--arch:clamp(34px,8svh,84px);--arch-k:.25}
.chap .chap-body::before{
  content:"";position:absolute;left:0;right:0;bottom:calc(100% - 1px);height:var(--arch);z-index:0;pointer-events:none;
  background:#090909;border-radius:50% 50% 0 0/100% 100% 0 0;
  transform:scaleY(var(--arch-k));transform-origin:50% 100%;will-change:transform;
}
.chap+.chap{
  margin-top:calc(var(--arch) * -1);
  border-radius:50% 50% 0 0/calc(var(--arch) * var(--arch-k)) calc(var(--arch) * var(--arch-k)) 0 0;
}
.chap+.chap .chap-bg{-webkit-mask-image:none;mask-image:none}
@media(max-width:767px){.chap{--arch:clamp(30px,6svh,56px)}}

/* ---------- body: opaque sheet, windows onto the scene ---------- */
.chap .chap-body{position:relative;z-index:1;background:#090909;padding-block:clamp(48px,8vh,104px) clamp(72px,12vh,150px)}
.chap .chap-body.cut{background:none}
.cutsvg{position:absolute;top:0;left:0;z-index:0;pointer-events:none;display:none}
.chap-body.cut .cutsvg{display:block}
.chan{position:relative;z-index:1}
.chap-body.cut .stage-frame{background:none}
.chap-body.cut .ecard-vis{background:none}
/* a little depth under the phone so it reads on any part of the field */
.stage-frame::before{
  content:"";position:absolute;inset:0;z-index:0;pointer-events:none;border-radius:inherit;
  background:radial-gradient(52% 60% at 50% 56%,rgba(9,9,9,.26),rgba(9,9,9,.06) 72%,transparent);
}
.stage-frame .phone{box-shadow:0 0 0 1px rgba(255,255,255,.18) inset,0 40px 90px -30px rgba(0,0,0,.85)}

/* ---------- stage loops: a product screen floating in the stage window ----------
   wide cut (16:10) on desktop, tall cut (3:4) at 820px and under; the still sits under the video */
.loop{
  position:relative;z-index:1;width:77%;aspect-ratio:16/10;border-radius:14px;overflow:hidden;background:#f3f3f6;
  box-shadow:0 0 0 1px rgba(255,255,255,.16),0 40px 90px -30px rgba(0,0,0,.85);
}
.loop picture,.loop img,.loop video{position:absolute;inset:0;width:100%;height:100%;display:block;object-fit:cover}
.loop video{opacity:0;transition:opacity .45s linear}
.loop.ready video{opacity:1}
/* desktop: the stage runs wider than the text column, as on the reference */
@media(min-width:1100px){.stage{--sw:min(1240px,calc(100vw - 64px));width:var(--sw);margin-inline:calc((100% - var(--sw)) / 2)}}
@media(min-width:821px) and (max-width:1099px){.stage-frame{aspect-ratio:16/10.4}.loop{width:86%}}
@media(max-width:820px){.loop{width:min(360px,calc(100% - 2 * var(--edge)));aspect-ratio:3/4;border-radius:16px}}

/* ---------- apps band: a section header between the statement and How it works ---------- */
#apps{padding-block:clamp(28px,6vh,84px) clamp(64px,11vh,132px)}
#apps .sec-head{margin-bottom:0}
#apps .sec-head h2{max-width:14ch}
#apps .sec-head .side{max-width:34ch}
@media(min-width:1000px){#apps .sec-head .row{flex-wrap:nowrap}#apps .sec-head h2{max-width:10.2ch;flex:none}}

/* ---------- open-top chapter: header + stage ride on the scene, sheet starts below the stage ---------- */
.chap-body[data-open-top]{--arch:clamp(20px,4svh,44px)}
.chap .chap-body[data-open-top]::before{bottom:auto;top:calc(var(--sheet-top,0px) - var(--arch) + 1px)}
.chap-body[data-open-top]::after{
  content:"";position:absolute;left:0;right:0;top:0;height:var(--sheet-top,0px);z-index:0;pointer-events:none;
  background:linear-gradient(to bottom,transparent 0,rgba(9,9,9,.52) 44px,rgba(9,9,9,.52) calc(var(--duo-b,38%) - 2%),rgba(9,9,9,.1) calc(var(--duo-b,38%) + 9%),rgba(9,9,9,.1) 100%);
}
.chap-body.cut[data-open-top] .stage-frame{box-shadow:none}
.chap-body[data-open-top] .duo{text-shadow:0 1px 22px rgba(0,0,0,.45)}
.chap-body[data-open-top] .duo-side{position:relative;isolation:isolate}
.chap-body[data-open-top] .duo-side::before{content:"";position:absolute;inset:-34px -44px;z-index:-1;pointer-events:none;background:radial-gradient(closest-side,rgba(9,9,9,.6),rgba(9,9,9,.42) 62%,transparent)}
.chap-body[data-open-top] .duo-side p{color:rgba(255,255,255,.9)}

/* ---------- tail: the statement band and the hosted plan are windows onto one more pinned scene ---------- */
#tail{--scene-css:linear-gradient(120deg,#1a1c4a 0,#3b2a6e 50%,#0f3a3c 100%);--op:56% 50%}
.chap.tail .chap-body{padding-block:0 clamp(24px,5vh,56px)}
.chap.tail .chap-body::before{display:none}
#result{padding-block:clamp(96px,22vh,220px);margin-bottom:clamp(28px,6vh,64px)}
/* unlit words of the statement stay readable over the scene */
/* floor raised from .42 so the unlit words clear 3:1 over the scene */
.result.scrub [data-split] .ch,.result.scrub [data-split].on .ch{opacity:clamp(.5,calc((var(--p,0) * 1.4 - var(--k,0)) * 8),1)}
.chap-body.cut .path.hot{background:none;box-shadow:inset 0 0 0 1px rgba(255,255,255,.14)}
.path.hot::before{content:"";position:absolute;inset:0;z-index:0;pointer-events:none;border-radius:inherit;background:linear-gradient(to top,rgba(9,9,9,.6) 8%,rgba(9,9,9,.12) 80%)}
/* statement and plan windows. Desktop (ripple scene): the shade follows the copy and lets go of the scene on the right, and the
   window melts into the sheet above and below. Phones keep the earlier scene with its even shade. */
#result{position:relative}
#result>.wrap{position:relative;z-index:1}
.chap-body.cut #result::before{content:"";position:absolute;inset:0;z-index:0;pointer-events:none;background:rgba(9,9,9,.6)}
@media(min-width:821px){
  .chap-body.cut #result::before{
    background:linear-gradient(90deg,rgba(9,9,9,.74) 0,rgba(9,9,9,.74) 60%,rgba(9,9,9,.32) 76%,transparent 92%);
    -webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 20%,#000 80%,transparent 100%);mask-image:linear-gradient(to bottom,transparent 0,#000 20%,#000 80%,transparent 100%)}
  .chap-body.cut #result::after{content:"";position:absolute;inset:0;z-index:0;pointer-events:none;background:linear-gradient(to bottom,#090909 0,rgba(9,9,9,0) 13%,rgba(9,9,9,0) 87%,#090909 100%)}
  .result.scrub [data-split] .ch,.result.scrub [data-split].on .ch{opacity:clamp(.64,calc((var(--p,0) * 1.4 - var(--k,0)) * 8),1)}
  .path.hot::before{background:linear-gradient(100deg,rgba(9,9,9,.62) 0,rgba(9,9,9,.5) 46%,rgba(9,9,9,.14) 78%,rgba(9,9,9,.06) 100%)}
}
@media(max-width:820px){
  #tail{--op:50% 50%}
  .path.hot::before{background:linear-gradient(to top,rgba(9,9,9,.82) 8%,rgba(9,9,9,.6) 80%)}
}
/* card windows: a pool of shade under the little diagram instead of a shade over the whole window */
.chap-body.cut .ecard-vis>*{position:relative;z-index:1}
.chap-body.cut .ecard-vis::after{content:"";position:absolute;inset:0;z-index:0;pointer-events:none;border-radius:inherit;background:radial-gradient(66% 66% at 50% 50%,rgba(9,9,9,.7),rgba(9,9,9,.46) 60%,transparent 100%)}

/* ---------- content flows in: 12px from the left, .1s apart ---------- */
.js [data-rv]{
  opacity:0;transform:translate3d(-12px,0,0);
  transition:opacity .5s linear,transform 1s cubic-bezier(.215,.61,.355,1);
  transition-delay:calc(var(--rv-i,0) * .1s);
}
.js [data-rv].in{opacity:1;transform:none}
.steps3 article:nth-child(2){--rv-i:1}.steps3 article:nth-child(3){--rv-i:2}
.paths .path:nth-child(2){--rv-i:1}

/* ---------- card visuals: sized to their window, not lost in it ---------- */
.chap-body.cut .ecard{background:none}
.ecard-vis .wv{scale:1.7}
.ecard-vis .ring-ico{scale:1.6}
.ecard-vis .sl{width:58%;font-size:11px}
.ecard-vis .tl{width:74%;height:44px}
.ecard-vis .rows{width:80%;font-size:12.5px;gap:9px}
.ecard-vis .rows i{padding-bottom:8px}
.ecard-vis .bars{width:74%;gap:13px}
.ecard-vis .bars i{height:7px;border-radius:4px}
.ecard-vis .stars{font-size:26px}
.ecard-vis .rep{height:56%;width:70%;gap:7px}
.ecard-vis .wv i{background:#fff}
.ecard-vis .sl i{background:rgba(255,255,255,.2);color:rgba(255,255,255,.86)}
.ecard-vis .tl{background:rgba(255,255,255,.16)}
.ecard-vis .ring-ico{background:rgba(255,255,255,.18);color:#fff}
.ecard-vis .ring-ico::before{border-color:rgba(255,255,255,.4)}
.ecard-vis .rows i{color:rgba(255,255,255,.82);border-color:rgba(255,255,255,.2)}
.ecard-vis .rows b{color:#fff}
.ecard-vis .bars i,.ecard-vis .rep i{background:rgba(255,255,255,.88)}

/* ---------- bottom pill: desktop and tablet only, snappier ---------- */
.pill{transition:transform .26s var(--ease)}
.pill.show{transition:transform .36s var(--ease)}
.pill-list{transition:grid-template-rows .24s cubic-bezier(.32,.72,0,1)}
.pill:not(.open) .pill-list{transition:grid-template-rows .18s ease-out .09s}
.pill-list ul{transition:visibility 0s .27s}
.pill-list a{opacity:0;translate:0 4px;transition:opacity .2s,translate .3s var(--ease),color .25s}
.pill.open .pill-list a{opacity:1;translate:0}
.pill.open .pill-list li:nth-child(1) a{transition-delay:136ms}
.pill.open .pill-list li:nth-child(2) a{transition-delay:102ms}
.pill.open .pill-list li:nth-child(3) a{transition-delay:68ms}
.pill.open .pill-list li:nth-child(4) a{transition-delay:34ms}
#pillLabel{will-change:transform}
/* typed label: letters and caret are laid out at full width, then revealed */
.pl-type{position:relative;display:inline-block;white-space:nowrap}
.pl-caret{position:absolute;left:1px;top:.08em;width:1.5px;height:1.05em;background:currentColor;pointer-events:none}
.pill-btn{overflow:hidden}

/* ---------- link underline marches on hover ---------- */
.duo-link{border-bottom:0;padding-bottom:3px;background:linear-gradient(90deg,#fff 50%,transparent 0) 0 100%/6px 1px repeat-x}
@media(hover:hover){
  .duo-link:hover{animation:link-march .6s linear infinite}
}
@keyframes link-march{to{background-position:6px 100%}}

/* ==========================================================================
   Phones (reference: no floating pill, solid bar once scrolled, full-bleed
   stage, one column, media above its text)
   ========================================================================== */
@media(max-width:767px){
  .pill{display:none!important}
  body::after{display:none!important}
  .nav.is-stuck{background:#090909;backdrop-filter:none;-webkit-backdrop-filter:none}
  .nav.is-stuck::before{display:none}

  .chap .chap-door{padding:84px 0}
  .chap .chap-door::before{background:linear-gradient(180deg,transparent 20%,rgba(9,9,9,.6) 37%,rgba(9,9,9,.6) 62%,transparent 80%);-webkit-mask-image:none;mask-image:none}
  .nav:not(.is-stuck)::before{background:linear-gradient(to bottom,rgba(9,9,9,.36),transparent)}
  .chap .door-title{font-size:clamp(56px,17vw,72px)}
  .chap .chap-body{padding-block:56px 72px}
  .chan{gap:36px}
  .duo{gap:18px}
  .duo-h{font-size:clamp(32px,9.2vw,40px);line-height:1.02}
  .duo-side p{font-size:16px;line-height:1.5;color:rgba(255,255,255,.82)}
  .duo-link{font-size:16px;margin-top:18px}

  .stage{margin-inline:calc(var(--edge) * -1)}
  .stage-frame{border-radius:0;box-shadow:none;padding:30px 0;aspect-ratio:auto;min-height:0}
  .stage-frame .phone{width:min(304px,calc(100% - 2 * var(--edge) - 20px));max-height:none}
  .stage-frame::before{display:none}
  .stage-frame .chat{justify-content:flex-start}
  .stage-cap{padding-inline:var(--edge);font-size:14px;color:rgba(255,255,255,.7)}

  .cardgrid{grid-template-columns:1fr;gap:32px}
  .ecard{background:none;box-shadow:none;padding:0;gap:12px}
  .ecard-vis{border-radius:12px;box-shadow:inset 0 0 0 1px rgba(255,255,255,.1)}
  .ecard-vis .rows{font-size:15px;gap:11px}
  .ecard-vis .rows i{padding-bottom:10px}
  .ecard-vis .sl{font-size:13px}
  .ecard-vis .stars{font-size:32px}
  .ecard-vis .wv{scale:2}
  .ecard-vis .ring-ico{scale:1.9}
  .ecard h4{font-size:18px;letter-spacing:-.02em;margin-top:6px}
  .ecard p{font-size:15px;line-height:1.5;color:rgba(255,255,255,.76)}

  .itemgrid{grid-template-columns:1fr}
  .itemgrid span{font-size:15px;padding:15px 0;color:rgba(255,255,255,.86)}
  section[id]{scroll-margin-top:50px}
}
@media(max-width:820px){
  .stage-frame .phone{max-height:none}
  #content,#followup,#visibility{--op:50% 50%}   /* the phone cut is already framed on the subject */
}
/* tablets keep the three cards on one row */
@media(min-width:768px) and (max-width:820px){
  .cardgrid{grid-template-columns:repeat(3,minmax(0,1fr))}
}

/* ---------- reduced motion ---------- */
@media(prefers-reduced-motion:reduce){
  .js .nav>*,.js .hero>.liquid-canvas{animation:none}
  .js [data-rv]{opacity:1;transform:none;transition:none}
  .dw-i{transform:none;animation:none!important}
  .ring .ltr{animation:none!important}
  .pl-caret{display:none}
  .loop video{display:none}
  .scene video{display:none}
  .scene img,.scene video{transform:none}
  .pill,.pill.show,.pill-list,.pill-list a{transition:none}
  .pill-list a{opacity:1;translate:0}
  .duo-link:hover{animation:none}
  .fx.hero-exited .hero-index{opacity:1}
}
