/* AI Buddy · the comparison scene ("Most agencies ask you to pay for something you can't see yet.")
   One screen: headline, promise and the three rows are all in the layout from the start and fit the window.
   Nothing here depends on scroll position. assets/diff-scene.js only plays the entrance once.

   Layout   .dif            the scene; on a wide page it fills the window (less a strip of the next block) and centres its content
            .dif-head       headline + promise
            .dif-t          the comparison, two columns: .dif-cols (labels) and three .dif-r rows
            .dif-o / .dif-n one row's "usual" line (struck) and the AI Buddy answer
   Sizes    --u is the fluid unit: 1% of the page width, capped by the window height so a short window still fits
   States   .is-armed on .dif  the script is running and parts wait for their entrance
            .is-in on a part   that part has entered (final state; also the state without script or with motion off) */

.dif{
  --dvh:var(--vh,100vh);
  --u:min(1cqw,calc(var(--dvh) * .0185));
  --col-gap:clamp(32px,6cqw,110px);
  --row-pad:clamp(14px,calc(var(--dvh) * .034),38px);
  --fs-row:clamp(18px,calc(var(--u) * 1.42),26px);
  --line:rgba(255,255,255,.11);
  --old:#8f8f9a;
  --old-line:rgba(143,143,154,.72);
  --cols:minmax(0,.85fr) minmax(0,1.15fr);   /* the answers are the longer lines, so they get the wider column */
  --ease:cubic-bezier(.19,1,.22,1);
  position:relative;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;
  gap:clamp(28px,calc(var(--dvh) * .06),76px);
  min-height:calc(var(--dvh) * .93);        /* a strip of the next block shows below, so the page reads as continuing */
  padding-block:clamp(44px,calc(var(--dvh) * .09),120px);
  color:#f2f2f6;
}

/* headline + promise */
.dif-head{display:grid;gap:clamp(14px,calc(var(--u) * 1.5),30px)}
.dif-h{margin:0;max-width:17em;font-family:var(--serif);font-weight:300;font-size:clamp(34px,calc(var(--u) * 4.4),84px);line-height:1.02;letter-spacing:-.045em;text-wrap:balance}
.dif-w{display:inline-block;white-space:nowrap}
.dif-w>span{display:inline-block}
.dif-sub{margin:0;max-width:34em;font-family:'Inter Tight','Helvetica Neue',Arial,sans-serif;font-weight:400;font-size:clamp(16px,calc(var(--u) * 1.16),21px);line-height:1.55;color:#a6a6b1;text-wrap:pretty}

/* the comparison */
.dif-cols,.dif-r{display:grid;grid-template-columns:var(--cols);column-gap:var(--col-gap)}
.dif-cols{padding-bottom:clamp(12px,calc(var(--dvh) * .02),22px)}
.dif-c{font-size:12px;line-height:1.4;letter-spacing:.24em;text-transform:uppercase;font-weight:500;color:#9a9aa5}
.dif-c.v{color:var(--v2)}
.dif-r{align-items:baseline;padding-block:var(--row-pad);border-top:1px solid var(--line)}
.dif-r:last-child{border-bottom:1px solid var(--line)}
.dif-r p{margin:0;font-family:var(--serif);font-weight:300;font-size:var(--fs-row);line-height:1.3;letter-spacing:-.022em;text-wrap:pretty}
.dif-o{color:var(--old)}
.dif-o s{text-decoration:none;background:linear-gradient(var(--old-line),var(--old-line)) 0 58%/100% 1px no-repeat}
.dif-n{color:#f2f2f6}
.dif-n b{font-weight:400;color:#fff;padding-bottom:.06em;background:linear-gradient(var(--v2),var(--v2)) 0 100%/100% 1px no-repeat}

/* wide page: the scene is the first window after the film, so the section adds no space above it
   and the next block starts right under the scene (the scene's own padding is the gap) */
@container (min-width:901px){
  .s5 .after>.sec.diff{padding-top:0}
  .s5 .after>.sec.diff>.wrap{padding-top:0}
  .s5 .dif+.hnum{margin-top:0}
}

/* narrow page (phones, and the phone preview): normal flow, one column, each answer under its line */
@container (max-width:900px){
  .s5 .after>.sec.diff>.wrap{padding-top:0}     /* the section's own top space (--sec-y) is the gap under the story row */
  .dif{min-height:0;justify-content:flex-start;gap:36px;padding-block:8px 0;--fs-row:20px;--row-pad:22px}
  .dif-h{font-size:clamp(30px,8.8cqw,44px);max-width:none}
  .dif-sub{font-size:17px}
  .dif-cols{grid-template-columns:minmax(0,1fr);row-gap:8px;padding-bottom:16px}
  .dif-c{font-size:11px;letter-spacing:.2em}
  .dif-c:first-child{text-decoration:line-through;text-decoration-thickness:1px}
  .dif-r{grid-template-columns:minmax(0,1fr);row-gap:10px}
  .dif-r .dif-o{font-size:17px}
}

/* entrance: plays once per part, only while the script has armed the scene */
.dif.is-armed .dif-w>span{opacity:0;filter:blur(10px);transform:translate3d(0,.28em,0)}
.dif.is-armed .dif-sub{opacity:0;transform:translate3d(0,12px,0)}
.dif.is-armed .dif-cols{opacity:0}
.dif.is-armed .dif-r{border-color:transparent}
.dif.is-armed .dif-o,.dif.is-armed .dif-n{opacity:0;transform:translate3d(0,12px,0)}
.dif.is-armed .dif-o{color:#e4e4ea}
.dif.is-armed .dif-o s,.dif.is-armed .dif-n b{background-size:0 1px}

.dif.is-armed .is-in .dif-w>span{opacity:1;filter:none;transform:none;transition:opacity .55s var(--ease),filter .55s var(--ease),transform .75s var(--ease);transition-delay:calc(var(--k) * 38ms)}
.dif.is-armed .is-in .dif-sub{opacity:1;transform:none;transition:opacity .6s var(--ease) .32s,transform .8s var(--ease) .32s}
.dif.is-armed .dif-cols.is-in{opacity:1;transition:opacity .5s var(--ease)}
.dif.is-armed .dif-r.is-in{border-color:var(--line);transition:border-color .6s var(--ease)}
.dif.is-armed .dif-r.is-in .dif-o{opacity:1;transform:none;color:var(--old);transition:opacity .4s var(--ease),transform .6s var(--ease),color .5s ease .4s}
.dif.is-armed .dif-r.is-in .dif-o s{background-size:100% 1px;transition:background-size .5s var(--ease) .3s}
.dif.is-armed .dif-r.is-in .dif-n{opacity:1;transform:none;transition:opacity .45s var(--ease) .2s,transform .7s var(--ease) .2s}
.dif.is-armed .dif-r.is-in .dif-n b{background-size:100% 1px;transition:background-size .5s var(--ease) .6s}

/* forced colours (Windows high contrast) drops backgrounds, so the strike becomes a real one */
@media (forced-colors:active){.dif-o s{text-decoration:line-through}.dif-n b{text-decoration:underline}}

/* motion off (the page's own switch, or the system setting): final state, no movement */
html.calm .dif *{transition:none !important}
@media (prefers-reduced-motion:reduce){.dif *{transition:none !important}}
