/**
 * Before & After Slider — frontend styles.
 *
 * Colors and radius come from CSS custom properties printed inline by
 * the shortcode (derived from the Settings screen).
 */

.bas-carousel {
	--bas-primary: #1de0e4;
	--bas-handle: #1de0e4;
	--bas-handle-icon: #0a2540;
	--bas-divider: #1de0e4;
	--bas-before-bg: #3a3a3a;
	--bas-after-bg: #1de0e4;
	--bas-text: #ffffff;
	--bas-after-text: #0a2540;
	--bas-radius: 16px;
	--bas-shadow: 0 10px 30px rgba( 0, 0, 0, 0.12 );
	--bas-ratio: 16 / 8;

	position: relative;
	overflow: hidden;
	width: 100%;
	box-sizing: border-box;
	padding: 8px 0 44px;
}

.bas-carousel * {
	box-sizing: border-box;
}

.bas-track {
	display: flex;
	transition: transform 0.45s ease;
	will-change: transform;
}

.bas-card {
	flex: 0 0 50%;
	max-width: 50%;
	padding: 12px;
}

.bas-compare {
	position: relative;
	width: 100%;
	aspect-ratio: var( --bas-ratio );
	overflow: hidden;
	border-radius: var( --bas-radius );
	box-shadow: var( --bas-shadow );
	cursor: ew-resize;
	user-select: none;
	background: #e5e7eb;
	outline: none;
}

.bas-compare:focus-visible {
	box-shadow: 0 0 0 3px var( --bas-primary ), var( --bas-shadow );
}

.bas-after-wrap,
.bas-before-wrap {
	position: absolute;
	inset: 0;
	height: 100%;
	overflow: hidden;
}

.bas-before-wrap {
	width: 50%;
	border-right: 3px solid var( --bas-divider );
}

.bas-img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100% !important;
	object-fit: cover;
	max-width: none;
	pointer-events: none;
}

/*
 * The before image is clipped by .bas-before-wrap (which changes width as
 * you drag). To keep the image visually full-size and left-anchored — so the
 * divider slides across a stationary image instead of squashing it — the
 * image is locked to the card's full pixel width via a JS-set custom
 * property. The 100vw fallback keeps it wide before JS runs; the wrapper's
 * overflow:hidden clips the excess.
 */
.bas-before-wrap .bas-img {
	width: var( --bas-card-width, 100% );
	min-width: var( --bas-card-width, 100% );
	max-width: none;
	left: 0;
}

.bas-label {
	position: absolute;
	bottom: 18px;
	padding: 7px 18px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.03em;
	color: var( --bas-text );
	border-radius: 999px;
	z-index: 3;
	white-space: nowrap;
}

.bas-label-before {
	left: 18px;
}

.bas-label-after {
	right: 18px;
}

.bas-label-before {
	background: var( --bas-before-bg );
	color: var( --bas-text );
}

.bas-label-after {
	background: var( --bas-after-bg );
	color: var( --bas-after-text );
}

.bas-handle {
	position: absolute;
	top: 0;
	left: 50%;
	height: 100%;
	width: 0;
	transform: translateX( -50% );
	z-index: 4;
	pointer-events: none;
}

.bas-handle-line {
	position: absolute;
	top: 0;
	left: 50%;
	width: 3px;
	height: 100%;
	background: var( --bas-divider );
	transform: translateX( -50% );
}

.bas-handle-circle {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1px;
	background: var( --bas-handle );
	border-radius: 50%;
	transform: translate( -50%, -50% );
	box-shadow: 0 2px 10px rgba( 0, 0, 0, 0.2 );
	color: var( --bas-handle-icon );
	font-size: 22px;
	font-weight: 700;
	line-height: 1;
}

.bas-compare.is-dragging .bas-track {
	transition: none;
}

.bas-card-body {
	padding: 12px 4px 0;
}

.bas-card-title {
	margin: 0 0 4px;
	font-size: 17px;
	line-height: 1.3;
}

.bas-card-desc {
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
	opacity: 0.8;
}

/* Navigation arrows. */
.bas-nav {
	position: absolute;
	top: 40%;
	transform: translateY( -50% );
	width: 42px;
	height: 42px;
	border: none;
	border-radius: 50%;
	background: #ffffff;
	color: #111827;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 2px 10px rgba( 0, 0, 0, 0.15 );
	z-index: 6;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s;
}

.bas-nav:hover {
	background: var( --bas-primary );
	color: #ffffff;
}

.bas-prev {
	left: 6px;
}

.bas-next {
	right: 6px;
}

/* Pagination dots. */
.bas-dots {
	position: absolute;
	bottom: 12px;
	left: 0;
	right: 0;
	display: flex;
	justify-content: center;
	gap: 8px;
	z-index: 6;
}

.bas-dot {
	width: 10px;
	height: 10px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.25 );
	cursor: pointer;
	transition: background 0.2s, transform 0.2s;
}

.bas-dot.is-active {
	background: var( --bas-primary );
	transform: scale( 1.3 );
}

/* Responsive fallbacks (JS also handles this). */
@media ( max-width: 1024px ) {
	.bas-card {
		flex-basis: 50%;
		max-width: 50%;
	}
}

@media ( max-width: 640px ) {
	.bas-card {
		flex-basis: 100%;
		max-width: 100%;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.bas-track {
		transition: none;
	}
}
