/*
 * UYAI motion. Presentation only, no JavaScript.
 * Everything sits inside prefers-reduced-motion: no-preference, so reduced-motion visitors get the static design.
 * Scroll-driven effects sit inside @supports; browsers without it show the content with no animation.
 * Editors can add the utility classes below to any block (Advanced > Additional CSS class):
 *   uyai-reveal   fade and rise on scroll        uyai-stagger  on a group: staggers its .uyai-reveal children
 *   uyai-wipe     image unveils top to bottom    uyai-parallax on an image wrapper: slow vertical drift
 *   uyai-zoom     image zooms 4% on hover
 */
@media (prefers-reduced-motion: no-preference) {
	:root { --uyai-ease: cubic-bezier(0.2, 0.7, 0.2, 1); }

	@keyframes uyai-rise { from { opacity: 0; transform: translateY(22px); } }
	@keyframes uyai-fadedown { from { opacity: 0; transform: translateY(-6px); } }
	@keyframes uyai-ulwipe {
		0% { background-size: 100% 1px; background-position: right bottom; }
		45% { background-size: 0 1px; background-position: right bottom; }
		46% { background-size: 0 1px; background-position: left bottom; }
		100% { background-size: 100% 1px; background-position: left bottom; }
	}

	/* Buttons: a fill sweeps in from the left on hover. */
	.wp-block-button__link,
	.wc-block-components-button {
		background-repeat: no-repeat;
		background-position: left center;
		background-size: 0 100%;
		background-image: linear-gradient(var(--wp--preset--color--accent), var(--wp--preset--color--accent));
		transition: background-size 0.7s var(--uyai-ease), color 0.5s ease;
	}
	.wp-block-button__link:hover,
	.wp-block-button__link:focus-visible,
	.wc-block-components-button:hover { background-size: 100% 100%; background-color: var(--wp--preset--color--ink); }
	.wp-block-button.is-style-uyai-light .wp-block-button__link {
		background-image: linear-gradient(var(--wp--preset--color--light-muted), var(--wp--preset--color--light-muted));
	}
	.wp-block-button.is-style-uyai-light .wp-block-button__link:hover { background-color: var(--wp--preset--color--base); }
	.wp-block-button.is-style-uyai-outline-light .wp-block-button__link {
		background-image: linear-gradient(var(--wp--preset--color--base), var(--wp--preset--color--base));
	}
	.wp-block-button.is-style-uyai-outline-light .wp-block-button__link:hover { background-color: transparent; }
	/* Text links redraw their underline. */
	.wp-block-button.is-style-uyai-link .wp-block-button__link {
		border-bottom: 0;
		background-image: linear-gradient(currentColor, currentColor);
		background-size: 100% 1px;
		background-position: left bottom;
		transition: color 0.3s;
	}
	.wp-block-button.is-style-uyai-link .wp-block-button__link:hover { animation: uyai-ulwipe 0.9s var(--uyai-ease); }

	/* Product cards: image zoom on hover (fine pointers). */
	.uyai-zoom img,
	.uyai-product-collection .wc-block-components-product-image img { transition: transform 1.8s var(--uyai-ease); }
	@media (hover: hover) {
		.uyai-zoom:hover img,
		.uyai-product-collection li:hover .wc-block-components-product-image img { transform: scale(1.04); }
	}

	/* Accordions fade open. */
	details[open] > :not(summary) { animation: uyai-fadedown 0.5s var(--uyai-ease); }

	/* Mobile menu items rise in. */
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item { animation: uyai-rise 0.9s var(--uyai-ease) backwards; }
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:nth-child(2) { animation-delay: 0.1s; }
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:nth-child(3) { animation-delay: 0.18s; }
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:nth-child(4) { animation-delay: 0.26s; }
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:nth-child(5) { animation-delay: 0.34s; }
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:nth-child(6) { animation-delay: 0.42s; }

	@supports (animation-timeline: view()) {
		@keyframes uyai-reveal { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
		@keyframes uyai-wipe { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
		@keyframes uyai-parallax { from { transform: translateY(-5%) scale(1.12); } to { transform: translateY(5%) scale(1.12); } }
		@keyframes uyai-hdshrink { to { padding-top: 7px; padding-bottom: 7px; } }
		@keyframes uyai-logoshrink { to { transform: scale(0.86); } }

		/* Defaults for the homepage compositions, so existing content animates without editing blocks. */
		.uyai-reveal,
		.uyai-product-collection li.wc-block-product,
		.is-style-uyai-edit > .wp-block-column,
		.uyai-journal .wp-block-post {
			animation: uyai-reveal linear both;
			animation-timeline: view();
			animation-range: entry 4% entry 44%;
		}
		.uyai-stagger > .uyai-reveal:nth-child(2),
		.uyai-product-collection li.wc-block-product:nth-child(2),
		.is-style-uyai-edit > .wp-block-column:nth-child(2) { animation-range: entry 10% entry 50%; }
		.uyai-stagger > .uyai-reveal:nth-child(3),
		.uyai-product-collection li.wc-block-product:nth-child(3),
		.is-style-uyai-edit > .wp-block-column:nth-child(3) { animation-range: entry 16% entry 56%; }
		.uyai-stagger > .uyai-reveal:nth-child(4),
		.uyai-product-collection li.wc-block-product:nth-child(4) { animation-range: entry 22% entry 62%; }

		.uyai-wipe,
		.uyai-portrait {
			animation: uyai-wipe linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 55%;
		}
		.uyai-parallax img,
		.uyai-portrait img {
			animation: uyai-parallax linear both;
			animation-timeline: view();
			animation-range: cover;
		}

		/* Header: padding and logo shrink slightly over the first 160px of scroll. */
		.uyai-header__inner {
			animation: uyai-hdshrink linear both;
			animation-timeline: scroll(root);
			animation-range: 0 160px;
		}
		.uyai-header .wp-block-site-logo img {
			animation: uyai-logoshrink linear both;
			animation-timeline: scroll(root);
			animation-range: 0 160px;
		}
	}
}
