/*!
 * Bricks Nestable Slider Enhancer — front end styles (v1.0.2)
 *
 * Specificity contract
 * --------------------
 * Every default below is written with :where() (zero specificity) or the lowest
 * specificity that still beats the stock Splide theme, so that anything the user
 * sets in the Bricks Style tab (typography, width, height, border, colour, margin)
 * always wins without needing !important.
 *
 * Loaded only when at least one feature is switched on.
 */

/* ==========================================================================
   1. Transitions
   ========================================================================== */

[data-enh-transition] {
	--enh-dur: 0.45s;
	--enh-ease: ease;
	--enh-scale: 0.85;
	--enh-fade: 0.3;
	--enh-slide-y: 40px;
	--enh-blur: 5px;
	--enh-tilt: 15deg;
	--enh-skew: 8deg;
	--enh-glow: 0 0 30px rgba(255, 200, 100, 0.8);
}

[data-enh-transition] .splide__slide {
	transition:
		transform var(--enh-dur) var(--enh-ease),
		opacity var(--enh-dur) var(--enh-ease),
		filter var(--enh-dur) var(--enh-ease),
		box-shadow var(--enh-dur) var(--enh-ease);
}

[data-enh-transition="card-tilt"] .splide__track {
	perspective: 1000px;
}
[data-enh-transition="card-tilt"] .splide__slide:not(.is-active) {
	transform: scale(0.9);
}
[data-enh-transition="card-tilt"] .splide__slide.is-prev {
	transform: rotateY(var(--enh-tilt)) scale(0.92);
}
[data-enh-transition="card-tilt"] .splide__slide.is-next {
	transform: rotateY(calc(-1 * var(--enh-tilt))) scale(0.92);
}

[data-enh-transition="fade"] .splide__slide:not(.is-active) {
	opacity: var(--enh-fade);
}

[data-enh-transition="scale"] .splide__slide:not(.is-active) {
	transform: scale(var(--enh-scale));
}

[data-enh-transition="slide-up"] .splide__slide:not(.is-active) {
	transform: translateY(var(--enh-slide-y));
}

[data-enh-transition="blur"] .splide__slide:not(.is-active) {
	filter: blur(var(--enh-blur));
}

[data-enh-transition="skew"] .splide__track {
	perspective: 1200px;
}
[data-enh-transition="skew"] .splide__slide.is-prev {
	transform: skewY(var(--enh-skew));
}
[data-enh-transition="skew"] .splide__slide.is-next {
	transform: skewY(calc(-1 * var(--enh-skew)));
}

[data-enh-transition="glow"] .splide__slide {
	border-radius: 8px;
}
[data-enh-transition="glow"] .splide__slide:not(.is-active) {
	opacity: 0.6;
}
[data-enh-transition="glow"] .splide__slide.is-active {
	box-shadow: var(--enh-glow);
}

/* ==========================================================================
   2. Number pagination
   ========================================================================== */

[data-enh-pag="numbers"] .splide__pagination {
	counter-reset: enh-n;
}

:where([data-enh-pag="numbers"]) .splide__pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
}

:where([data-enh-pag="numbers"]) .splide__pagination li {
	margin: 0;
	line-height: 1;
}

:where([data-enh-pag="numbers"]) .splide__pagination__page {
	counter-increment: enh-n;
}

:where([data-enh-pag="numbers"]) .splide__pagination__page::before {
	content: counter(enh-n);
}

/* Chip defaults: (0,1,1) — beats the stock dots, loses to any Bricks rule. */
:where([data-enh-pag="numbers"]) button.splide__pagination__page {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 28px;
	height: 28px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.08);
	color: #222;
	font-size: 12px;
	line-height: 1;
	opacity: 1;
	transform: none;
}

/* Active chip: (0,2,1) — beats `.splide__pagination__page.is-active` from the theme. */
:where([data-enh-pag="numbers"]) button.splide__pagination__page.is-active {
	background: #222;
	color: #fff;
	transform: none;
	opacity: 1;
}

/* ==========================================================================
   3. Carousel progress bar
   ========================================================================== */

.enh-progress {
	position: relative;
	box-sizing: border-box;
	background: var(--enh-prog-bg, rgba(0, 0, 0, 0.15));
	overflow: hidden;
}

.enh-progress.is-clickable {
	cursor: pointer;
}

.enh-progress-bar {
	background: var(--enh-prog-bar, currentColor);
	display: block;
}

/* Horizontal */
.enh-progress[data-orient="h"] {
	width: var(--enh-prog-len, 100%);
	max-width: 100%;
	height: var(--enh-prog-thick, 4px);
	margin: var(--enh-prog-gap, 12px) 0 0;
}

.enh-progress[data-orient="h"][data-pos="above"] {
	margin: 0 0 var(--enh-prog-gap, 12px);
}

.enh-progress[data-orient="h"][data-align="center"] {
	margin-left: auto;
	margin-right: auto;
}

.enh-progress[data-orient="h"][data-align="end"] {
	margin-left: auto;
}

.enh-progress[data-orient="h"] .enh-progress-bar {
	height: 100%;
	width: 0;
	transition: width 0.4s ease;
}

/* Vertical: pinned to the left/right edge of the slider */
[data-enh-progress] {
	position: relative;
}

.enh-progress[data-orient="v"] {
	position: absolute;
	top: 0;
	width: var(--enh-prog-thick, 4px);
	height: var(--enh-prog-len, 100%);
	max-height: 100%;
	z-index: 3;
}

.enh-progress[data-orient="v"][data-pos="right"] {
	right: var(--enh-prog-gap, 0px);
}

.enh-progress[data-orient="v"][data-pos="left"] {
	left: var(--enh-prog-gap, 0px);
}

.enh-progress[data-orient="v"][data-align="center"] {
	top: 50%;
	transform: translateY(-50%);
}

.enh-progress[data-orient="v"][data-align="end"] {
	top: auto;
	bottom: 0;
}

.enh-progress[data-orient="v"] .enh-progress-bar {
	width: 100%;
	height: 0;
	transition: height 0.4s ease;
}

/* ==========================================================================
   4. Thumbnails
   ========================================================================== */

/* “Use this slider as thumbnails” (isNavigation), opacity set by the control. */
[data-enh-thumbs] .splide__list > .splide__slide {
	cursor: pointer;
	transition: opacity 0.3s ease;
}
[data-enh-thumbs] .splide__list > .splide__slide:not(.is-active) {
	opacity: var(--enh-thumb-op, 0.5);
}
[data-enh-thumbs] .splide__list > .splide__slide.is-active {
	opacity: 1;
}

/* Auto-paired thumbnail slider (marked by the script). */
[data-enh-thumb-pair] .splide__list > .splide__slide {
	cursor: pointer;
	transition: opacity 0.3s ease;
}
[data-enh-thumb-pair] .splide__list > .splide__slide:not(.is-active) {
	opacity: 0.5;
}
[data-enh-thumb-pair] .splide__list > .splide__slide.is-active {
	opacity: 1;
}

/* Keyboard users need a visible focus ring on thumbnails. */
[data-enh-thumbs] .splide__slide:focus-visible,
[data-enh-thumb-pair] .splide__slide:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	[data-enh-transition] .splide__slide {
		transition: none;
	}
	.enh-progress-bar {
		transition: none;
	}
}
