/* Category Slider: static image + title cards in a scrolling row. */

.mst-csl {
	--mst-csl-per: 5;
	--mst-csl-gap: 16px;
	--mst-csl-zoom: 1.08;
	--mst-csl-zoom-speed: 500ms;
	--mst-csl-arrow-size: 36px;
	--mst-csl-arrow-icon: 18px;
	position: relative;
}

/* Heading row: title and subtitle on one side, arrows on the other */

.mst-csl-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 20px;
}

.mst-csl-heading {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.mst-csl-heading-title {
	margin: 0;
	line-height: 1.2;
}

.mst-csl-heading-sub {
	display: block;
	opacity: .75;
}

/* No heading: the arrows alone, placed by the alignment setting. */
.mst-csl--no-heading .mst-csl-head {
	justify-content: flex-start;
}

/* Arrows */

.mst-csl-nav {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: none;
}

.mst-csl-arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--mst-csl-arrow-size);
	height: var(--mst-csl-arrow-size);
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	cursor: pointer;
	transition: color .2s ease, background-color .2s ease, opacity .2s ease;
}

.mst-csl-arrow svg {
	width: var(--mst-csl-arrow-icon);
	height: var(--mst-csl-arrow-icon);
	display: block;
}

/* In Arabic the row runs the other way, so the arrowheads flip too (the class is set by the script). */
.mst-csl--rtl .mst-csl-arrow svg {
	transform: scaleX(-1);
}

.mst-csl-arrow[disabled] {
	opacity: .35;
	cursor: default;
}

/* Arrows on the sides, floating over the row. */

.mst-csl-nav--sides {
	position: absolute;
	inset-inline: 0;
	top: 50%;
	margin: 0;
	transform: translateY(-50%);
	justify-content: space-between;
	pointer-events: none;
	z-index: 2;
}

.mst-csl-nav--sides .mst-csl-arrow {
	pointer-events: auto;
	background-color: rgba(255, 255, 255, .9);
	border-radius: 50%;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}

.mst-csl--arrows-sides .mst-csl-viewport {
	position: relative;
}

/* The scrolling row */

.mst-csl-track {
	display: flex;
	gap: var(--mst-csl-gap);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-ms-overflow-style: none;
	-webkit-overflow-scrolling: touch;
	outline: none;
}

.mst-csl-track::-webkit-scrollbar {
	display: none;
}

.mst-csl-card {
	flex: 0 0 calc((100% - (var(--mst-csl-per) - 1) * var(--mst-csl-gap)) / var(--mst-csl-per));
	scroll-snap-align: start;
	display: block;
	text-decoration: none;
	color: inherit;
}

.mst-csl-card:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

/* Image box: the zoom happens inside it, so the card keeps its size. */

.mst-csl-media {
	display: block;
	position: relative;
	height: 330px;
	overflow: hidden;
	background-color: #f5f5f5;
}

.mst-csl-media img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: contain;
	transition: transform var(--mst-csl-zoom-speed) ease;
	will-change: transform;
}

.mst-csl-card:hover .mst-csl-media img,
.mst-csl-card:focus-visible .mst-csl-media img {
	transform: scale(var(--mst-csl-zoom));
}

.mst-csl-title {
	display: block;
	margin-top: 12px;
	text-align: center;
	transition: color .2s ease;
}

/* Dragging with the mouse */

.mst-csl--drag .mst-csl-track {
	cursor: grab;
}

.mst-csl--drag .mst-csl-track.is-dragging {
	cursor: grabbing;
	scroll-behavior: auto;
	scroll-snap-type: none;
	user-select: none;
}

.mst-csl--drag .mst-csl-track.is-dragging img {
	pointer-events: none;
}

/* Phones: the heading and the arrows stack, so long titles keep their room. */

@media (max-width: 767px) {
	.mst-csl--head-stack .mst-csl-head {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mst-csl-track {
		scroll-behavior: auto;
	}

	.mst-csl-media img {
		transition: none;
	}
}
