/* ==========================================================
 * Snap Before/After — Widget Styles
 * ----------------------------------------------------------
 * LVHA pseudo-class order enforced everywhere.
 * No emoji icons. Inline SVG with currentColor in markup.
 * Focus-visible outlines required for keyboard accessibility.
 * ========================================================== */

.snap-ba {
	position: relative;
	display: block;
	width: 100%;
	max-width: 100%;
	margin: 0;
	background: #0b1d3a;
	overflow: hidden;
	user-select: none;
	-webkit-user-select: none;
	touch-action: none;
}

.snap-ba.snap-ba--ratio {
	height: 0;
	padding-bottom: var(--sba-ratio-padding, 56.25%);
}

.snap-ba__stage {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

.snap-ba.snap-ba--ratio .snap-ba__stage {
	position: absolute;
	inset: 0;
}

/* After image — full size, sits below the before clip */
.snap-ba__after-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	user-select: none;
	-webkit-user-drag: none;
	pointer-events: none;
}

.snap-ba.snap-ba--contain .snap-ba__after-img,
.snap-ba.snap-ba--contain .snap-ba__before-img {
	object-fit: contain;
}

/* Before container — clip-path animated by JS */
.snap-ba__before {
	position: absolute;
	inset: 0;
	overflow: hidden;
	pointer-events: none;
	will-change: clip-path;
}

.snap-ba__before-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	user-select: none;
	-webkit-user-drag: none;
	pointer-events: none;
}

/* ----------------------------------------------------------
 * Divider line
 * ---------------------------------------------------------- */
.snap-ba__divider {
	position: absolute;
	background: #fff;
	pointer-events: none;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.18);
	will-change: transform;
}

.snap-ba--horizontal .snap-ba__divider {
	top: 0;
	bottom: 0;
	left: 50%;
	width: 3px;
	transform: translateX(-50%);
}

.snap-ba--vertical .snap-ba__divider {
	left: 0;
	right: 0;
	top: 50%;
	height: 3px;
	transform: translateY(-50%);
}

/* ----------------------------------------------------------
 * Handle (button)
 * ---------------------------------------------------------- */
.snap-ba__handle {
	position: absolute;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin: 0;
	padding: 0;
	background: #fff;
	color: #0b1d3a;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
	cursor: grab;
	font: inherit;
	-webkit-appearance: none;
	appearance: none;
	will-change: transform;
	z-index: 3;
	touch-action: none;
}

.snap-ba--horizontal .snap-ba__handle {
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}

.snap-ba--vertical .snap-ba__handle {
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
}

/* LVHA — link/visited/hover/active (focus rules use focus-visible separately) */
.snap-ba__handle:link,
.snap-ba__handle:visited {
	color: #0b1d3a;
}

.snap-ba__handle:hover {
	color: #0b1d3a;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
}

.snap-ba__handle:focus {
	outline: 0;
}

.snap-ba__handle:focus-visible {
	outline: 3px solid #1258c2;
	outline-offset: 3px;
}

.snap-ba__handle:active {
	cursor: grabbing;
	box-shadow: 0 8px 22px rgba(0, 0, 0, 0.36);
}

.snap-ba__handle svg {
	display: block;
	width: 60%;
	height: 60%;
	color: inherit;
	pointer-events: none;
}

/* When the user is dragging, prevent text selection on the page */
.snap-ba.is-dragging,
.snap-ba.is-dragging * {
	cursor: grabbing !important;
	user-select: none;
	-webkit-user-select: none;
}

/* ----------------------------------------------------------
 * Labels
 * ---------------------------------------------------------- */
.snap-ba__label {
	--sba-label-offset: 16px;
	position: absolute;
	display: inline-block;
	max-width: calc(50% - var(--sba-label-offset) - 8px);
	padding: 6px 12px;
	background: rgba(11, 29, 58, 0.85);
	color: #fff;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.4;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
	border-radius: 4px;
	pointer-events: none;
	z-index: 2;
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
}

/* Horizontal: before goes top-left, after goes top-right */
.snap-ba--horizontal .snap-ba__label--before {
	top: var(--sba-label-offset);
	left: var(--sba-label-offset);
}

.snap-ba--horizontal .snap-ba__label--after {
	top: var(--sba-label-offset);
	right: var(--sba-label-offset);
}

/* Vertical: before goes top, after goes bottom (both centered) */
.snap-ba--vertical .snap-ba__label--before {
	top: var(--sba-label-offset);
	left: 50%;
	transform: translateX(-50%);
}

.snap-ba--vertical .snap-ba__label--after {
	bottom: var(--sba-label-offset);
	left: 50%;
	transform: translateX(-50%);
}

/* ----------------------------------------------------------
 * Editor empty state
 * ---------------------------------------------------------- */
.snap-ba-empty {
	padding: 2rem;
	text-align: center;
	background: #f3f4f6;
	border: 2px dashed #cbd5e1;
	color: #4b5563;
	border-radius: 6px;
	font-size: 0.95rem;
}

/* ----------------------------------------------------------
 * Screen reader only (in case theme doesn't provide it)
 * ---------------------------------------------------------- */
.snap-ba .screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	width: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	word-wrap: normal !important;
}

/* ----------------------------------------------------------
 * Reduced motion — disable animation transitions
 * ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.snap-ba__before,
	.snap-ba__divider,
	.snap-ba__handle {
		transition: none !important;
	}
}

/* ----------------------------------------------------------
 * High contrast / forced colors
 * ---------------------------------------------------------- */
@media (forced-colors: active) {
	.snap-ba__divider {
		background: CanvasText;
	}
	.snap-ba__handle {
		background: ButtonFace;
		color: ButtonText;
		border-color: ButtonText;
	}
	.snap-ba__handle:focus-visible {
		outline-color: Highlight;
	}
}
