/**
 * Shared horizontal carousel chrome (viewport, track, arrow nav).
 * Slide widths and gaps are set by the consuming section.
 */

.veylo-carousel {
	--veylo-carousel-gap: 0px;
	position: relative;
	overflow: visible;
	outline: none;
}

.veylo-carousel:focus-visible {
	box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-primary);
	border-radius: var(--radius-lg);
}

.veylo-carousel__viewport {
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.veylo-carousel__viewport::-webkit-scrollbar {
	display: none;
}

.veylo-carousel__track {
	display: flex;
	gap: var(--veylo-carousel-gap);
	list-style: none;
	margin: 0;
	padding: 0;
}

.veylo-carousel__slide {
	box-sizing: border-box;
	flex: 0 0 auto;
	min-width: 0;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

@media (min-width: 768px) {
	.veylo-carousel__viewport {
		overflow: hidden;
		scroll-snap-type: none;
	}

	.veylo-carousel__track {
		will-change: transform;
	}

	.veylo-carousel__slide {
		scroll-snap-align: unset;
		scroll-snap-stop: normal;
	}
}

.veylo-carousel__nav {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: none;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: var(--radius-full);
	background: color-mix(in srgb, var(--color-text) 72%, transparent);
	color: var(--color-surface);
	box-shadow: none;
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transform: translateY(-50%);
	transition: opacity 160ms ease, background-color 160ms ease;
}

@media (min-width: 768px) {
	.veylo-carousel__nav:not(:disabled) {
		display: inline-flex;
	}

	.veylo-carousel:hover .veylo-carousel__nav:not(:disabled),
	.veylo-carousel:focus-within .veylo-carousel__nav:not(:disabled),
	.veylo-carousel__nav:focus-visible:not(:disabled) {
		opacity: 1;
		pointer-events: auto;
	}

	/* Homepage card sections: arrows stay visible; disabled stay hidden. */
	.veylo-carousel--persistent-nav .veylo-carousel__nav:not(:disabled) {
		opacity: 1;
		pointer-events: auto;
	}
}

.veylo-carousel__nav:hover:not(:disabled) {
	background: color-mix(in srgb, var(--color-text) 88%, transparent);
}

.veylo-carousel__nav:focus-visible {
	outline: 2px solid var(--color-primary);
	outline-offset: 2px;
}

.veylo-carousel__nav--prev {
	left: -12px;
}

.veylo-carousel__nav--next {
	right: -12px;
}

.veylo-carousel__sr {
	border: 0;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}
