/*
 * 3D Content Scroll (hash a6f2d9).
 * Layout and the transform maths live here. script.js only writes two numbers per item:
 * --dcs-d (signed distance from the centre, 1 = one item) and --dcs-a (its absolute value).
 * Pinned mode needs the --pin class and motion allowed. Everything else is a plain list:
 * the Elementor editor, reduced motion, devices with pinning off.
 */

.dcs-a6f2d9 {
	/* Defaults. Each one is overridden by an Elementor control on the widget. */
	--dcs-pad-x: calc(7 * 1cqw);
	--dcs-gap: calc(7 * 1cqw);
	--dcs-stack-gap: 24px;
	--dcs-list-gap: 48px;
	--dcs-intro-gap: 24px;
	--dcs-copy-gap: 16px;
	--dcs-ratio: 346 / 266;
	--dcs-radius: 10px;
	--dcs-stage-n: 100;
	--dcs-top: 0px;
	--dcs-nav-bottom: 60px;
	--dcs-nav-gap: 10px;
	--dcs-line: 3px;
	--dcs-line-idle: 1px;
	--dcs-copy-origin: left center;
	--dcs-body-top: 24px;
	--dcs-body-bottom: 24px;
	--dcs-line-off: #CBCAC6;
	--dcs-line-on: #C4A667;
	--dcs-start-n: 25;
	--dcs-step-n: 80;
	--dcs-end-n: 25;
	--dcs-angle: 60deg;
	--dcs-persp: 1000px;
	--dcs-scale-min: 0.6;
	--dcs-blur: 1px;
	--dcs-pitch: 50%;
	--dcs-origin: center center;
	--dcs-ease: 3.5;
	--dcs-smooth: 25;
	--dcs-pin-on: 1;
	--dcs-vh: 1vh;
	--dcs-n: 1;

	/* Derived lengths. The track is the stage plus the pinned scroll distance. */
	--dcs-stage-h: calc(var(--dcs-stage-n) * var(--dcs-vh));
	--dcs-pin: calc((var(--dcs-start-n) + (var(--dcs-n) - 1) * var(--dcs-step-n) + var(--dcs-end-n)) * var(--dcs-vh));

	position: relative;
	width: 100%;
	max-width: 100%;
	/* cqw units (side padding and column gap are a share of the widget width). */
	container-type: inline-size;
	background-color: #252322;
}

/* Small viewport units where supported, so the mobile address bar does not resize the stage. */
@supports (height: 1svh) {
	.dcs-a6f2d9 {
		--dcs-vh: 1svh;
	}
}

.dcs-a6f2d9,
.dcs-a6f2d9 *,
.dcs-a6f2d9 *::before,
.dcs-a6f2d9 *::after {
	box-sizing: border-box;
}

.elementor-widget-content_scroll_3d_a6f2d9 {
	width: 100%;
}

/* Measuring probe: one hundred viewport units tall, so script.js can read the unit in pixels. */
.dcs-a6f2d9__probe {
	position: absolute;
	top: 0;
	left: 0;
	width: 0;
	height: calc(100 * var(--dcs-vh));
	visibility: hidden;
	pointer-events: none;
}

/* ---------- Base: plain list (editor, reduced motion, pinning off) ---------- */

.dcs-a6f2d9__stage {
	padding: 64px var(--dcs-pad-x);
}

.dcs-a6f2d9__intro {
	margin: 0 0 48px;
}

.dcs-a6f2d9__eyebrow,
.dcs-a6f2d9__heading,
.dcs-a6f2d9__num,
.dcs-a6f2d9__title,
.dcs-a6f2d9__desc {
	margin: 0;
}

.dcs-a6f2d9__eyebrow {
	margin-bottom: var(--dcs-intro-gap);
}

.dcs-a6f2d9__item {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	column-gap: var(--dcs-gap);
	row-gap: var(--dcs-stack-gap);
	align-items: stretch;
	margin: 0 0 var(--dcs-list-gap);
}

.dcs-a6f2d9__item:last-child {
	margin-bottom: 0;
}

.dcs-a6f2d9__media {
	margin: 0;
	width: 100%;
	aspect-ratio: var(--dcs-ratio);
	border-radius: var(--dcs-radius);
	overflow: hidden;
	position: relative;
}

.dcs-a6f2d9__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

.dcs-a6f2d9__copy {
	min-width: 0;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: var(--dcs-stack-gap);
}

@media (max-width: 768px) {
	.dcs-a6f2d9__copy {
		margin-top: 20px;
	}
}

.dcs-a6f2d9__title {
	margin-bottom: var(--dcs-copy-gap);
}

.dcs-a6f2d9__nav {
	display: none;
}

