/* Classic Addons - Before / After Image Comparison */
.caw-before-after {
	--caw-ba-divider-color: #ffffff;
	--caw-ba-divider-width: 3px;
	--caw-ba-handle-size: 40px;
	position: relative;
	width: 100%;
	margin: 0 auto;
	box-sizing: border-box;
	user-select: none;
	-webkit-user-select: none;
}
.caw-before-after *,
.caw-before-after *::before,
.caw-before-after *::after { box-sizing: border-box; }

.caw-before-after-empty {
	padding: 24px;
	text-align: center;
	background: #fafafa;
	border: 1px dashed #ccc;
	color: #777;
}

.caw-ba-frame {
	position: relative;
	width: 100%;
	overflow: hidden;
	line-height: 0;
	touch-action: none;
}

.caw-ba-before,
.caw-ba-after-inner {
	position: relative;
	width: 100%;
	display: block;
}
.caw-ba-before img,
.caw-ba-after-inner img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
	user-select: none;
	-webkit-user-drag: none;
	pointer-events: none;
}

.caw-ba-after {
	position: absolute;
	top: 0;
	left: 0;
	overflow: hidden;
	will-change: width, height;
}
.caw-ba-orient-horizontal .caw-ba-after { height: 100%; width: 50%; }
.caw-ba-orient-vertical   .caw-ba-after { width: 100%; height: 50%; }

.caw-ba-orient-horizontal .caw-ba-after-inner { width: auto; }
.caw-ba-orient-vertical   .caw-ba-after-inner { width: 100%; }

/* Lock the inner image so it doesn't squish when the clip slides */
.caw-ba-after-inner {
	position: relative;
	width: 100%;
}
.caw-ba-orient-horizontal .caw-ba-after-inner img {
	width: var(--caw-ba-frame-width, 100%);
	max-width: none;
}
.caw-ba-orient-vertical .caw-ba-after-inner img {
	width: 100%;
}

/* Divider */
.caw-ba-divider {
	position: absolute;
	background-color: var(--caw-ba-divider-color);
	pointer-events: none;
	z-index: 3;
}
.caw-ba-orient-horizontal .caw-ba-divider {
	top: 0;
	bottom: 0;
	width: var(--caw-ba-divider-width);
	transform: translateX(-50%);
}
.caw-ba-orient-vertical .caw-ba-divider {
	left: 0;
	right: 0;
	height: var(--caw-ba-divider-width);
	transform: translateY(-50%);
}

/* Handle */
.caw-ba-handle {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: var(--caw-ba-handle-size);
	height: var(--caw-ba-handle-size);
	border-radius: 50%;
	background-color: #ffffff;
	color: #333333;
	border: 0;
	padding: 0;
	cursor: ew-resize;
	pointer-events: auto;
	box-shadow: 0 2px 6px rgba(0,0,0,0.2);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	z-index: 4;
}
.caw-ba-orient-vertical .caw-ba-handle { cursor: ns-resize; }
.caw-ba-mode-hover .caw-ba-handle { cursor: default; }
.caw-ba-handle:focus { outline: 2px solid #2271b1; outline-offset: 2px; }

.caw-ba-arrow {
	width: 0;
	height: 0;
	border-style: solid;
}
.caw-ba-orient-horizontal .caw-ba-arrow-1 {
	border-width: 5px 7px 5px 0;
	border-color: transparent currentColor transparent transparent;
}
.caw-ba-orient-horizontal .caw-ba-arrow-2 {
	border-width: 5px 0 5px 7px;
	border-color: transparent transparent transparent currentColor;
}
.caw-ba-orient-vertical .caw-ba-arrow-1 {
	border-width: 0 5px 7px 5px;
	border-color: transparent transparent currentColor transparent;
}
.caw-ba-orient-vertical .caw-ba-arrow-2 {
	border-width: 7px 5px 0 5px;
	border-color: currentColor transparent transparent transparent;
}
.caw-ba-orient-vertical .caw-ba-handle { flex-direction: column; }

/* Labels */
.caw-ba-label {
	position: absolute;
	z-index: 2;
	padding: 4px 10px;
	font-size: 12px;
	line-height: 1.4;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #fff;
	background-color: rgba(0,0,0,0.5);
	border-radius: 2px;
	pointer-events: none;
}
.caw-ba-orient-horizontal .caw-ba-label-before { top: 12px; left: 12px; }
.caw-ba-orient-horizontal .caw-ba-label-after  { top: 12px; right: 12px; }
.caw-ba-orient-vertical   .caw-ba-label-before { top: 12px; left: 12px; }
.caw-ba-orient-vertical   .caw-ba-label-after  { bottom: 12px; left: 12px; }

@media (max-width: 540px) {
	.caw-before-after { --caw-ba-handle-size: 34px; }
	.caw-ba-label { font-size: 11px; padding: 3px 8px; }
}
