/* ==========================================================================
   Motion layer - scroll reveals, counters, typewriter, parallax.
   Everything here is additive: with JS off, or with reduced motion on,
   the page renders exactly as it did before.
   ========================================================================== */

/* ---------- scroll reveal ---------- */
.js-motion [data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  will-change: opacity, transform;
  transition:
    opacity .62s cubic-bezier(.22, .68, .32, 1) var(--d, 0ms),
    transform .62s cubic-bezier(.22, .68, .32, 1) var(--d, 0ms);
}
.js-motion [data-reveal].is-in { opacity: 1; transform: none; }

/* a few elements read better arriving from the side */
.js-motion [data-reveal="left"]  { transform: translateX(-26px); }
.js-motion [data-reveal="right"] { transform: translateX(26px); }
.js-motion [data-reveal="scale"] { transform: scale(.965); }
.js-motion [data-reveal].is-in   { transform: none; }

/* ---------- hero ---------- */
.js-motion .hero__content > * {
  opacity: 0; transform: translateY(16px);
  animation: heroIn .7s cubic-bezier(.22,.68,.32,1) forwards;
  animation-delay: calc(120ms + var(--i, 0) * 90ms);
}
@keyframes heroIn { to { opacity: 1; transform: none; } }

/* `transform` already holds the fan's offset and rotation, so the float
   rides on the independent `translate` property instead of fighting it. */
.js-motion .xv-card {
  opacity: 0;
  animation:
    cardIn .9s cubic-bezier(.19,.9,.3,1) var(--ad, 0s) forwards,
    float 7s ease-in-out var(--fd, 0s) infinite;
}
.js-motion .xv-card--back  { --ad: .52s; --fd: 1.3s; }
.js-motion .xv-card--mid   { --ad: .38s; --fd: 0s; }
.js-motion .xv-card--front { --ad: .66s; --fd: 2.1s; }
@keyframes cardIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -9px; }
}

.js-motion .hero__glow { animation: drift 26s ease-in-out infinite alternate; }
@keyframes drift {
  from { transform: translate3d(0,0,0) scale(1); }
  to   { transform: translate3d(3%, 2%, 0) scale(1.08); }
}

.js-motion .hero__strip { opacity: 0; animation: heroIn .8s ease forwards .9s; }

/* ---------- typewriter ---------- */
.tw-c { visibility: hidden; }
.tw-c.on { visibility: visible; }
.tw-caret {
  display: inline-block;
  width: .055em; height: .78em;
  background: var(--gold);
  vertical-align: -.06em;
  margin-left: .045em;
  border-radius: 1px;
  animation: caret 1.05s steps(1) infinite;
}
@keyframes caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.tw-caret.is-done { animation: caretOut .5s ease forwards 1.4s; }
@keyframes caretOut { to { opacity: 0; width: 0; margin-left: 0; } }

/* ---------- navbar condenses once you leave the hero ---------- */
.navbar { transition: padding .3s ease, box-shadow .3s ease, background .3s ease; }
.navbar.is-stuck { box-shadow: 0 10px 30px rgba(6,20,14,.28); }
.navbar.is-stuck .navbar__inner { padding-block: 9px; }
.navbar__inner { transition: padding .3s ease; }

/* ---------- ghost numerals drift against the scroll ---------- */
.js-motion .section__ghost { will-change: transform; }

/* ---------- metric bars grow in ---------- */
.js-motion .bar__fill {
  width: 0 !important;
  transition: width .95s cubic-bezier(.22,.68,.32,1) var(--d, 0ms);
}
.js-motion .bar__fill.is-grown { width: var(--w) !important; }

/* ---------- radar draws itself ---------- */
.js-motion .radar__area {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(.82);
  transition: opacity .7s ease var(--d, 0ms), transform .7s cubic-bezier(.22,.68,.32,1) var(--d, 0ms);
}
.js-motion .radar.is-in .radar__area { opacity: 1; transform: none; }

/* ---------- cards lift under the pointer ---------- */
@media (hover: hover) and (pointer: fine) {
  .plan, .feature, .proof__card, .stat-panel, .eco__col, .quote {
    transition: transform .3s cubic-bezier(.22,.68,.32,1), box-shadow .3s ease, border-color .2s ease;
  }
  .plan:hover, .proof__card:hover, .stat-panel:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 44px -24px rgba(6,58,46,.5);
  }
  .quote:hover { transform: translateY(-3px); }
  .eco__col:hover { transform: translateY(-3px); }
  .dir { transition: transform .25s ease, background .25s ease; }
  .dir:hover { transform: translateY(-3px); background: rgba(255,255,255,.14); }
  .club { transition: transform .2s ease, border-color .2s ease; }
  .club:hover { transform: translateY(-2px); border-color: var(--green); }
  .marquee img { transition: transform .3s ease, filter .3s ease; }
  .marquee img:hover { transform: scale(1.14); filter: saturate(1.2); }
  .social a { transition: transform .25s ease, background .18s ease, color .18s ease; }
  .social a:hover { transform: translateY(-3px); }
}

/* ---------- table rows ---------- */
.cmp tbody tr { transition: background .18s ease; }

/* ---------- anyone who asked for calm gets the static page ---------- */
@media (prefers-reduced-motion: reduce) {
  .js-motion [data-reveal],
  .js-motion .hero__content > *,
  .js-motion .xv-card,
  .js-motion .hero__strip { opacity: 1 !important; transform: none !important; animation: none !important; }
  .js-motion .hero__glow { animation: none !important; }
  .js-motion .xv-card { translate: none !important; }
  .js-motion .bar__fill { width: var(--w) !important; transition: none !important; }
  .js-motion .radar__area { opacity: 1 !important; transform: none !important; }
  .tw-c { visibility: visible !important; }
  .tw-caret { display: none; }
}