@media (max-width: 1024px) {
	.dcs-a6f2d9__item {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* ---------- Pinned 3D scroll ---------- */

@media (prefers-reduced-motion: no-preference) {

	.dcs-a6f2d9--pin .dcs-a6f2d9__track {
		height: calc(var(--dcs-stage-h) + var(--dcs-pin));
	}

	/* The stage sticks for the whole track. The bottom padding is the indicator offset. */
	.dcs-a6f2d9--pin .dcs-a6f2d9__stage {
		position: sticky;
		top: var(--dcs-top);
		height: var(--dcs-stage-h);
		padding: 0 0 var(--dcs-nav-bottom);
		display: grid;
		grid-template-rows: minmax(0, 1fr) auto;
		overflow: clip;
	}

	/* Three equal columns. The content block is centred in the area above the indicator. */
	.dcs-a6f2d9--pin .dcs-a6f2d9__body {
		display: grid;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		column-gap: var(--dcs-gap);
		align-items: center;
		/* Rows hug their content, so the right column matches the heading and image height. */
		align-content: center;
		min-height: 0;
		padding: var(--dcs-body-top) var(--dcs-pad-x) var(--dcs-body-bottom);
	}

	.dcs-a6f2d9--pin .dcs-a6f2d9__intro {
		grid-column: 1;
		grid-row: 1;
		margin: 0;
	}

	/* Items stop being boxes: their image and text land in the shared grid cells and overlap. */
	.dcs-a6f2d9--pin .dcs-a6f2d9__item {
		display: contents;
		margin: 0;
	}

	.dcs-a6f2d9--pin .dcs-a6f2d9__media {
		grid-column: 2;
		grid-row: 1;
		align-self: center;
	}

	.dcs-a6f2d9--pin .dcs-a6f2d9__copy {
		grid-column: 3;
		grid-row: 1;
		align-self: stretch;
	}

	/*
	 * One rule drives both stacks. d is the signed distance from the centre in items,
	 * a is its absolute value. Opacity, scale, blur, tilt and travel all follow from it.
	 * Perspective sits inside each transform, so no parent has to stay transform free.
	 */
	.dcs-a6f2d9--pin .dcs-a6f2d9__media,
	.dcs-a6f2d9--pin .dcs-a6f2d9__copy {
		opacity: calc(1 - var(--dcs-a));
		transform-origin: var(--dcs-origin);
		transform: perspective(var(--dcs-persp)) translateY(calc(var(--dcs-d) * var(--dcs-pitch))) rotateX(calc(var(--dcs-d) * var(--dcs-angle) * -1)) scale(calc(1 - (1 - var(--dcs-scale-min)) * var(--dcs-a)));
		filter: blur(calc(var(--dcs-a) * var(--dcs-blur)));
		backface-visibility: hidden;
	}

	/*
	 * The text block pivots on its left edge. Perspective is anchored to the transform origin,
	 * so with the origin on the left the left edge stays vertical and the text tilts away
	 * along one straight line instead of fanning out from its own centre.
	 */
	.dcs-a6f2d9--pin .dcs-a6f2d9__copy {
		transform-origin: var(--dcs-copy-origin);
	}

	/* At rest the transform and filter go away completely, so text stays sharp. */
	.dcs-a6f2d9--pin .dcs-a6f2d9__item.is-rest .dcs-a6f2d9__media,
	.dcs-a6f2d9--pin .dcs-a6f2d9__item.is-rest .dcs-a6f2d9__copy {
		transform: none;
		filter: none;
	}

	/* Items a full step or more away are not painted at all. */
	.dcs-a6f2d9--pin .dcs-a6f2d9__item.is-off .dcs-a6f2d9__media,
	.dcs-a6f2d9--pin .dcs-a6f2d9__item.is-off .dcs-a6f2d9__copy {
		visibility: hidden;
	}

	.dcs-a6f2d9--pin.is-live .dcs-a6f2d9__media,
	.dcs-a6f2d9--pin.is-live .dcs-a6f2d9__copy {
		will-change: transform, opacity, filter;
	}

	/* Indicator: one segment per item, edge to edge of the stage. */
	.dcs-a6f2d9--pin .dcs-a6f2d9__nav {
		display: flex;
		gap: var(--dcs-nav-gap);
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.dcs-a6f2d9--pin .dcs-a6f2d9__nav li {
		flex: 1 1 0;
		min-width: 0;
		margin: 0;
		padding: 0;
	}

	.dcs-a6f2d9--pin .dcs-a6f2d9__nav-btn {
		position: relative;
		display: block;
		width: 100%;
		height: var(--dcs-line);
		min-height: 0;
		margin: 0;
		padding: 0;
		border: 0;
		border-radius: 0;
		background: transparent;
		cursor: pointer;
		-webkit-appearance: none;
		appearance: none;
		transition: none;
	}

	/* Bigger tap target than the line itself. */
	.dcs-a6f2d9--pin .dcs-a6f2d9__nav-btn::after {
		content: '';
		position: absolute;
		left: 0;
		right: 0;
		top: -12px;
		bottom: -12px;
	}

	/*
	 * The button box is as tall as the active line. The visible line is a centred pseudo element,
	 * thin when inactive and thick when active, so both stay vertically centred on each other.
	 */
	.dcs-a6f2d9--pin .dcs-a6f2d9__nav-btn::before {
		content: '';
		position: absolute;
		left: 0;
		right: 0;
		top: 50%;
		height: var(--dcs-line-idle);
		transform: translateY(-50%);
		background: var(--dcs-line-off);
		transition: height 0.25s ease, background-color 0.25s ease;
	}

	.dcs-a6f2d9--pin .dcs-a6f2d9__nav-btn.is-active::before {
		height: var(--dcs-line);
		background: var(--dcs-line-on);
	}

	.dcs-a6f2d9--pin .dcs-a6f2d9__nav-btn:focus-visible {
		outline: 2px solid var(--dcs-line-on);
		outline-offset: 4px;
	}

	/* Tablet and phone: one column. The image takes the space left between heading and text. */
	@media (max-width: 1024px) {
		.dcs-a6f2d9--pin .dcs-a6f2d9__body {
			grid-template-columns: minmax(0, 1fr);
			grid-template-rows: auto minmax(0, 1fr) auto;
			row-gap: var(--dcs-stack-gap);
			align-items: stretch;
			align-content: stretch;
		}

		.dcs-a6f2d9--pin .dcs-a6f2d9__intro {
			grid-column: 1;
			grid-row: 1;
		}

		.dcs-a6f2d9--pin .dcs-a6f2d9__media {
			grid-column: 1;
			grid-row: 2;
			min-height: 0;
			max-height: 100%;
			align-self: center;
		}

		.dcs-a6f2d9--pin .dcs-a6f2d9__copy {
			grid-column: 1;
			grid-row: 3;
		}
	}
}
