/* Site-wide motion. Loaded after design.css on every page.
   Progressive: runs only where scroll-driven animations are supported and the visitor
   has not asked for reduced motion. Content is never hidden waiting for a scroll,
   and hover never moves a card (see design.md). Only tokens from design.css. */

::selection{background:var(--text);color:var(--bg)}

/* Scroll progress: a hairline under the fixed nav */
body::after{content:"";position:fixed;top:var(--nav-height);left:0;right:0;z-index:1001;height:1px;background:linear-gradient(90deg,var(--muted),var(--text));transform:scaleX(0);transform-origin:0 50%;pointer-events:none}

/* Hero: a soft spotlight and dot grid behind the copy */
.page-hero{position:relative;isolation:isolate}
.page-hero::before{content:"";position:absolute;z-index:-1;top:calc(-1 * var(--space-7));right:0;width:min(720px,80vw);aspect-ratio:1;border-radius:50%;background:radial-gradient(closest-side,color-mix(in srgb,var(--text) 9%,transparent),transparent);pointer-events:none}
.page-hero::after{content:"";position:absolute;z-index:-1;inset:0;background-image:radial-gradient(color-mix(in srgb,var(--text) 14%,transparent) 1px,transparent 1px);background-size:var(--space-4) var(--space-4);-webkit-mask-image:radial-gradient(ellipse 60% 70% at 85% 20%,var(--bg),transparent 70%);mask-image:radial-gradient(ellipse 60% 70% at 85% 20%,var(--bg),transparent 70%);opacity:.5;pointer-events:none}

/* Identity pill: a live dot with a quiet pulse */
.site-dot{position:relative}
.site-dot::after{content:"";position:absolute;inset:-4px;border-radius:50%;border:1px solid var(--status);opacity:0}

/* Cards: a light sweep on hover. Border colour changes; the card itself stays put. */
.case,.case-card,.impact,.stat{position:relative;overflow:hidden;transition:border-color .3s ease}
.case::after,.case-card::after{content:"";position:absolute;inset:0;background:linear-gradient(115deg,transparent 30%,color-mix(in srgb,var(--text) 8%,transparent) 50%,transparent 70%);transform:translateX(-120%);transition:transform .9s ease;pointer-events:none}
.case:hover::after,.case:focus-visible::after,.case-card:hover::after,.case-card:focus-visible::after{transform:translateX(120%)}

/* Section headings: a fading hairline above each one */
.sec-head{position:relative}
.sec-head::before{content:"";position:absolute;top:calc(-1 * var(--space-3));left:0;width:var(--space-7);height:1px;background:linear-gradient(90deg,var(--line-strong),transparent)}

@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    body::after{animation:m-progress linear both;animation-timeline:scroll(root)}

    /* Hero parallax, wide screens only: on a phone the hero stacks and stays fully readable */
    .page-hero::before{animation:m-float linear both;animation-timeline:scroll(root);animation-range:0 100vh}
    @media (min-width:901px){
      .page-hero h1{--lift:-56px;animation:m-lift linear both;animation-timeline:scroll(root);animation-range:0 90vh}
      .page-hero .lede,.page-hero .cs-hero-sub,.page-hero .post-byline{--lift:-28px;animation:m-lift linear both;animation-timeline:scroll(root);animation-range:0 90vh}
      .page-hero .hero-side{--lift:-88px;animation:m-lift linear both;animation-timeline:scroll(root);animation-range:0 90vh}
    }

    /* Content settles into place as it enters. It is fully visible throughout. */
    .case,.case-card,.impact,.stat,.sec-head,.role,.range-col{animation:m-rise linear both;animation-timeline:view();animation-range:entry 0% entry 70%}
    .case:nth-child(2n),.case-card:nth-child(2n),.impact:nth-child(2n),.range-col:nth-child(2n){animation-range:entry 10% entry 80%}

    /* Case-study imagery drifts at its own depth */
    .mock,.device,.cs-shot,.shot,.screen,.pg-photo,.cs-hero-shot{animation:m-drift linear both;animation-timeline:view();animation-range:cover}
    .mock:nth-child(2n),.shot:nth-child(2n),.screen:nth-child(2n),.pg-photo:nth-child(2n){--depth:36}

    .site-dot::after{animation:m-pulse 2.4s ease-out infinite}
  }
}

@keyframes m-progress{to{transform:scaleX(1)}}
@keyframes m-float{to{translate:0 calc(var(--space-7) * 1.5);opacity:.4}}
@keyframes m-lift{to{translate:0 var(--lift,-32px);opacity:.55}}
@keyframes m-rise{from{translate:0 var(--space-4)}to{translate:0 0}}
@keyframes m-drift{from{translate:0 calc(var(--depth,20) * 1px)}to{translate:0 calc(var(--depth,20) * -1px)}}
@keyframes m-pulse{0%{opacity:.7;transform:scale(.6)}100%{opacity:0;transform:scale(1.6)}}
