/* =========================================================
   LH Before / After image comparison slider
   Position driven by --lh-ba-pos (0–100), set from the
   invisible range input in lh-before-after.js
   ========================================================= */

.lh-ba__frame {
	--lh-ba-pos: 50;
	position: relative;
	width: 100%;
	overflow: hidden;
	border-radius: 1rem;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
	user-select: none;
	-webkit-user-select: none;
	background: var(--color-gray-200, #e5e7eb);
}

.lh-ba__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	pointer-events: none;
}

/* After image sits on top, clipped to the right of the handle */
.lh-ba__after-clip {
	position: absolute;
	inset: 0;
	clip-path: inset(0 0 0 calc(var(--lh-ba-pos) * 1%));
	will-change: clip-path;
}

/* Divider + grip */
.lh-ba__handle {
	position: absolute;
	top: 0;
	bottom: 0;
	left: calc(var(--lh-ba-pos) * 1%);
	width: 0;
	pointer-events: none;
	will-change: left;
}

.lh-ba__handle::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: -2px;
	width: 4px;
	background: #fff;
	box-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
}

.lh-ba__handle-grip {
	position: absolute;
	top: 50%;
	left: 0;
	transform: translate(-50%, -50%);
	width: 3rem;
	height: 3rem;
	border-radius: 9999px;
	background: #fff;
	color: var(--color-primary, #1f2937);
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

/* Labels */
.lh-ba__badge {
	position: absolute;
	bottom: 0.75rem;
	padding: 0.35rem 0.9rem;
	border-radius: 9999px;
	font-family: boucherie-block, sans-serif !important;
	font-size: 0.95rem;
	font-weight: 400;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--color-alert, #f89e24);
	background: #002435;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.lh-ba__badge--before {
	left: 0.75rem;
}

.lh-ba__badge--after {
	right: 0.75rem;
}

/* Hide a label when the handle passes over its side */
.lh-ba__frame[data-lh-ba-min] .lh-ba__badge--before {
	opacity: 0;
}

.lh-ba__frame[data-lh-ba-max] .lh-ba__badge--after {
	opacity: 0;
}

/* Invisible range input on top drives everything:
   native drag, touch and keyboard support for free. */
.lh-ba__range {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: ew-resize;
	touch-action: pan-y; /* keep vertical page scroll working on touch */
	-webkit-appearance: none;
	appearance: none;
}

/* Big invisible thumb so grabbing near the handle always works */
.lh-ba__range::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 3rem;
	height: 100%;
}

.lh-ba__range::-moz-range-thumb {
	width: 3rem;
	height: 100%;
	border: 0;
}

/* Visible focus ring for keyboard users */
.lh-ba__range:focus-visible + .lh-ba__handle .lh-ba__handle-grip,
.lh-ba__frame:has(.lh-ba__range:focus-visible) .lh-ba__handle-grip {
	outline: 3px solid var(--color-action, #f59e0b);
	outline-offset: 2px;
}

.lh-ba__caption {
	margin-top: 0.75rem;
	text-align: center;
	font-size: 0.9rem;
	color: var(--color-gray-700, #4b5563);
}
