/* ==========================================================================
   Before/After Slider - Frontend Styles
   ========================================================================== */

/* --- Container --- */
.ba-container {
	--ba-position: 50%;
	--ba-divider-width: 2px;
	--ba-divider-color: #ffffff;
	--ba-handle-size: 50px;
	--ba-handle-color: #ffffff;
	--ba-handle-opacity: 1;
	position: relative;
	overflow: hidden;
	width: var(--ba-width, 100%);
	height: var(--ba-height, auto);
	aspect-ratio: var(--ba-aspect-ratio, auto);
	margin: 0 auto;
	line-height: 0;
	direction: ltr;
	cursor: ew-resize;
	-webkit-user-select: none;
	user-select: none;
	touch-action: pan-y;
}

.ba-container[data-ba-direction="vertical"] {
	cursor: ns-resize;
	touch-action: pan-x;
}

/* --- Image layers --- */
.ba-layer--after {
	position: relative;
	width: 100%;
}

.ba-layer--before {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	clip-path: inset(0 calc(100% - var(--ba-position)) 0 0);
	z-index: 1;
}

.ba-container[data-ba-direction="vertical"] .ba-layer--before {
	clip-path: inset(0 0 calc(100% - var(--ba-position)) 0);
}

.ba-layer .ba-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* --- Divider line --- */
.ba-divider {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--ba-position);
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	transform: translateX(-50%);
}

.ba-container[data-ba-direction="vertical"] .ba-divider {
	top: var(--ba-position);
	bottom: auto;
	left: 0;
	right: 0;
	transform: translateY(-50%);
	flex-direction: row;
}

.ba-divider::before {
	content: '';
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	width: var(--ba-divider-width);
	background: var(--ba-divider-color);
}

.ba-container[data-ba-direction="vertical"] .ba-divider::before {
	top: 50%;
	bottom: auto;
	left: 0;
	right: 0;
	width: auto;
	height: var(--ba-divider-width);
	transform: translateY(-50%);
}

/* --- Handle button --- */
.ba-handle {
	pointer-events: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--ba-handle-size);
	height: var(--ba-handle-size);
	border: 3px solid var(--ba-handle-color);
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.2);
	color: var(--ba-handle-color);
	opacity: var(--ba-handle-opacity);
	cursor: inherit;
	padding: 0;
	box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
	transition: opacity 0.15s ease, transform 0.15s ease;
}

.ba-handle:hover,
.ba-handle:focus-visible {
	opacity: 1;
	transform: scale(1.08);
}

.ba-handle:focus-visible {
	outline: 2px solid #007cba;
	outline-offset: 2px;
}

/* --- Handle SVG icon --- */
.ba-handle-icon {
	width: 60%;
	height: 60%;
	fill: none;
	stroke-width: 2;
}

.ba-container[data-ba-direction="vertical"] .ba-handle-icon {
	transform: rotate(90deg);
}

/* --- Caption --- */
.ba-caption {
	margin-top: 0.5em;
	text-align: center;
	font-size: 0.875em;
	color: inherit;
	opacity: 0.8;
	line-height: 1.4;
}
