/* ==========================================================================
   HLXperts High-Performance Motion & Animation Stylesheet
   Caliber: Linear / Stripe / Vercel (60-120fps GPU Accelerated)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. High-Performance Keyframe Animations (GPU transform3d & opacity only)
   -------------------------------------------------------------------------- */
@keyframes pulseRing {
  0% {
    transform: scale3d(0.95, 0.95, 1);
    opacity: 0.8;
  }

  50% {
    transform: scale3d(1.7, 1.7, 1);
    opacity: 0;
  }

  100% {
    transform: scale3d(1.7, 1.7, 1);
    opacity: 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate3d(0, 10px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translate3d(0, -10px, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* Bars now share a single base height (see .voice-bar in components.css,
   set to 56px, the tallest peak below) and animate transform: scaleY()
   instead of height. Ratios are each bar's original px value divided by
   56px. Visually near-identical; animating scale is compositor-only,
   animating height forces layout on every frame across all 10 bars. */
@keyframes waveformPulse1 {

  0%,
  100% {
    transform: scaleY(0.214);
  }

  50% {
    transform: scaleY(0.857);
  }
}

@keyframes waveformPulse2 {

  0%,
  100% {
    transform: scaleY(0.5);
  }

  50% {
    transform: scaleY(0.25);
  }
}

@keyframes waveformPulse3 {

  0%,
  100% {
    transform: scaleY(0.321);
  }

  50% {
    transform: scaleY(1);
  }
}

@keyframes waveformPulse4 {

  0%,
  100% {
    transform: scaleY(0.75);
  }

  50% {
    transform: scaleY(0.286);
  }
}

@keyframes typingDot {

  0%,
  60%,
  100% {
    transform: translate3d(0, 0, 0);
    opacity: 0.35;
  }

  30% {
    transform: translate3d(0, -5px, 0);
    opacity: 1;
  }
}

@keyframes flowParticle {

  /* 18px = the connector line's fixed 24px height minus the 6px dot
     (see .workflow-connector-line in components.css). If that height
     ever changes, update this value too, it's no longer relative since
     transform percentages resolve against the dot's own size, not the
     line's. */
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 0;
  }

  15% {
    opacity: 1;
  }

  85% {
    opacity: 1;
  }

  100% {
    transform: translate3d(0, 18px, 0);
    opacity: 0;
  }
}

@keyframes ambientGlowOrb {

  0%,
  100% {
    transform: translate3d(0, 0, 0);
    opacity: 0.3;
  }

  50% {
    transform: translate3d(30px, -25px, 0);
    opacity: 0.55;
  }
}

@keyframes beamRotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes marqueeScroll {
  0% {
    transform: translate3d(0, 0, 0);
  }

  100% {
    transform: translate3d(calc(-100% - 16px), 0, 0);
  }
}

@keyframes buttonGlowSweep {

  /* Same visual sweep as before, driven by transform instead of left so
     it composites on the GPU instead of reflowing every frame. Percentages
     here are relative to the pseudo-element's own width, not the button's,
     so nudge -220%/220% if you want the sweep faster/slower to cross. */
  0% {
    transform: translate3d(-220%, 0, 0) rotate(25deg);
  }

  40%,
  100% {
    transform: translate3d(220%, 0, 0) rotate(25deg);
  }
}

@keyframes badgeFloat {

  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  50% {
    transform: translate3d(0, -5px, 0);
  }
}

@keyframes radarPing {
  0% {
    transform: scale3d(1, 1, 1);
    opacity: 0.8;
  }

  100% {
    transform: scale3d(2.4, 2.4, 1);
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   2. Interactive & Section Motion Enhancements
   -------------------------------------------------------------------------- */

/* Button Light Sweep */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: -50%;
  left: 0;
  width: 50%;
  height: 200%;
  background: linear-gradient(90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.4) 50%,
      transparent 100%);
  animation: buttonGlowSweep 3.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  pointer-events: none;
  will-change: transform;
}

/* Border Beam Effect (Hardware accelerated) */
.border-beam-container {
  position: relative;
}

.border-beam-container::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  /* Conic gradient rotated via transform instead of a linear gradient
     slid via background-position. Same rotating-beam look, but rotate()
     is compositor-only while background-position forces a repaint. */
  background: conic-gradient(from 0deg, transparent 0%, var(--brand-green) 12%, transparent 24%);
  animation: beamRotate 4s linear infinite;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  will-change: transform;
  z-index: 1;
}

/* One-Line Seamless Infinite Marquee */
.marquee-container {
  overflow: hidden;
  position: relative;
  width: 100%;
  display: flex;
  user-select: none;
  gap: 16px;
  mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
}

.marquee-content {
  display: flex;
  flex-shrink: 0;
  flex-wrap: nowrap;
  align-items: center;
  gap: 16px;
  animation: marqueeScroll 28s linear infinite;
  will-change: transform;
}

.marquee-container:hover .marquee-content {
  animation-play-state: paused;
}

/* Levitating Badge Animation */
.floating-badge {
  animation: badgeFloat 4s ease-in-out infinite;
}

/* Radar Ping on Active Step */
.radar-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-amber);
}

