/*
 * Virtina child: scroll story (full-screen slides with a background video each).
 * Loaded only on template-home-vch.php. Colors come from tokens.
 *
 * The section is N x 100vh tall (N comes from --vch-story-count, set on the section).
 * The stage sticks to the top of the viewport while the visitor scrolls, and the
 * active slide follows the scroll position.
 */

:root {
	--vch-color-story-fallback: #d9893f;
	--vch-color-story-tint: rgba(255, 175, 125, 0.45);
	--vch-color-story-text-shadow: rgba(0, 0, 0, 0.25);
	--vch-color-dot-inactive: rgba(255, 255, 255, 0.38);
	--vch-color-glass: rgba(255, 255, 255, 0.1);
	--vch-color-final-card-bg: #fff;
	--vch-color-final-card-text: #000;
	--vch-story-fade: 0.8s;
}

.vch-story {
	position: relative;
	height: calc(var(--vch-story-count, 6) * 100vh);
	height: calc(var(--vch-story-count, 6) * 100svh);
}

.vch-story__stage {
	position: sticky;
	top: 0;
	height: 100vh;
	height: 100svh;
	overflow: hidden;
}

.vch-story__slide {
	position: absolute;
	inset: 0;
	background: var(--vch-color-story-fallback);
	opacity: 0;
	visibility: hidden;
	transition:
		opacity var(--vch-story-fade) ease,
		visibility 0s linear var(--vch-story-fade);
}

.vch-story__slide--active {
	opacity: 1;
	visibility: visible;
	transition:
		opacity var(--vch-story-fade) ease,
		visibility 0s;
}

