/* Overlay Slideshow: front end (also used by the editor preview). */

.ovs {
	position: relative;
	display: block;
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
	overflow: hidden;
}

/* Gives the slideshow its height from the image shape, at any width. */
.ovs__sizer {
	display: block;
	width: 100%;
}

/* In "fill" mode the script sets an explicit height, never below the image shape. */
.ovs--fill .ovs__sizer {
	min-height: 0;
}

/* Size container: text size (cqw) and slide-in distances (cqw/cqh) follow this box. */
.ovs__viewport {
	position: absolute;
	inset: 0;
	overflow: hidden;
	container-type: size;
	touch-action: pan-y;
}

.ovs__slide {
	position: absolute;
	inset: 0;
	visibility: hidden;
	opacity: 0;
	z-index: 0;
}

.ovs__slide.is-active {
	visibility: visible;
	opacity: 1;
	z-index: 2;
}

.ovs__slide.is-leaving {
	visibility: visible;
	opacity: 1;
	z-index: 1;
}

.ovs .ovs__slide img.ovs__img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	object-fit: cover;
}

.ovs__position {
	position: absolute;
	width: max-content;
	max-width: 100%;
	margin: 0;
}

.ovs .ovs__text {
	box-sizing: border-box;
	margin: 0;
	line-height: 1.15;
	letter-spacing: normal;
	text-transform: none;
	white-space: pre-wrap;
	overflow-wrap: break-word;
	opacity: 0;
}

/* Text entrance: starts after its delay, counted from when the image is on screen. */
.ovs__slide.is-playing .ovs__text {
	animation: ovs-text-in var(--ovs-duration, 0.6s) cubic-bezier(0.16, 1, 0.3, 1) var(--ovs-delay, 0s) both;
}

.ovs__text--from-right {
	--ovs-from: translateX(calc((100 - var(--ovs-x)) * 1cqw + var(--ovs-x) * 1%));
}

.ovs__text--from-left {
	--ovs-from: translateX(calc(var(--ovs-x) * -1cqw - (100 - var(--ovs-x)) * 1%));
}

.ovs__text--from-top {
	--ovs-from: translateY(calc(var(--ovs-y) * -1cqh - (100 - var(--ovs-y)) * 1%));
}

.ovs__text--from-bottom {
	--ovs-from: translateY(calc((100 - var(--ovs-y)) * 1cqh + var(--ovs-y) * 1%));
}

.ovs__text--zoom {
	--ovs-from: scale(0.6);
}

.ovs__slide.is-playing .ovs__text--none {
	animation-duration: 1ms;
}

@keyframes ovs-text-in {
	from {
		opacity: 0;
		transform: var(--ovs-from, none);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* Image transitions */
.ovs--fade .ovs__slide.is-entering {
	animation: ovs-fade-in var(--ovs-speed, 0.8s) ease both;
}

.ovs--slide .ovs__slide.is-entering {
	animation: ovs-enter-next var(--ovs-speed, 0.8s) ease both;
}

.ovs--slide .ovs__slide.is-leaving {
	animation: ovs-leave-next var(--ovs-speed, 0.8s) ease both;
}

.ovs--slide.ovs--backwards .ovs__slide.is-entering {
	animation-name: ovs-enter-previous;
}

.ovs--slide.ovs--backwards .ovs__slide.is-leaving {
	animation-name: ovs-leave-previous;
}

@keyframes ovs-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes ovs-enter-next {
	from { transform: translateX(100%); }
	to { transform: none; }
}

@keyframes ovs-leave-next {
	from { transform: none; }
	to { transform: translateX(-100%); }
}

@keyframes ovs-enter-previous {
	from { transform: translateX(-100%); }
	to { transform: none; }
}

@keyframes ovs-leave-previous {
	from { transform: none; }
	to { transform: translateX(100%); }
}

/* Arrows and dots. Specific selectors so theme button styles do not leak in. */
.ovs button.ovs__arrow {
	position: absolute;
	top: 50%;
	z-index: 5;
	width: 40px;
	height: 40px;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.35);
	box-shadow: none;
	color: #fff;
	cursor: pointer;
	transform: translateY(-50%);
	opacity: 0.75;
	transition: opacity 0.2s, background-color 0.2s;
}

.ovs button.ovs__arrow--prev { left: 10px; }
.ovs button.ovs__arrow--next { right: 10px; }

.ovs button.ovs__arrow::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 10px;
	border-top: 2px solid currentColor;
	border-left: 2px solid currentColor;
	transform: translate(-30%, -50%) rotate(-45deg);
}

.ovs button.ovs__arrow--next::before {
	transform: translate(-70%, -50%) rotate(135deg);
}

.ovs button.ovs__arrow:hover,
.ovs button.ovs__arrow:focus-visible {
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	opacity: 1;
}

.ovs__dots {
	position: absolute;
	right: 0;
	bottom: 10px;
	left: 0;
	z-index: 5;
	display: flex;
	justify-content: center;
	gap: 8px;
	pointer-events: none;
}

.ovs .ovs__dots button.ovs__dot {
	width: 12px;
	height: 12px;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	background: transparent;
	box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
	cursor: pointer;
	pointer-events: auto;
}

.ovs .ovs__dots button.ovs__dot.is-active {
	background: #fff;
}

.ovs button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* Smaller controls on phones so they cover less of the picture. */
@media (max-width: 600px) {
	.ovs button.ovs__arrow {
		width: 30px;
		height: 30px;
	}

	.ovs button.ovs__arrow--prev { left: 6px; }
	.ovs button.ovs__arrow--next { right: 6px; }

	.ovs .ovs__dots button.ovs__dot {
		width: 9px;
		height: 9px;
	}
}

.ovs-notice {
	padding: 12px;
	border: 1px dashed #b32d2e;
	color: #b32d2e;
}

/* Respect "reduce motion": same timing, but fades instead of movement. */
@media (prefers-reduced-motion: reduce) {
	.ovs .ovs__text {
		--ovs-from: none;
	}

	.ovs--slide .ovs__slide.is-entering {
		animation-name: ovs-fade-in !important;
	}

	.ovs--slide .ovs__slide.is-leaving {
		animation: none;
	}
}
