/* OE – GSMO Animation: Impact Flow (v2.0.0)
 * Ported from the GSMO prototypes' hero graphic (.oe-gi-viz on the sector
 * pages, .viz on the Global page). Rules, values and keyframes are the
 * prototypes', in the same order, scoped under .oe-gif; colours come from
 * the block's fields as --oe-* tokens with the prototype's hex as fallback.
 * Icon colour is --ink (set per icon from PHP).
 */

.oe-gif {
	--oe-gif-ease: cubic-bezier(.22, 1, .36, 1);
	width: 100%;
}

/* Scroll-in fade (prototype: .js .rv / .rv.in), hidden from first paint as
   in the prototype. Safety net: if script.js never starts (.is-js), it
   shows anyway after 2s. */
.oe-gif.oe-gif--reveal .oe-gif-rv { opacity: 0; transform: translateY(24px); transition: opacity .45s var(--oe-gif-ease), transform .45s var(--oe-gif-ease); transition-delay: var(--d, 0s); }
.oe-gif.oe-gif--reveal .oe-gif-rv.in { opacity: 1; transform: none; }
.oe-gif.oe-gif--reveal:not(.is-js) .oe-gif-rv { animation: oe-gif-failsafe 0s 2s forwards; }
@keyframes oe-gif-failsafe { to { opacity: 1; transform: none; } }

.oe-gif .oe-gif-viz { width: 100%; max-width: var(--oe-gif-max, 680px); margin-inline: auto; }
.oe-gif .oe-gif-viz svg { width: 100%; height: auto; display: block; overflow: visible; }
.oe-gif .oe-gif-viz .oe-gif-wv { fill: none; stroke-width: 1.8; stroke-linecap: round; opacity: .9; }
.oe-gif .oe-gif-viz .oe-gif-in { fill: none; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 2 9; animation: oe-gif-flow 1s linear infinite; }
.oe-gif .oe-gif-viz .oe-gif-rt { fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
@keyframes oe-gif-flow { to { stroke-dashoffset: -11; } }
/* Icons: navy line icons in the circle and cards (.oe-gi-ic), white in the start box and input circles (.oe-gi-icw). */
.oe-gif .oe-gif-viz .oe-gif-icon { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.oe-gif .oe-gif-viz .oe-gif-icon--start, .oe-gif .oe-gif-viz .oe-gif-icon--input { stroke-width: 2.4; }
.oe-gif .oe-gif-viz .oe-gif-icon .oe-gif-wheel { fill: var(--oe-color-primary-4, #ffffff); }
.oe-gif .oe-gif-viz .oe-gif-icon :is(.oe-gif-b1, .oe-gif-b2, .oe-gif-b3) { fill: var(--ink); stroke: none; }
/* Bar chart baseline in a result card: navy, as the prototypes (.oe-gi-ic). */
.oe-gif .oe-gif-viz .oe-gif-icon--result .oe-gif-base { stroke: var(--oe-color-secondary, #003469); }
/* Library icons (Heroicons / Feather) draw with currentColor. */
.oe-gif .oe-gif-viz .oe-gif-lib { overflow: visible; }
.oe-gif .oe-gif-viz .oe-gif-src { transform-box: fill-box; transform-origin: center; animation: oe-gif-bob 3.6s ease-in-out infinite; animation-delay: var(--sd, 0s); }
@keyframes oe-gif-bob { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
.oe-gif .oe-gif-viz .oe-gif-card { fill: var(--oe-color-primary-4, #ffffff); stroke: var(--oe-color-secondary-muted, #E8ECF4); stroke-width: 1.5; animation: oe-gif-glow 3.6s ease-in-out infinite; animation-delay: var(--cd, 0s); }
@keyframes oe-gif-glow { 0%, 70%, 100% { stroke: var(--oe-color-secondary-muted, #E8ECF4); stroke-width: 1.5; } 80%, 90% { stroke: var(--cc); stroke-width: 3; } }
.oe-gif .oe-gif-viz .oe-gif-node { fill: var(--oe-color-primary-4, #ffffff); stroke: var(--oe-gif-flow, #00addc); stroke-width: 2.5; transform-box: fill-box; transform-origin: center; animation: oe-gif-pulse 1.8s ease-in-out infinite; }
@keyframes oe-gif-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.oe-gif .oe-gif-viz .oe-gif-b1, .oe-gif .oe-gif-viz .oe-gif-b2, .oe-gif .oe-gif-viz .oe-gif-b3 { transform-box: fill-box; transform-origin: bottom; animation: oe-gif-bar 3.6s ease-in-out infinite; }
.oe-gif .oe-gif-viz .oe-gif-b2 { animation-delay: .1s; } .oe-gif .oe-gif-viz .oe-gif-b3 { animation-delay: .2s; }
@keyframes oe-gif-bar { 0%, 55% { transform: scaleY(.45); } 80%, 100% { transform: scaleY(1); } }
.oe-gif .oe-gif-viz .oe-gif-pp { animation: oe-gif-person 3.6s ease-in-out infinite; animation-delay: var(--pd, 0s); }
@keyframes oe-gif-person { 0%, 55% { opacity: .25; } 75%, 100% { opacity: 1; } }
.oe-gif .oe-gif-viz .oe-gif-cn { fill: var(--oe-gif-flow, #00addc); stroke: var(--oe-color-primary-4, #ffffff); stroke-width: 2; }
.oe-gif .oe-gif-viz .oe-gif-label { font-family: inherit; font-size: 15px; fill: var(--oe-color-secondary, #003469); text-anchor: middle; }

/* Paused while out of view (script.js adds .is-paused); the SMIL loops are
   paused with svg.pauseAnimations(). Nothing changes on screen. */
.oe-gif.is-paused .oe-gif-viz * { animation-play-state: paused; }

/* "Animate" off: the prototype's reduced-motion result (one instant run of
   each CSS animation, SMIL paused, no coins). */
.oe-gif.oe-gif--still .oe-gif-viz *, .oe-gif.oe-gif--still .oe-gif-viz *::before, .oe-gif.oe-gif--still .oe-gif-viz *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
.oe-gif.oe-gif--still .oe-gif-coins { display: none; }

@media (prefers-reduced-motion: reduce) {
	.oe-gif *, .oe-gif *::before, .oe-gif *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
	.oe-gif.oe-gif--reveal .oe-gif-rv { opacity: 1; transform: none; }
	.oe-gif .oe-gif-coins { display: none; }
}
