/* ==========================================================================
   Animations — keyframes, scroll-reveal states, motion preferences
   ========================================================================== */

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.78); }
}

@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-50% - var(--space-md) / 2)); }
}

@keyframes float-slow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-14px) rotate(0.6deg); }
}

@keyframes drift-gradient {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* --- Scroll reveal -------------------------------------------------------
   Elements opt in with [data-reveal]; the observer in js/reveal.js adds
   .is-revealed. Without JS the fallback below keeps everything visible.
   ------------------------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

[data-reveal='zoom'] { transform: scale(0.95); }

/* Sideways reveals only where the layout is actually side by side; below that
   breakpoint they would push content past the viewport edge. */
@media (min-width: 60em) {
  [data-reveal='left']  { transform: translateX(-26px); }
  [data-reveal='right'] { transform: translateX(26px); }
}

/* No `!important` here: important author declarations outrank animations, and
   that silently froze .is-floating. Source order already wins over the
   [data-reveal] rules above, which share its specificity. */
.is-revealed {
  opacity: 1;
  transform: none;
}

html.no-js [data-reveal] { opacity: 1; transform: none; }

/* --- Animated accents ---------------------------------------------------- */

.is-floating { animation: float-slow 7s var(--ease-soft) infinite; }

.u-text-gradient--animated {
  background-size: 220% 100%;
  animation: drift-gradient 9s var(--ease-soft) infinite;
}

/* --- Reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal] { opacity: 1; transform: none; }
  .marquee__track { animation: none; transform: none; }
  .marquee { mask-image: none; -webkit-mask-image: none; overflow-x: auto; }
  .is-floating { animation: none; }
}
