/**
 * CPH Gallery Slider
 *
 * Center-mode carousel with 3D effects and arrow navigation.
 *
 * @package Salient_Child
 * @since   1.0.0
 */

/* ==========================================================================
   CSS Custom Properties (set via inline styles from PHP)
   ========================================================================== */

.cph-gallery-slider {
	--slider-height: 600px;
	--slide-width: 60%;
	--slide-radius: 25px;
	--slide-gap: 40px;
	--side-scale: 0.75;
	--side-opacity: 0.6;
	--arrow-color: #ffffff;
	--arrow-offset: 30px;
	--dot-size: 12px;
	--dot-gap: 10px;
	--pagination-offset: 20px;
	--transition-duration: 600ms;
	--perspective: 1000px;

	position: relative;
	width: 100%;
	height: var(--slider-height);
	overflow: hidden;
}

/* ==========================================================================
   Viewport
   ========================================================================== */

.cph-gallery-slider__viewport {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: visible;
	/* Let track extend beyond, container clips */
	perspective: var(--perspective);
}

/* ==========================================================================
   Track (contains slides, positioned for center mode)
   ========================================================================== */

.cph-gallery-slider__track {
	display: flex;
	align-items: center;
	/* Gap handled via JS margin-right for precise control */
	height: 100%;
	will-change: transform;
	transform-style: preserve-3d;
}

.cph-gallery-slider--draggable .cph-gallery-slider__track {
	cursor: grab;
	user-select: none;
}

.cph-gallery-slider--draggable .cph-gallery-slider__track:active {
	cursor: grabbing;
}

/* ==========================================================================
   Slide Base Styles
   ========================================================================== */

.cph-gallery-slider__slide {
	flex-shrink: 0;
	/* Width set by JS - do not use CSS percentage here as it resolves incorrectly in flex track */
	height: 100%;
	border-radius: var(--slide-radius);
	overflow: hidden;
	/* Transitions handled by GSAP for better control */
	transform-style: preserve-3d;
	backface-visibility: hidden;
	will-change: transform, opacity, filter;
}

.cph-gallery-slider__slide img,
.row .col .cph-gallery-slider__slide img {
	width: 100%;
	height: 100%;
	max-height: none;
	object-fit: cover;
	display: block;
	margin: 0;
	padding: 0;
	border-radius: 0;
	pointer-events: none;
}

/* ==========================================================================
   3D Effect - Initial States (GSAP takes over after init)
   ========================================================================== */

/* Hide slides initially until GSAP positions them */
.cph-gallery-slider:not(.is-initialized) .cph-gallery-slider__slide {
	opacity: 0;
}

/* ==========================================================================
   Arrow Buttons - Base
   ========================================================================== */

.cph-gallery-slider__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;

	display: flex;
	align-items: center;
	justify-content: center;

	padding: 0;
	background: transparent;
	border: none;
	color: var(--arrow-color);

	cursor: pointer;
	transition: transform 0.3s ease, opacity 0.3s ease, background 0.3s ease;
}

.cph-gallery-slider__arrow svg rect,
.cph-gallery-slider__arrow svg circle,
.cph-gallery-slider__arrow svg path {
	transition: stroke 0.3s ease, stroke-width 0.3s ease, fill 0.3s ease;
}

.cph-gallery-slider__arrow:hover {
	transform: translateY(-50%) scale(1.05);
}

.cph-gallery-slider__arrow:focus {
	outline: none;
}

