/* One motion standard for the marketing site (Next pages and static /landing pages).
   Hero: fade up on load, CSS only, so content never depends on JS.
   Scroll: site-motion.js hides only what is below the fold, then reveals it once. */
@keyframes sm-rise { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:none; } }
@keyframes sm-rise-lg { from { opacity:0; transform:translateY(30px); } to { opacity:1; transform:none; } }

:is(.hf-hero .hf-label, .hf-hero-intro, .work-page .work-corners, .work-page .work-lead, .tpl-mast, .tpl-hero-copy, .tpl-stage, .tpl-chips, .project-intro>:not(h1), .project-hero) {
  animation:sm-rise .8s cubic-bezier(.16,1,.3,1) backwards;
}
:is(.hf-hero h1) {
  animation:sm-rise-lg .9s cubic-bezier(.16,1,.3,1) .1s backwards;
}
:is(.hf-hero-intro, .work-page .work-lead, .tpl-hero-copy, .project-hero) { animation-delay:.4s; }
.tpl-stage { animation-delay:.55s!important; }
.tpl-chips { animation-delay:.7s!important; }

.sm-wait { opacity:0!important; translate:0 20px; }
.sm-in { transition:opacity .8s cubic-bezier(.16,1,.3,1) var(--sm-d,0s), translate .8s cubic-bezier(.16,1,.3,1) var(--sm-d,0s)!important; }

@media print { .sm-wait { opacity:1!important; translate:none; } }
@media (prefers-reduced-motion:reduce) {
  :is(.hf-hero .hf-label, .hf-hero-intro, .hf-hero h1, .work-page .work-corners, .work-page .work-lead, .work-page .catalog-intro h1, .tpl-mast, .tpl-hero-copy, .tpl-stage, .tpl-chips, .tpl-hero h1, .project-intro>*, .project-hero, .hero-fade-up, .hero-fade-up-sm) { animation:none; }
}

img.sm-long,body.work-page .work-card .project-image img.sm-long { position:absolute;inset:0 0 auto;z-index:5;display:block;width:100%;height:auto;max-width:none;max-height:none;object-fit:fill;pointer-events:none; }
img.sm-long { opacity:0; }

@media (prefers-reduced-motion:no-preference) {
  /* Headlines: each line rises from behind a mask */
  @keyframes sm-line { from { transform:translateY(100%);clip-path:inset(-15% -5% 100% -5%); } to { transform:none;clip-path:inset(-15% -5% -24% -5%); } }
  h1.sm-lines { animation:none; }
  :is(h1.sm-headline, h1.sm-lines>span, .work-page .catalog-intro h1 :is(.l1,em), .tpl-hero h1>span, .project-intro>h1) { animation:sm-line 1s cubic-bezier(.16,1,.3,1) .05s backwards; }
  :is(h1.sm-lines>span:nth-child(2), .work-page .catalog-intro h1 em, .tpl-hero h1>span:nth-child(2)) { animation-delay:.22s!important; }

  /* Previews: the full page scrolls on hover */
  @media (hover:hover) and (pointer:fine) {
    .tpl-card>a { position:relative;aspect-ratio:1280/800;overflow:hidden;border-radius:12px;container-type:size; }
    body.work-page .work-card .project-image { position:relative;container-type:size; }
    body img.sm-long { transition:opacity .25s,transform .9s cubic-bezier(.45,.05,.55,.95); }
    :is(.tpl-card>a,.work-card):is(:hover,:focus-visible) .sm-long { opacity:1;transform:translateY(calc(-100% + 100cqh));transition:opacity .25s,transform 7s cubic-bezier(.45,.05,.55,.95) .25s; }
  }

  /* Answers stream in word by word */
  @keyframes sm-word { from { opacity:0; } to { opacity:1; } }
  .sm-run .sm-w { animation:sm-word .4s ease backwards;animation-delay:calc(var(--sm-start,0ms) + var(--i) * 38ms); }

  /* /templates steps: a line draws as you scroll */
  @media (min-width:1024px) {
    .tpl-steps { position:relative; }
    .tpl-steps::before,.tpl-steps::after { content:"";position:absolute;left:-28px;top:0;bottom:0;width:1px; }
    .tpl-steps::before { background:var(--line); }
    .tpl-steps::after { background:var(--amber);transform:scaleY(var(--sm-p,0));transform-origin:top; }
    .tpl-steps h3 { transition:color .4s; }
    .tpl-steps li.is-lit h3 { color:var(--amber); }
  }

  /* Buttons: arrow nudge, soft press */
  :is(.tpl-btn,.tpl-link,.rc-primary,.rc-link,.project-intro .primary)>span,:is(.stone-page,.v2-dark) a.rounded-full>svg { transition:translate .25s cubic-bezier(.16,1,.3,1); }
  :is(.tpl-link,.rc-primary,.rc-link,.project-intro .primary)>span { display:inline-block; }
  @media (hover:hover) {
    :is(.rc-primary,.rc-link,.project-intro .primary,.tpl-link):hover>span { translate:3px -3px; }
    .tpl-btn:hover>span,:is(.stone-page,.v2-dark) a.rounded-full:hover>svg { translate:3px 0; }
  }
  :is(.tpl-btn,.rc-primary):active,:is(.stone-page,.v2-dark) a.rounded-full:active { scale:.98; }
}
