/* ==========================================================================
   Cortx — motion. The X mark can spin in four ways; pages opt in via class:
     .spin            continuous, slow rotation (hero marks)
     .spin-fast       continuous, quicker
     .spin-once       one full turn on load, then spins again on hover
     .spin-hover      turns on hover / focus
     [data-scroll-spin]  rotation follows page scroll (driven by main.js)
   All motion is switched off for prefers-reduced-motion.
   ========================================================================== */

.mark-spin { transform-origin: 50% 50%; will-change: transform; }

.spin      { animation: cortx-spin 24s linear infinite; }
.spin-fast { animation: cortx-spin 9s linear infinite; }
.spin-once { animation: cortx-spin-once 1.6s cubic-bezier(.2,.8,.2,1) 0.2s 1 both; }
.spin-hover { transition: transform 0.9s cubic-bezier(.3,.7,.2,1); }
.spin-hover:hover, .spin-once:hover { transform: rotate(360deg); transition: transform 0.9s cubic-bezier(.3,.7,.2,1); }

@keyframes cortx-spin { to { transform: rotate(360deg); } }
@keyframes cortx-spin-once { from { transform: rotate(-360deg) scale(0.8); opacity: 0; } to { transform: none; opacity: 1; } }

/* Counter-rotate to keep a child upright inside a spinning parent */
.spin-reverse { animation: cortx-spin 24s linear infinite reverse; }

/* Hero visual: orbit rings behind the mark */
.orbit { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.orbit circle { fill: none; stroke: var(--cortx-sky); stroke-width: 0.5; opacity: 0.35; }
.orbit circle.dash { stroke-dasharray: 2 4; animation: cortx-spin 60s linear infinite reverse; transform-origin: 50% 50%; }

/* Node pulse (agents page) */
.pulse-nodes circle.node { animation: node-pulse 2.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.pulse-nodes circle.node:nth-of-type(2) { animation-delay: .35s; }
.pulse-nodes circle.node:nth-of-type(3) { animation-delay: .7s; }
.pulse-nodes circle.node:nth-of-type(4) { animation-delay: 1.05s; }
@keyframes node-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .spin, .spin-fast, .spin-once, .spin-reverse, .orbit circle.dash, .pulse-nodes circle.node { animation: none !important; }
  .brand:hover .mark, .spin-hover:hover, .spin-once:hover { transform: none !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
