/*
 * Yi Vision 2030: site-wide motion layer (Option A, subtle).
 * Owns: tokens, buttons, scroll reveal, Why-lead rows, hero float and pulse,
 * impact photo zoom, count-up helper, scroll progress line.
 * Does not style: .zone, details.v, .zbanner, .pick, #quiz, .chip, .result, .qq, .yi-deadline.
 * Rules: transform and opacity only (plus soft button shadow), all motion inside
 * prefers-reduced-motion: no-preference, hidden-initial states only under .yi-js.
 */

:root {
	--yi-ease: cubic-bezier(.2, .7, .2, 1);
	--yi-ease-pop: cubic-bezier(.34, 1.56, .64, 1);
	--yi-dur-s: 200ms;
	--yi-dur-m: 350ms;
	--yi-dur-l: 500ms;
}

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

	/* ---------- Keyframes ---------- */
	@keyframes yi-m-rise {
		from { opacity: 0; transform: translateY(18px); }
		to { opacity: 1; transform: none; }
	}
	@keyframes yi-m-left {
		from { opacity: 0; transform: translateX(-28px); }
		to { opacity: 1; transform: none; }
	}
	@keyframes yi-m-float {
		from { transform: translateY(-6px); }
		to { transform: translateY(6px); }
	}
	@keyframes yi-m-ring {
		0% { opacity: .55; transform: scale(1); }
		100% { opacity: 0; transform: scale(1.16, 1.3); }
	}

	/* ---------- Buttons ---------- */
	.btn,
	.wp-block-button .wp-block-button__link.wp-element-button {
		transition:
			transform var(--yi-dur-s) var(--yi-ease),
			box-shadow var(--yi-dur-m) var(--yi-ease),
			background-color var(--yi-dur-s) var(--yi-ease),
			color var(--yi-dur-s) var(--yi-ease);
	}
	.btn:hover,
	.wp-block-button .wp-block-button__link.wp-element-button:hover {
		transform: translateY(-2px);
		box-shadow: 0 8px 20px rgba(31, 42, 92, .18);
	}
	.btn.sa:hover,
	.wp-block-button.is-style-saffron .wp-block-button__link.wp-element-button:hover {
		box-shadow: 0 8px 20px rgba(200, 95, 0, .32);
	}
	.btn.gr:hover,
	.wp-block-button.is-style-green .wp-block-button__link.wp-element-button:hover {
		box-shadow: 0 8px 20px rgba(6, 112, 58, .3);
	}
	.btn:active,
	.wp-block-button .wp-block-button__link.wp-element-button:active {
		transform: translateY(0) scale(.98);
		box-shadow: 0 2px 6px rgba(31, 42, 92, .16);
		transition-duration: 90ms;
	}
	.btn .arr,
	.wp-block-button__link .arr {
		display: inline-block;
		transition: transform var(--yi-dur-s) var(--yi-ease);
	}
	.btn:hover .arr,
	.wp-block-button__link:hover .arr,
	.btn:focus-visible .arr,
	.wp-block-button__link:focus-visible .arr {
		transform: translateX(3px);
	}

	/* ---------- Scroll reveal (hidden state only when JS is running) ---------- */
	.yi-js .yi-rv:not(.is-in) { opacity: 0; }
	.yi-rv.is-in {
		animation: yi-m-rise var(--yi-dur-l) var(--yi-ease) var(--yi-d, 0ms) backwards;
	}
	.yi-rv.yi-rv-l.is-in {
		animation-name: yi-m-left;
		animation-duration: 550ms;
	}

	/* ---------- Hero ---------- */
	.yi-hero .yi-hero-cols > .wp-block-column:first-child > :not(h1):not(.yi-deadline):not(script) {
		animation: yi-m-rise var(--yi-dur-l) var(--yi-ease) backwards;
	}
	.yi-hero .yi-hero-cols > .wp-block-column:first-child > .yi-tag { animation-delay: 40ms; }
	.yi-hero .yi-hero-cols > .wp-block-column:first-child > .yi-sub { animation-delay: 140ms; }
	.yi-hero .yi-hero-cols > .wp-block-column:first-child > .wp-block-buttons { animation-delay: 240ms; }

	.yi-hero .yi-heroimg {
		animation: yi-m-float 8s ease-in-out infinite alternate;
	}

	/* Primary hero CTA: soft ring, three pulses, then stops. Pseudo element, no layout impact. */
	.yi-hero .wp-block-button.is-style-saffron .wp-block-button__link {
		position: relative;
	}
	.yi-hero .wp-block-button.is-style-saffron .wp-block-button__link::after {
		content: "";
		position: absolute;
		inset: -2px;
		border-radius: inherit;
		border: 2px solid #F58220;
		opacity: 0;
		pointer-events: none;
		animation: yi-m-ring 1.8s var(--yi-ease) 1.6s 3 both;
	}

	/* ---------- Why-lead rows ---------- */
	.yi-why .yi-gives > .yi-give::before {
		transition: transform var(--yi-dur-m) var(--yi-ease-pop);
		transform-origin: center;
	}
	.yi-why .yi-gives > .yi-give:hover::before,
	.yi-why .yi-gives > .yi-give:focus-within::before {
		transform: scale(1.12);
	}

	/* ---------- Photo zoom on hover (lightbox untouched) ---------- */
	@media (hover: hover) {
		.yi-gal figure.wp-block-image img,
		.yi-photorow > .wp-block-image img {
			transition: transform var(--yi-dur-l) var(--yi-ease);
			transform-origin: 50% 0;
		}
		.yi-gal figure.wp-block-image:hover img,
		.yi-photorow > .wp-block-image:hover img {
			transform: scale(1.04);
		}
	}

	/* ---------- Stats: steady digit widths while counting ---------- */
	.yi-stats .yi-stat-num { font-variant-numeric: tabular-nums; }

	/* ---------- Scroll progress line ---------- */
	.yi-progress {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 2px;
		z-index: 60;
		background: #F58220;
		transform: scaleX(0);
		transform-origin: 0 50%;
		pointer-events: none;
		will-change: transform;
	}
	html.yi-lb-open .yi-progress { display: none; }
}

/* Never show the progress line under reduced motion */
@media (prefers-reduced-motion: reduce) {
	.yi-progress { display: none !important; }
}
