/* =========================================================
   Image Compare – stylesheet
   ========================================================= */

/* Container */
.ic-container {
	position: relative;
	display: block;
	width: 100%;
	overflow: hidden;
	cursor: col-resize;
	user-select: none;
	-webkit-user-select: none;
	line-height: 0; /* removes ghost space below inline images */
	border-radius: 4px;
}

/* Shared image styles */
.ic-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
}

/* After image – base layer */
.ic-img-after {
	position: relative;
	z-index: 1;
}

/* Before wrapper – always full size; clip-path set by JS reveals the before image */
.ic-before-wrapper {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 2;
	clip-path: inset(0 50% 0 0); /* updated by JS */
}

.ic-img-before {
	width: 100%;
}

/* ---- Slider (vertical dividing line + handle) ---- */
.ic-slider {
	position: absolute;
	top: 0;
	left: 50%;   /* updated by JS */
	height: 100%;
	width: 0;
	z-index: 4;
	transform: translateX(-50%);
}

.ic-slider-line {
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 3px;
	height: 100%;
	background: #fff;
	box-shadow: 0 0 6px rgba(0, 0, 0, .4);
	pointer-events: none;
}

/* Circular drag handle */
.ic-handle {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 2px;
	cursor: col-resize;
}

.ic-arrow {
	width: 20px;
	height: 20px;
	fill: #333;
	flex-shrink: 0;
}

/* Focus ring for keyboard accessibility */
.ic-slider:focus {
	outline: none;
}
.ic-slider:focus-visible .ic-handle {
	box-shadow: 0 0 0 3px #fff, 0 0 0 5px #0073aa;
}

/* ---- Labels ---- */
.ic-label {
	position: absolute;
	top: 12px;
	z-index: 3;
	background: rgba(0, 0, 0, .55);
	color: #fff;
	font-size: 20px;
	font-family: inherit;
	line-height: 1;
	padding: 5px 10px;
	border-radius: 3px;
	pointer-events: none;
	letter-spacing: .02em;
}

.ic-label-before {
	left: 12px;
}

.ic-label-after {
	right: 12px;
}

/* =========================================================
   Vertical orientation
   ========================================================= */

.ic-container.ic-vertical {
	cursor: row-resize;
}

/* In vertical mode the clip-path trims from the bottom instead */
.ic-vertical .ic-before-wrapper {
	clip-path: inset(0 0 50% 0); /* updated by JS */
}

/* The slider bar becomes horizontal */
.ic-vertical .ic-slider {
	top: 50%;      /* updated by JS */
	left: 0;
	height: 0;
	width: 100%;
	transform: translateY(-50%);
}

.ic-vertical .ic-slider-line {
	top: 50%;
	left: 0;
	transform: translateY(-50%);
	width: 100%;
	height: 3px;
}

.ic-vertical .ic-handle {
	cursor: row-resize;
}

.ic-vertical .ic-handle .ic-arrow-left {
	transform: rotate(90deg);
}

.ic-vertical .ic-handle .ic-arrow-right {
	transform: rotate(90deg);
}

/* Vertical labels */
.ic-vertical .ic-label-before {
	top: 12px;
	left: 50%;
	transform: translateX(-50%);
}

.ic-vertical .ic-label-after {
	top: auto;
	bottom: 12px;
	right: auto;
	left: 50%;
	transform: translateX(-50%);
}

/* =========================================================
   Reduced-motion preference
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
	.ic-handle,
	.ic-slider-line,
	.ic-before-wrapper {
		transition: none !important;
	}
}
