/**
 * Rotating Headline frontend styles.
 *
 * The first keyword carries .is-active from the server, so the headline is
 * visible and correctly laid out with CSS alone.
 */

.rhl-module {
	--rhl-bg-image: none;
	position: relative;
	box-sizing: border-box;
	width: 100%;
}

.rhl-module *,
.rhl-module *::before,
.rhl-module *::after {
	box-sizing: border-box;
}

/* Hero framing ---------------------------------------------------------- */

.rhl-module--hero {
	display: flex;
	align-items: center;
	overflow: hidden;
	min-height: var(--rhl-min-height, 620px);
	background-color: var(--rhl-bg-colour, #1e2226);
}

.rhl-module__bg,
.rhl-module__overlay {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.rhl-module__bg {
	background-image: var(--rhl-bg-image);
	background-repeat: no-repeat;
	background-position: var(--rhl-bg-position, center center);
	background-size: cover;
}

.rhl-module__overlay {
	background-color: var(--rhl-overlay-colour, #000);
	opacity: var(--rhl-overlay-opacity, 0.25);
}

.rhl-module__inner {
	position: relative;
	z-index: 1;
	width: 100%;
	padding-right: var(--rhl-edge-padding, 64px);
	padding-left: var(--rhl-edge-padding, 64px);
}

.rhl-module--inline .rhl-module__inner {
	padding-right: 0;
	padding-left: 0;
}

/* Headline -------------------------------------------------------------- */

.rhl-module__headline {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--rhl-gap, 18px);
	margin: 0;
	padding: 0;
	color: var(--rhl-text-colour, #fff);
	font-family: var(--rhl-font-family, sans-serif);
	font-size: var(--rhl-font-size, 62px);
	font-weight: var(--rhl-font-weight, 500);
	line-height: var(--rhl-line-height, 1.1);
	letter-spacing: var(--rhl-letter-spacing, -0.6px);
	text-transform: var(--rhl-text-transform, uppercase);
}

.rhl-module--align-left .rhl-module__headline {
	justify-content: flex-start;
}

.rhl-module--align-center .rhl-module__headline {
	justify-content: center;
	text-align: center;
}

.rhl-module--align-right .rhl-module__headline {
	justify-content: flex-end;
}

.rhl-module__static {
	white-space: nowrap;
}

.rhl-module__dot {
	flex: 0 0 auto;
	width: var(--rhl-dot-size, 10px);
	height: var(--rhl-dot-size, 10px);
	border-radius: 50%;
	background-color: var(--rhl-dot-colour, #cdfa55);
}

/* Rotator --------------------------------------------------------------- */

/*
 * All keywords share a single grid cell. In the default width mode the cell is
 * as wide as the longest keyword, so nothing on the line ever shifts.
 */
.rhl-module__rotator {
	display: inline-grid;
	position: relative;
	grid-template-areas: "word";
	transition: width var(--rhl-duration, 0.5s) var(--rhl-easing, ease-out);
}

.rhl-module__word {
	grid-area: word;
	justify-self: start;
	white-space: nowrap;
	/* Resting position for a keyword that is waiting its turn: just above. */
	opacity: 0;
	transform: translateY(calc(var(--rhl-drift, 14px) * -1));
	pointer-events: none;
	/* Queued keywords snap back into position without animating. */
	transition: none;
}

.rhl-module--align-center .rhl-module__word {
	justify-self: center;
}

.rhl-module--align-right .rhl-module__word {
	justify-self: end;
}

.rhl-module__word.is-active,
.rhl-module__word.is-leaving {
	transition:
		opacity var(--rhl-duration, 0.5s) var(--rhl-easing, ease-out),
		transform var(--rhl-duration, 0.5s) var(--rhl-easing, ease-out);
}

.rhl-module__word.is-active {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

/* Outgoing keyword fades out while drifting down. */
.rhl-module__word.is-leaving {
	opacity: 0;
	transform: translateY(var(--rhl-drift, 14px));
}

/* Reduced motion -------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.rhl-module--respect-motion .rhl-module__rotator {
		transition: none;
	}

	.rhl-module--respect-motion .rhl-module__word,
	.rhl-module--respect-motion .rhl-module__word.is-active,
	.rhl-module--respect-motion .rhl-module__word.is-leaving {
		transform: none;
	}

	.rhl-module--respect-motion .rhl-module__word.is-active,
	.rhl-module--respect-motion .rhl-module__word.is-leaving {
		transition: opacity var(--rhl-duration, 0.5s) linear;
	}
}

/* Small screens --------------------------------------------------------- */

@media (max-width: 768px) {
	.rhl-module--hero {
		min-height: var(--rhl-min-height-mobile, 420px);
	}

	.rhl-module--hero .rhl-module__inner {
		padding-right: var(--rhl-edge-padding-mobile, 24px);
		padding-left: var(--rhl-edge-padding-mobile, 24px);
	}
}
