/* Before/after sliders (inc/before-after.php). Mirrors the former Twenty20 plugin's look;
   position is driven by the --vf-ba custom property instead of measured pixel sizes. */

.twenty20 {
	margin-bottom: 20px;
	clear: both;
}

.twentytwenty-container {
	position: relative;
	overflow: hidden;
	overflow: clip; /* Unlike hidden, can't be scrolled (e.g. by find-in-page jumping to a hidden label). */
	z-index: 0;
	user-select: none;
	-webkit-user-select: none;
}

/* Scoped under .twenty20 so blog-post image rules (e.g. .vf-post-content img margins) don't apply. */
.twenty20 .twentytwenty-container img {
	display: block;
	margin: 0;
	width: 100%;
	max-width: 100%;
	height: auto;
	-webkit-user-drag: none;
}

.twenty20 .twentytwenty-after {
	position: relative;
	z-index: 10;
}

.twenty20 .twentytwenty-container img.twentytwenty-before {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	object-fit: cover;
	z-index: 20;
	clip-path: inset(0 calc(100% - var(--vf-ba, 50%)) 0 0);
}

.twentytwenty-handle {
	position: absolute;
	top: 50%;
	left: var(--vf-ba, 50%);
	z-index: 40;
	width: 38px;
	height: 38px;
	margin: -22px 0 0 -22px;
	border: 3px solid #fff;
	border-radius: 1000px;
	box-shadow: 0 0 12px rgba(51, 51, 51, 0.5);
	cursor: ew-resize;
	touch-action: none;
	box-sizing: content-box;
}

.twentytwenty-handle:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

.twentytwenty-horizontal .twentytwenty-handle::before,
.twentytwenty-horizontal .twentytwenty-handle::after {
	content: " ";
	display: block;
	position: absolute;
	left: 50%;
	z-index: 30;
	width: 3px;
	height: 9999px;
	margin-left: -1.5px;
	background: #fff;
}

.twentytwenty-horizontal .twentytwenty-handle::before {
	bottom: 50%;
	margin-bottom: 22px;
	box-shadow: 0 3px 0 #fff, 0 0 12px rgba(51, 51, 51, 0.5);
}

.twentytwenty-horizontal .twentytwenty-handle::after {
	top: 50%;
	margin-top: 22px;
	box-shadow: 0 -3px 0 #fff, 0 0 12px rgba(51, 51, 51, 0.5);
}

.twentytwenty-left-arrow,
.twentytwenty-right-arrow {
	position: absolute;
	top: 50%;
	width: 0;
	height: 0;
	margin-top: -6px;
	border: 6px inset transparent;
}

.twentytwenty-left-arrow {
	left: 50%;
	margin-left: -17px;
	border-right: 6px solid #fff;
}

.twentytwenty-right-arrow {
	right: 50%;
	margin-right: -17px;
	border-left: 6px solid #fff;
}

.twentytwenty-overlay {
	position: absolute;
	inset: 0;
	z-index: 25;
	background: rgba(0, 0, 0, 0);
	transition: background 0.5s;
}

.twentytwenty-overlay:hover {
	background: rgba(0, 0, 0, 0.5);
}

.twentytwenty-before-label,
.twentytwenty-after-label {
	position: absolute;
	bottom: 0;
	max-width: 50%;
	box-sizing: border-box;
	padding: 4px;
	border-radius: 2px;
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
	font-size: 13px;
	letter-spacing: 0.1em;
	opacity: 0;
	transition: opacity 0.5s;
}

.twentytwenty-before-label {
	left: 1px;
}

.twentytwenty-after-label {
	right: 1px;
}

.twentytwenty-overlay:hover .twentytwenty-before-label,
.twentytwenty-overlay:hover .twentytwenty-after-label {
	opacity: 1;
}

.twentytwenty-container.active .twentytwenty-overlay {
	background: rgba(0, 0, 0, 0);
}

.twentytwenty-container.active .twentytwenty-before-label,
.twentytwenty-container.active .twentytwenty-after-label {
	opacity: 0;
}
