/* Idle motion for artwork that is already on the page: only the decorative
   layers move, and never the approved photos, type or layout.
   All of it is opt-in for the reader's motion preference. */
@keyframes ambient-drift {
  from {
    translate: var(--ambient-from-x, 0px) var(--ambient-from-y, 0px);
    rotate: var(--ambient-from-rotate, 0deg);
    scale: var(--ambient-from-scale, 1);
  }
  to {
    translate: var(--ambient-to-x, 0px) var(--ambient-to-y, 0px);
    rotate: var(--ambient-to-rotate, 0deg);
    scale: var(--ambient-to-scale, 1);
  }
}

/* Small independent accents start at their approved position. JavaScript only
   enables these loops while the accent is visible in an active tab. */
@keyframes ambient-gentle {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  50% {
    translate: var(--ambient-gentle-x, 0px) var(--ambient-gentle-y, -6px);
    rotate: var(--ambient-gentle-rotate, 3deg);
  }
}

@media (prefers-reduced-motion: no-preference) {
  [data-ambient-motion].is-ambient-ready {
    animation: ambient-gentle var(--ambient-gentle-duration, 8s) infinite ease-in-out paused;
  }
  [data-ambient-motion].is-ambient-running { animation-play-state: running; }
  .closing-cta__floating-star { --ambient-gentle-x: 3px; }
  .celebration-video__cube { --ambient-gentle-duration: 7.5s; --ambient-gentle-x: 2px; --ambient-gentle-rotate: 4deg; }
  .blog-article-hero__decoration { --ambient-gentle-duration: 8.5s; --ambient-gentle-x: -2px; --ambient-gentle-y: -4px; --ambient-gentle-rotate: -3deg; }

  .quiz__decoration-small,
  .quiz__decoration-left,
  .quests__decor--cloud,
  .quests__decor--star,
  .quests__spark,
  .faq__triangle,
  .reviews__laurel--left,
  .reviews__laurel--right {
    animation: ambient-drift var(--ambient-duration, 8s) var(--ambient-delay, 0s) infinite alternate ease-in-out;
  }

  /* Quiz gift scene. */
  .quiz__decoration-small { --ambient-duration: 6s; --ambient-from-y: -13px; --ambient-to-y: 13px; --ambient-from-rotate: -18deg; --ambient-to-rotate: 18deg; }
  .quiz__decoration-left { --ambient-duration: 8.5s; --ambient-delay: -2s; --ambient-from-y: 12px; --ambient-to-y: -12px; --ambient-from-rotate: 6deg; --ambient-to-rotate: -6deg; }

  /* Quest sky: the cloud drifts sideways, the star and sparks keep shorter beats. */
  .quests__decor--cloud { --ambient-duration: 14s; --ambient-from-x: -34px; --ambient-to-x: 34px; }
  .quests__decor--star { --ambient-duration: 5.5s; --ambient-delay: -1.5s; --ambient-from-y: -13px; --ambient-to-y: 13px; --ambient-from-rotate: -20deg; --ambient-to-rotate: 20deg; }
  .quests__spark { --ambient-duration: 4.5s; --ambient-from-scale: .7; --ambient-to-scale: 1.25; --ambient-from-rotate: -20deg; --ambient-to-rotate: 20deg; }
  .quests__spark--pink { --ambient-duration: 3.8s; --ambient-delay: -1.2s; }
  .quests__spark--ring { --ambient-duration: 5.4s; --ambient-delay: -2.4s; }
  .quests__spark--gold-end { --ambient-duration: 4.1s; --ambient-delay: -3.1s; }
  .quests__spark--ring-end { --ambient-duration: 6s; --ambient-delay: -.8s; }

  /* Each FAQ backdrop floats inside its own clipped panel. Both rotations carry
     the layout angle the panel sets, so the drift never straightens the shape. */
  .faq__triangle { --ambient-duration: 6.5s; --ambient-from-y: -9px; --ambient-to-y: 9px; --ambient-from-x: -5px; --ambient-to-x: 5px; --ambient-from-rotate: 26deg; --ambient-to-rotate: 34deg; }
  .faq__panel--definition .faq__triangle { --ambient-duration: 7.6s; --ambient-delay: -2.6s; --ambient-from-rotate: -19.83deg; --ambient-to-rotate: -11.83deg; }

  /* The award laurel breathes around the rating instead of shifting it. */
  .reviews__laurel--left { --ambient-duration: 6.5s; --ambient-from-rotate: -5deg; --ambient-to-rotate: 2deg; }
  .reviews__laurel--right { --ambient-duration: 6.5s; --ambient-delay: -.5s; --ambient-from-rotate: 5deg; --ambient-to-rotate: -2deg; }

  /* Both play buttons keep a slow pulse so the video reads as playable. */
  .video-trigger img, .celebration-video__play img {
    animation: ambient-drift 2.8s infinite alternate ease-in-out;
    --ambient-from-scale: 1;
    --ambient-to-scale: 1.09;
  }
  .video-trigger:is(:hover, :focus-visible) img, .celebration-video__play:is(:hover, :focus-visible) img { animation-play-state: paused; }

  /* Cards answer the pointer; touch screens never get a stuck hover state. */
  @media (hover: hover) and (pointer: fine) {
    .shows__card-link, .additions__card-link, .cases__theme, .catalog-card__link {
      transition: translate var(--motion-fast) var(--ease-out);
    }
    .shows__card-link:hover, .additions__card-link:hover, .cases__theme:hover, .catalog-card__link:hover { translate: 0 -6px; }
  }
}

@media print {
  [data-ambient-motion] { animation: none !important; }
}
