/**
 * Photo Rows widget.
 * Design: Figma "Two Rows Photo Carousel" (hDnYALoz9b7tlb7gTrhfkI, node 608:392).
 *
 * The widget's controls write the custom properties below from Elementor's
 * generated CSS; the values here are the Figma defaults and only apply if that
 * CSS is missing.
 *
 * Sizing: the photo width is fluid, clamp(smallest, size-in-vw, largest), and
 * the height follows from the aspect ratio, so photos scale continuously with
 * the screen instead of jumping at breakpoints. Gap, row spacing, corner radius
 * (and, in the script, travel) are authored in px "at full size", meaning when
 * a photo is at its Largest Width, and scale by the same factor as the photo:
 * --sf-unit is what 1px at full size measures right now. The whole composition
 * shrinks as one piece, so its proportions match the design at every width.
 *
 * Structure: .sf-photo-rows (full-bleed root) > [editor notices] >
 * .sf-photo-rows__stage (the two rows). The script only slides the tracks
 * sideways (transform) as the page scrolls past: nothing sticks and nothing is
 * added to the page's length, so the page is exactly as long as a plain block
 * of photos, with or without the script (or with reduced motion).
 */

.sf-photo-rows {
	--sf-photo-size: 29.8vw; /* 572px at the 1920px design width */
	--sf-photo-min: 260; /* px */
	--sf-photo-max: 572; /* px, also the "full size" the values below refer to */
	--sf-aspect: 1.6;
	--sf-gap: 18; /* px at full size */
	--sf-row-gap: 19; /* px at full size */
	--sf-radius: 10; /* px at full size */
	--sf-travel-mode: full; /* full = slide the whole set, capped by --sf-max-speed; custom = --sf-travel. Read by the script */
	--sf-max-speed: 1; /* full mode: most px a row may slide per px scrolled. Read by the script */
	--sf-travel: 160; /* custom mode: px at full size either side of rest. Read by the script */
	--sf-stagger: 41; /* % of one photo width the bottom row sits left of the top row */

	--sf-photo-w: clamp(calc(var(--sf-photo-min) * 1px), var(--sf-photo-size), calc(var(--sf-photo-max) * 1px));
	--sf-photo-h: calc(var(--sf-photo-w) / var(--sf-aspect));
	--sf-unit: calc(var(--sf-photo-w) / var(--sf-photo-max));

	display: flex;
	flex-direction: column;

	/*
	 * Full bleed. The negative margins pull the box out to both viewport edges
	 * while width stays auto, and inline-size containment stops the (very wide)
	 * tracks inside from feeding back into the intrinsic width of the Elementor
	 * container, so a row-direction flex parent cannot be pushed wider.
	 *
	 * The script measures the parent's content box and the real viewport width
	 * (documentElement.clientWidth, which excludes a classic scrollbar) and sets
	 * --sf-bleed-left / --sf-bleed-right exactly.
	 *
	 * Until it runs, the rows stay inside their container. A CSS-only
	 * "calc(50% - 50vw)" estimate is deliberately not used: 100vw includes the
	 * vertical scrollbar on Windows, so it would flash a sideways page scrollbar
	 * on every load, wherever the section sits on the page.
	 */
	contain: inline-size;
	margin-left: var(--sf-bleed-left, 0px);
	margin-right: var(--sf-bleed-right, 0px);
}

.sf-photo-rows__stage {
	display: flex;
	flex-direction: column;
	gap: calc(var(--sf-row-gap) * var(--sf-unit));
}

.sf-photo-rows__row {
	height: var(--sf-photo-h);
	overflow: hidden; /* fallback for browsers without overflow: clip */
	overflow: clip;
}

.sf-photo-rows__track {
	display: flex;
	gap: calc(var(--sf-gap) * var(--sf-unit));
	width: max-content;
	height: 100%;
	will-change: transform;
}

/* Resting stagger before the script positions the tracks (it then owns transform). */
.sf-photo-rows__row--bottom .sf-photo-rows__track {
	transform: translate3d(calc(var(--sf-photo-w) * var(--sf-stagger) / -100), 0, 0);
}

/* Doubled class so these beat theme and Elementor list/img resets (".elementor img" is 0,1,1). */
.sf-photo-rows .sf-photo-rows__set {
	display: flex;
	flex: none;
	gap: calc(var(--sf-gap) * var(--sf-unit));
	margin: 0;
	padding: 0;
	list-style: none;
}

.sf-photo-rows .sf-photo-rows__item {
	flex: none;
	width: var(--sf-photo-w);
	height: var(--sf-photo-h);
	margin: 0;
	padding: 0;
	border-radius: calc(var(--sf-radius) * var(--sf-unit));
	overflow: hidden;
}

.sf-photo-rows .sf-photo-rows__item::before,
.sf-photo-rows .sf-photo-rows__item::after {
	content: none;
}

.sf-photo-rows .sf-photo-rows__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	border: 0;
	border-radius: inherit;
	box-shadow: none;
	object-fit: cover;
}

/* Editor-only guidance (never rendered for visitors). */
.sf-photo-rows__notice {
	align-self: center;
	box-sizing: border-box;
	max-width: min(64ch, calc(100% - 32px));
	margin: 0 0 calc(var(--sf-row-gap) * var(--sf-unit));
	padding: 10px 14px;
	border-radius: 6px;
	background: #fff8e1;
	color: #3d2e00;
	font: 13px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	box-shadow: 0 0 0 1px #f0d98c;
}

.sf-photo-rows__notice p {
	margin: 0;
}

.sf-photo-rows__notice p + p {
	margin-top: 4px;
}

@media (prefers-reduced-motion: reduce) {
	.sf-photo-rows__track {
		will-change: auto;
	}
}
