/**
 * Merchalia animations — simple, accessible, performance-conscious.
 * - Page-load fade-up on hero
 * - Reveal-on-scroll for sections
 * - Hover lifts on cards and buttons
 * - Smooth anchor scrolling
 * - Honours prefers-reduced-motion
 */

/* Smooth anchor scrolling */
html {
	scroll-behavior: smooth;
}

/* Fixed header offset for anchor links */
:target {
	scroll-margin-top: 80px;
}

/* Page-load fade-up (hero items only) — staggered for cinematic reveal
 * timed to start ~200ms after first paint so the video poster shows
 * before text overlays in. */
@keyframes merchalia-fade-up {
	from {
		opacity: 0;
		transform: translateY(20px);
		filter: blur(4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
		filter: blur(0);
	}
}

.wp-site-blocks > main > section:first-of-type > *:not(.merchalia-hero-video-bg):not(.merchalia-hero-video-overlay):not(.merchalia-hero-video-control):not(.merchalia-hero-scroll-indicator),
.wp-site-blocks > section:first-of-type > *:not(.merchalia-hero-video-bg):not(.merchalia-hero-video-overlay):not(.merchalia-hero-video-control):not(.merchalia-hero-scroll-indicator) {
	animation: merchalia-fade-up 0.85s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

.wp-site-blocks > main > section:first-of-type > *:nth-child(1),
.wp-site-blocks > section:first-of-type > *:nth-child(1) { animation-delay: 0.20s; }
.wp-site-blocks > main > section:first-of-type > *:nth-child(2),
.wp-site-blocks > section:first-of-type > *:nth-child(2) { animation-delay: 0.20s; }
.wp-site-blocks > main > section:first-of-type > *:nth-child(3),
.wp-site-blocks > section:first-of-type > *:nth-child(3) { animation-delay: 0.30s; }
.wp-site-blocks > main > section:first-of-type > *:nth-child(4),
.wp-site-blocks > section:first-of-type > *:nth-child(4) { animation-delay: 0.45s; }
.wp-site-blocks > main > section:first-of-type > *:nth-child(5),
.wp-site-blocks > section:first-of-type > *:nth-child(5) { animation-delay: 0.60s; }
.wp-site-blocks > main > section:first-of-type > *:nth-child(6),
.wp-site-blocks > section:first-of-type > *:nth-child(6) { animation-delay: 0.75s; }
.wp-site-blocks > main > section:first-of-type > *:nth-child(7),
.wp-site-blocks > section:first-of-type > *:nth-child(7) { animation-delay: 0.90s; }

/* Reveal-on-scroll (applied by JS IntersectionObserver) */
.merchalia-reveal {
	opacity: 0;
	transform: translateY(24px);
	transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1),
	            transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
	will-change: opacity, transform;
}

.merchalia-reveal.is-visible {
	opacity: 1;
	transform: translateY(0);
}

/* Buttons — subtle lift + faster transition */
.wp-element-button,
.wp-block-button__link {
	transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1),
	            background-color 0.18s ease-out,
	            color 0.18s ease-out,
	            border-color 0.18s ease-out;
}

.wp-element-button:hover,
.wp-block-button__link:hover {
	transform: translateY(-1px);
}

.wp-element-button:active,
.wp-block-button__link:active {
	transform: translateY(0);
	transition-duration: 0.05s;
}

/* Product cards — lift + ruby border on hover */
.wp-block-group.has-stone-border-color {
	transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
	            border-color 0.35s ease-out,
	            box-shadow 0.35s ease-out;
}

.wp-block-group.has-stone-border-color:hover {
	transform: translateY(-4px);
	border-color: var(--wp--preset--color--ruby) !important;
	box-shadow: 0 18px 40px rgba(26, 26, 26, 0.06);
}

/* Heading-as-link hover */
h2 a, h3 a, h4 a {
	transition: color 0.2s ease-out;
}

h2 a:hover, h3 a:hover, h4 a:hover {
	color: var(--wp--preset--color--ruby) !important;
}

/* Inline links (paragraphs, lists) */
p a, li a {
	transition: color 0.18s ease-out, opacity 0.18s ease-out;
}

/* Pill badges — subtle hover */
p[style*="border-radius:100px"] {
	transition: background-color 0.2s ease-out, transform 0.2s ease-out;
}

p[style*="border-radius:100px"]:hover {
	transform: translateY(-1px);
}

/* Navigation items — underline grow */
.wp-block-navigation__container .wp-block-navigation-item__content {
	position: relative;
	transition: color 0.2s ease-out;
}

.wp-block-navigation__container .wp-block-navigation-item__content::after {
	content: '';
	position: absolute;
	left: 0;
	bottom: -4px;
	width: 100%;
	height: 1.5px;
	background: var(--wp--preset--color--ruby);
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.wp-block-navigation__container .wp-block-navigation-item__content:hover::after,
.wp-block-navigation__container .wp-block-navigation-item.current-menu-item .wp-block-navigation-item__content::after {
	transform: scaleX(1);
}

.wp-block-navigation__container .wp-block-navigation-item__content:hover {
	color: var(--wp--preset--color--ruby) !important;
}

/* Category number hover — slight scale */
.wp-block-column:has(p[class*="has-ruby-color"]:first-child) {
	transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Honour reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}

	.merchalia-reveal {
		opacity: 1;
		transform: none;
	}
}
