/* Shared motion language for the customer-facing website. */
:root {
  --motion-ease: cubic-bezier(.22, 1, .36, 1);
  --motion-spring: cubic-bezier(.2, 1.35, .35, 1);
  --motion-duration: 720ms;
}

.motion-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10000;
  height: 3px;
  pointer-events: none;
  background: linear-gradient(90deg, #0a8a45, #25c77b, #45e39a);
  box-shadow: 0 1px 8px rgba(37, 199, 123, .32);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

/* Only animate where the scroll timeline exists. Without the @supports the shorthand
   keeps fill-mode: both while animation-duration falls back to 0s, which retains the
   end keyframe and paints a permanently full bar -- notably on iOS Safari before 26.
   Left unanimated, the base rule's scaleX(0) paints nothing, which is honest. */
@supports (animation-timeline: scroll(root block)) {
  .motion-progress {
    animation: motion-scroll-progress linear both;
    animation-timeline: scroll(root block);
  }
}

html.motion-enabled .motion-reveal {
  opacity: 0;
  transform: translate3d(0, 28px, 0) scale(.985);
  transition:
    opacity var(--motion-duration) var(--motion-ease),
    transform var(--motion-duration) var(--motion-ease);
  transition-delay: var(--motion-delay, 0ms);
}

/* A target that contains other targets moves without fading. Fading both multiplies
   one 0->1 opacity by another, which reads as a murky wash instead of two moves. The
   section still enters; its cards carry the fade and the stagger. */
html.motion-enabled .motion-reveal.motion-reveal-group {
  opacity: 1;
  transform: translate3d(0, 18px, 0);
  transition: transform var(--motion-duration) var(--motion-ease);
}

html.motion-enabled .motion-reveal.motion-from-left {
  transform: translate3d(-34px, 0, 0);
}

html.motion-enabled .motion-reveal.motion-from-right {
  transform: translate3d(34px, 0, 0);
}

html.motion-enabled .motion-reveal.motion-scale-in {
  transform: scale(.94);
}

html.motion-enabled .motion-reveal.motion-in {
  opacity: 1;
  transform: none;
  will-change: auto;
}

html.motion-enabled .motion-page-intro {
  animation: motion-page-intro 680ms var(--motion-ease) both;
}

html.motion-enabled .motion-float {
  animation: motion-float 5.8s ease-in-out infinite;
  animation-delay: 900ms;
  will-change: translate;
}

html.motion-enabled .motion-interactive {
  transition-property: translate, scale, transform, box-shadow, border-color,
    background-color, color, opacity, filter, text-decoration-color;
  transition-duration: 220ms;
  transition-timing-function: var(--motion-ease);
}

@media (hover: hover) and (pointer: fine) {
  html.motion-enabled .motion-interactive:hover {
    translate: 0 -4px;
  }

  html.motion-enabled a.motion-interactive:hover,
  html.motion-enabled button.motion-interactive:hover {
    translate: 0 -2px;
  }
}

html.motion-enabled a.motion-interactive:active,
html.motion-enabled button.motion-interactive:active {
  scale: .97;
  transition-duration: 90ms;
}

/* The same feedback for the keyboard. Every micro-interaction here was hover-only,
   so a keyboard user got the focus ring and none of the motion. outline rather than
   box-shadow, so a component's own shadow cannot paint over the ring. */
html.motion-enabled .motion-interactive:focus-visible {
  outline: 2px solid var(--motion-focus, #45e39a);
  outline-offset: 3px;
  translate: 0 -2px;
}

/* Controls that should not move under the cursor. Lifting a list row shifts the answer
   it is about to reveal, and a header control that moves as the cursor approaches reads
   as unstable -- the header was also inconsistent, because a[class*='btn'] picked up the
   two nav links with dropdowns and left the other three alone. They keep the colour
   change and the focus ring; they lose the travel. */
html.motion-enabled details.motion-interactive:hover,
html.motion-enabled details.motion-interactive:focus-visible,
html.motion-enabled .hd-link.motion-interactive:hover,
html.motion-enabled .hd-link.motion-interactive:focus-visible,
html.motion-enabled .mobile-nav-toggle.motion-interactive:hover,
html.motion-enabled .mobile-nav-toggle.motion-interactive:focus-visible {
  translate: none;
}

@keyframes motion-page-intro {
  from { opacity: 0; translate: 0 -14px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes motion-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -10px; }
}

@keyframes motion-scroll-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@media (max-width: 720px) {
  :root {
    --motion-duration: 600ms;
  }

  html.motion-enabled .motion-reveal {
    transform: translate3d(0, 20px, 0) scale(.99);
  }

  html.motion-enabled .motion-reveal.motion-from-left,
  html.motion-enabled .motion-reveal.motion-from-right {
    transform: translate3d(0, 20px, 0);
  }

  html.motion-enabled .motion-float {
    animation-duration: 7.5s;
  }
}

@media (prefers-reduced-motion: reduce) {
  .motion-progress { display: none !important; }

  html.motion-enabled .motion-reveal,
  html.motion-enabled .motion-reveal-group,
  html.motion-enabled .motion-page-intro,
  html.motion-enabled .motion-float,
  html.motion-enabled .motion-interactive {
    opacity: 1 !important;
    transform: none !important;
    translate: none !important;
    scale: none !important;
    animation: none !important;
    transition: none !important;
  }
}
