/* ==========================================================================
   Image Mosaic block — ACF block styles
   Jewelry Studio

   Figma source values (px):
     Bounding box : 809 × 770
     Image 1 (top-left,     small) : left 0,   top 63,  w 392, h 237
     Image 2 (top-right,    large) : left 417,  top 0,   w 392, h 425
     Image 3 (bottom-left,  large) : left 0,   top 345, w 392, h 425
     Image 4 (bottom-right, small) : left 417,  top 470, w 392, h 237

   All positions are percentages of the 809 × 770 bounding box.
   ========================================================================== */

/* ── Wrapper ──────────────────────────────────────────────────────────────── */
.image-mosaic {
	position: relative;
	aspect-ratio: 809 / 770;
	width: 100%;
}

/* ── Shared item styles ───────────────────────────────────────────────────── */
.image-mosaic__item {
	position: absolute;
	width: 48.46%; /* 392 / 809 */
}

.image-mosaic__item img {
	display: block;
	width: 100%;
	height: auto;
	object-fit: cover;
}

/* ── Image 1 — top-left, small (392 × 237) ───────────────────────────────── */
.image-mosaic__item--1 {
	left: 0%;
	top:  8.18%; /* 63 / 770 */
}

.image-mosaic__item--1 img {
	aspect-ratio: 392 / 237;
}

/* ── Image 2 — top-right, large (392 × 425) ──────────────────────────────── */
.image-mosaic__item--2 {
	left: 51.54%; /* 417 / 809 */
	top:  0%;
}

.image-mosaic__item--2 img {
	aspect-ratio: 392 / 425;
}

/* ── Image 3 — bottom-left, large (392 × 425) ────────────────────────────── */
.image-mosaic__item--3 {
	left: 0%;
	top:  44.81%; /* 345 / 770 */
}

.image-mosaic__item--3 img {
	aspect-ratio: 392 / 425;
}

/* ── Image 4 — bottom-right, small (392 × 237) ───────────────────────────── */
.image-mosaic__item--4 {
	left: 51.54%; /* 417 / 809 */
	top:  61.04%; /* 470 / 770 */
}

.image-mosaic__item--4 img {
	aspect-ratio: 392 / 237;
}

/* ── Editor placeholder ───────────────────────────────────────────────────── */
.image-mosaic--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 160px;
	background: #f0f0f0;
	border: 2px dashed #ccc;
	color: #888;
	font-size: 0.875rem;
}

/* ── Scroll-reveal animations ─────────────────────────────────────────────── */
/*
 * Hidden state: applied by PHP on the frontend via the `.js-animate` class.
 * Visible state: `.is-visible` is added by scroll-animations.js via
 * IntersectionObserver the first time the element enters the viewport.
 *
 * Wrapped in `prefers-reduced-motion` so users who opt out of motion
 * see images at full opacity with no transition whatsoever.
 *
 * Stagger order mirrors the visual reading order of the mosaic grid:
 *   1 (top-left) → 2 (top-right) → 3 (bottom-left) → 4 (bottom-right)
 */
@media (prefers-reduced-motion: no-preference) {

	/* Shared hidden state --------------------------------------------------- */
	.image-mosaic__item.js-animate {
		opacity: 0;
		transition: opacity 0.55s ease, transform 0.55s ease;
	}

	/* Per-item initial offsets + stagger delays ----------------------------- */
	.image-mosaic__item--1.js-animate {
		transform: translateX( -28px );
		/* delay: 0 ms — intentionally omitted (default) */
	}

	.image-mosaic__item--2.js-animate {
		transform: translateX( 28px );
		transition-delay: 120ms;
	}

	.image-mosaic__item--3.js-animate {
		transform: translateX( -28px );
		transition-delay: 240ms;
	}

	.image-mosaic__item--4.js-animate {
		transform: translateX( 28px );
		transition-delay: 360ms;
	}

	/* Visible state — added by JS ------------------------------------------ */
	.image-mosaic__item.js-animate.is-visible {
		opacity: 1;
		transform: translateX( 0 );
	}

}
