/**
 * Before/After Image Slider Styles
 * Responsive, touch-friendly comparison slider
 */

.before-after-container {
	position: relative;
	width: 100%;
	max-width: 100%;
	overflow: hidden;
	border-radius: 12px;
	box-shadow: 0 10px 30px rgba(8, 25, 35, 0.15);
	user-select: none;
	-webkit-user-select: none;
	touch-action: pan-y;
}

.before-after-container.fullwidth {
	border-radius: 0;
}

/* Image containers */
.ba-before,
.ba-after {
	position: relative;
	width: 100%;
	display: block;
	aspect-ratio: 16 / 9;
}

.ba-before img,
.ba-after img {
	width: 100%;
	height: 100%;
	display: block;
	pointer-events: none;
	object-fit: cover;
}

.ba-after {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	clip-path: inset(0 50% 0 0);
	transition: clip-path 0.05s ease-out;
	overflow: hidden;
}

/* Labels */
.ba-label {
	position: absolute;
	top: 16px;
	padding: 6px 14px;
	background: rgba(8, 25, 35, 0.9);
	backdrop-filter: blur(10px);
	color: white;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	border-radius: 6px;
	z-index: 2;
	pointer-events: none;
}

.ba-label.before {
	right: 16px;
	opacity: 1;
	transition: opacity 0.2s ease;
}

.ba-label.after {
	left: 16px;
}

/* Slider control */
.ba-slider {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 4px;
	background: white;
	box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
	z-index: 3;
	cursor: ew-resize;
	transform: translateX(-50%);
	transition: width 0.2s ease;
}

.ba-slider::before,
.ba-slider::after {
	content: '';
	position: absolute;
	left: 50%;
	width: 0;
	height: 0;
	border-style: solid;
	transform: translateX(-50%);
}

.ba-slider::before {
	top: 0;
	border-width: 0 8px 12px 8px;
	border-color: transparent transparent white transparent;
}

.ba-slider::after {
	bottom: 0;
	border-width: 12px 8px 0 8px;
	border-color: white transparent transparent transparent;
}

/* Handle */
.ba-handle {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 48px;
	height: 48px;
	background: white;
	border: 3px solid #0D5BD3;
	border-radius: 50%;
	transform: translate(-50%, -50%);
	cursor: ew-resize;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	transition: all 0.2s ease;
	z-index: 4;
	display: flex;
	align-items: center;
	justify-content: center;
	touch-action: none;
}

.ba-handle::before,
.ba-handle::after {
	content: '';
	position: absolute;
	width: 10px;
	height: 2px;
	background: #0D5BD3;
	top: 50%;
	transform: translateY(-50%);
}

.ba-handle::before {
	left: 8px;
	-webkit-mask-image: linear-gradient(to right, transparent, #0D5BD3 30%);
	mask-image: linear-gradient(to right, transparent, #0D5BD3 30%);
}

.ba-handle::after {
	right: 8px;
	-webkit-mask-image: linear-gradient(to left, transparent, #0D5BD3 30%);
	mask-image: linear-gradient(to left, transparent, #0D5BD3 30%);
}

/* Arrows icon */
.ba-handle svg {
	width: 20px;
	height: 20px;
	color: #0D5BD3;
	pointer-events: none;
}

/* Hover/Active states */
.ba-handle:hover,
.ba-handle:focus {
	transform: translate(-50%, -50%) scale(1.1);
	box-shadow: 0 6px 20px rgba(13, 91, 211, 0.4);
	outline: none;
}

.ba-handle:focus {
	border-color: #0A4FB5;
	box-shadow: 0 0 0 4px rgba(13, 91, 211, 0.2);
	outline: 3px solid #0D5BD3;
	outline-offset: 2px;
}

.ba-handle.active {
	transform: translate(-50%, -50%) scale(1.05);
	cursor: grabbing;
}

.ba-slider:hover {
	width: 6px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.ba-label {
		font-size: 12px;
		padding: 6px 12px;
		top: 12px;
	}

	.ba-label.before {
		left: 12px;
	}

	.ba-label.after {
		right: 12px;
	}

	.ba-handle {
		width: 40px;
		height: 40px;
	}

	.ba-handle svg {
		width: 16px;
		height: 16px;
	}
}

@media (max-width: 480px) {
	.ba-label {
		font-size: 11px;
		padding: 5px 10px;
		top: 8px;
	}

	.ba-label.before {
		right: 8px;
	}

	.ba-label.after {
		left: 8px;
	}
}

/* Accessibility: Reduce motion */
@media (prefers-reduced-motion: reduce) {
	.ba-after,
	.ba-handle,
	.ba-slider {
		transition: none;
	}
}
