/*
  Motion layer for the homepage. Loaded after redesign.css.

  - Hover, focus and press feedback is pure CSS and works without JavaScript.
  - The page entrance and scroll reveals only apply when js/motion.js has put
    the "motion" class on <html>. Without it every element is simply visible.
  - Only transform, opacity, clip-path and color are animated.
*/

:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

body.home a:focus-visible {
  outline: 2px solid #030712;
  outline-offset: 4px;
}

/* ---------- Pill buttons ---------- */

body.home .link-3,
body.home .link-block-2 {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: color 0.2s ease, transform 0.3s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

/* The fill that inverts the button. It fades in by default and sweeps up
   from the bottom edge when motion is allowed. */
body.home .link-3::before,
body.home .link-block-2::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.2s ease;
}

body.home .link-3::before {
  background: #030712;
}

body.home .link-block-2::before {
  background: #fff;
}

body.home .link-3 svg,
body.home .link-block-2 svg {
  transition: transform 0.5s var(--ease-out);
}

/* The fill layer does the colour change, so the button's own background
   stays put on hover. */
body.home .link-3:hover {
  background: transparent;
}

body.home .link-block-2:hover {
  background: #030712;
}

@media (hover: hover) and (pointer: fine) {
  body.home .link-3:hover {
    color: #fff;
  }

  body.home .link-block-2:hover {
    color: #030712;
  }

  body.home .link-3:hover::before,
  body.home .link-block-2:hover::before {
    opacity: 1;
  }
}

body.home .link-3:focus-visible,
body.home .link-3:active {
  color: #fff;
}

body.home .link-block-2:focus-visible,
body.home .link-block-2:active {
  color: #030712;
}

body.home .link-3:focus-visible::before,
body.home .link-3:active::before,
body.home .link-block-2:focus-visible::before,
body.home .link-block-2:active::before {
  opacity: 1;
}

/* ---------- Text links in the closing section ---------- */

body.home .cta-link {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  transition: color 0.3s ease, text-decoration-color 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
  body.home .cta-link:hover {
    color: rgb(107, 114, 128);
    text-decoration-color: transparent;
  }
}

body.home .cta-link:focus-visible,
body.home .cta-link:active {
  color: rgb(107, 114, 128);
  text-decoration-color: transparent;
}

/* ---------- Project and article cards ---------- */

/* Keeps the rounded corners crisp while the image inside is transformed. */
body.home .link-block,
body.home .insight-image {
  isolation: isolate;
}

body.home .link-5,
body.home .link-4 {
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.4s ease;
}

@media (hover: hover) and (pointer: fine) {
  body.home .collection-item-2:hover .link-5,
  body.home .insight-card:hover .link-4 {
    text-decoration-line: underline;
    text-decoration-color: currentColor;
  }
}

body.home .collection-item-2:active .link-5,
body.home .insight-card:active .link-4 {
  text-decoration-line: underline;
  text-decoration-color: currentColor;
}

body.home .collection-item-2:has(a:focus-visible) .link-5,
body.home .insight-card:has(a:focus-visible) .link-4 {
  text-decoration-line: underline;
  text-decoration-color: currentColor;
}

/* Arrow control: the arrow leaves through the top right corner while a copy
   arrives from the bottom left, clipped to the arrow's own 28px box. */
body.home .div-block-22 > a {
  position: relative;
  display: block;
  width: 28px;
  height: 28px;
  overflow: hidden;
}

body.home .div-block-22 > a::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../images/6828ca5849263c69080efd06_arrowli.svg") center / 100% 100% no-repeat;
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  /* Pills: sweep the fill and nudge the arrow. */
  body.home .link-3,
  body.home .link-block-2 {
    transition: color 0.45s var(--ease-out), transform 0.3s var(--ease-out);
  }

  body.home .link-3::before,
  body.home .link-block-2::before {
    opacity: 1;
    transform: translate3d(0, 102%, 0);
    transition: transform 0.55s var(--ease-out);
  }

  body.home .link-3:active,
  body.home .link-block-2:active {
    transform: scale(0.97);
  }

  body.home .link-3:focus-visible::before,
  body.home .link-3:active::before,
  body.home .link-block-2:focus-visible::before,
  body.home .link-block-2:active::before {
    transform: none;
  }

  body.home .link-3:focus-visible svg,
  body.home .link-3:active svg {
    transform: translate3d(4px, 0, 0);
  }

  body.home .link-block-2:focus-visible svg,
  body.home .link-block-2:active svg {
    transform: translate3d(6px, 0, 0);
  }

  /* Cards: image scale inside the existing rounded frame, arrow swap. */
  body.home .link-block img,
  body.home .insight-image img {
    backface-visibility: hidden;
    transition: transform 1s var(--ease-out) var(--reveal-delay, 0ms);
  }

  body.home .div-block-22 > a img,
  body.home .div-block-22 > a::after {
    transition: transform 0.6s var(--ease-in-out);
  }

  body.home .div-block-22 > a::after {
    opacity: 1;
    transform: translate3d(-110%, 110%, 0);
  }

  body.home .collection-item-2:active .link-block img,
  body.home .insight-card:active .insight-image img {
    transform: scale(1.03);
  }

  body.home .collection-item-2:active .div-block-22 > a img {
    transform: translate3d(110%, -110%, 0);
  }

  body.home .collection-item-2:active .div-block-22 > a::after {
    transform: none;
  }

  body.home .collection-item-2:has(a:focus-visible) .link-block img,
  body.home .insight-card:has(a:focus-visible) .insight-image img {
    transform: scale(1.03);
  }

  body.home .collection-item-2:has(a:focus-visible) .div-block-22 > a img {
    transform: translate3d(110%, -110%, 0);
  }

  body.home .collection-item-2:has(a:focus-visible) .div-block-22 > a::after {
    transform: none;
  }
}

