/* Divi 5 Image Carousel */

.d5ic {
	--d5ic-pv: var(--d5ic-pv-d, 3);
	--d5ic-gap: 16px;
	--d5ic-peek: 0;
	--d5ic-gaps: calc(var(--d5ic-pv) - 1);
	--d5ic-ratio: auto;
	--d5ic-radius: 0px;
	--d5ic-accent: currentColor;
	position: relative;
	width: 100%;
	min-width: 0;
}

@media (max-width: 980px) {
	.d5ic {
		--d5ic-pv: var(--d5ic-pv-t, 2);
	}
}

@media (max-width: 767px) {
	.d5ic {
		--d5ic-pv: var(--d5ic-pv-p, 1);
	}
}

/* Mode 3: the last visible image is always cut off, so one more gap is visible. */
.d5ic--bleed {
	--d5ic-peek: var(--d5ic-peek-set, 0.25);
	--d5ic-gaps: var(--d5ic-pv);
}

/* The stage is what breaks out of the content width; carousel.js sets the two variables. */
.d5ic__stage {
	position: relative;
	width: var(--d5ic-w, 100%);
	max-width: none;
	margin-left: var(--d5ic-ml, 0px);
}

.d5ic .d5ic__track {
	position: relative;
	display: flex;
	gap: var(--d5ic-gap);
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

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

.d5ic__track:focus-visible {
	outline: 2px solid var(--d5ic-accent);
	outline-offset: 2px;
}

.d5ic .d5ic__slide {
	flex: 0 0 calc((100% - var(--d5ic-gaps) * var(--d5ic-gap)) / (var(--d5ic-pv) + var(--d5ic-peek)));
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	aspect-ratio: var(--d5ic-ratio);
	overflow: hidden;
	border-radius: var(--d5ic-radius);
	scroll-snap-align: start;
}

.d5ic__link {
	display: block;
	width: 100%;
	height: 100%;
}

.d5ic .d5ic__img {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	object-fit: cover;
	user-select: none;
}

.d5ic--ratio-auto .d5ic__track {
	align-items: flex-start;
}

.d5ic--ratio-auto .d5ic__link,
.d5ic--ratio-auto .d5ic__img {
	height: auto;
}

/* Arrows */
.d5ic .d5ic__arrow {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #111;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
	cursor: pointer;
	transform: translateY(-50%);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.d5ic__arrow--prev {
	left: 12px;
}

.d5ic__arrow--prev svg {
	transform: rotate(180deg);
}

.d5ic__arrow--next {
	right: 12px;
}

.d5ic .d5ic__arrow:hover {
	transform: translateY(-50%) scale(1.06);
}

.d5ic .d5ic__arrow:disabled {
	opacity: 0.35;
	cursor: default;
	transform: translateY(-50%);
}

.d5ic .d5ic__arrow:focus-visible,
.d5ic .d5ic__nav-item:focus-visible {
	outline: 2px solid var(--d5ic-accent);
	outline-offset: 2px;
}

/* Navigation below the carousel */
.d5ic__nav {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4px;
	margin-top: 16px;
}

.d5ic .d5ic__nav-item {
	position: relative;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	line-height: 1;
	cursor: pointer;
}

/* Dots: 24px tap target around a 10px dot. */
.d5ic--nav-dots .d5ic__nav-item {
	width: 24px;
	height: 24px;
}

.d5ic--nav-dots .d5ic__nav-item::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: currentColor;
	opacity: 0.3;
	transform: translate(-50%, -50%);
	transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.d5ic--nav-dots .d5ic__nav-item.is-active::before {
	background: var(--d5ic-accent);
	opacity: 1;
	transform: translate(-50%, -50%) scale(1.25);
}

/* Numbers: one digit per image. */
.d5ic--nav-numbers .d5ic__nav-item {
	min-width: 32px;
	height: 32px;
	padding: 0 6px;
	border-bottom: 2px solid transparent;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	opacity: 0.55;
	transition: opacity 0.2s ease, border-color 0.2s ease;
}

.d5ic--nav-numbers .d5ic__nav-item:hover {
	opacity: 1;
}

.d5ic--nav-numbers .d5ic__nav-item.is-active {
	border-bottom-color: var(--d5ic-accent);
	color: var(--d5ic-accent);
	font-weight: 700;
	opacity: 1;
}

/* Everything fits: no navigation needed. */
.d5ic.is-static .d5ic__arrow,
.d5ic.is-static .d5ic__nav {
	display: none;
}

/* Visual Builder placeholder */
.d5ic-empty {
	padding: 32px 16px;
	border: 1px dashed currentColor;
	text-align: center;
	opacity: 0.7;
}

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

	.d5ic .d5ic__arrow,
	.d5ic .d5ic__nav-item,
	.d5ic .d5ic__nav-item::before {
		transition: none;
	}
}
