/**
 * Teb Open — Motion design system (v1.5.0).
 *
 * Progressive-enhancement contract:
 * - Initial hidden states apply ONLY under `html.to-motion-boot`, a class
 *   added by an inline head snippet that ships on motion-enabled pages and
 *   removes itself after 3s unless `window.__toMotionReady` flips. Content
 *   can never stay hidden with JS disabled or a failed script load.
 * - Engine A (motion.js, all pages): IntersectionObserver adds `.is-inview`.
 * - Engine B (front page only): GSAP sets inline states that win the cascade.
 * - transform/opacity only. y-axis travel only (RTL-safe).
 */

/* ---------- Entrance initial states (armed only with .to-motion-boot) ---------- */
.to-motion-boot [data-motion] {
	opacity: 0;
}

.to-motion-boot [data-motion~='fade-up'] {
	transform: translate3d(0, var(--to-motion-distance), 0);
}

.to-motion-boot [data-motion~='fade-up-s'] {
	transform: translate3d(0, var(--to-motion-distance-s), 0);
}

.to-motion-boot [data-motion~='scale-in'] {
	transform: scale(0.94);
}

/* ---------- Revealed state (Engine A) ---------- */
[data-motion].is-inview {
	opacity: 1;
	transform: none;
	transition:
		opacity var(--to-dur-in) var(--to-ease-out-soft),
		transform var(--to-dur-in) var(--to-ease-out-soft);
	transition-delay: var(--to-motion-delay, 0ms);
	will-change: transform, opacity;
}

/* Already inside the first viewport at load: keep the LCP tight. */
[data-motion].is-inview--fast {
	transition-duration: var(--to-dur);
	will-change: auto;
}

/* Elements revealed by Engine B (GSAP): the engine owns the final state. */
.to-motion-live [data-motion] {
	will-change: auto;
}

/* ---------- Product tab panel entrance (display switch restarts it) ---------- */
@keyframes to-panel-in {
	from {
		opacity: 0;
		transform: translate3d(0, 8px, 0);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

.to-product-page .woocommerce-Tabs-panel:not([hidden]) {
	animation: to-panel-in var(--to-dur) var(--to-ease-out-soft) both;
}

/* ---------- Reduced motion: everything instant, everything visible ---------- */
@media (prefers-reduced-motion: reduce) {
	.to-motion-boot [data-motion],
	.to-motion-boot [data-motion~='fade-up'],
	.to-motion-boot [data-motion~='fade-up-s'],
	.to-motion-boot [data-motion~='scale-in'] {
		opacity: 1;
		transform: none;
	}

	[data-motion].is-inview,
	[data-motion].is-inview--fast {
		transition: none;
		transition-delay: 0ms;
	}

	.to-product-page .woocommerce-Tabs-panel:not([hidden]) {
		animation: none;
	}
}

/* ---------- Spline 3D hero (v1.5.1, opt-in architecture) ----------
 * The poster is the always-available static fallback: it renders before the
 * viewer loads, covers reduced-motion / mobile / Save-Data / WebGL-missing /
 * error paths, and crossfades out only once a real scene reports ready.
 * Nothing of this is active unless the operator configures a scene URL. */
.to-spline-poster {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: inherit;
        opacity: 1;
        transition: opacity var(--to-dur-slow) var(--to-ease);
        pointer-events: none;
        z-index: 1;
}
