/* ============================================================
   ACF Repeater Comparison Gallery — widget.css
   Author: Musa Asif
   ============================================================ */

/* Elementor (and some themes/ElementsKit) apply
   `.elementor-widget-container { height: 100% }`. Inside a flex-column
   Container that resolves to a tiny height and crushes the widget box, so the
   gallery overflows and overlaps the page. Force THIS widget's container to
   wrap its content. Scoped to our widget only — affects nothing else. */
.elementor-widget-acf_repeater_comparison > .elementor-widget-container {
	height: auto !important;
}

/* Box-sizing + a hard horizontal clip so the gallery can never spill out of
   its Elementor container on any screen size. */
.arcg-wrapper, .arcg-wrapper * { box-sizing: border-box; }
.arcg-wrapper {
	width: 100%;
	max-width: 100%;
	overflow-x: clip; /* modern browsers; older ones simply ignore it */
}

/* ---- Grid layout ------------------------------------------ */
.arcg-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 24px;
	width: 100%;
	max-width: 100%;
}

.arcg-item { width: 100%; min-width: 0; max-width: 100%; }

/* ============================================================
   Comparison slider
   ------------------------------------------------------------
   --arcg-pos (default 50%) is set on .arcg-slider by JS and
   drives both the clip-path of the before overlay and the
   divider position. LEFT = Before, RIGHT = After.
   ============================================================ */

.arcg-slider {
	--arcg-pos: 50%;
	position: relative;
	overflow: hidden;
	cursor: col-resize;
	border-radius: 8px;
	line-height: 0;
	background: #eceff1;
	box-shadow: 0 6px 22px rgba(0, 0, 0, 0.10);
	/* Equal height. PHP sets --arcg-ar from the Image Ratio control (a CSS
	   variable, so an explicit Height override can cleanly reset it to auto). */
	aspect-ratio: var(--arcg-ar, 4 / 3);
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
}

/* Equal-height mode (default): the After image fills the ratio box. */
.arcg-img--after {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
}

/* "Original" ratio opt-in: image defines height, slider heights may differ. */
.arcg-slider.is-natural {
	aspect-ratio: auto;
}
.arcg-slider.is-natural .arcg-img--after {
	position: static;
	height: auto;
}

.arcg-clip {
	position: absolute;
	inset: 0;
	-webkit-clip-path: inset(0 calc(100% - var(--arcg-pos)) 0 0);
	        clip-path: inset(0 calc(100% - var(--arcg-pos)) 0 0);
}

.arcg-img--before {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
}

/* Divider */
.arcg-divider {
	position: absolute;
	top: 0;
	left: var(--arcg-pos);
	transform: translateX(-50%);
	height: 100%;
	width: 3px;
	background: #ffffff;
	box-shadow: 0 0 8px rgba(0, 0, 0, 0.35);
	cursor: col-resize;
	z-index: 10;
	touch-action: none;
}

.arcg-divider:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(0, 112, 240, 0.6), 0 0 8px rgba(0, 0, 0, 0.35);
}

/* Handle */
.arcg-handle {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 48px;
	height: 48px;
	background: #ffffff;
	border-radius: 50%;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	cursor: col-resize;
}

.arcg-arrow { display: inline-block; width: 0; height: 0; }
.arcg-arrow--left  { border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-right: 9px solid #444; }
.arcg-arrow--right { border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-left: 9px solid #444; }

/* Labels */
.arcg-label {
	position: absolute;
	bottom: 14px;
	padding: 4px 12px;
	background: rgba(0, 0, 0, 0.52);
	color: #ffffff;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	border-radius: 3px;
	pointer-events: none;
	z-index: 5;
	line-height: 1.4;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.arcg-label--before { left:  14px; }
.arcg-label--after  { right: 14px; }

/* ============================================================
   Carousel
   ============================================================ */

.arcg-carousel { position: relative; width: 100%; max-width: 100%; }

.arcg-viewport { overflow: hidden; width: 100%; max-width: 100%; }

.arcg-track {
	display: flex;
	gap: 20px;
	will-change: transform;
}

/* JS sets the exact slide width from slides-to-show + gap. The 100% default
   is a safe fallback (one slide per view, fully contained) for the brief
   moment before JS runs, or if it doesn't. */
.arcg-layout-carousel .arcg-item { flex: 0 0 100%; max-width: 100%; }

/* Nav arrows */
.arcg-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	border: none;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.5);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 20;
	padding: 0;
	transition: background 0.2s ease, opacity 0.2s ease;
}
.arcg-nav:hover { background: rgba(0, 0, 0, 0.75); }
.arcg-nav[disabled] { opacity: 0.35; cursor: default; pointer-events: none; }
.arcg-nav-prev { left: 10px; }
.arcg-nav-next { right: 10px; }

/* Chevron drawn with borders */
.arcg-nav span {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-right: 2px solid #fff;
	border-bottom: 2px solid #fff;
}
.arcg-nav-prev span { transform: rotate(135deg);  margin-left: 4px; }
.arcg-nav-next span { transform: rotate(-45deg);  margin-right: 4px; }

/* Dots */
.arcg-dots {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 16px;
}
.arcg-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	border: none;
	padding: 0;
	background: rgba(0, 0, 0, 0.25);
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
}
.arcg-dot.is-active { background: #333; transform: scale(1.2); }

/* ============================================================
   Editor placeholder + notices
   ============================================================ */

.arcg-editor-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 44px 20px;
	background: #f8f8f8;
	border: 2px dashed #d0d0d0;
	border-radius: 6px;
	text-align: center;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: #777;
	font-size: 14px;
	line-height: 1;
}
.arcg-editor-placeholder small { font-size: 11px; color: #aaa; line-height: 1.4; }
.arcg-editor-icon { font-size: 34px; color: #c8c8c8; }

.arcg-notice {
	padding: 10px 14px;
	margin: 0;
	background: #fff8e1;
	border: 1px solid #ffc107;
	border-radius: 4px;
	color: #7a5a00;
	font-size: 13px;
	line-height: 1.5;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 767px) {
	/* Default to a single column on phones. Elementor's own Columns control
	   (higher specificity) still overrides this when you set a mobile value. */
	.arcg-grid { grid-template-columns: 1fr; gap: 16px; }

	.arcg-handle { width: 38px; height: 38px; gap: 5px; }
	.arcg-arrow--left  { border-right-width: 7px; border-top-width: 5px; border-bottom-width: 5px; }
	.arcg-arrow--right { border-left-width:  7px; border-top-width: 5px; border-bottom-width: 5px; }
	.arcg-label { font-size: 10px; padding: 3px 8px; bottom: 10px; }
	.arcg-label--before { left:  10px; }
	.arcg-label--after  { right: 10px; }
	.arcg-nav { width: 36px; height: 36px; }
}