.vch-story__media,
.vch-story__tint {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.vch-story__media {
	object-fit: cover;
	object-position: center;
}

.vch-story__tint {
	background: var(--vch-color-story-tint);
}

.vch-story__text {
	position: absolute;
	top: 30%;
	left: 50%;
	box-sizing: border-box;
	width: 64%;
	max-width: 860px;
	margin: 0;
	transform: translateX(-50%);
	color: var(--vch-color-on-overlay);
	font-family: 'Archivo', sans-serif;
	font-size: clamp(26px, 3.1vw, 54px);
	font-weight: 700;
	line-height: 1.35;
	text-align: center;
	text-shadow: 0 2px 24px var(--vch-color-story-text-shadow);
	word-break: break-word;
}

/* Slide 1 keeps the large Figma headline size. */
.vch-story__text--large {
	width: 67.4%;
	max-width: 1165px;
	font-size: clamp(40px, 5.79vw, 100px);
	line-height: 1.2;
}

.vch-story__nav {
	position: absolute;
	bottom: 28px;
	left: 0;
	right: 0;
}

.vch-story__dots {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: clamp(24px, 6.77vw, 117px);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* The pill-ring shape is an SVG mask, so the fill color comes from the token. */
.vch-story__dot {
	display: block;
	width: 42px;
	height: 30px;
	box-sizing: border-box;
	padding: 0;
	border: 0;
	background-color: var(--vch-color-dot-inactive);
	-webkit-mask: url('../images/vch-story-dot.svg') center / 100% 100% no-repeat;
	mask: url('../images/vch-story-dot.svg') center / 100% 100% no-repeat;
	cursor: pointer;
	transition: background-color 0.3s ease;
}

.vch-story__dot:hover,
.vch-story__dot--active {
	background-color: var(--vch-color-on-overlay);
}

.vch-story__dot:focus-visible,
.vch-story__skip:focus-visible {
	outline: 3px solid var(--vch-color-on-overlay);
	outline-offset: 4px;
}

.vch-story__skip {
	position: absolute;
	top: 32px;
	right: 32px;
	color: var(--vch-color-on-overlay);
	font-family: 'Inter', sans-serif;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: -0.48px;
	line-height: 1.5;
	text-decoration: none;
	white-space: nowrap;
}

@media (max-width: 767px) {
	.vch-story__text {
		top: 26%;
		width: 88%;
		font-size: clamp(22px, 6vw, 32px);
	}

	.vch-story__text--large {
		width: 88%;
		font-size: clamp(34px, 9vw, 56px);
	}

	.vch-story__dots {
		gap: 16px;
	}

	.vch-story__dot {
		width: 28px;
		height: 20px;
	}

	.vch-story__skip {
		top: 20px;
		right: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.vch-story__slide,
	.vch-story__slide--active,
	.vch-story__dot {
		transition: none;
	}
}

/* Slides 2-4: glass cards stacked above the pagination dots. */
.vch-story__cards {
	position: absolute;
	left: 50%;
	bottom: 80px;
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	justify-content: center;
	gap: 15px;
	box-sizing: border-box;
	width: max-content;
	max-width: calc(100% - 32px);
	transform: translateX(-50%);
}

.vch-story__card {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: clamp(150px, 16.84vw, 291px);
	height: clamp(110px, 9.32vw, 161px);
	padding: 16px 20px;
	border-radius: clamp(18px, 1.74vw, 30px);
	background: var(--vch-color-glass);
	-webkit-backdrop-filter: blur(15px);
	backdrop-filter: blur(15px);
	text-align: center;
}

.vch-story__card-text {
	margin: 0;
	color: var(--vch-color-on-overlay);
	font-family: 'Archivo', sans-serif;
	font-size: clamp(18px, 1.74vw, 30px);
	font-weight: 700;
	line-height: 1.2;
}

/* Lead line: left aligned, sits beside the body card. */
.vch-story__card--lead {
	align-items: flex-start;
	padding-left: clamp(20px, 2.3vw, 40px);
	text-align: left;
}

/* Body copy: wide card, medium weight, two paragraphs. */
.vch-story__card--body {
	align-items: flex-start;
	width: clamp(300px, 49.4vw, 854px);
	height: auto;
	min-height: clamp(110px, 9.32vw, 161px);
	padding: clamp(18px, 2.3vw, 40px);
	text-align: left;
}

.vch-story__card--body .vch-story__card-text {
	font-size: clamp(14px, 1.16vw, 20px);
	font-weight: 500;
}

.vch-story__card--body .vch-story__card-text + .vch-story__card-text {
	margin-top: 1em;
}

/* Icon cards: icon above a 26px label. */
.vch-story__card--icon {
	height: clamp(150px, 13.25vw, 229px);
}

.vch-story__card--icon .vch-story__card-text {
	font-size: clamp(16px, 1.5vw, 26px);
}

.vch-story__icon {
	display: block;
	width: clamp(46px, 4.3vw, 75px);
	margin-bottom: clamp(10px, 1.4vw, 24px);
	background-color: var(--vch-color-on-overlay);
	-webkit-mask: url('../images/vch-story-icon-strategy.svg') center / contain no-repeat;
	mask: url('../images/vch-story-icon-strategy.svg') center / contain no-repeat;
	aspect-ratio: 75 / 62.5;
}

.vch-story__icon--marketing {
	aspect-ratio: 87 / 61.6;
	-webkit-mask-image: url('../images/vch-story-icon-marketing.svg');
	mask-image: url('../images/vch-story-icon-marketing.svg');
}

.vch-story__icon--platform {
	aspect-ratio: 70 / 55;
	-webkit-mask-image: url('../images/vch-story-icon-platform.svg');
	mask-image: url('../images/vch-story-icon-platform.svg');
}

@media (max-width: 767px) {
	.vch-story__cards {
		bottom: 72px;
		flex-direction: column;
		align-items: stretch;
		width: 88%;
		max-width: none;
		gap: 10px;
	}

	.vch-story__card,
	.vch-story__card--body,
	.vch-story__card--icon {
		width: 100%;
		height: auto;
		min-height: 96px;
		padding: 16px;
	}

	.vch-story__card--body .vch-story__card-text {
		font-size: 15px;
	}

	.vch-story__card-text {
		font-size: 20px;
	}

	.vch-story__icon {
		width: 46px;
	}
}

/* Last slide: after its video ends, the three icon cards give way to the closing card. */
.vch-story__cards,
.vch-story__card--final {
	transition:
		opacity 0.6s ease,
		visibility 0s linear 0.6s;
}

.vch-story__card--final {
	position: absolute;
	top: 50%;
	left: 50%;
	box-sizing: border-box;
	width: clamp(300px, 49.4vw, 854px);
	height: auto;
	padding: clamp(28px, 3.5vw, 60px);
	gap: clamp(20px, 2.3vw, 40px);
	opacity: 0;
	visibility: hidden;
	transform: translate(-50%, -50%);
}

.vch-story__slide--finished .vch-story__cards {
	opacity: 0;
	visibility: hidden;
	transition:
		opacity 0.6s ease,
		visibility 0s linear 0.6s;
}

.vch-story__slide--finished .vch-story__card--final {
	opacity: 1;
	visibility: visible;
	transition:
		opacity 0.6s ease,
		visibility 0s;
}

.vch-story__card--final .vch-story__card-text {
	font-size: clamp(18px, 1.74vw, 30px);
	font-weight: 500;
}

.vch-story__final-cta {
	flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
	.vch-story__cards,
	.vch-story__card--final,
	.vch-story__slide--finished .vch-story__cards,
	.vch-story__slide--finished .vch-story__card--final {
		transition: none;
	}
}

@media (max-width: 767px) {
	.vch-story__card--final {
		width: 88%;
		padding: 24px 20px;
	}

	.vch-story__card--final .vch-story__card-text {
		font-size: 17px;
	}
}

/* Slides 2-4: cards fade up one after another when their slide becomes active. */
.vch-story__cards .vch-story__card {
	opacity: 0;
	transform: translateY(16px);
	transition:
		opacity 0.6s ease,
		transform 0.6s ease;
}

.vch-story__slide--active .vch-story__cards .vch-story__card {
	opacity: 1;
	transform: none;
	transition-delay: calc(0.3s + var(--vch-card-index, 0) * 0.45s);
}

@media (prefers-reduced-motion: reduce) {
	.vch-story__cards .vch-story__card,
	.vch-story__slide--active .vch-story__cards .vch-story__card {
		opacity: 1;
		transform: none;
		transition: none;
	}
}

/* Closing card on the last slide: solid white with black text. */
.vch-story__card--final {
	background: var(--vch-color-final-card-bg);
}

.vch-story__card--final .vch-story__card-text {
	color: var(--vch-color-final-card-text);
}

/* Pagination progress: the dot fills from left to right as its video plays. The dot mask clips the fill. */
.vch-story__dot {
	position: relative;
	overflow: hidden;
}

.vch-story__dot-fill {
	position: absolute;
	inset: 0;
	background-color: var(--vch-color-on-overlay);
	transform: scaleX(0);
	transform-origin: left center;
}

.vch-story__dot:hover {
	background-color: var(--vch-color-on-overlay);
}

.vch-story__dot--active {
	background-color: var(--vch-color-dot-inactive);
}
