/*
 * Motion — the live site's Elementor/Convex animations, 1:1 by name (see docs/BUILD-CONTRACT.md → Motion API).
 * Durations as live actually renders them (Convex's __plugins.css overrides Elementor's): normal .75s, slow 1s,
 * fast .5s; "slower" 2s for the big faded word-art titles (.big-title.animated-slow on live). Elements wait
 * invisible until in view (Elementor's .elementor-invisible), then play once.
 */

.js [data-sg-anim]:not(.is-in),
.js [data-sg-stagger] > :not(ul):not(.is-in),
.js [data-sg-stagger] > ul > li:not(.is-in) { visibility: hidden; }

.is-in[data-sg-anim], [data-sg-stagger] .is-in {
	animation-duration: .75s;
	animation-fill-mode: both;
	animation-timing-function: ease;
}
.is-in[data-sg-speed="slow"]   { animation-duration: 1s; }
.is-in[data-sg-speed="fast"]   { animation-duration: .5s; }
.is-in[data-sg-speed="slower"] { animation-duration: 2s; }

.is-in[data-sg-anim="fadeIn"]           { animation-name: fadeIn; }
.is-in[data-sg-anim="fadeInUp"]         { animation-name: fadeInUp; }
.is-in[data-sg-anim="fadeInDown"]       { animation-name: fadeInDown; }
.is-in[data-sg-anim="fadeInLeft"]       { animation-name: fadeInLeft; }
.is-in[data-sg-anim="fadeInRight"]      { animation-name: fadeInRight; }
.is-in[data-sg-anim="zoomIn"]           { animation-name: zoomIn; }
/* Convex's own family: 60px moves (convex-fadein = opacity only). */
.is-in[data-sg-anim="convexFadeIn"]      { animation-name: convexFadeIn; }
.is-in[data-sg-anim="convexFadeInUp"]    { animation-name: convexFadeInUp; }
.is-in[data-sg-anim="convexFadeInDown"]  { animation-name: convexFadeInDown; }
.is-in[data-sg-anim="convexFadeInLeft"]  { animation-name: convexFadeInLeft; }
.is-in[data-sg-anim="convexFadeInRight"] { animation-name: convexFadeInRight; }
[data-sg-stagger="sequential"][data-sg-anim="fadeInDown"] .is-in { animation-name: fadeInDown; }
[data-sg-stagger="sequential"][data-sg-anim="fadeInUp"] .is-in   { animation-name: fadeInUp; }
[data-sg-stagger="sequential"][data-sg-anim="fadeIn"] .is-in     { animation-name: fadeIn; }

/* The stagger container itself is never hidden or animated; its items are. */
.js [data-sg-stagger][data-sg-anim] { visibility: visible; animation: none; }

@keyframes fadeIn       { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp     { from { opacity: 0; transform: translate3d(0, 100%, 0); } to { opacity: 1; transform: none; } }
@keyframes fadeInDown   { from { opacity: 0; transform: translate3d(0, -100%, 0); } to { opacity: 1; transform: none; } }
@keyframes fadeInLeft   { from { opacity: 0; transform: translate3d(-100%, 0, 0); } to { opacity: 1; transform: none; } }
@keyframes fadeInRight  { from { opacity: 0; transform: translate3d(100%, 0, 0); } to { opacity: 1; transform: none; } }
@keyframes zoomIn       { from { opacity: 0; transform: scale3d(.3, .3, .3); } 50% { opacity: 1; } }
@keyframes convexFadeIn      { from { opacity: 0; } to { opacity: 1; } }
@keyframes convexFadeInUp    { from { opacity: 0; transform: translateY(60px); } to { opacity: 1; transform: translateY(0); } }
@keyframes convexFadeInDown  { from { opacity: 0; transform: translateY(-60px); } to { opacity: 1; transform: translateY(0); } }
@keyframes convexFadeInLeft  { from { opacity: 0; transform: translateX(-60px); } to { opacity: 1; transform: translateX(0); } }
@keyframes convexFadeInRight { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }

/* Letter-by-letter headings (live: every Elementor heading; 1s fadeInUp per letter, 0.05s apart). */
.sg-letters__word { display: inline-block; margin-right: .1em; }
.sg-letters__char { display: inline-block; opacity: 0; transform: translateY(20px); }
.is-in .sg-letters__char { animation: fadeInUp 1s forwards; }

/* Scroll effects are driven by JS (transform/opacity inline); hint the compositor. */
[data-sg-fx] { will-change: transform, opacity; }

@media (prefers-reduced-motion: reduce) {
	.js [data-sg-anim]:not(.is-in), .js [data-sg-stagger] > *, .js [data-sg-stagger] > ul > li { visibility: visible; }
	.sg-letters__char { opacity: 1; transform: none; }
	[data-sg-fx] { transform: none !important; opacity: 1 !important; }
}
