/*
 * FG Motion — gated initial states for the site-wide GSAP engine (fg-motion.js).
 *
 * Anti-FOUC only: hides opt-in targets BEFORE the engine runs, exclusively under
 * `html.fg-anim` (set pre-paint, and only when motion is allowed) AND
 * prefers-reduced-motion: no-preference. The engine then drives the reveal with
 * inline GSAP styles, which win over these rules.
 *
 * Transforms are owned by GSAP (fromTo / set), so CSS only zeroes OPACITY here —
 * there is no CSS transform or transition to fight the tween, and nothing leaves a
 * permanent `will-change` behind (GSAP's transforms composite on their own).
 *
 * Fail-safe: if the engine can't run it adds `html.fg-motion-static`, forcing every
 * target visible. No-JS and reduced-motion visitors never receive `.fg-anim`, so
 * they are unaffected and always see static, fully visible content.
 */

@media (prefers-reduced-motion: no-preference) {

	/* Singles only — a group/intro CONTAINER carries the preset for its children
	   and must never be hidden itself (its children are hidden below instead). */
	html.fg-anim [data-animate]:not([data-animate-group]):not([data-intro]),
	html.fg-anim [data-animate-group] > *:not([data-animate-skip]),
	html.fg-anim [data-intro] [data-animate] {
		opacity: 0;
	}

	/* Engine bailed (no GSAP / threw) → reveal everything, overriding the above. */
	html.fg-anim.fg-motion-static [data-animate],
	html.fg-anim.fg-motion-static [data-animate-group] > *,
	html.fg-anim.fg-motion-static [data-intro] [data-animate] {
		opacity: 1 !important;
		visibility: visible !important;
		transform: none !important;
		clip-path: none !important;
	}
}

/* Belt-and-suspenders: reduced-motion visitors are never hidden, gate or not. */
@media (prefers-reduced-motion: reduce) {

	[data-animate],
	[data-animate-group] > *,
	[data-intro] [data-animate] {
		opacity: 1 !important;
		transform: none !important;
		clip-path: none !important;
	}

	[data-parallax] {
		transform: none !important;
	}
}
