/*
 * Custom Slider — 3D product hero
 *
 * Note: never put opacity/filter on .csl__card or .csl__card-inner — both
 * flatten preserve-3d and break the flip. Fog and shading are overlays.
 */

.csl {
	--csl-bg: var(--color-bg, #fbf9f6);
	--csl-fg: var(--color-heading, #1c1917);
	--csl-muted: #6f6760;
	--csl-line: rgba(28, 25, 23, 0.16);
	--csl-card-bg: #ece7e0;
	--csl-shadow: rgba(28, 25, 23, 0.42);
	--csl-accent: #c5a059;
	/* Accent for small text: #c5a059 is only 2.3:1 on the light background. */
	--csl-accent-text: #8a6a2b;
	--csl-font-display: var(--font-heading, "Playfair Display", Georgia, "Times New Roman", serif);
	--csl-font-body: var(--font-body, "Inter", system-ui, -apple-system, "Segoe UI", sans-serif);
	--csl-height: 100svh;
	--csl-offset-top: 120px;
	--csl-pad: clamp(20px, 3.2vw, 48px);
	--csl-radius: 3px;
	/* Card size before the script measures the stage. */
	--csl-ch: min(58vh, 540px);
	--csl-cw: calc(var(--csl-ch) * 0.75);

	position: relative;
	isolation: isolate;
	overflow: hidden;
	/* Themes set --csl-viewport-offset to their header height so the hero's controls stay above the fold. */
	height: calc(var(--csl-height) - var(--csl-viewport-offset, 0px));
	min-height: 620px;
	background: var(--csl-bg);
	color: var(--csl-fg);
	font-family: var(--csl-font-body);
	-webkit-font-smoothing: antialiased;
}

.csl--dark {
	--csl-bg: #0e0d0c;
	--csl-fg: #f4efe8;
	--csl-muted: #a39b92;
	--csl-line: rgba(244, 239, 232, 0.16);
	--csl-card-bg: #1d1b19;
	--csl-shadow: rgba(0, 0, 0, 0.7);
}

.csl *,
.csl *::before,
.csl *::after {
	box-sizing: border-box;
}

.csl-block.alignfull {
	margin-top: 0;
	margin-bottom: 0;
}

/*
 * Page-builder themes (Astra) cap direct children of content blocks at the
 * content width. The layers must span the whole hero, or the grain/stage
 * show as a boxed panel while the cards spill past it.
 */
.csl > .csl__stage,
.csl > .csl__grain,
.csl > .csl__ui {
	max-width: none !important;
	margin: 0 !important;
}

/* ------------------------------------------------------------------ Stage */

.csl__stage {
	position: absolute;
	inset: 0;
	z-index: 1;
	outline: none;
	cursor: grab;
	touch-action: pan-y;
	-webkit-user-select: none;
	user-select: none;
}

.csl__stage.is-over-card {
	cursor: pointer;
}

.csl__stage.is-dragging {
	cursor: grabbing;
}

.csl__stage:focus-visible {
	box-shadow: inset 0 0 0 2px var(--csl-accent);
}

.csl__world {
	position: absolute;
	left: var(--csl-center-x, 55%);
	top: var(--csl-center-y, 54%);
	width: 0;
	height: 0;
	transform-style: preserve-3d;
}

.csl__card {
	position: absolute;
	left: 0;
	top: 0;
	display: block;
	width: var(--csl-cw);
	height: var(--csl-ch);
	margin: calc(var(--csl-ch) / -2) 0 0 calc(var(--csl-cw) / -2);
	color: inherit;
	text-decoration: none;
	outline: none;
	transform-style: preserve-3d;
	will-change: transform;
	-webkit-tap-highlight-color: transparent;
}

.csl__card[hidden] {
	display: none;
}

.csl__card-inner {
	position: absolute;
	inset: 0;
	transform-style: preserve-3d;
}

.csl__face {
	position: absolute;
	inset: 0;
	overflow: hidden;
	border-radius: var(--csl-radius);
	background: var(--csl-card-bg);
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	box-shadow:
		0 50px 80px -40px var(--csl-shadow),
		0 18px 30px -18px var(--csl-shadow);
}

.csl__face--back {
	transform: rotateY(180deg);
}

.csl__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
	-webkit-user-select: none;
	user-select: none;
}

/* Darkens faces turned away from the light, and fades far cards into the background. */
.csl__shade {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: #000;
	opacity: var(--csl-dark, 0);
}

.csl__shade::after {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--csl-bg);
	opacity: var(--csl-fog, 0);
}

