/* ═══════════════════════════════════════════════════════════════════
   ASTAA — motion layer
   Scroll reveals, ambient loops, and hover choreography.
   Everything here degrades to "no motion" under prefers-reduced-motion
   (see the block at the bottom).
   ═══════════════════════════════════════════════════════════════════ */

/* ───────── scroll reveal ───────── */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  filter: blur(6px);
  transition:
    opacity 0.75s var(--ease),
    transform 0.75s var(--ease),
    filter 0.75s var(--ease);
  transition-delay: var(--d, 0ms);
  will-change: opacity, transform;
}

.reveal.is-in {
  opacity: 1;
  transform: none;
  filter: none;
}

/* stagger children — --d is assigned per item in main.js */
.stagger>.reveal {
  transition-delay: var(--d, 0ms);
}

/* ───────── hero entrance ───────── */
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(22px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rise-in-sm {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.hero-copy>* {
  animation: rise-in 0.85s var(--ease) both;
}

.hero-copy>.pill {
  animation-delay: 0.05s;
}

.hero-copy>.hero-title {
  animation-delay: 0.14s;
}

.hero-copy>.hero-lede {
  animation-delay: 0.23s;
}

.hero-copy>.hero-cta {
  animation-delay: 0.32s;
}

.hero-copy>.hero-trust {
  animation-delay: 0.41s;
}

/* the entrance sits on the wrapper, not on .hero-photo itself — a filled
   animation would otherwise outrank the inline transform the tilt sets */
.hero-visual {
  animation: rise-in 1s var(--ease) 0.16s both;
}

.float-card {
  animation: rise-in-sm 0.7s var(--ease) both;
}

.float-capture {
  animation-delay: 0.55s;
}

.float-revenue {
  animation-delay: 0.7s;
}

.float-reco {
  animation-delay: 0.85s;
}

.hero-stats {
  animation: rise-in 0.9s var(--ease) 0.5s both;
}

/* ───────── ambient float ───────── */
@keyframes bob {

  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  50% {
    transform: translate3d(0, -11px, 0);
  }
}

@keyframes bob-sm {

  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  50% {
    transform: translate3d(0, -7px, 0);
  }
}

/* the bob runs on an inner wrapper-free element, so it composes with the
   entrance animation by starting only after that finishes */
.float-capture {
  animation:
    rise-in-sm 0.7s var(--ease) 0.55s both,
    bob 6.5s ease-in-out 1.3s infinite;
}

.float-revenue {
  animation:
    rise-in-sm 0.7s var(--ease) 0.7s both,
    bob-sm 5.5s ease-in-out 1.6s infinite;
}

.float-reco {
  animation:
    rise-in-sm 0.7s var(--ease) 0.85s both,
    bob-sm 7.5s ease-in-out 1.9s infinite;
}

/* ambient glow drift inside the dark section grounds */
@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33%      { transform: translate3d(2.5%, 3%, 0) scale(1.06); }
  66%      { transform: translate3d(-2.5%, -2%, 0) scale(0.96); }
}

/* ───────── live indicators ───────── */
@keyframes blink {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(214, 69, 69, 0.55);
  }

  50% {
    opacity: 0.55;
    box-shadow: 0 0 0 5px rgba(214, 69, 69, 0);
  }
}

.fc-live i {
  animation: blink 1.6s ease-in-out infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(15, 138, 95, 0.35);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(15, 138, 95, 0);
  }
}

.pill .dot {
  animation: pulse-dot 2.2s ease-in-out infinite;
}

/* plane crossing the mini route */
@keyframes fly-across {
  0% {
    left: 0;
    opacity: 0;
  }

  12% {
    opacity: 1;
  }

  88% {
    opacity: 1;
  }

  100% {
    left: 100%;
    opacity: 0;
  }
}

.fc-plane {
  animation: fly-across 4.5s var(--ease-io) infinite;
}

/* ───────── marquee ───────── */
@keyframes marquee-scroll {
  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(-50%, 0, 0);
  }
}

.marquee-track {
  animation: marquee-scroll 34s linear infinite;
}

.marquee:hover .marquee-track {
  animation-play-state: paused;
}

/* ───────── bar growth (dashboard + hero) ───────── */
@keyframes grow-y {
  from {
    transform: scaleY(0);
  }

  to {
    transform: scaleY(1);
  }
}

.fr-bars i,
.age i {
  transform-origin: 50% 100%;
  animation: grow-y 0.75s var(--ease) both;
}

.fr-bars i:nth-child(1) {
  animation-delay: 0.9s;
}

.fr-bars i:nth-child(2) {
  animation-delay: 0.97s;
}

.fr-bars i:nth-child(3) {
  animation-delay: 1.04s;
}

.fr-bars i:nth-child(4) {
  animation-delay: 1.11s;
}

.fr-bars i:nth-child(5) {
  animation-delay: 1.18s;
}

.fr-bars i:nth-child(6) {
  animation-delay: 1.25s;
}

.fr-bars i:nth-child(7) {
  animation-delay: 1.32s;
}

