/*
 * NativeSwiper — the rail's layout, scroll snap and edge fades. The look of the built-in nav buttons
 * (`.nativeswiper-nav`, rendered with `showNavButtons`) is the app's own stylesheet.
 */

/* Built-in nav buttons around the rail (opt-in via the showNavButtons prop) */
.nativeswiper-outer {
	display: flex;
	align-items: center;
	gap: 0;
}

.nativeswiper-outer .nativeswiper-container {
	flex: 1;
	min-width: 0;
}

/* Core */
.nativeswiper-container {
	width: 100%;
	position: relative;
	--nativeswiper-fade-size: 38px;
	--nativeswiper-fade-left: 0;
	--nativeswiper-fade-right: 0;
	/* Disable pointer events on padded area */
	pointer-events: auto;
}

.nativeswiper-container.nativeswiper-fade-active .nativeswiper-wrapper {
	mask-image: linear-gradient(
		to right,
		rgba(0, 0, 0, 0.3) 0,
		rgba(0, 0, 0, 0.7) calc(var(--nativeswiper-fade-left) * var(--nativeswiper-fade-size) * 0.5),
		rgba(0, 0, 0, 1) calc(var(--nativeswiper-fade-left) * var(--nativeswiper-fade-size)),
		rgba(0, 0, 0, 1) calc(100% - var(--nativeswiper-fade-right) * var(--nativeswiper-fade-size)),
		rgba(0, 0, 0, 0.7) calc(100% - var(--nativeswiper-fade-right) * var(--nativeswiper-fade-size) * 0.5),
		rgba(0, 0, 0, 0.3) 100%
	);
	mask-repeat: no-repeat;
	mask-size: 100% 100%;
	-webkit-mask-image: linear-gradient(
		to right,
		rgba(0, 0, 0, 0.3) 0,
		rgba(0, 0, 0, 0.7) calc(var(--nativeswiper-fade-left) * var(--nativeswiper-fade-size) * 0.5),
		rgba(0, 0, 0, 1) calc(var(--nativeswiper-fade-left) * var(--nativeswiper-fade-size)),
		rgba(0, 0, 0, 1) calc(100% - var(--nativeswiper-fade-right) * var(--nativeswiper-fade-size)),
		rgba(0, 0, 0, 0.7) calc(100% - var(--nativeswiper-fade-right) * var(--nativeswiper-fade-size) * 0.5),
		rgba(0, 0, 0, 0.3) 100%
	);
	-webkit-mask-repeat: no-repeat;
	-webkit-mask-size: 100% 100%;
}

.nativeswiper-wrapper {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	scroll-behavior: smooth;
	/* Firefox */
	cursor: grab;
	/* Allow vertical overflow (shadows, hover translateY) to be visible */
	padding-block: 30px;
	margin-block: -30px;
	/* Disable pointer events on padded area */
	pointer-events: auto;
}

.nativeswiper-wrapper.dragging {
	/* Disable snap ONLY while dragging for direct user control */
	scroll-snap-type: none;
	scroll-behavior: unset;
	cursor: grabbing;
}

.nativeswiper-wrapper::-webkit-scrollbar {
	display: none;
	/* Chrome, Safari, and Opera */
}

.nativeswiper-slide {
	scroll-snap-align: start;
	scroll-snap-stop: always;
	height: auto;
	width: fit-content !important;
	/* Prevent text selection during drag */
	user-select: none;
	-webkit-user-select: none;
	/* Re-enable pointer events on slides */
	pointer-events: auto;
}

.nativeswiper-slide a {
	display: block;
	text-decoration: none;
}

.nativeswiper-slide:not(:last-child) {
	margin-right: var(--nativeswiper-slide-gap, 10px);
}

.nativeswiper-nosnap .nativeswiper-wrapper {
	scroll-snap-type: unset;
	scroll-behavior: unset;
}

.nativeswiper-nosnap .nativeswiper-wrapper .nativeswiper-slide {
	scroll-snap-align: unset;
	scroll-snap-stop: unset;
}

/*
 * `snapOnTouch` — a rail that must land on one slide at a time keeps the browser's own momentum and snap on a narrow
 * touch device, one slide per swipe, instead of the free scroll above.
 */
.nativeswiper-snap-touch .nativeswiper-wrapper {
	scroll-snap-type: x mandatory;
}

.nativeswiper-snap-touch .nativeswiper-wrapper .nativeswiper-slide {
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

/* `slidesPerView: 1` — each slide spans the rail. */
.nativeswiper-one-per-view > .nativeswiper-wrapper > .nativeswiper-slide {
	width: 100% !important;
	flex: 0 0 100%;
}

/* `slidesPerView` above 1 — that many slides span the rail, the gaps between them included. */
.nativeswiper-per-view > .nativeswiper-wrapper > .nativeswiper-slide {
	width: calc(
		(100% - (var(--nativeswiper-slides-per-view) - 1) * var(--nativeswiper-slide-gap, 10px)) /
			var(--nativeswiper-slides-per-view)
	) !important;
	flex: 0 0 auto;
}

/*
 * A carousel move (`speed`) animates the offset by script: no snap and no smooth scrolling in its way while it runs.
 * Last, so it wins over the snap rules above at the same specificity.
 */
.nativeswiper-animating .nativeswiper-wrapper {
	scroll-snap-type: none;
	scroll-behavior: auto;
}

/*
 * A carousel with nothing to scroll hides its arrows, as Swiper's `swiper-button-lock` did. `button.` makes it (0,1,1):
 * above a button skin's one class (`.btn`, a consumer's `.icon-button`) wherever that loads, below a consumer's scoped
 * rule that keeps its arrows shown on purpose.
 */
button.nativeswiper-button-lock {
	display: none;
}

/*
 * `hasPagination` — Swiper 12's bullets (swiper/modules/pagination.css, MIT), so the carousels that left Swiper look
 * the same; the `--nativeswiper-pagination-*` variables take Swiper's `--swiper-pagination-*` defaults, and the active
 * colour is Swiper's default theme colour.
 */
.nativeswiper-pagination {
	position: absolute;
	text-align: center;
	transition: 300ms opacity;
	transform: translate3d(0, 0, 0);
	z-index: 10;
}

.nativeswiper-pagination-bullets.nativeswiper-pagination-horizontal {
	bottom: var(--nativeswiper-pagination-bottom, 8px);
	top: var(--nativeswiper-pagination-top, auto);
	left: 0;
	width: 100%;
}

.nativeswiper-pagination-bullet {
	width: var(--nativeswiper-pagination-bullet-width, var(--nativeswiper-pagination-bullet-size, 8px));
	height: var(--nativeswiper-pagination-bullet-height, var(--nativeswiper-pagination-bullet-size, 8px));
	display: inline-block;
	border-radius: var(--nativeswiper-pagination-bullet-border-radius, 50%);
	background: var(--nativeswiper-pagination-bullet-inactive-color, #000);
	opacity: var(--nativeswiper-pagination-bullet-inactive-opacity, 0.2);
}

.nativeswiper-pagination-clickable .nativeswiper-pagination-bullet {
	cursor: pointer;
}

.nativeswiper-pagination-bullet:only-child {
	display: none !important;
}

.nativeswiper-pagination-bullet-active {
	opacity: var(--nativeswiper-pagination-bullet-opacity, 1);
	background: var(--nativeswiper-pagination-color, #007aff);
}

.nativeswiper-pagination-horizontal.nativeswiper-pagination-bullets .nativeswiper-pagination-bullet {
	margin: 0 var(--nativeswiper-pagination-bullet-horizontal-gap, 4px);
}
