/* SLD homepage hero carousel.
 *
 * Ported from Convert experience 1004212380 with two deliberate changes:
 *   1. aspect-ratio on the viewport. Convert had none, so the hero had zero height until its
 *      image decoded and then pushed the page down - that is the layout shift we are fixing.
 *   2. Slides are stacked and cross-faded rather than display:none/block, so switching a slide
 *      cannot reflow anything.
 *
 * Breakpoint is 545px to match the original exactly.
 */

.sld-hero {
	display: flex;
	flex-direction: column;
	width: 100%;
	position: relative;
}

/* Reserve the space before any image has loaded. --sld-hero-ratio-* are set inline from the
   real intrinsic dimensions of the first slide. */
.sld-hero__viewport {
	position: relative;
	width: 100%;
	aspect-ratio: var(--sld-hero-ratio-d, 1920 / 750);
	overflow: hidden;
}

.sld-hero__track {
	position: absolute;
	inset: 0;
}

.sld-hero__track--mobile {
	display: none;
}

.sld-hero-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity .4s ease;
}

.sld-hero-slide.is-active {
	opacity: 1;
	visibility: visible;
}

.sld-hero-slide img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Arrows */
.sld-hero__nav {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 50px;
	height: 50px;
	margin: auto;
	padding: 0;
	z-index: 2;
	background: transparent;
	border: 0;
	outline: 0;
	cursor: pointer;
	line-height: 0;
}

.sld-hero__nav:hover,
.sld-hero__nav:focus {
	background: transparent;
	border: 0;
}

.sld-hero__nav:focus-visible {
	outline: 2px solid #e32227;
	outline-offset: 2px;
}

.sld-hero__nav--prev { left: 0; }
.sld-hero__nav--next { right: 0; }

/* Dots */
.sld-hero__dots {
	list-style: none;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px;
	margin: 0;
}

.sld-hero__dots li { margin: 0; }

.sld-hero__dot {
	display: block;
	width: 15px;
	height: 15px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background-color: #d9d9d9;
	cursor: pointer;
	transition: background-color .2s ease;
}

.sld-hero__dot.is-active {
	background-color: #e32227;
}

.sld-hero__dot:focus-visible {
	outline: 2px solid #e32227;
	outline-offset: 2px;
}

@media (max-width: 545px) {
	.sld-hero__viewport {
		aspect-ratio: var(--sld-hero-ratio-m, 760 / 770);
	}

	.sld-hero__track--desktop { display: none; }
	.sld-hero__track--mobile  { display: block; }

	.sld-hero__nav { top: -50px; }
}

/* Respect the OS setting. Auto-rotation is also disabled in JS. */
@media (prefers-reduced-motion: reduce) {
	.sld-hero-slide { transition: none; }
}
