/**
 * POTERA "Vorher / Nachher" widget.
 *
 * The two photos are stacked in one frame; the before photo is clipped to
 * --pba-pos, so moving the handle wipes between the two states. The frame owns
 * the height, both photos fill it identically, or the wipe would not line up.
 * Everything the widget's Elementor controls can change is written as a custom
 * property so the generated selectors stay one line each.
 */

.pba {
	--pba-pos: 50%;
	--pba-divider-width: 3px;
	--pba-divider-color: #FFFFFF;
	--pba-focus-color: #1668D8;
	position: relative;
	isolation: isolate;
	overflow: hidden;
	min-height: 220px;
	background: #12296B;
	cursor: ew-resize;
	touch-action: pan-y; /* vertical page scrolling must still work on touch */
	-webkit-user-select: none;
	user-select: none;
}

/* Both photos occupy exactly the same box. */
.pba__pane {
	position: absolute;
	inset: 0;
	margin: 0;
}

.pba__pane--before {
	z-index: 2;
	clip-path: inset(0 calc(100% - var(--pba-pos)) 0 0);
}

.pba__pane--after {
	z-index: 1;
}

.pba__pane img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	pointer-events: none;
}

/* Labels sit above both photos and never eat a drag. */
.pba__label {
	position: absolute;
	top: 14px;
	z-index: 4;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.pba__label--before {
	left: 14px;
}

.pba__label--after {
	right: 14px;
}

/* The divider line is drawn by the grip, so the two can never drift apart. */
.pba__handle {
	position: absolute;
	top: 50%;
	left: var(--pba-pos);
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transform: translate(-50%, -50%);
	cursor: ew-resize;
}

.pba__handle::before {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	z-index: -1;
	width: var(--pba-divider-width);
	height: 200vh;
	background: var(--pba-divider-color);
	box-shadow: 0 0 0 1px rgba(18, 41, 107, .10);
	transform: translate(-50%, -50%);
}

.pba__handle:focus-visible {
	outline: 3px solid var(--pba-focus-color);
	outline-offset: 3px;
}

.pba__handle svg,
.pba__handle i {
	display: block;
}

.pba__handle svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.pba.is-dragging,
.pba.is-dragging .pba__handle {
	cursor: grabbing;
}

@media (max-width: 767px) {

	.pba__label {
		top: 10px;
	}

	.pba__label--before {
		left: 10px;
	}

	.pba__label--after {
		right: 10px;
	}
}
