.kbas-comparison {
	--kbas-position: 50%;
	--kbas-aspect-ratio: 16 / 9;
	--kbas-accent: #ffffff;
	--kbas-shadow: rgba(0, 0, 0, 0.28);
	box-sizing: border-box;
	position: relative;
	width: 100%;
	max-width: 100%;
	overflow: hidden;
	border-radius: inherit;
	isolation: isolate;
}

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

.kbas-media {
	position: relative;
	width: 100%;
	aspect-ratio: var(--kbas-aspect-ratio);
	overflow: hidden;
	background: #e7e7e7;
	border-radius: inherit;
	touch-action: pan-y;
	user-select: none;
}

.kbas-image {
	display: block;
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-position: center;
	pointer-events: none;
	user-select: none;
}

.kbas-fit-cover .kbas-image {
	object-fit: cover;
}

.kbas-fit-contain .kbas-image {
	object-fit: contain;
}

.kbas-image--after {
	z-index: 1;
}

.kbas-image--before {
	z-index: 2;
	clip-path: inset(0 calc(100% - var(--kbas-position)) 0 0);
	will-change: clip-path;
}

.kbas-aspect-natural .kbas-media {
	aspect-ratio: auto;
}

.kbas-aspect-natural .kbas-image--after {
	position: relative;
	height: auto;
}

.kbas-aspect-natural .kbas-image--before {
	height: 100%;
}

.kbas-divider {
	position: absolute;
	z-index: 4;
	top: 0;
	bottom: 0;
	left: var(--kbas-position);
	width: 3px;
	transform: translateX(-50%);
	background: var(--kbas-accent);
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 0 9px var(--kbas-shadow);
	pointer-events: none;
}

.kbas-handle {
	position: absolute;
	top: 50%;
	left: 50%;
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	transform: translate(-50%, -50%);
	color: #1c1c1c;
	background: var(--kbas-accent);
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 999px;
	box-shadow: 0 3px 14px var(--kbas-shadow);
}

.kbas-handle svg {
	display: block;
	width: 28px;
	height: 20px;
}

.kbas-handle path {
	fill: none;
	stroke: currentColor;
	stroke-width: 2.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.kbas-label {
	position: absolute;
	z-index: 3;
	top: 16px;
	padding: 7px 11px;
	color: #fff;
	font-family: inherit;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	background: rgba(0, 0, 0, 0.62);
	border-radius: 4px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
	pointer-events: none;
}

.kbas-label--before {
	left: 16px;
}

.kbas-label--after {
	right: 16px;
}

.kbas-range {
	position: absolute;
	z-index: 5;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: ew-resize;
	touch-action: pan-y;
}

.kbas-has-focus .kbas-media,
.kbas-media:has(.kbas-range:focus-visible) {
	outline: 3px solid #2271b1;
	outline-offset: -3px;
}

.kbas-missing-images {
	padding: 16px;
	color: #5a1e00;
	background: #fff1e8;
	border-left: 4px solid #d63638;
}

@media (max-width: 480px) {
	.kbas-handle {
		width: 42px;
		height: 42px;
	}

	.kbas-label {
		top: 10px;
		padding: 6px 8px;
		font-size: 10px;
	}

	.kbas-label--before {
		left: 10px;
	}

	.kbas-label--after {
		right: 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.kbas-image--before,
	.kbas-divider {
		will-change: auto;
	}
}
