/*
 * ARN Hero — Typography: one large word per slide (builds on
 * hero-base.css). Phone first: the word and the object above the text, the
 * menu as numbers along the bottom; from 768 px the word fills the screen,
 * the text sits in a bottom corner and the menu runs down an edge, turned on
 * its side.
 *
 * data-view       poster   one word across the screen
 *                 stacked  lines from the start edge
 *                 marquee  moving band of the word
 *                 cutout   the slide image inside the letters
 * data-tone       light | dark
 * data-pos        start | end           bottom corner of the text
 * data-object     start | center | end  object position
 * data-menu-side  start | end           edge of the side menu
 * data-case       upper | none
 * data-letters    solid | outline
 * data-fx         rise | fade | zoom
 * data-motion     on | off              the band moves (set by the runtime)
 * slide data-layer  weave | front | behind   object and word
 *
 * The word is sized from its longest line and its number of lines
 * (--vdx-type-chars, --vdx-type-lines, printed on the word) against the
 * stage, a size container. Layers of a slide share one grid cell: backdrop,
 * word, object, the woven outline copy of the word, text.
 *
 * Tokens set by the widget controls (empty by default, palette fallbacks):
 * --vdx-type-surface, --vdx-type-ink, --vdx-type-stroke, --vdx-type-shadow,
 * --vdx-type-menu, --vdx-type-menu-active, --vdx-type-number,
 * --vdx-type-scale, --vdx-type-object-size (share of the hero height,
 * unitless), --vdx-type-band (seconds for one word of the band).
 */

