/* Happy - Image Carousel widget
--------------------------------------------- */

.happy-carousel {
	--happy-gap: 20px;
	--happy-pv: var(--happy-per-view, 1);
	position: relative;
	max-width: calc(var(--happy-per-view, 1) * 640px); /* keeps the arrows near the images */
	margin: 0 auto 20px;
}

@media only screen and (max-width: 900px) {
	.happy-carousel {
		--happy-pv: min(var(--happy-per-view, 1), 2);
	}
}

@media only screen and (max-width: 600px) {
	.happy-carousel {
		--happy-pv: 1;
	}
}

.happy-carousel__track {
	display: flex;
	gap: var(--happy-gap);
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-behavior: smooth;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
}

.happy-carousel.is-ready .happy-carousel__track {
	scrollbar-width: none;
}

.happy-carousel.is-ready .happy-carousel__track::-webkit-scrollbar {
	display: none;
}

.happy-carousel__slide {
	flex: 0 0 calc((100% - (var(--happy-pv) - 1) * var(--happy-gap)) / var(--happy-pv));
	min-width: 0;
	scroll-snap-align: start;
	text-align: center;
}

.happy-carousel__link {
	display: block;
	color: #010101;
}

.happy-carousel .happy-carousel__image {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 420px;
	margin: 0 auto;
	object-fit: contain;
}

.happy-carousel__caption {
	display: block;
	margin-top: 12px;
	font-size: 0.8em;
	font-weight: 700;
	letter-spacing: 2px;
	text-transform: uppercase;
}

/* Controls are only shown once the JS is running and there's something to scroll. */
.happy-carousel__arrow,
.happy-carousel__dots {
	display: none;
}

.happy-carousel.is-ready:not(.is-static) .happy-carousel__arrow,
.happy-carousel.is-ready:not(.is-static) .happy-carousel__dots {
	display: flex;
}

.happy-carousel .happy-carousel__arrow {
	position: absolute;
	top: calc((100% - 44px) / 2); /* centred on the slides, above the dots */
	z-index: 2;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid #010101;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.9);
	color: #010101;
	line-height: 0;
	letter-spacing: 0;
	transform: translateY(-50%);
}

.happy-carousel .happy-carousel__arrow:hover,
.happy-carousel .happy-carousel__arrow:focus {
	background: #010101;
	color: #fff;
}

.happy-carousel__arrow--prev {
	left: 0;
}

.happy-carousel__arrow--next {
	right: 0;
}

.happy-carousel__dots {
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 34px;
	margin-top: 10px;
}

.happy-carousel .happy-carousel__dot {
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	background: transparent;
	letter-spacing: 0;
}

.happy-carousel .happy-carousel__dot::before {
	content: "";
	display: block;
	width: 10px;
	height: 10px;
	margin: 0 auto;
	border: 1px solid #010101;
	border-radius: 50%;
	background: #fff;
}

.happy-carousel .happy-carousel__dot[aria-current="true"]::before,
.happy-carousel .happy-carousel__dot:hover::before {
	background: #010101;
}

@media (prefers-reduced-motion: reduce) {
	.happy-carousel__track {
		scroll-behavior: auto;
	}
}
