/*
 * Carousel component — a strip of posters, or stills one at a time.
 *
 * strip:  read off the old site's justified poster carousel — images
 *         500px tall (300px from 1024px down, 200px from 767px down),
 *         25px apart; white chevrons, 30px (20px on a tablet, none on a
 *         phone), 25px in from the ends and centred on the images; and an
 *         empty 27px dots row under them, kept so the copy below sits
 *         where it did.
 * single: read off the old site's stills carousel — one image, full width,
 *         light chevrons 25px tall, 10px in from the ends.
 */

.carousel {
	--carousel-gap: 25px;
	--carousel-arrow: 30px;
	--carousel-inset: 25px;
	--carousel-height: 500px;
	position: relative;
}

.carousel__track {
	display: flex;
	align-items: flex-start;
	gap: var(--carousel-gap);
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.carousel__track::-webkit-scrollbar {
	display: none;
}

.carousel__track:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}

.carousel__slide {
	flex: 0 0 auto;
	margin: 0;
	scroll-snap-align: start;
}

.carousel__image {
	display: block;
	max-width: none;
}

/* --- strip --- */

.carousel--strip {
	padding-bottom: 27px;
}

.carousel--strip .carousel__image {
	width: auto;
	height: var(--carousel-height);
}

/* --- single --- */

.carousel--single {
	--carousel-gap: 0px;
	--carousel-arrow: 25px;
	--carousel-inset: 10px;
}

.carousel--single .carousel__slide {
	flex-basis: 100%;
}

.carousel--single .carousel__image {
	width: 100%;
	height: auto;
}

/* --- arrows --- */

.carousel__arrow {
	position: absolute;
	top: calc((100% - 27px) / 2);
	z-index: 1;
	width: var(--carousel-arrow);
	height: var(--carousel-arrow);
	margin: calc(var(--carousel-arrow) / -2) 0 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: #fff;
	cursor: pointer;
}

.carousel--single .carousel__arrow {
	top: 50%;
	color: rgb(238 238 238 / 0.9);
}

.carousel__arrow[hidden] {
	display: none;
}

.carousel__arrow::before {
	content: "";
	display: block;
	width: 100%;
	height: 100%;
	background: currentColor;
	-webkit-mask: var(--carousel-chevron) center / 60% 100% no-repeat;
	mask: var(--carousel-chevron) center / 60% 100% no-repeat;
	--carousel-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 20'%3E%3Cpath d='M10 2 2 10l8 8' fill='none' stroke='%23000' stroke-width='2.5'/%3E%3C/svg%3E");
}

.carousel__arrow--prev {
	left: var(--carousel-inset);
}

.carousel__arrow--next {
	right: var(--carousel-inset);
}

.carousel__arrow--next::before {
	transform: scaleX(-1);
}

.carousel__arrow:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 4px;
}

@media (prefers-reduced-motion: no-preference) {
	.carousel__track {
		scroll-behavior: smooth;
	}
}

@media (max-width: 1024px) {
	.carousel--strip {
		--carousel-height: 300px;
		--carousel-arrow: 20px;
	}
}

@media (max-width: 767px) {
	.carousel--strip {
		--carousel-height: 200px;
	}

	.carousel--strip .carousel__arrow {
		display: none;
	}
}