.radar-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent-amber);
  animation: radarPing 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* Ambient Glow Orbs - High Performance Gradients without expensive blur filter */
.ambient-glow-orb {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(152, 202, 58, 0.14) 0%, rgba(152, 202, 58, 0.05) 40%, rgba(152, 202, 58, 0) 70%);
  pointer-events: none;
  z-index: 0;
  animation: ambientGlowOrb 14s ease-in-out infinite;
  transform: translateZ(0);
}

.ambient-glow-orb.top-right {
  top: -120px;
  right: -120px;
}

.ambient-glow-orb.center-left {
  top: 45%;
  left: -220px;
  animation-delay: -7s;
}

.ambient-glow-orb.bottom-center {
  bottom: -150px;
  left: 35%;
  animation-delay: -3.5s;
}

/* --------------------------------------------------------------------------
   3. Fast & Seamless Scroll Reveal Transitions (0.35s snappy GPU transform)
   -------------------------------------------------------------------------- */
.reveal-on-scroll {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition: opacity 0.35s ease-out,
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  /* Release the compositor layer once the reveal is done. Leaving
     will-change on indefinitely keeps every revealed element promoted
     to its own GPU layer for the rest of the page's life, which is the
     single biggest cost on a page with this many animated elements. */
  will-change: auto;
}

/* Stagger Delays for Grid Children */
.stagger-1 {
  transition-delay: 30ms;
}

.stagger-2 {
  transition-delay: 60ms;
}

.stagger-3 {
  transition-delay: 90ms;
}

.stagger-4 {
  transition-delay: 120ms;
}

.stagger-5 {
  transition-delay: 150ms;
}

.stagger-6 {
  transition-delay: 180ms;
}

.stagger-7 {
  transition-delay: 210ms;
}

.stagger-8 {
  transition-delay: 240ms;
}

/* --------------------------------------------------------------------------
   3.5 Offscreen Animation Pause
   .anim-offscreen is toggled by an IntersectionObserver in app.js on each
   section and on the standalone decorative elements (ambient orbs, header
   status dot) that live outside any section. Stops the ~30 infinite
   animations (voice bars, pulse rings, border beams, button sweeps, flow
   particles) from compositing on every frame while nothing is looking at
   them, without touching their visible-in-view behavior at all.
   -------------------------------------------------------------------------- */
section.anim-offscreen .voice-bar,
section.anim-offscreen .marquee-content {
  animation-play-state: paused;
}

section.anim-offscreen .live-pulse-dot::after,
section.anim-offscreen .btn-primary::after,
section.anim-offscreen .border-beam-container::after,
section.anim-offscreen .workflow-connector-line::after {
  animation-play-state: paused;
}

.ambient-glow-orb.anim-offscreen {
  animation-play-state: paused;
}

.live-pulse-dot.anim-offscreen::after {
  animation-play-state: paused;
}

/* --------------------------------------------------------------------------
   4. Reduced Motion Fallback
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {

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

  .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
  }

  .ambient-glow-orb,
  .btn-primary::after,
  .border-beam-container::after,
  .floating-badge {
    animation: none !important;
    opacity: 0.2 !important;
  }

  .marquee-content {
    animation: none !important;
    flex-wrap: wrap;
    justify-content: center;
  }

  .workflow-connector-line::after,
  .voice-bar,
  .chat-typing-indicator span {
    animation: none !important;
  }
}