.vdx-typography {
	--vdx-type-surface: var(--vendix-color-bg-light, #f7f8fa);
	--vdx-type-heading: var(--vendix-color-heading, #111827);
	--vdx-type-body: var(--vendix-color-text, #374151);
	--vdx-type-muted: var(--vendix-color-muted, #6b7280);
	--vdx-type-word: var(--vdx-type-ink, var(--vdx-type-heading));
	--vdx-type-scale: 1;
	--vdx-type-fit: 1.36;
	--vdx-type-object-size: 82;
	--vdx-type-top: calc(var(--vdx-safe-top, 0px) + 16px);
	--vdx-type-bottom: 24px;
	--vdx-type-pad-start: var(--vdx-gutter);
	--vdx-type-pad-end: var(--vdx-gutter);
	--vdx-links-bottom: 84px;

	background: var(--vdx-type-surface);
	color: var(--vdx-type-heading);
}

.vdx-typography[data-tone="light"] {
	--vdx-focus-ring: var(--vendix-color-secondary, #111827);
	--vdx-btn-line: var(--vendix-color-secondary, #111827);
	--vdx-btn-ink: var(--vendix-color-secondary, #111827);
	--vdx-btn-hover-bg: var(--vendix-color-secondary, #111827);
	--vdx-btn-hover-ink: #ffffff;
	--vdx-link-color: var(--vdx-type-heading);
}

.vdx-typography[data-tone="dark"] {
	--vdx-type-surface: var(--vdx-ink);
	--vdx-type-heading: #ffffff;
	--vdx-type-body: var(--vdx-on-media-soft);
	--vdx-type-muted: var(--vdx-on-media-soft);
}

/* Letters typed in mixed case are narrower. */
.vdx-typography[data-case="none"] {
	--vdx-type-fit: 1.62;
}

/* Room for the menu row along the bottom. */
.vdx-typography:has(> .vdx-typography__menu) {
	--vdx-type-bottom: 84px;
}

/* ------------------------------------------------------------------ */
/* Slides and layers                                                   */
/* ------------------------------------------------------------------ */

.vdx-typography .vdx-typography__stage {
	position: absolute;
	inset: 0;
	container-type: size;
	touch-action: pan-y;
}

.vdx-typography .vdx-typography__slide {
	position: absolute;
	inset: 0;
	display: grid;
	grid-template-rows: minmax(0, 1fr) auto;
	grid-template-areas:
		"word"
		"content";
	gap: 16px;
	padding-block: var(--vdx-type-top) var(--vdx-type-bottom);
	padding-inline: var(--vdx-type-pad-start) var(--vdx-type-pad-end);
	background: var(--vdx-type-surface);
	visibility: hidden;
}

.vdx-typography .vdx-typography__slide.is-active,
.vdx-typography .vdx-typography__slide.is-leaving {
	visibility: visible;
}

.vdx-typography .vdx-typography__slide.is-active {
	z-index: 2;
}

.vdx-typography .vdx-typography__slide.is-leaving {
	z-index: 1;
}

.vdx-typography .vdx-typography__backdrop {
	position: absolute;
	z-index: 0;
	inset: 0;
	overflow: hidden;
}

.vdx-typography .vdx-typography__veil {
	position: absolute;
	inset: 0;
	background: var(--vdx-type-surface);
	opacity: calc(0.72 * var(--vdx-shade-opacity));
}

.vdx-typography[data-tone="dark"] .vdx-typography__veil {
	background: var(--vdx-shade);
	opacity: calc(0.6 * var(--vdx-shade-opacity));
}

.vdx-typography .vdx-typography__words {
	position: relative;
	z-index: 1;
	grid-area: word;
	display: grid;
	align-content: center;
	min-block-size: 0;
	min-inline-size: 0;
	pointer-events: none;
}

.vdx-typography .vdx-typography__words--front {
	z-index: 3;
}

/* Object behind the word: the word layer comes on top. */
.vdx-typography .vdx-typography__slide[data-layer="behind"] .vdx-typography__words {
	z-index: 2;
}

.vdx-typography .vdx-typography__slide[data-layer="behind"] .vdx-typography__object {
	z-index: 1;
}

/* The heading only carries the semantics; both copies of the word look the same. */
.vdx-typography .vdx-typography__heading {
	margin: 0;
	padding: 0;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
}

.vdx-typography .vdx-typography__word {
	display: block;
	color: var(--vdx-type-word);
	font-size: calc(var(--vdx-type-scale) * 92vw * var(--vdx-type-fit) / var(--vdx-type-chars));
	font-size: calc(var(--vdx-type-scale) * min((100cqi - var(--vdx-type-pad-start) - var(--vdx-type-pad-end)) * var(--vdx-type-fit) / var(--vdx-type-chars), 52cqb / var(--vdx-type-lines)));
	font-weight: 800;
	letter-spacing: -0.03em;
	line-height: 0.86;
	text-align: center;
	white-space: nowrap;
}

.vdx-typography[data-case="upper"] .vdx-typography__word {
	text-transform: uppercase;
}

/* Arabic joins its letters and needs taller lines. */
.vdx-typography:lang(ar) .vdx-typography__word {
	letter-spacing: normal;
	line-height: 1.15;
}

.vdx-typography[data-letters="outline"] .vdx-typography__word,
.vdx-typography .vdx-typography__word--line {
	color: transparent;
	-webkit-text-stroke: var(--vdx-type-stroke, 2px) var(--vdx-type-word);
}

/* Image inside the letters (the runtime sets --vdx-type-fill when the slide shows). */
.vdx-typography .vdx-typography__slide.has-fill .vdx-typography__word:not(.vdx-typography__word--line) {
	background-image: var(--vdx-type-fill, none);
	background-position: center;
	background-size: cover;
	color: transparent;
	-webkit-background-clip: text;
	background-clip: text;
}

.vdx-typography .vdx-typography__object {
	position: relative;
	z-index: 2;
	grid-area: word;
	display: grid;
	place-items: end center;
	min-block-size: 0;
	container-type: size;
	pointer-events: none;
}

.vdx-typography[data-object="start"] .vdx-typography__object {
	justify-items: start;
}

.vdx-typography[data-object="end"] .vdx-typography__object {
	justify-items: end;
}

.vdx-typography .vdx-typography__object-img {
	display: block;
	inline-size: auto;
	max-inline-size: 100%;
	block-size: 82%;
	block-size: calc(var(--vdx-type-object-size) * 1cqb);
	margin: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: contain;
	filter: drop-shadow(0 calc(var(--vdx-type-shadow, 20px) * 0.6) var(--vdx-type-shadow, 20px) color-mix(in srgb, var(--vendix-color-secondary, #111827) 24%, transparent));
}

/* ------------------------------------------------------------------ */
/* Views                                                               */
/* ------------------------------------------------------------------ */

/* Stacked: lines from the start edge, near the top. */
.vdx-typography[data-view="stacked"] .vdx-typography__words {
	align-content: start;
}

.vdx-typography[data-view="stacked"] .vdx-typography__word {
	text-align: start;
}

/* Marquee: the word repeats in a band across the whole width. Four runs
   (ARNMRTVNDX_Hero_Typography::MARQUEE_RUNS): moving by a quarter shows
   the next run in the place of the first. */
.vdx-typography[data-view="marquee"] .vdx-typography__words {
	margin-inline: calc(-1 * var(--vdx-type-pad-start)) calc(-1 * var(--vdx-type-pad-end));
}

.vdx-typography[data-view="marquee"] .vdx-typography__word {
	display: flex;
	inline-size: max-content;
	font-size: calc(var(--vdx-type-scale) * 30cqb);
	animation: vdx-type-band var(--vdx-type-band, 26s) linear infinite;
	animation-play-state: paused;
}

.vdx-typography[data-view="marquee"][data-motion="on"] .vdx-typography__word {
	animation-play-state: running;
}

.vdx-typography .vdx-typography__run {
	padding-inline-end: 0.32em;
}

@keyframes vdx-type-band {
	to {
		transform: translateX(calc(var(--vdx-sign) * -25%));
	}
}

/* ------------------------------------------------------------------ */
/* Text                                                                */
/* ------------------------------------------------------------------ */

.vdx-typography .vdx-typography__content {
	position: relative;
	z-index: 4;
	grid-area: content;
	display: grid;
	justify-items: start;
	gap: 10px;
	max-inline-size: 420px;
}

.vdx-typography .vdx-typography__kicker {
	margin: 0;
	color: var(--vdx-primary);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: var(--vdx-tracking-wide);
	line-height: 1.4;
	text-transform: uppercase;
}

.vdx-typography[data-tone="dark"] .vdx-typography__kicker {
	color: var(--vdx-accent);
}

.vdx-typography .vdx-typography__text {
	margin: 0;
	color: var(--vdx-type-body);
	font-size: 15px;
	line-height: 1.6;
	text-wrap: pretty;
}

.vdx-typography .vdx-typography__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-block-start: 4px;
}

.vdx-typography .vdx-btn {
	min-block-size: 46px;
	padding: 11px 20px;
	font-size: 14px;
}

/* ------------------------------------------------------------------ */
/* Transitions                                                         */
/* ------------------------------------------------------------------ */

.vdx-typography .vdx-typography__slide.is-active {
	animation: vdx-type-fade calc(var(--vdx-speed) * 0.6) ease both;
}

/* Entrance on the layers, so the band keeps its own animation on the word. */
.vdx-typography[data-fx="rise"] .vdx-typography__slide.is-active .vdx-typography__words {
	animation: vdx-type-rise var(--vdx-speed) var(--vdx-ease) both;
}

.vdx-typography[data-fx="zoom"] .vdx-typography__slide.is-active .vdx-typography__words {
	animation: vdx-type-zoom var(--vdx-speed) var(--vdx-ease) both;
}

.vdx-typography .vdx-typography__slide.is-active .vdx-typography__object {
	animation: vdx-type-object var(--vdx-speed) var(--vdx-ease) both;
	animation-delay: calc(var(--vdx-speed) * 0.15);
}

.vdx-typography .vdx-typography__slide.is-active .vdx-typography__content > * {
	animation: vdx-type-text calc(var(--vdx-speed) * 0.9) var(--vdx-ease) both;
	animation-delay: calc(var(--vdx-speed) * 0.3);
}

.vdx-typography .vdx-typography__slide.is-active .vdx-typography__content > :nth-child(2) {
	animation-delay: calc(var(--vdx-speed) * 0.4);
}

.vdx-typography .vdx-typography__slide.is-active .vdx-typography__content > :nth-child(3) {
	animation-delay: calc(var(--vdx-speed) * 0.5);
}

.vdx-typography .vdx-typography__slide.is-leaving :is(.vdx-typography__words, .vdx-typography__object, .vdx-typography__content) {
	animation: vdx-type-fade-out calc(var(--vdx-speed) * 0.4) ease both;
}

@keyframes vdx-type-fade {
	from {
		opacity: 0;
	}
}

@keyframes vdx-type-fade-out {
	to {
		opacity: 0;
	}
}

@keyframes vdx-type-rise {
	from {
		opacity: 0;
		translate: 0 14%;
	}
}

@keyframes vdx-type-zoom {
	from {
		opacity: 0;
		scale: 1.2;
	}
}

@keyframes vdx-type-object {
	from {
		opacity: 0;
		translate: 0 6%;
	}
}

@keyframes vdx-type-text {
	from {
		opacity: 0;
		transform: translateY(18px);
	}
}

/* ------------------------------------------------------------------ */
/* Menu and dock (phone: numbers along the bottom)                     */
/* ------------------------------------------------------------------ */

.vdx-typography .vdx-typography__menu {
	position: absolute;
	z-index: 5;
	inset-block-end: 18px;
	inset-inline-start: var(--vdx-gutter);
	display: flex;
	color: var(--vdx-type-menu, var(--vdx-type-muted));
}

.vdx-typography .vdx-typography__tabs {
	display: flex;
	gap: 2px;
}

.vdx-typography .vdx-typography__tab {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-inline-size: 32px;
	min-block-size: 44px;
	padding-inline: 4px;
	color: inherit;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: var(--vdx-tracking-wide);
	line-height: 1.2;
	text-transform: uppercase;
	white-space: nowrap;
}

.vdx-typography .vdx-typography__tab:is(:hover, :focus),
.vdx-typography .vdx-typography__tab[aria-selected="true"] {
	color: var(--vdx-type-menu-active, var(--vdx-type-word));
}

/* Autoplay progress under the current slide. */
.vdx-typography .vdx-typography__tab[aria-selected="true"]::after {
	content: "";
	position: absolute;
	inset-block-end: 6px;
	inset-inline-start: 4px;
	inline-size: calc(var(--vdx-progress, 1) * (100% - 8px));
	block-size: 2px;
	background: var(--vdx-progress-color, var(--vdx-primary));
}

.vdx-typography[data-tone="dark"] .vdx-typography__tab[aria-selected="true"]::after {
	background: var(--vdx-progress-color, var(--vdx-accent));
}

.vdx-typography .vdx-typography__tab-num {
	font-variant-numeric: tabular-nums;
}

/* Phones show the numbers; the names stay in the accessible name. */
.vdx-typography .vdx-typography__tab-label {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.vdx-typography .vdx-typography__dock {
	position: absolute;
	z-index: 5;
	inset-block-end: 18px;
	inset-inline-end: var(--vdx-gutter);
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--vdx-type-menu-active, var(--vdx-type-word));
}

.vdx-typography .vdx-typography__arrow {
	display: none;
	place-items: center;
	inline-size: 44px;
	block-size: 44px;
	border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
	border-radius: 50%;
	color: inherit;
	transition: border-color 0.2s ease;
}

.vdx-typography .vdx-typography__arrow:is(:hover, :focus) {
	border-color: currentColor;
	color: inherit;
}

.vdx-typography .vdx-typography__arrow svg {
	inline-size: 18px;
	block-size: 18px;
}

.vdx-typography .vdx-typography__counter {
	display: none;
	align-items: center;
	gap: 10px;
	margin: 0;
	color: var(--vdx-type-number, inherit);
	font-size: 15px;
	font-variant-numeric: tabular-nums;
	font-weight: 700;
	line-height: 1;
}

.vdx-typography .vdx-typography__counter-current {
	display: inline-block;
}

.vdx-typography .vdx-typography__counter-current.is-changing {
	animation: vdx-type-text calc(var(--vdx-speed) * 0.8) var(--vdx-ease) both;
}

.vdx-typography .vdx-typography__counter-bar {
	overflow: hidden;
	inline-size: 64px;
	block-size: 2px;
	background: color-mix(in srgb, currentColor 22%, transparent);
}

.vdx-typography .vdx-typography__counter-fill {
	display: block;
	inline-size: calc(var(--vdx-progress, 1) * 100%);
	block-size: 100%;
	background: var(--vdx-progress-color, var(--vdx-primary));
}

.vdx-typography[data-tone="dark"] .vdx-typography__counter-fill {
	background: var(--vdx-progress-color, var(--vdx-accent));
}

.vdx-typography .vdx-typography__counter-total {
	color: var(--vdx-type-muted);
}

/* ------------------------------------------------------------------ */
/* Tablet and desktop: the word fills the screen                       */
/* ------------------------------------------------------------------ */

@media (min-width: 768px) {
	.vdx-typography {
		--vdx-type-top: calc(var(--vdx-safe-top, 0px) + 32px);
		--vdx-type-menu-width: 44px;
		--vdx-links-bottom: 112px;
	}

	.vdx-typography,
	.vdx-typography:has(> .vdx-typography__menu) {
		--vdx-type-bottom: 40px;
	}

	/* Keep the menu edge free. */
	.vdx-typography:has(> .vdx-typography__menu) {
		--vdx-type-pad-start: calc(var(--vdx-gutter) + var(--vdx-type-menu-width) + 16px);
	}

	.vdx-typography[data-menu-side="end"]:has(> .vdx-typography__menu) {
		--vdx-type-pad-start: var(--vdx-gutter);
		--vdx-type-pad-end: calc(var(--vdx-gutter) + var(--vdx-type-menu-width) + 16px);
	}

	.vdx-typography .vdx-typography__slide {
		grid-template-rows: minmax(0, 1fr);
		grid-template-areas: "word";
	}

	/* Text in a bottom corner over the word's cell; the dock takes the other corner. */
	.vdx-typography .vdx-typography__content {
		grid-area: word;
		align-self: end;
		justify-self: start;
		gap: 12px;
		max-inline-size: min(380px, 40%);
	}

	.vdx-typography[data-pos="end"] .vdx-typography__content {
		justify-self: end;
	}

	.vdx-typography .vdx-btn {
		min-block-size: 48px;
		padding: 12px 24px;
		font-size: 15px;
	}

	.vdx-typography .vdx-typography__text {
		font-size: 16px;
	}

	/* The side menu: names turned on their side; LTR reads upwards from the start edge. */
	.vdx-typography .vdx-typography__menu {
		inset-block: var(--vdx-type-top) var(--vdx-type-bottom);
		inset-inline: var(--vdx-gutter) auto;
		inline-size: var(--vdx-type-menu-width);
		align-items: center;
		justify-content: center;
	}

	.vdx-typography[data-menu-side="end"] .vdx-typography__menu {
		inset-inline: auto var(--vdx-gutter);
	}

	/* The moving band runs under the menu: the menu sits on a pill of the surface color. */
	.vdx-typography[data-view="marquee"] .vdx-typography__menu {
		block-size: fit-content;
		margin-block: auto;
		padding-block: 14px;
		border-radius: 999px;
		background: var(--vdx-type-surface);
	}

	.vdx-typography .vdx-typography__tabs {
		flex-direction: column;
		align-items: center;
		gap: 18px;
	}

	.vdx-typography .vdx-typography__tab {
		min-inline-size: 44px;
		padding-block: 0;
		padding-inline: 6px;
		writing-mode: vertical-rl;
		rotate: 180deg;
	}

	.vdx-typography.vdx-hero--rtl .vdx-typography__tab {
		rotate: none;
	}

	/* Names shown unless "Slide names in the menu" is off (then they stay vdx-sr-only). */
	.vdx-typography .vdx-typography__tab-label:not(.vdx-sr-only) {
		position: static;
		inline-size: auto;
		block-size: auto;
		overflow: visible;
		clip-path: none;
	}

	.vdx-typography .vdx-typography__dock {
		inset-block-end: var(--vdx-type-bottom);
		inset-inline: auto var(--vdx-type-pad-end);
		gap: 12px;
	}

	.vdx-typography[data-pos="end"] .vdx-typography__dock {
		inset-inline: var(--vdx-type-pad-start) auto;
	}

	.vdx-typography .vdx-typography__arrow {
		display: grid;
	}

	.vdx-typography .vdx-typography__counter {
		display: flex;
	}
}

/* ------------------------------------------------------------------ */
/* Reduced motion: short cross-fade only, the band stands still        */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	.vdx-typography[data-fx] .vdx-typography__slide.is-active .vdx-typography__words,
	.vdx-typography .vdx-typography__slide.is-active .vdx-typography__object,
	.vdx-typography[data-view="marquee"] .vdx-typography__word {
		animation: none;
	}

	.vdx-typography .vdx-typography__slide.is-active .vdx-typography__content > * {
		animation-name: vdx-type-fade;
		animation-delay: 0s;
	}
}