/* dashboard stacked bars grow when their panel becomes active */
.panel.is-active .ac-bars span::before,
.panel.is-active .ac-bars span::after {
  transform-origin: 50% 100%;
  animation: grow-y 0.7s var(--ease) both;
}

.panel.is-active .ac-bars span:nth-child(1)::before,
.panel.is-active .ac-bars span:nth-child(1)::after {
  animation-delay: 0.05s;
}

.panel.is-active .ac-bars span:nth-child(2)::before,
.panel.is-active .ac-bars span:nth-child(2)::after {
  animation-delay: 0.11s;
}

.panel.is-active .ac-bars span:nth-child(3)::before,
.panel.is-active .ac-bars span:nth-child(3)::after {
  animation-delay: 0.17s;
}

.panel.is-active .ac-bars span:nth-child(4)::before,
.panel.is-active .ac-bars span:nth-child(4)::after {
  animation-delay: 0.23s;
}

.panel.is-active .ac-bars span:nth-child(5)::before,
.panel.is-active .ac-bars span:nth-child(5)::after {
  animation-delay: 0.29s;
}

.panel.is-active .ac-bars span:nth-child(6)::before,
.panel.is-active .ac-bars span:nth-child(6)::after {
  animation-delay: 0.35s;
}

.panel.is-active .ac-bars span:nth-child(7)::before,
.panel.is-active .ac-bars span:nth-child(7)::after {
  animation-delay: 0.41s;
}

/* panel swap */
@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.window-body.is-active {
  animation: panel-in 0.42s var(--ease) both;
}

/* progress bar fill */
@keyframes fill-x {
  from {
    transform: scaleX(0);
  }

  to {
    transform: scaleX(1);
  }
}

.panel.is-active .prog i {
  transform-origin: 0 50%;
  animation: fill-x 1s var(--ease) 0.2s both;
}

/* ───────── ecosystem rings ───────── */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes ring-pulse {

  0%,
  100% {
    opacity: 0.5;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.035);
  }
}

.eco-ring.r1 {
  animation: ring-pulse 5s ease-in-out infinite;
}

.eco-ring.r2 {
  animation: spin 34s linear infinite;
}

.eco-ring.r3 {
  animation: ring-pulse 5s ease-in-out 1.4s infinite;
}

@keyframes core-glow {

  0%,
  100% {
    box-shadow: 0 22px 48px -14px rgba(10, 58, 114, 0.6);
  }

  50% {
    box-shadow: 0 22px 62px -12px rgba(21, 82, 201, 0.75);
  }
}

.eco-core-in {
  animation: core-glow 4.5s ease-in-out infinite;
}

/* ───────── misc ───────── */
@keyframes shimmer {
  from {
    background-position: -160% 0;
  }

  to {
    background-position: 260% 0;
  }
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(100deg, transparent 38%, rgba(255, 255, 255, 0.28) 50%, transparent 62%);
  background-size: 220% 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t);
}

.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary:hover::after {
  opacity: 1;
  animation: shimmer 1.05s linear;
}

/* FAB attention ping */
@keyframes ping {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }

  70%,
  100% {
    transform: scale(1.7);
    opacity: 0;
  }
}

.fab::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #25d366;
  z-index: -1;
  animation: ping 2.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* ═══════════════ 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;
  }

  .reveal {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .marquee-track {
    animation: none;
    transform: none;
  }

  .fab::before {
    display: none;
  }
}

/* ═══════════════ SECTION GROUNDS ═══════════════ */

/* the dot field over the dark grounds drifts, so a long dark stretch is
   never completely static even before anything scrolls into view */
.sec--navy::before,
.sec--blue::before,
.sec--ink::before {
  animation: drift 34s ease-in-out infinite;
}

.sec--blue::before {
  animation-duration: 41s;
  animation-direction: reverse;
}

.sec--ink::before {
  animation-duration: 29s;
  animation-delay: -6s;
}

/* a light streak travels along each chapter seam */
@keyframes seam-sweep {
  0% {
    background-position: -70% 0;
  }

  100% {
    background-position: 170% 0;
  }
}

.sec--sand::after,
.sec--mist::after,
.sec--white::after,
.sec--paper::after,
.sec--navy::after,
.sec--blue::after,
.sec--ink::after {
  background-size: 55% 100%;
  background-repeat: no-repeat;
  animation: seam-sweep 11s linear infinite;
}

.sec--mist::after {
  animation-delay: -3s;
}

.sec--blue::after {
  animation-delay: -6s;
}

.sec--ink::after {
  animation-delay: -9s;
}

/* section headings lift in a touch more decisively than the cards */
.section-head.reveal {
  transform: translateY(34px);
}

/* the numbered chapter badge pops after its eyebrow lands */
@keyframes badge-pop {
  from {
    transform: scale(0.55);
    opacity: 0;
  }

  70% {
    transform: scale(1.12);
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.reveal.is-in .eyebrow i {
  animation: badge-pop 0.5s var(--ease) 0.18s both;
}
