/*!
 * StoryFlow – Before / After Scroll Wipe: extra styling (since 1.0.6)
 * Loaded only by the Before / After widget, after the core StoryFlow styles.
 * Selectors start with ".sf-scene.sf-compare" so they win over the core rules.
 */

.sf-scene.sf-compare { --sf-lbl-dim: 0.25; --sf-lbl-inset: 26px; }

/* ---------- Section background image ---------- */
.sf-scene.sf-compare .sf-compare__secbg { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.sf-scene.sf-compare .sf-compare__secbg img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: center; }
.sf-scene.sf-compare .sf-compare__secbg::after { content: ""; position: absolute; inset: 0; background-color: rgba(0, 0, 0, 0.35); }
.sf-scene.sf-compare .sf-compare__stage { z-index: 1; }

/* ---------- Divider line ---------- */
.sf-scene.sf-fx-wipe-x .sf-compare__line { width: var(--sf-line-w, 3px); margin-left: calc(var(--sf-line-w, 3px) / -2); }
.sf-scene.sf-fx-wipe-y .sf-compare__line { height: var(--sf-line-w, 3px); margin-top: calc(var(--sf-line-w, 3px) / -2); }
.sf-scene.sf-noglow .sf-compare__line { box-shadow: none; }
.sf-scene.sf-noline .sf-compare__line { background: transparent; box-shadow: none; }

/* ---------- Handle ---------- */
.sf-scene.sf-compare .sf-compare__line span {
	width: var(--sf-handle, 44px);
	height: var(--sf-handle, 44px);
	margin: calc(var(--sf-handle, 44px) / -2) 0 0 calc(var(--sf-handle, 44px) / -2);
}
.sf-scene.sf-fx-wipe-x .sf-compare__line span { top: var(--sf-handle-pos, 50%); }
.sf-scene.sf-fx-wipe-y .sf-compare__line span { left: var(--sf-handle-pos, 50%); }
.sf-scene.sf-compare .sf-compare__line span::before,
.sf-scene.sf-compare .sf-compare__line span::after {
	border-width: calc(var(--sf-handle, 44px) * 0.14);
	margin-top: calc(var(--sf-handle, 44px) * -0.14);
}
.sf-scene.sf-compare .sf-compare__line span::before { left: calc(var(--sf-handle, 44px) * 0.14); border-right-color: var(--sf-arrow, #111); }
.sf-scene.sf-compare .sf-compare__line span::after { right: calc(var(--sf-handle, 44px) * 0.14); border-left-color: var(--sf-arrow, #111); }

/* Image handle */
.sf-scene.sf-handle-image .sf-compare__line span { background: none !important; border-radius: 0; }
.sf-scene.sf-handle-image .sf-compare__line span::before,
.sf-scene.sf-handle-image .sf-compare__line span::after { display: none; }
.sf-scene.sf-handle-image.sf-fx-wipe-y .sf-compare__line span { transform: none; }
.sf-scene.sf-handle-image .sf-compare__line span img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: contain;
	filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}
.sf-scene.sf-handle-spin .sf-compare__line span img { transform: rotate(calc(var(--sf-c, 0) * 720deg)); }

/* ---------- Labels ---------- */
.sf-scene.sf-compare .sf-compare__label--a {
	left: var(--sf-lbl-inset, 26px);
	opacity: calc(1 - var(--sf-c, 0) * (1 - var(--sf-lbl-dim, 0.25)));
}
.sf-scene.sf-compare .sf-compare__label--b {
	right: var(--sf-lbl-inset, 26px);
	opacity: calc(var(--sf-lbl-dim, 0.25) + var(--sf-c, 0) * (1 - var(--sf-lbl-dim, 0.25)));
}
/* Position comes from per-device CSS variables set by the "Label position" control. */
.sf-scene.sf-compare .sf-compare__label--a { top: var(--sf-la-t, auto); bottom: var(--sf-la-b, var(--sf-lbl-inset, 26px)); translate: 0 var(--sf-l-y, 0px); }
.sf-scene.sf-compare .sf-compare__label--b { top: var(--sf-lb-t, auto); bottom: var(--sf-lb-b, var(--sf-lbl-inset, 26px)); translate: 0 var(--sf-l-y, 0px); }

.sf-scene.sf-lblbg-flat .sf-compare__label { -webkit-backdrop-filter: none; backdrop-filter: none; }
.sf-scene.sf-lblbg-none .sf-compare__label {
	background: none !important;
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
	padding: 0;
	border-radius: 0;
	text-shadow: 0 2px 14px rgba(0, 0, 0, 0.75), 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* ---------- Heading box ---------- */
.sf-scene.sf-headbg-none .sf-compare__head { background: none; }
.sf-scene.sf-headbg-color .sf-compare__head { background: var(--sf-head-bg, rgba(0, 0, 0, 0.6)); padding-bottom: 5vh; padding-top: 5vh; }
.sf-scene.sf-headbg-none .sf-compare__head,
.sf-scene.sf-headbg-none .sf-compare__head * { text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6); }

.sf-scene.sf-headrv-start .sf-compare__head {
	opacity: calc(1 - clamp(0, var(--sf-c, 0) * 3, 1) * (1 - var(--sf-head-dim, 0)));
}
.sf-scene.sf-headrv-end .sf-compare__head {
	opacity: calc(var(--sf-head-dim, 0) + clamp(0, (var(--sf-c, 0) - 0.75) * 4, 1) * (1 - var(--sf-head-dim, 0)));
}

/* ---------- Drag mode (since 1.0.12): visitors move the divider themselves ---------- */
.sf-scene.sf-cmp-drag { height: auto !important; }
.sf-scene.sf-cmp-drag .sf-compare__pin { position: relative; height: 100vh; }
.sf-scene.sf-cmp-drag .sf-compare__stage {
	cursor: ew-resize;
	touch-action: pan-y; /* vertical swipes still scroll the page */
	-webkit-user-select: none;
	user-select: none;
	outline: none;
}
.sf-scene.sf-cmp-drag.sf-fx-wipe-y .sf-compare__stage { cursor: ns-resize; touch-action: pan-x; }
.sf-scene.sf-cmp-drag .sf-compare__stage:focus-visible { box-shadow: inset 0 0 0 3px var(--sf-line, #f5b301); }
.sf-scene.sf-cmp-drag .sf-compare__stage img { pointer-events: none; -webkit-user-drag: none; }
.sf-scene.sf-cmp-drag .sf-compare__line { opacity: 1; }
.sf-scene.sf-cmp-drag .sf-compare__line span { transition: scale 0.2s ease; }
.sf-scene.sf-cmp-drag.is-dragging .sf-compare__line span { scale: 1.12; }
/* Drag mode follows the usual comparison-slider layout: BEFORE left / top of the divider, AFTER right / below,
   and both labels stay fully visible. */
.sf-scene.sf-cmp-drag.sf-fx-wipe-x .sf-compare__b { clip-path: inset(0 0 0 calc(var(--sf-c, 0.5) * 100%)); }
.sf-scene.sf-cmp-drag.sf-fx-wipe-y .sf-compare__b { clip-path: inset(calc(var(--sf-c, 0.5) * 100%) 0 0 0); }
.sf-scene.sf-cmp-drag .sf-compare__label--a,
.sf-scene.sf-cmp-drag .sf-compare__label--b { opacity: 1; }
