/**
 * SleekLine Product Slider — Styles
 * Version: 1.0.0
 */

/* ============================================================
   ROOT VARIABLES (overridable via Bricks controls)
   ============================================================ */
.slps-slider {
	--slps-gap: 10px;
	--slps-slide-gap: 0px;
	--slps-arrow-size: 40px;
	--slps-arrow-bg: rgba(0, 0, 0, 0.5);
	--slps-arrow-color: #fff;
	--slps-thumb-active-border: #000;
	--slps-thumb-inactive-opacity: 0.6;
	--slps-thumb-columns: 4;

	position: relative;
	display: block;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
	overflow: hidden; /* CRITICAL: prevents slider from blowing up parent width */
}

.slps-slider *,
.slps-slider *::before,
.slps-slider *::after {
	box-sizing: border-box;
}

/* ============================================================
   LAYOUT: thumbnail position variants
   ============================================================ */
.slps-slider--thumbs-bottom .slps-main {
	margin-bottom: var(--slps-gap);
}
.slps-slider--thumbs-top .slps-main {
	margin-top: var(--slps-gap);
}

/* ============================================================
   MAIN SLIDER
   ============================================================ */
.slps-main {
	position: relative;
	overflow: hidden;
	width: 100%;
	max-width: 100%;
	min-width: 0; /* CRITICAL: prevents flex children from expanding parent */
	/* Prevents vertical scroll on touch-drag */
	touch-action: pan-y;
}

.slps-track {
	display: flex;
	flex-wrap: nowrap;
	align-items: stretch;
	gap: var(--slps-slide-gap, 0);
	width: 100%;
	will-change: transform;
	/* Transition is set by JS */
}

.slps-slide {
	position: relative;
	display: block;
	flex: 0 0 100%;
	min-width: 0; /* CRITICAL: prevents image natural width from expanding slide */
	max-width: 100%;
	/* Images inside should take full slide width */
}

/* ============================================================
   HEIGHT MODES
   ============================================================ */

/* Mode 1: Adaptive — height animates to current slide (like FlexSlider smoothHeight).
   JS sets the track's height to the currently-active slide's height.
   Non-active slides are absolutely positioned to not affect layout height. */
.slps-height-adaptive .slps-main {
	height: auto;
	transition: height 0.35s ease;
}
.slps-height-adaptive .slps-track {
	position: relative;
	min-height: 1px; /* Prevents collapse before first measure */
}
.slps-height-adaptive .slps-slide {
	/* All slides stay in flow; JS uses track.clientHeight from active slide */
}

/* Mode 2: Tallest — container is the height of the tallest image.
   This is the default flex behavior; no special CSS needed.
   But we allow images to fit naturally. */
.slps-height-tallest .slps-slide img {
	height: auto;
	object-fit: contain;
}

/* Mode 3: Fixed Ratio — all slides use aspect-ratio, images object-fit: cover.
   Best for uniform visual grid; images may be slightly cropped. */
.slps-height-ratio {
	--slps-aspect-ratio: 1 / 1;
}
.slps-height-ratio .slps-slide {
	aspect-ratio: var(--slps-aspect-ratio);
	overflow: hidden;
}
.slps-height-ratio .slps-slide img,
.slps-height-ratio .slps-slide__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.slps-slide img,
.slps-slide__img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
	user-select: none;
	-webkit-user-drag: none;
	pointer-events: none; /* Prevent image-drag ghost; click is caught on link */
}

.slps-slide__lightbox {
	display: block;
	text-decoration: none;
}

.slps-slide__lightbox img {
	pointer-events: auto; /* Let Bricks lightbox handle click */
}

/* ============================================================
   ARROWS
   ============================================================ */
.slps-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: var(--slps-arrow-size);
	height: var(--slps-arrow-size);
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--slps-arrow-bg);
	color: var(--slps-arrow-color);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: opacity 0.2s ease, background 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.slps-arrow:hover {
	opacity: 0.85;
}

.slps-arrow:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

.slps-arrow svg {
	width: 55%;
	height: 55%;
}

.slps-arrow--prev {
	left: 10px;
}

.slps-arrow--next {
	right: 10px;
}

/* ============================================================
   THUMBNAILS (simple mode)
   ============================================================ */
.slps-thumbs {
	display: grid;
	grid-template-columns: repeat(var(--slps-thumb-columns, 4), 1fr);
	gap: var(--slps-gap, 10px);
	list-style: none;
	padding: 0;
	margin: 0;
}

.slps-thumb {
	background: transparent;
	border: 2px solid transparent;
	padding: 0;
	cursor: pointer;
	opacity: var(--slps-thumb-inactive-opacity, 0.6);
	transition: opacity 0.2s ease, border-color 0.2s ease;
	overflow: hidden;
	border-radius: 2px;
	line-height: 0;
}

.slps-thumb img,
.slps-thumb__img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
}

.slps-thumb:hover,
.slps-thumb.is-active {
	opacity: 1;
}

.slps-thumb.is-active {
	border-color: var(--slps-thumb-active-border, #000);
}

/* ============================================================
   RESPONSIVE: hide arrows on mobile if configured
   ============================================================ */
@media (max-width: 767px) {
	.slps-hide-arrows-mobile .slps-arrow {
		display: none;
	}
}

/* ============================================================
   BUILDER PLACEHOLDER (when no product context)
   ============================================================ */
.slps-builder-placeholder {
	padding: 30px;
	background: #f5f5f5;
	border: 2px dashed #bbb;
	text-align: center;
	color: #555;
	border-radius: 4px;
}
.slps-builder-placeholder p {
	margin: 0 0 8px 0;
}
.slps-builder-placeholder p:last-child {
	margin-bottom: 0;
	font-size: 0.9em;
}

/* ============================================================
   NESTABLE variant — children-driven layout
   ============================================================ */
.slps-slider--nestable .slps-track--nestable > * {
	flex-shrink: 0;
}

/* ============================================================
   OVERRIDES — ensure Bricks' woocommerce-layer.min.css does not
   break our layout. The native WC gallery wrapper gets display:flex
   column which kills FlexSlider; our slider uses its own structure
   and we make sure nothing bleeds through.
   ============================================================ */
.slps-slider,
.slps-slider .slps-main,
.slps-slider .slps-track {
	display: block;
}
.slps-slider .slps-track {
	display: flex;
}
