/* ==========================================================================
   Divi Before/After Slider — Frontend Styles
   ========================================================================== */

/* ---- Wrapper ---- */
.dbas-slider-wrapper {
	position: relative;
	height: var(--dbas-height, 400px);
	overflow: hidden;
	cursor: ew-resize;
	user-select: none;
	-webkit-user-select: none;
	touch-action: pan-y;
	background: #111;
	/* Respect any border-radius set via Divi design options */
}

/* ---- After side (full-width background layer) ---- */
.dbas-after-side {
	position: absolute;
	inset: 0;
	z-index: 1;
}

/* ---- Before side (full-width layer revealed via clip-path) ---- */
.dbas-before-side {
	position: absolute;
	inset: 0;
	width: 100%;
	z-index: 2;
	/* clip-path is set and updated by JS — no overflow:hidden needed */
}

/* ---- Images — centered with object-fit ---- */
.dbas-image {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	object-fit: cover;
	object-position: center center;
	pointer-events: none;
	display: block;
}

.dbas-after-image {
	width: 100%;
}

.dbas-before-image {
	width: 100%;
}

/* ---- Placeholder when no image is chosen ---- */
.dbas-placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #2a2a2a;
	color: #888;
	font-size: 14px;
	font-style: italic;
}

/* ---- Divider handle ---- */
.dbas-handle {
	position: absolute;
	top: 0;
	bottom: 0;
	/* left is set by JS */
	z-index: 3;
	/* Center the handle on the divider line */
	transform: translateX(-50%);
	/* Make hit target wide enough to grab easily */
	width: 44px;
	margin-left: calc(var(--dbas-line-width, 2px) / 2 - 22px);
}

.dbas-divider-line {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: var(--dbas-line-width, 2px);
	transform: translateX(-50%);
	background: var(--dbas-handle-color, #ffffff);
	box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
	pointer-events: none;
}

.dbas-handle-circle {
	position: absolute;
	top: 50%;
	left: 50%;
	width: var(--dbas-handle-size, 44px);
	height: var(--dbas-handle-size, 44px);
	transform: translate(-50%, -50%);
	color: var(--dbas-handle-color, #ffffff);
	cursor: grab;
	display: flex;
	align-items: center;
	justify-content: center;
	filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.35));
}

.dbas-handle-circle svg {
	width: 100%;
	height: 100%;
	display: block;
}

.dbas-slider-wrapper.dbas-dragging .dbas-handle-circle {
	cursor: grabbing;
}

/* Keyboard focus style */
.dbas-handle:focus {
	outline: none;
}

.dbas-handle:focus-visible .dbas-divider-line {
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8);
}

/* ---- Overlays ---- */
.dbas-overlay {
	position: absolute;
	z-index: 10;
	padding: var(--dbas-overlay-pad, 8px) calc(var(--dbas-overlay-pad, 8px) * 1.5);
	background: var(--dbas-overlay-bg, rgba(0, 0, 0, 0.45));
	color: var(--dbas-overlay-text, #ffffff);
	border-radius: var(--dbas-overlay-radius, 4px);
	pointer-events: none;
	max-width: 80%;
	line-height: 1.4;
}

/* Position variants */
.dbas-pos-top-left {
	top: 12px;
	left: 12px;
}

.dbas-pos-top-center {
	top: 12px;
	left: 50%;
	transform: translateX(-50%);
}

.dbas-pos-top-right {
	top: 12px;
	right: 12px;
}

.dbas-pos-center-left {
	top: 50%;
	left: 12px;
	transform: translateY(-50%);
}

.dbas-pos-center {
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}

.dbas-pos-center-right {
	top: 50%;
	right: 12px;
	transform: translateY(-50%);
}

.dbas-pos-bottom-left {
	bottom: 12px;
	left: 12px;
}

.dbas-pos-bottom-center {
	bottom: 12px;
	left: 50%;
	transform: translateX(-50%);
}

.dbas-pos-bottom-right {
	bottom: 12px;
	right: 12px;
}

.dbas-label {
	display: block;
	font-size: var(--dbas-label-size, 16px);
	font-weight: 700;
	margin: 0;
	line-height: 1.3;
}

.dbas-overlay-text {
	margin: 4px 0 0;
	font-size: var(--dbas-overlay-size, 14px);
	font-weight: 400;
}

/* Only child — no extra margin */
.dbas-overlay-text:only-child {
	margin-top: 0;
}

/* ---- Responsive height (tablet / phone set via JS from data attrs) ---- */
@media (max-width: 980px) {
	.dbas-slider-wrapper[data-height-tablet] {
		height: attr(data-height-tablet);
	}
}

@media (max-width: 767px) {
	.dbas-slider-wrapper[data-height-phone] {
		height: attr(data-height-phone);
	}
}
