/* ============================ Before / after ============================ */

.bb-ba__frame {
	--bb-pos: 50%;
	--bb-handle: #FFFFFF;

	position: relative;
	aspect-ratio: 1.7;
	border-radius: 14px;
	overflow: hidden;
	background: var(--bb-grey-bg);
	cursor: ew-resize;
	touch-action: none;
	user-select: none;
}

.bb-ba__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* The "before" image stays full size and is revealed with clip-path, so it
   never squashes and no container-query units are needed. */
.bb-ba__img--before {
	z-index: 2;
	clip-path: inset( 0 calc( 100% - var( --bb-pos ) ) 0 0 );
}

.bb-ba__divider {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--bb-pos);
	z-index: 3;
	width: 3px;
	margin-left: -1.5px;
	background: var(--bb-handle);
	box-shadow: 0 0 12px rgba(0, 0, 0, .3);
	pointer-events: none;
}

.bb-ba__grip {
	position: absolute;
	top: 50%;
	left: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	background: var(--bb-handle);
	box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
}

.bb-ba__grip::before,
.bb-ba__grip::after {
	content: "";
	position: absolute;
	width: 0;
	height: 0;
	border-block: 5px solid transparent;
}

.bb-ba__grip::before {
	left: 11px;
	border-right: 7px solid var(--bb-navy);
}

.bb-ba__grip::after {
	right: 11px;
	border-left: 7px solid var(--bb-navy);
}

.bb-ba__frame.is-dragging .bb-ba__grip {
	transform: translate(-50%, -50%) scale(1.08);
}

.bb-ba__tag {
	position: absolute;
	top: 14px;
	z-index: 4;
	padding: 6px 14px;
	border-radius: 999px;
	background: rgba(14, 33, 72, .85);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	pointer-events: none;
}

.bb-ba__tag--before {
	left: 14px;
}

.bb-ba__tag--after {
	right: 14px;
	background: var(--bb-saffron);
}

/* The range is the accessible control; it sits invisible over the frame. */
.bb-ba__range {
	position: absolute;
	inset: auto 0 0 0;
	z-index: 5;
	width: 100%;
	margin: 0;
	opacity: 0;
	height: 100%;
	cursor: ew-resize;
}

.bb-ba__range:focus-visible {
	opacity: .001;
	outline: 3px solid var(--bb-saffron);
	outline-offset: -3px;
}

.bb-ba__caption {
	margin: 14px 0 0;
	color: var(--bb-body);
	font-size: 14px;
	text-align: center;
}

@media (max-width: 767px) {
	.bb-ba__grip {
		width: 36px;
		height: 36px;
	}

	.bb-ba__tag {
		top: 10px;
		padding: 5px 11px;
		font-size: 12px;
	}
}
