/*
 * Motion is deliberately progressive: without this stylesheet, JavaScript,
 * canvas, or a supported scroll timeline, every image remains in its final
 * static composition.
 */

@media (prefers-reduced-motion: no-preference) {
  :root {
    --motion-ease: cubic-bezier(.22, 1, .36, 1);
  }

  .cover-title span {
    animation: motion-title-rise 700ms var(--motion-ease) both;
  }
  .cover-title span:last-child { animation-delay: 90ms; }
  .cover-figure {
    transform-origin: 50% 100%;
    animation: motion-hero-figure 850ms 120ms var(--motion-ease) both;
  }

  [data-motion].motion-pending {
    opacity: 0;
    transform: translate3d(0, 22px, 0) scale(.985);
  }
  [data-motion="scale"].motion-pending { transform: scale(.985); }
  [data-motion].motion-pending.is-visible {
    animation: motion-artifact-rise 760ms var(--motion-ease) both;
  }
  [data-motion="scale"].motion-pending.is-visible {
    animation-name: motion-artifact-scale;
  }

  .tanit-specimen.motion-pending,
  .method-inscription.motion-pending {
    opacity: 1;
    transform: none;
  }
  .tanit-specimen.motion-pending {
    position: relative;
    overflow: hidden;
  }
  .tanit-specimen.motion-pending::after,
  .method-inscription.motion-pending::after {
    content: "";
    position: absolute;
    z-index: 2;
    inset: 0;
    pointer-events: none;
    background: var(--paper);
    transform: translate3d(0, 0, 0);
  }
  .tanit-specimen.motion-pending::after { background: var(--paper); }
  .method-inscription.motion-pending::after { background: #fffefa; }
  .tanit-specimen.motion-pending.is-visible::after,
  .method-inscription.motion-pending.is-visible::after {
    animation: motion-wipe-x 720ms var(--motion-ease) both;
  }

  .motion-drift { overflow: hidden; }
  @supports (animation-timeline: view()) {
    .motion-drift > img {
      animation: motion-interlude-drift 1ms linear both;
      animation-timeline: view(block);
      animation-range: entry 8% exit 92%;
    }
  }

  .about-coin.motion-tilt {
    isolation: isolate;
    overflow: hidden;
    border-radius: 50%;
    transform-style: preserve-3d;
  }
  .about-coin.motion-tilt img {
    transform: perspective(420px) rotateX(var(--coin-rotate-x, 0deg)) rotateY(var(--coin-rotate-y, 0deg)) scale(var(--coin-scale, 1));
    transform-origin: 50% 50%;
    transition: transform 180ms var(--motion-ease);
  }
  .about-coin.motion-tilt::after {
    content: "";
    position: absolute;
    z-index: 2;
    inset: -25%;
    pointer-events: none;
    opacity: 0;
    background: linear-gradient(112deg, transparent 38%, rgba(255, 255, 255, .55) 50%, transparent 62%);
    transform: translate3d(-48%, 0, 0) rotate(-12deg);
  }
  .about-coin.motion-tilt.is-tilting::after {
    opacity: .48;
    transform: translate3d(48%, 0, 0) rotate(-12deg);
    transition: transform 620ms var(--motion-ease), opacity 180ms linear;
  }

  .mask-particle-canvas {
    position: absolute;
    z-index: 2;
    display: block;
    pointer-events: none;
    opacity: 0;
    transition: opacity 120ms linear;
  }
  .mask-particle-canvas.is-active { opacity: 1; }
  .mask-figure.mask-particles-active {
    opacity: 0 !important;
    transition: opacity 120ms linear;
  }
}

@keyframes motion-title-rise {
  from { opacity: 0; transform: translate3d(0, 28px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes motion-hero-figure {
  from { opacity: 0; transform: translate3d(0, 24px, 0) scale(.985); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes motion-artifact-rise {
  from { opacity: 0; transform: translate3d(0, 22px, 0) scale(.985); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes motion-artifact-scale {
  from { opacity: 0; transform: scale(.985); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes motion-wipe-x {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(104%, 0, 0); }
}
@keyframes motion-interlude-drift {
  from { transform: scale(1.045) translate3d(var(--motion-drift-start, -1.5%), 0, 0); }
  to { transform: scale(1.045) translate3d(var(--motion-drift-end, 1.5%), 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .mask-particle-canvas { display: none !important; }
  .mask-figure.mask-particles-active { opacity: revert !important; }
}
