/* Scroll animations: key-figure counters and the deployment-process timeline.
   Hidden "before" states only exist once motion.js adds .anim-ready, and never for reduced-motion users. */

@media (prefers-reduced-motion: no-preference) {
  /* ---- key figures ---- */
  .anim-ready .stat { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
  .anim-ready .stat:nth-child(2) { transition-delay: .15s; }
  .anim-ready .stat:nth-child(3) { transition-delay: .3s; }
  .anim-ready .stat.is-in { opacity: 1; transform: none; }
  [data-count] { font-variant-numeric: tabular-nums lining-nums; }

  /* ---- process timeline ---- */
  .proc-fill { position: absolute; background: #D4AF37; pointer-events: none; display: none; }
  .anim-ready .proc-fill { display: block; transition: transform 2.4s linear; }
  /* desktop: horizontal line growing left to right */
  .proc-fill-h { left: 0; right: 0; top: 0; height: 1px; transform-origin: left center; transform: scaleX(0); }
  .proc-fill-v { display: none !important; }
  .proc-steps.is-in .proc-fill-h { transform: scaleX(1); }
  /* mobile: vertical line growing top to bottom */
  @media (max-width: 767px) {
    .proc-fill-h { display: none !important; }
    .anim-ready .proc-fill-v { display: block !important; left: 19px; top: .5rem; width: 1px; height: calc(100% - 1rem); transform-origin: center top; transform: scaleY(0); }
    .proc-steps.is-in .proc-fill-v { transform: scaleY(1); }
  }

  .anim-ready .proc-step { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
  .proc-steps.is-in .proc-step { opacity: 1; transform: none; }
  .proc-step:nth-of-type(1) { --d: .3s; }
  .proc-step:nth-of-type(2) { --d: .9s; }
  .proc-step:nth-of-type(3) { --d: 1.5s; }
  .proc-step:nth-of-type(4) { --d: 2.1s; }
  .anim-ready .proc-step { transition-delay: var(--d); }

  /* numbered circles pop in as the line reaches them (uses `scale`, so Tailwind's translate is untouched) */
  .anim-ready .proc-step > span:first-child { opacity: 0; }
  .proc-steps.is-in .proc-step > span:first-child { animation: proc-pop .6s cubic-bezier(.2, .9, .3, 1.3) var(--d) both; }
  /* final step keeps a soft gold pulse a couple of times once the line has arrived */
  .proc-steps.is-in .proc-step:nth-of-type(4) > span:first-child { animation: proc-pop .6s cubic-bezier(.2, .9, .3, 1.3) var(--d) both, proc-pulse 1.8s ease-out calc(var(--d) + .7s) 2; }

  @keyframes proc-pop { 0% { opacity: 0; scale: .4; } 100% { opacity: 1; scale: 1; } }
  @keyframes proc-pulse { 0% { box-shadow: 0 0 0 0 rgba(212, 175, 55, .55); } 100% { box-shadow: 0 0 0 16px rgba(212, 175, 55, 0); } }
}
