/* ============================================================================
   USBS — Animations
   Keyframes · scroll-reveal states · SVG motion · reduced-motion guard
   ========================================================================== */

/* --- Scroll reveal -------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out);
  will-change: opacity, transform;
}
[data-reveal="left"]  { transform: translateX(-34px); }
[data-reveal="right"] { transform: translateX(34px); }
[data-reveal="scale"] { transform: scale(0.94); }
[data-reveal].is-in { opacity: 1; transform: none; }

/* Stagger children */
[data-stagger] > * { opacity: 0; transform: translateY(24px); transition: opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out); }
[data-stagger].is-in > * { opacity: 1; transform: none; }
[data-stagger].is-in > *:nth-child(1) { transition-delay: 0.04s; }
[data-stagger].is-in > *:nth-child(2) { transition-delay: 0.12s; }
[data-stagger].is-in > *:nth-child(3) { transition-delay: 0.20s; }
[data-stagger].is-in > *:nth-child(4) { transition-delay: 0.28s; }
[data-stagger].is-in > *:nth-child(5) { transition-delay: 0.36s; }
[data-stagger].is-in > *:nth-child(6) { transition-delay: 0.44s; }

/* --- Keyframes ------------------------------------------------------------ */
@keyframes loaderSpin { to { transform: rotate(360deg); } }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(18,198,233,0.5); }
  70%  { box-shadow: 0 0 0 12px rgba(18,198,233,0); }
  100% { box-shadow: 0 0 0 0 rgba(18,198,233,0); }
}

@keyframes marquee { to { transform: translateX(-50%); } }

@keyframes scrollWheel {
  0% { opacity: 0; transform: translate(-50%, 0); }
  40% { opacity: 1; }
  80% { opacity: 0; transform: translate(-50%, 12px); }
  100% { opacity: 0; }
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}
.floaty { animation: floaty 7s var(--ease-io) infinite; }
.floaty--slow { animation-duration: 11s; }

@keyframes drift {
  from { transform: translate3d(0,0,0); }
  to   { transform: translate3d(-40px, 20px, 0); }
}

/* Dash-flow along route paths */
@keyframes routeDraw { to { stroke-dashoffset: 0; } }
@keyframes routeFlow { to { stroke-dashoffset: -240; } }

.wm-route {
  stroke-dasharray: 6 10;
  animation: routeFlow 6s linear infinite;
}
.wm-route.draw {
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: routeDraw 2.4s var(--ease-out) forwards;
}

/* Moving cargo node along a path (JS drives offsetDistance) */
.cargo-node { fill: var(--cyan-bright); filter: drop-shadow(0 0 6px rgba(69,224,255,0.9)); }

/* Hub ping */
@keyframes ping {
  0% { r: 3; opacity: 0.9; }
  100% { r: 16; opacity: 0; }
}
.wm-ping { animation: ping 2.6s var(--ease-out) infinite; }

/* Title reveal (mask wipe) */
.reveal-line { display: block; overflow: hidden; }
.reveal-line > span { display: block; transform: translateY(110%); transition: transform var(--t-slow) var(--ease-out); }
.is-loaded .reveal-line > span { transform: translateY(0); }
.is-loaded .reveal-line:nth-child(2) > span { transition-delay: 0.09s; }
.is-loaded .reveal-line:nth-child(3) > span { transition-delay: 0.18s; }

/* Gradient sheen sweep for section titles */
@keyframes sheen { to { background-position: 200% center; } }
.sheen { background-size: 200% auto; animation: sheen 6s linear infinite; }

/* Number ticking flip helper */
.counting { font-variant-numeric: tabular-nums; }

/* Border conic rotation (premium card accent) */
@keyframes spinConic { to { transform: rotate(360deg); } }
.conic-accent { position: relative; }
.conic-accent::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; z-index: -1;
  background: conic-gradient(from 0deg, transparent 0 70%, rgba(18,198,233,0.8) 85%, transparent 100%);
  animation: spinConic 5s linear infinite; opacity: 0; transition: opacity var(--t-med);
}
.conic-accent:hover::after { opacity: 1; }

/* Page-transition overlay (View-Transitions fallback) */
.page-veil { position: fixed; inset: 0; z-index: 950; background: var(--abyss); transform: scaleY(0); transform-origin: bottom; pointer-events: none; }
.page-veil.in { transform: scaleY(1); transform-origin: bottom; transition: transform var(--t-med) var(--ease-io); }
.page-veil.out { transform: scaleY(0); transform-origin: top; transition: transform var(--t-med) var(--ease-io); }

/* View Transitions API */
@supports (view-transition-name: none) {
  ::view-transition-old(root) { animation: vtOut 320ms var(--ease-io) both; }
  ::view-transition-new(root) { animation: vtIn 420ms var(--ease-out) both; }
}
@keyframes vtOut { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(12px); } }

/* --- Reduced motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal], [data-stagger] > * { opacity: 1 !important; transform: none !important; }
  .reveal-line > span { transform: none !important; }
  .cursor-dot, .cursor-ring { display: none !important; }
}
