/**
 * «Comparador A/B» (efeoncepro/compare). Front end and editor.
 * Without the view script: the two images side by side, each with its label. With it (.is-ready): stacked, B clipped
 * from the handle to the right (clip-path reads --v), a native range over the whole stage (opacity 0, 44 px thumb).
 * The handle sits on the thumb's real center: 22px + (100% − 44px) × v. touch-action: pan-y keeps vertical scrolling.
 * AXIS values: navy #023c70 · ground #001a33 · accent = line of the topic, only on the handle's ring.
 */

.eo-compare {
	--eo-c-ink: #023c70;
	--eo-c-soft: #6d6777;
	--eo-c-acc: var(--eo-line-on-light, #0375db);
	--eo-c-thumb: 44px;
	--eo-c-x: calc(var(--eo-c-thumb) / 2 + (100% - var(--eo-c-thumb)) * var(--v, 0.5));
}

.dark-scheme .eo-compare {
	--eo-c-ink: #ffffff;
	--eo-c-soft: #cfe4fa;
	--eo-c-acc: var(--eo-line-on-dark, #0375db);
}

.eo-compare.eo-compare {
	clear: both;
	box-sizing: border-box;
	margin: 40px 0;
	padding: 0;
	color: var(--eo-c-ink);
	font-family: "Poppins", system-ui, sans-serif;
}

.eo-compare__stage {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.eo-compare__side {
	position: relative;
	overflow: hidden;
	border-radius: 16px;
	aspect-ratio: var(--eo-cmp-ratio);
}

.eo-compare.eo-compare .eo-compare__img {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	margin: 0;
	border-radius: 0;
	object-fit: cover;
	user-select: none;
	-webkit-user-drag: none;
}

.eo-compare .eo-compare__label {
	position: absolute;
	top: 12px;
	left: 12px;
	padding: 6px 12px;
	border-radius: 9999px;
	background: rgba(0, 26, 51, 0.72);
	color: #ffffff;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
}

.eo-compare.is-ready .eo-compare__side--b .eo-compare__label {
	right: 12px;
	left: auto;
}

/* Overlay. */
.eo-compare.is-ready .eo-compare__stage {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: 16px;
	aspect-ratio: var(--eo-cmp-ratio);
	touch-action: pan-y;
}

.eo-compare.is-ready .eo-compare__side {
	position: absolute;
	inset: 0;
	border-radius: 0;
	aspect-ratio: auto;
}

.eo-compare.is-ready .eo-compare__side--b {
	clip-path: inset(0 0 0 var(--eo-c-x));
}

.eo-compare .eo-compare__range {
	display: none;
}

.eo-compare.is-ready .eo-compare__range {
	position: absolute;
	inset: 0;
	z-index: 3;
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	background: transparent;
	opacity: 0;
	cursor: ew-resize;
	touch-action: pan-y;
	appearance: none;
	-webkit-appearance: none;
}

.eo-compare.is-ready .eo-compare__range::-webkit-slider-thumb {
	width: var(--eo-c-thumb);
	height: 2000px;
	appearance: none;
	-webkit-appearance: none;
}

.eo-compare.is-ready .eo-compare__range::-moz-range-thumb {
	width: var(--eo-c-thumb);
	height: 2000px;
	border: 0;
}

.eo-compare__handle {
	display: none;
}

.eo-compare.is-ready .eo-compare__handle {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--eo-c-x);
	z-index: 2;
	display: block;
	width: 2px;
	margin-left: -1px;
	background: #ffffff;
	pointer-events: none;
}

.eo-compare.is-ready .eo-compare__handle span {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 40px;
	height: 40px;
	border: 2px solid #ffffff;
	border-radius: 50%;
	background: rgba(0, 26, 51, 0.72);
	box-shadow: 0 0 0 2px var(--eo-c-acc), 0 6px 20px rgba(0, 26, 51, 0.32);
	transform: translate(-50%, -50%);
}

/* Two chevrons: the handle moves both ways. */
.eo-compare.is-ready .eo-compare__handle span::before,
.eo-compare.is-ready .eo-compare__handle span::after {
	content: "";
	position: absolute;
	top: 50%;
	width: 8px;
	height: 8px;
	border-top: 2px solid #ffffff;
	border-left: 2px solid #ffffff;
}

.eo-compare.is-ready .eo-compare__handle span::before {
	left: 9px;
	transform: translateY(-50%) rotate(-45deg);
}

.eo-compare.is-ready .eo-compare__handle span::after {
	right: 9px;
	transform: translateY(-50%) rotate(135deg);
}

.eo-compare.is-ready .eo-compare__range:focus-visible ~ .eo-compare__handle span {
	outline: 3px solid var(--eo-c-acc);
	outline-offset: 4px;
}

/* Ohio's decorative cursor would cover the handle. */
body:has(.eo-compare.is-ready .eo-compare__stage:hover) .circle-cursor {
	opacity: 0 !important;
	visibility: hidden !important;
}

.eo-compare.eo-compare .eo-compare__caption {
	margin: 12px 0 0;
	color: var(--eo-c-soft);
	font-family: "Poppins", system-ui, sans-serif;
	font-size: 13px;
	line-height: 1.5;
	text-align: left;
}

@media (max-width: 480px) {
	.eo-compare:not(.is-ready) .eo-compare__stage {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* 0.25.1: una imagen vertical no pasa del 82 por ciento del alto de la pantalla y se centra; las horizontales siguen a todo el ancho. */
.wp-block-efeoncepro-compare .eo-compare__stage {
	max-width: min(100%, calc(82svh * var(--eo-w, 16) / var(--eo-h, 9)));
	margin-inline: auto;
}
