/* ==========================================================================
   Motion: entrance reveals, parallax and the reduced-motion switch
   ========================================================================== */

@keyframes reveal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes reveal-float-left {
  from { opacity: 0; transform: translate(-60px, 0); }
  to { opacity: 1; transform: translate(0, 0); }
}

@keyframes reveal-float-right {
  from { opacity: 0; transform: translate(60px, 0); }
  to { opacity: 1; transform: translate(0, 0); }
}

@keyframes reveal-float-top {
  from { opacity: 0; transform: translate(0, -60px); }
  to { opacity: 1; transform: translate(0, 0); }
}

/* Brand photo drift: the layer travels 40% of (viewport + frame) either side of centre */
@keyframes brand-parallax {
  from { transform: translate3d(0, calc(-0.4 * (var(--parallax-viewport) + var(--parallax-frame))), 0); }
  to { transform: translate3d(0, calc(0.4 * (var(--parallax-viewport) + var(--parallax-frame))), 0); }
}

/* Entrance animation and parallax are an enhancement for 1024px and up only.
   Phones and tablets always show every block, with no hidden or offset state. */
@media (prefers-reduced-motion: no-preference) and (min-width: 1024px) {
  /* Content is hidden only when script is running and has not yet revealed it */
  .js [data-reveal] {
    opacity: 0;
  }

  .js [data-reveal].is-revealed {
    animation-name: reveal-fade;
    animation-duration: var(--reveal-duration, 1200ms);
    animation-delay: var(--reveal-delay, 0ms);
    animation-timing-function: var(--ease-reveal);
    animation-fill-mode: both;
  }

  .js [data-reveal="float-left"].is-revealed { animation-name: reveal-float-left; }
  .js [data-reveal="float-right"].is-revealed { animation-name: reveal-float-right; }
  .js [data-reveal="float-top"].is-revealed { animation-name: reveal-float-top; }

  /* Once finished the animation is dropped so hover transforms can apply */
  .js [data-reveal].is-revealed.is-settled {
    opacity: 1;
    transform: none;
    animation: none;
  }

  /* Scroll-driven parallax; script drives the same effect where unsupported */
  @supports (animation-timeline: view()) {
    .brand-row__photo {
      view-timeline-name: --frame;
      view-timeline-axis: block;
    }

    .brand-row__layer {
      animation: brand-parallax linear both;
      animation-timeline: --frame;
      animation-range: cover 0% cover 100%;
    }
  }
}

/* Transitions run through duration tokens, so one override stops them all */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-100: 0.01ms;
    --duration-150: 0.01ms;
    --duration-200: 0.01ms;
    --duration-300: 0.01ms;
    --duration-350: 0.01ms;
    --duration-400: 0.01ms;
  }
}