/* Moving highlight: reacts to the card's angle like a light source would. */
.csl__glare {
	position: absolute;
	inset: -20%;
	pointer-events: none;
	background: radial-gradient(
		circle at var(--csl-gx, 30%) var(--csl-gy, 20%),
		rgba(255, 255, 255, 0.55) 0%,
		rgba(255, 255, 255, 0.12) 28%,
		rgba(255, 255, 255, 0) 55%
	);
	mix-blend-mode: soft-light;
	opacity: var(--csl-glare, 0.6);
}

.csl__badge {
	position: absolute;
	top: 12px;
	left: 12px;
	padding: 5px 10px;
	border-radius: 999px;
	background: var(--csl-bg);
	color: var(--csl-fg);
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.csl__back-text {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 24px;
	background: var(--csl-accent);
	color: #1c1917;
	text-align: center;
}

.csl__back-name {
	font-family: var(--csl-font-display);
	font-size: clamp(22px, 2.4vw, 34px);
	line-height: 1.05;
}

.csl__back-price {
	font-size: 13px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.csl__card:focus-visible .csl__face--front {
	outline: 2px solid var(--csl-accent);
	outline-offset: 6px;
}

/* Without the script: show the first product only. */
.csl:not(.is-ready) .csl__card ~ .csl__card {
	display: none;
}

/* ------------------------------------------------------------------ Grain */

.csl__grain {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	opacity: 0.05;
	mix-blend-mode: multiply;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.csl--dark .csl__grain {
	opacity: 0.06;
	mix-blend-mode: screen;
	filter: invert(1);
}

/* --------------------------------------------------------------------- UI */

.csl__ui {
	position: absolute;
	inset: 0;
	z-index: 3;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-rows: auto 1fr auto;
	padding-top: 5px;
	padding: var(--csl-offset-top) var(--csl-pad) var(--csl-pad);
	pointer-events: none;
}

.csl__ui a,
.csl__ui button,
.csl__review {
	pointer-events: auto;
}

.csl__mask {
	display: block;
	overflow: hidden;
}

.csl__swap {
	display: block;
}

.csl__head {
	grid-column: 1;
	grid-row: 1;
	width: min(360px, 30vw);
}

.csl__eyebrow {
	margin: 0 0 10px;
	color: var(--csl-accent-text);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	min-height: 1.3em;
}

/* Doubled class: theme rules such as `.entry-content h2` must not win. */
.csl .csl__title {
	margin: 0 0 22px;
	padding-bottom: 0.08em;
	color: var(--csl-fg);
	font-family: var(--csl-font-display);
	font-size: clamp(24px, 2.1vw, 32px);
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0;
}

.csl__meta {
	margin: 0;
}

.csl__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	padding: 9px 0 10px;
	border-top: 1px solid var(--csl-line);
}

.csl__row dt {
	flex: none;
	color: var(--csl-muted);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.csl__row dd {
	margin: 0;
	font-size: 14px;
	line-height: 1.4;
	text-align: right;
}

.csl__row dd del {
	margin-right: 6px;
	color: var(--csl-muted);
}

.csl__row dd ins {
	text-decoration: none;
}

.csl__count {
	display: flex;
	align-items: baseline;
	gap: 6px;
	font-family: var(--csl-font-display);
	line-height: 1;
}

.csl__count .csl__mask {
	font-size: 26px;
	padding-bottom: 0.06em;
}

.csl__count-total {
	color: var(--csl-muted);
	font-size: 13px;
}

.csl__count-total::before {
	content: "/ ";
}

.csl__foot {
	grid-column: 1 / -1;
	grid-row: 3;
	display: grid;
	grid-template-columns: 1fr minmax(0, 420px) 1fr;
	align-items: end;
	gap: 24px;
}

.csl__actions {
	grid-column: 1;
	justify-self: start;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.csl__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 48px;
	margin: 0;
	padding: 0 24px;
	border: 1px solid var(--csl-fg);
	border-radius: 999px;
	background: transparent;
	color: var(--csl-fg);
	font-family: var(--csl-font-body);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.16em;
	line-height: 1;
	text-decoration: none;
	text-transform: uppercase;
	transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.csl__btn--primary {
	background: var(--csl-fg);
	color: var(--csl-bg);
}

.csl__btn:hover,
.csl__btn:focus-visible {
	border-color: var(--csl-accent);
	background: var(--csl-accent);
	color: #1c1917;
}

.csl__btn:focus-visible,
.csl__arrow:focus-visible {
	outline: 2px solid var(--csl-accent);
	outline-offset: 3px;
}

.csl__review {
	grid-column: 2;
	justify-self: center;
	text-align: center;
}

.csl__review[hidden] {
	display: none;
}

.csl__stars {
	position: relative;
	display: inline-block;
	font-size: 13px;
	letter-spacing: 3px;
	line-height: 1;
}

.csl__stars::before {
	content: "★★★★★";
	color: var(--csl-line);
}

.csl__stars::after {
	content: "★★★★★";
	position: absolute;
	left: 0;
	top: 0;
	width: calc(var(--csl-rating, 0) / 5 * 100%);
	overflow: hidden;
	color: var(--csl-fg);
	white-space: nowrap;
}

.csl__review-count {
	margin-left: 8px;
	color: var(--csl-muted);
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	vertical-align: 2px;
}

.csl__quote {
	margin: 10px 0 6px;
	font-family: var(--csl-font-display);
	font-size: clamp(17px, 1.5vw, 22px);
	font-style: italic;
	line-height: 1.2;
}

.csl__quote .csl__swap::before {
	content: "“";
}

.csl__quote .csl__swap::after {
	content: "”";
}

.csl__author {
	color: var(--csl-muted);
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}

.csl__nav {
	grid-column: 3;
	justify-self: end;
	display: flex;
	align-items: center;
	gap: 14px;
}

.csl__arrow {
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--csl-line);
	border-radius: 50%;
	background: transparent;
	color: var(--csl-fg);
	cursor: pointer;
	transition: border-color 0.3s ease, background-color 0.3s ease, opacity 0.3s ease;
}

.csl__arrow:hover {
	border-color: var(--csl-fg);
}

.csl__arrow[aria-disabled="true"] {
	opacity: 0.3;
	cursor: default;
}

.csl__arrow svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.csl__progress {
	position: relative;
	width: clamp(80px, 9vw, 140px);
	height: 1px;
	background: var(--csl-line);
}

.csl__progress-fill {
	position: absolute;
	inset: -0.5px 0;
	background: var(--csl-fg);
	transform: scaleX(0);
	transform-origin: left center;
}

.csl__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.csl-empty {
	padding: 16px;
	border: 1px dashed currentColor;
}

/* ----------------------------------------------------------------- Tablet */

@media (max-width: 1100px) {
	.csl__head {
		width: min(320px, 36vw);
	}

	.csl__foot {
		grid-template-columns: 1fr auto;
	}

	.csl__nav {
		grid-column: 2;
	}

	.csl__review {
		display: none;
	}
}

/* ----------------------------------------------------------------- Mobile */

/*
 * Mobile: stage, product details and the button + arrows row must all fit
 * in the first screen (~640px below a 72px header on small phones).
 */
@media (max-width: 767px) {
	.csl {
		height: auto;
		min-height: 0;
		padding-top: 8px;
	}

	.csl {
		--csl-center-x: 50%;
		--csl-center-y: 50%;
	}

	.csl__stage {
		position: relative;
		inset: auto;
		height: min(50svh, 420px);
		min-height: 300px;
	}

	.csl__ui {
		position: relative;
		inset: auto;
		display: flex;
		flex-direction: column;
		gap: 14px;
		padding: 4px var(--csl-pad) 24px;
	}

	.csl__head {
		width: 100%;
	}

	.csl__eyebrow {
		margin-bottom: 6px;
	}

	.csl .csl__title {
		margin-bottom: 10px;
		font-size: clamp(22px, 6.4vw, 28px);
	}

	.csl__row {
		padding: 6px 0 7px;
	}

	/* Price only; long colour lists push the button off screen. */
	.csl__row + .csl__row {
		display: none;
	}

	.csl__foot {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 12px;
	}

	.csl__review:not([hidden]) {
		display: block;
		flex-basis: 100%;
		order: -1;
		text-align: left;
	}

	.csl__actions {
		flex: 1;
		min-width: 0;
	}

	.csl__btn {
		width: 100%;
	}

	.csl__nav {
		gap: 8px;
	}

	.csl__count,
	.csl__progress {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.csl__btn,
	.csl__arrow {
		transition: none;
	}
}
