/**
 * Subtle background parallax (assets/js/section-parallax.js).
 *
 * Do NOT set overflow:hidden on the section — isolation + z-index:-1 texture
 * layers would disappear behind the section fill.
 *
 * Vertical travel uses a taller pseudo (overscan) with background-size: cover,
 * then clip-path clips painting exactly to the section box so neighbours and
 * the page edge never get a tinted strip. Rules are scoped to .aps-parallax-host
 * (JS marks eligible main sections only) so footer/header gray styles never grow
 * the document height via the oversized layers.
 */

/* Only tracked hosts — never footer/header chrome. */
html.aps-parallax-js .aps-parallax-host::before,
html.aps-parallax-js .aps-parallax-host::after {
	/*
	 * Expand top/bottom by half overscan so cover has vertical slack for
	 * ±(overscan/2) background-position shifts; clip back to the section.
	 */
	inset: auto;
	top: calc( var( --aps-parallax-overscan, 216px ) / -2 );
	right: 0;
	bottom: calc( var( --aps-parallax-overscan, 216px ) / -2 );
	left: 0;
	width: auto;
	height: auto;
	background-size: cover;
	background-repeat: no-repeat;
	clip-path: inset( calc( var( --aps-parallax-overscan, 216px ) / 2 ) 0 );
}

html.aps-parallax-js .aps-parallax-host::before {
	background-position: var( --section-texture-position-x, 50% )
		calc( var( --section-texture-position-y, 50% ) + var( --aps-parallax-shift, 0px ) );
}

html.aps-parallax-js .aps-parallax-host::after {
	background-position: center calc( 50% + var( --aps-parallax-shift, 0px ) );
}

/* Surface url() background on Section/Hero hosts marked by the script. */
html.aps-parallax-js .aps-parallax--bg {
	background-position-y: calc(
		var( --aps-parallax-bg-base-y, 50% ) + var( --aps-parallax-shift, 0px )
	);
}

@media ( prefers-reduced-motion: reduce ) {
	html.aps-parallax-js .aps-parallax-host::before,
	html.aps-parallax-js .aps-parallax-host::after {
		inset: 0;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		background-size: cover;
		clip-path: none;
	}

	html.aps-parallax-js .aps-parallax-host::before {
		background-position: var( --section-texture-position, 50% 50% );
	}

	html.aps-parallax-js .aps-parallax-host::after {
		background-position: center;
	}

	html.aps-parallax-js .aps-parallax--bg {
		background-position-y: var( --aps-parallax-bg-base-y, 50% );
	}
}

@media ( max-width: 781px ) {
	html.aps-parallax-js .aps-parallax-host::before,
	html.aps-parallax-js .aps-parallax-host::after {
		inset: 0;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		background-size: cover;
		clip-path: none;
	}
}
