/**
 * Site-wide motion: AOS's settings in CSS terms, and the card hover lift.
 *
 * The reveal itself is bloom-core's AOS — inc/motion.php decides what animates and puts bloom's own
 * `kadenceAnimation` attribute on it; the library does the rest, and switches itself off under
 * prefers-reduced-motion (assets/vendor/aos/aos.js inits with `disable` set from the media query, which
 * strips every data-aos attribute). What is left here is the two things AOS cannot tell us: how far the rise
 * should travel, and how the cards behave under a pointer.
 *
 * Not in add_editor_style(): these selectors match wrappers that exist in the editor canvas too.
 */

:root {
	--fm-rise: 24px;
	--fm-ease: cubic-bezier(0.2, 0.7, 0.3, 1);
	--fm-lift: -3px;
	--fm-hover: 180ms;
}

/* AOS ships fade-up at 100px, which is far too much travel for a page of clinical copy. */
[data-aos="fade-up"] {
	transform: translate3d(0, var(--fm-rise), 0);
}

/* Safety net. aos.css hides every [data-aos^=fade] the moment it loads, with no scripting guard, and aos.js
 * only arrives in the footer — so anything that stops the library running leaves the page blank rather than
 * un-animated. functions.php prints a one-line script in <head> that adds this class straight away and takes
 * it back off if AOS never turned up, so content is visible with JavaScript off, blocked or broken. */
html:not(.freesia-aos) [data-aos] {
	opacity: 1 !important;
	transform: none !important;
}

/* ------------------------------------------------------------------
 * Hover lift for the card families that only deepen their shadow on their own. Pointer devices only, and
 * `transform` so it composes with AOS's `translate3d` rather than being overridden by it.
 * ---------------------------------------------------------------- */
@media (hover: hover) {
	.freesia-home-cond, .freesia-home-prog, .freesia-home-dev, .freesia-home-step,
	.freesia-condition-cause, .freesia-condition-tip,
	.freesia-articles-latest__card, .freesia-contact-channel,
	.freesia-landing-card, .freesia-landing-doctor, .freesia-program-card,
	.wp-block-bloom-post-grid .pg-card, .bloom-loop-card {
		transition: transform var(--fm-hover) var(--fm-ease), box-shadow var(--fm-hover) var(--fm-ease);
	}

	@media (prefers-reduced-motion: no-preference) {
		:is(
			.freesia-home-cond, .freesia-home-prog, .freesia-home-dev, .freesia-home-step,
			.freesia-condition-cause, .freesia-condition-tip,
			.freesia-articles-latest__card, .freesia-contact-channel,
			.freesia-landing-card, .freesia-landing-doctor, .freesia-program-card,
			.wp-block-bloom-post-grid .pg-card, .bloom-loop-card
		):hover {
			/* Only once AOS has finished with the element, so the lift never fights the arrival. */
			transform: translateY(var(--fm-lift));
		}
		:is(
			.freesia-home-cond, .freesia-home-prog, .freesia-home-dev, .freesia-home-step,
			.freesia-condition-cause, .freesia-condition-tip,
			.freesia-articles-latest__card, .freesia-contact-channel,
			.freesia-landing-card, .freesia-landing-doctor, .freesia-program-card,
			.wp-block-bloom-post-grid .pg-card, .bloom-loop-card
		)[data-aos]:not(.aos-animate):hover {
			transform: none;
		}
	}
}

@media (prefers-reduced-motion: reduce) {
	.freesia-home-cond, .freesia-home-prog, .freesia-home-dev, .freesia-home-step,
	.freesia-condition-cause, .freesia-condition-tip,
	.freesia-articles-latest__card, .freesia-contact-channel,
	.freesia-landing-card, .freesia-landing-doctor, .freesia-program-card,
	.wp-block-bloom-post-grid .pg-card, .bloom-loop-card {
		transition: none !important;
	}
}
