/*
 * Motion (motion-and-counters change): blocks and cards that fade in from below on scroll (D3, D4) and the banner
 * parallax (D5). main.js adds the classes, so without JavaScript nothing is hidden; reduced motion switches it off.
 */

.reveal {
	opacity: 0;
	transform: translate3d(0, var(--motion-reveal-distance), 0);
	transition:
		opacity var(--motion-reveal-duration) var(--motion-ease),
		transform var(--motion-reveal-duration) var(--motion-ease);
	transition-delay: calc(var(--reveal-index, 0) * var(--motion-stagger));
}

.reveal.is-visible {
	opacity: 1;
	transform: none;
}

/*
 * Banner parallax (D5), from 768px: the image is 20% taller than the banner and main.js shifts it by up to ±10% of
 * the banner height while the banner passes, so it always covers the banner.
 */
@media (min-width: 768px) {
	.banner.has-parallax .banner__media img {
		position: relative;
		top: -10%;
		height: 120%;
		will-change: transform;
	}
}

/*
 * Banner stack (two or more banners in a row, inc/sections.php): each banner but the last stays under the sticky header
 * while the next one slides over it. main.js sets --banner-height, so a banner taller than the free screen sticks only
 * once its bottom has come into view. main.js also adds the dots on the right (from 768px) and moves the cards.
 */
.banner-stack > .banner {
	overflow: clip; /* the rising card */
}

.banner-stack > .banner:not(:last-child) {
	position: sticky;
	top: min(
		calc(var(--admin-bar-height) + var(--sticky-header-height)),
		calc(100vh - var(--banner-height, 0px))
	);
}

.banner-stack > .banner.has-stack-motion .banner__card {
	will-change: transform;
}

.banner-stack__dots {
	display: none;
}

@media (min-width: 768px) {
	.banner-stack__dots {
		position: fixed;
		top: 50%;
		right: var(--space-32);
		z-index: 10;
		display: flex;
		flex-direction: column;
		gap: var(--space-16);
		opacity: 0;
		pointer-events: none;
		transform: translateY(-50%);
		transition: opacity var(--motion-reveal-duration) var(--motion-ease);
	}

	.banner-stack__dots.is-visible {
		opacity: 1;
		pointer-events: auto;
	}

	/* 8px dot, 24px target. */
	.banner-stack__dot {
		position: relative;
		width: var(--space-24);
		height: var(--space-24);
		margin: calc(var(--space-8) * -1);
		border: 0;
		background: none;
		cursor: pointer;
	}

	.banner-stack__dot::before {
		content: "";
		position: absolute;
		inset: var(--space-8);
		border: 2px solid var(--color-white);
		border-radius: 50%;
		background: var(--color-white);
		transition: background-color var(--transition);
	}

	.banner-stack__dot[aria-current="true"]::before {
		background: transparent;
	}

	.banner-stack__dot:focus-visible {
		outline: 2px solid var(--color-white);
		outline-offset: 0;
		border-radius: 50%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.reveal {
		opacity: 1;
		transform: none;
		transition: none;
	}
}