.cph-gallery-slider__arrow:focus-visible {
	outline: 2px solid var(--arrow-color, #ffffff);
	outline-offset: 4px;
}

.cph-gallery-slider__arrow--prev {
	left: var(--arrow-offset);
}

.cph-gallery-slider__arrow--next {
	right: var(--arrow-offset);
}

/* ==========================================================================
   Arrow Styles - Pill (Default)
   ========================================================================== */

.cph-gallery-slider--arrows-pill .cph-gallery-slider__arrow {
	width: 140px;
	height: 50px;
}

.cph-gallery-slider--arrows-pill .cph-gallery-slider__arrow svg {
	width: 100%;
	height: auto;
}

/* ==========================================================================
   Arrow Styles - Circle
   ========================================================================== */

.cph-gallery-slider--arrows-circle .cph-gallery-slider__arrow {
	width: 50px;
	height: 50px;
}

.cph-gallery-slider--arrows-circle .cph-gallery-slider__arrow svg {
	width: 100%;
	height: auto;
}

/* ==========================================================================
   Arrow Styles - Minimal
   ========================================================================== */

.cph-gallery-slider--arrows-minimal .cph-gallery-slider__arrow {
	width: 40px;
	height: 40px;
}

.cph-gallery-slider--arrows-minimal .cph-gallery-slider__arrow svg {
	width: 100%;
	height: auto;
}

/* ==========================================================================
   Arrows Hidden State (when at edge in non-infinite mode)
   ========================================================================== */

.cph-gallery-slider__arrow.is-hidden {
	opacity: 0;
	pointer-events: none;
}

/* ==========================================================================
   Pagination Dots
   ========================================================================== */

.cph-gallery-slider__pagination {
	position: absolute;
	bottom: var(--pagination-offset);
	left: 50%;
	transform: translateX(-50%);
	z-index: 10;

	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--dot-gap);
}

.cph-gallery-slider__dot {
	width: var(--dot-size);
	height: var(--dot-size);
	padding: 0;
	border: 1px solid #ffffff;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.cph-gallery-slider__dot:hover {
	transform: scale(1.2);
}

.cph-gallery-slider__dot:focus {
	outline: none;
}

.cph-gallery-slider__dot:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.cph-gallery-slider__dot.is-active {
	background-color: #ffffff;
	border-color: #ffffff;
}

/* ==========================================================================
   Responsive - Large Desktop (1440px+)
   ========================================================================== */

@media (min-width: 1440px) {
	.cph-gallery-slider--arrows-pill .cph-gallery-slider__arrow {
		width: 160px;
		height: 58px;
	}
}

/* ==========================================================================
   Responsive - Tablet (max-width: 999px)
   ========================================================================== */

@media (max-width: 999px) {
	.cph-gallery-slider {
		--slide-width: 70%;
		--slide-gap: 20px;
		--arrow-offset: 20px;
	}

	.cph-gallery-slider--arrows-pill .cph-gallery-slider__arrow {
		width: 100px;
		height: 36px;
	}

	.cph-gallery-slider--arrows-circle .cph-gallery-slider__arrow {
		width: 40px;
		height: 40px;
	}

	.cph-gallery-slider--arrows-minimal .cph-gallery-slider__arrow {
		width: 32px;
		height: 32px;
	}
}

/* ==========================================================================
   Responsive - Mobile (max-width: 690px)
   ========================================================================== */

@media (max-width: 690px) {
	.cph-gallery-slider {
		--slide-width: 85%;
		--slide-gap: 15px;
		--slide-radius: 15px;
		--arrow-offset: 10px;
	}

	.cph-gallery-slider__arrow {
		top: 90%;
	}

	.cph-gallery-slider--arrows-pill .cph-gallery-slider__arrow {
		width: 80px;
		height: 30px;
	}

	.cph-gallery-slider--arrows-circle .cph-gallery-slider__arrow {
		width: 36px;
		height: 36px;
	}

	.cph-gallery-slider--arrows-minimal .cph-gallery-slider__arrow {
		width: 28px;
		height: 28px;
	}
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.cph-gallery-slider-empty {
	padding: 40px;
	text-align: center;
	font-family: 'aktiv-grotesk', sans-serif;
	font-size: 18px;
	color: #666;
}

/* ==========================================================================
   Initialization State
   ========================================================================== */

.cph-gallery-slider:not(.is-initialized) .cph-gallery-slider__track {
	opacity: 0;
}

.cph-gallery-slider.is-initialized .cph-gallery-slider__track {
	opacity: 1;
	transition: opacity 0.3s ease;
}