@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  body.home .link-3:hover::before,
  body.home .link-block-2:hover::before {
    transform: none;
  }

  body.home .link-3:hover svg {
    transform: translate3d(4px, 0, 0);
  }

  body.home .link-block-2:hover svg {
    transform: translate3d(6px, 0, 0);
  }

  body.home .collection-item-2:hover .link-block img,
  body.home .insight-card:hover .insight-image img {
    transform: scale(1.03);
  }

  body.home .collection-item-2:hover .div-block-22 > a img {
    transform: translate3d(110%, -110%, 0);
  }

  body.home .collection-item-2:hover .div-block-22 > a::after {
    transform: none;
  }
}

/* ---------- Page entrance (needs js/motion.js) ---------- */

body.home .text-block-2 {
  --intro-delay: 0ms;
  --intro-y: -10px;
}

body.home .div-block-3 {
  --intro-delay: 70ms;
  --intro-y: -10px;
}

body.home .div-block-19 {
  --intro-delay: 150ms;
}

body.home .heading-2.homenew {
  --intro-delay: 230ms;
}

body.home .link-block-2 {
  --intro-delay: 560ms;
}

body.home .text-block-16 {
  --intro-delay: 640ms;
}

html.motion body.home :is(.text-block-2, .div-block-3, .div-block-19, .heading-2.homenew, .link-block-2, .text-block-16) {
  opacity: 0;
}

html.motion.motion-in body.home :is(.text-block-2, .div-block-3, .div-block-19, .heading-2.homenew, .link-block-2, .text-block-16) {
  opacity: 1;
  animation: intro-rise 1s var(--ease-out) var(--intro-delay, 0ms) backwards;
}

@keyframes intro-rise {
  from {
    opacity: 0;
    transform: translate3d(0, var(--intro-y, 18px), 0);
  }
}

/* Headline: each line rises from behind its own baseline. The script wraps
   the words for the length of the animation, then restores the original
   markup, so wrapping and typography are untouched. */
html.motion.motion-in body.home .heading-2.homenew.is-split {
  animation: none;
}

html.motion.motion-in body.home .heading-2.homenew .hl-word {
  display: inline-block;
  animation: headline-rise 1.1s var(--ease-out) calc(230ms + var(--line, 0) * 90ms) backwards;
}

@keyframes headline-rise {
  from {
    transform: translate3d(0, 105%, 0);
    clip-path: inset(0 -0.1em 100% -0.1em);
  }

  to {
    transform: none;
    clip-path: inset(-0.3em -0.1em -0.3em -0.1em);
  }
}

/* ---------- Scroll reveals (need js/motion.js) ---------- */

html.motion [data-reveal="up"] {
  transition:
    opacity 0.9s var(--ease-out) var(--reveal-delay, 0ms),
    transform 1.1s var(--ease-out) var(--reveal-delay, 0ms);
}

html.motion [data-reveal="up"]:not(.is-revealed) {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
}

/* Cards: the image frame rises first, the text follows, and the image
   settles from a slight zoom inside its frame. */
html.motion [data-reveal="card"] > :first-child {
  transition:
    opacity 1s var(--ease-out) var(--reveal-delay, 0ms),
    transform 1.2s var(--ease-out) var(--reveal-delay, 0ms);
}

html.motion [data-reveal="card"] > :last-child {
  transition:
    opacity 0.9s var(--ease-out) calc(var(--reveal-delay, 0ms) + 120ms),
    transform 1.1s var(--ease-out) calc(var(--reveal-delay, 0ms) + 120ms);
}

html.motion [data-reveal="card"]:not(.is-revealed) > :first-child {
  opacity: 0;
  transform: translate3d(0, 36px, 0);
}

html.motion [data-reveal="card"]:not(.is-revealed) > :last-child {
  opacity: 0;
  transform: translate3d(0, 20px, 0);
}

html.motion body.home [data-reveal="card"]:not(.is-revealed) > :first-child img {
  transform: scale(1.06);
}

html.motion body.home [data-reveal="card"].is-revealing > :first-child img {
  transition-duration: 1.5s;
}

/* Divider: drawn from the left. */
html.motion [data-reveal="line"] {
  transform-origin: left center;
  transition: transform 1.3s var(--ease-out) var(--reveal-delay, 0ms);
}

html.motion [data-reveal="line"]:not(.is-revealed) {
  transform: scaleX(0);
}

/* Elements that were already scrolled past appear without animating. */
html.motion [data-reveal-instant],
html.motion [data-reveal-instant] * {
  transition: none !important;
}
