/*
  Motion system v2.
  CSS owns every visual state. JS only toggles two classes:
    .motion-hidden   -> pre-reveal state (set on html before paint, scoped list below)
    .is-revealed      -> per-element final state, added once and never removed

  No inline style ever has to survive for the final look to hold — the
  cascade below is the single source of truth, so there is nothing for a
  stray clearProps / mid-animation reset to un-defeat.
*/

html.motion-enhanced .section-head,
html.motion-enhanced .protocol__item,
html.motion-enhanced .feature,
html.motion-enhanced .module,
html.motion-enhanced .well-card,
html.motion-enhanced .exp-cell,
html.motion-enhanced .risk,
html.motion-enhanced .fund__tier,
html.motion-enhanced .budget__chip,
html.motion-enhanced .tl__row,
html.motion-enhanced .founder__manifesto,
html.motion-enhanced .founder__notes,
html.motion-enhanced .ks__media,
html.motion-enhanced .ks__stats,
html.motion-enhanced .ks__tiers-wrap,
html.motion-enhanced .cave__spec .cell {
  opacity: 0;
  filter: blur(6px);
  transform: translate3d(0, 24px, 0);
  will-change: opacity, transform, filter;
}

/* Final state wins by specificity + source order, independent of inline styles. */
html.motion-enhanced .section-head.is-revealed,
html.motion-enhanced .protocol__item.is-revealed,
html.motion-enhanced .feature.is-revealed,
html.motion-enhanced .module.is-revealed,
html.motion-enhanced .well-card.is-revealed,
html.motion-enhanced .exp-cell.is-revealed,
html.motion-enhanced .risk.is-revealed,
html.motion-enhanced .fund__tier.is-revealed,
html.motion-enhanced .budget__chip.is-revealed,
html.motion-enhanced .tl__row.is-revealed,
html.motion-enhanced .founder__manifesto.is-revealed,
html.motion-enhanced .founder__notes.is-revealed,
html.motion-enhanced .ks__media.is-revealed,
html.motion-enhanced .ks__stats.is-revealed,
html.motion-enhanced .ks__tiers-wrap.is-revealed,
html.motion-enhanced .cave__spec .cell.is-revealed {
  opacity: 1;
  filter: none;
  transform: none;
  will-change: auto;
}

html.motion-enhanced .hero .eyebrow,
html.motion-enhanced .hero__title,
html.motion-enhanced .hero__sub,
html.motion-enhanced .hero__ctas,
html.motion-enhanced .hero__meta {
  opacity: 0;
  transform: translate3d(0, 16px, 0);
}

html.motion-enhanced .hero .eyebrow.is-revealed,
html.motion-enhanced .hero__title.is-revealed,
html.motion-enhanced .hero__sub.is-revealed,
html.motion-enhanced .hero__ctas.is-revealed,
html.motion-enhanced .hero__meta.is-revealed {
  opacity: 1;
  transform: none;
}

/*
  Hard fallback: if GSAP/ScrollTrigger fail to load or error out, motion.js
  adds .motion-failed to <html> and every hidden state above is neutralized
  immediately — content is never left invisible because of a CDN or script
  failure.
*/
html.motion-failed .section-head,
html.motion-failed .protocol__item,
html.motion-failed .feature,
html.motion-failed .module,
html.motion-failed .well-card,
html.motion-failed .exp-cell,
html.motion-failed .risk,
html.motion-failed .fund__tier,
html.motion-failed .budget__chip,
html.motion-failed .tl__row,
html.motion-failed .founder__manifesto,
html.motion-failed .founder__notes,
html.motion-failed .ks__media,
html.motion-failed .ks__stats,
html.motion-failed .ks__tiers-wrap,
html.motion-failed .cave__spec .cell,
html.motion-failed .hero .eyebrow,
html.motion-failed .hero__title,
html.motion-failed .hero__sub,
html.motion-failed .hero__ctas,
html.motion-failed .hero__meta {
  opacity: 1 !important;
  filter: none !important;
  transform: none !important;
  will-change: auto !important;
}

@media (max-width: 640px) {
  html.motion-enhanced .section-head,
  html.motion-enhanced .protocol__item,
  html.motion-enhanced .feature,
  html.motion-enhanced .module,
  html.motion-enhanced .well-card,
  html.motion-enhanced .exp-cell,
  html.motion-enhanced .risk,
  html.motion-enhanced .fund__tier,
  html.motion-enhanced .budget__chip,
  html.motion-enhanced .tl__row,
  html.motion-enhanced .founder__manifesto,
  html.motion-enhanced .founder__notes,
  html.motion-enhanced .ks__media,
  html.motion-enhanced .ks__stats,
  html.motion-enhanced .ks__tiers-wrap,
  html.motion-enhanced .cave__spec .cell {
    filter: blur(4px);
    transform: translate3d(0, 16px, 0);
  }
}

/*
  Belt-and-suspenders: the bootstrap script in <head> only ever adds
  .motion-enhanced when prefers-reduced-motion does NOT match, so the block
  above should never be reachable for reduced-motion users. This query is
  kept as a hard backstop in case that check is ever changed independently.
*/
@media (prefers-reduced-motion: reduce) {
  html.motion-enhanced .section-head,
  html.motion-enhanced .protocol__item,
  html.motion-enhanced .feature,
  html.motion-enhanced .module,
  html.motion-enhanced .well-card,
  html.motion-enhanced .exp-cell,
  html.motion-enhanced .risk,
  html.motion-enhanced .fund__tier,
  html.motion-enhanced .budget__chip,
  html.motion-enhanced .tl__row,
  html.motion-enhanced .founder__manifesto,
  html.motion-enhanced .founder__notes,
  html.motion-enhanced .ks__media,
  html.motion-enhanced .ks__stats,
  html.motion-enhanced .ks__tiers-wrap,
  html.motion-enhanced .cave__spec .cell,
  html.motion-enhanced .hero .eyebrow,
  html.motion-enhanced .hero__title,
  html.motion-enhanced .hero__sub,
  html.motion-enhanced .hero__ctas,
  html.motion-enhanced .hero__meta {
    opacity: 1;
    filter: none;
    transform: none;
    will-change: auto;
  }
}
