/**
 * Section: Hero
 *
 * Mobile-first. All values come from assets/css/tokens.css.
 *
 * @package cartrack
 */

.hero {
	position: relative;
	isolation: isolate;
	display: flex;
	overflow: hidden;
	min-height: var(--hero-min-height);
	color: var(--color-text-inverse);
	background-color: var(--hero-overlay-colour); /* Shown when no image is set. */
}

.hero--height-full {
	min-height: max(var(--hero-min-height), var(--hero-height-full));
}

.hero--height-large {
	min-height: max(var(--hero-min-height), var(--hero-height-large));
}

.hero--height-medium {
	min-height: max(var(--hero-min-height), var(--hero-height-medium));
}

/* ---------- Background ---------- */

.hero__media {
	position: absolute;
	inset: 0;
	z-index: -1;
}

/* Video and embed: the shared .bg-video component (components/background-video.css). */
.hero__image {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hero__overlay,
.hero__media::after {
	content: "";
	position: absolute;
	inset: 0;
}

.hero__overlay {
	background-color: var(--hero-overlay-colour);
	opacity: var(--hero-overlay-opacity);
}

/* Constant scrim so text stays legible whatever overlay is chosen. */
.hero__media::after {
	background-color: var(--hero-scrim);
}

/* ---------- Layout ---------- */

.hero__inner {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: var(--space-2xl);
	width: 100%;
	max-width: calc(var(--container-narrow) + 2 * var(--container-gutter));
	margin-inline: auto;
	padding: var(--space-2xl) var(--container-gutter) var(--space-lg);
}

.hero__content {
	display: flex;
	flex: 1;
	flex-direction: column;
	justify-content: center;
	align-items: flex-start;
	max-width: var(--hero-content-max);
}

.hero--align-center .hero__content {
	align-items: center;
	margin-inline: auto;
	text-align: center;
}

/* ---------- Content ---------- */

/* Eyebrow and audience links are not in the mobile frame. */
.hero__eyebrow,
.hero__audience {
	display: none;
}

.hero__eyebrow {
	margin: 0 0 var(--space-sm);
	font-family: var(--font-heading);
	font-size: var(--font-size-xs);
	font-weight: var(--font-weight-medium);
	letter-spacing: var(--letter-spacing-eyebrow);
	text-transform: uppercase;
	color: var(--color-text-inverse-muted);
}

.hero__heading {
	margin: 0 0 var(--space-md);
	font-family: var(--t-h1-family);
	font-size: var(--t-h1-size);
	font-weight: var(--t-h1-weight);
	line-height: var(--t-h1-line-height);
	letter-spacing: var(--t-h1-tracking);
	color: inherit;
}

/* Audience links: the shared .link-pills component (components/link-pills.css). */
.hero__audience {
	margin: 0 0 var(--space-md);
}

.hero__subheading {
	margin: 0 0 var(--space-lg);
	font-family: var(--t-body-family);
	font-size: var(--t-body-size);
	font-weight: var(--t-body-weight);
	line-height: var(--t-body-line-height);
	letter-spacing: var(--t-body-tracking);
}

.hero__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-md);
}

.hero--align-center .hero__actions {
	justify-content: center;
}

/* ---------- Rating ---------- */

.hero__rating {
	display: inline-flex;
	align-items: center;
	gap: var(--space-xs);
	color: inherit;
	text-decoration: none;
}

a.hero__rating:hover .hero__rating-label {
	text-decoration: underline;
}

.hero__rating-logo {
	width: var(--hero-rating-logo-size);
	height: var(--hero-rating-logo-size);
	object-fit: contain;
}

.hero__rating-body {
	display: flex;
	flex-direction: column;
	gap: var(--space-2xs);
}

.hero__rating-top {
	display: flex;
	align-items: center;
	gap: var(--space-2xs);
}

.hero__rating-score {
	padding: 0 var(--space-2xs);
	border-radius: var(--radius-sm);
	background-color: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: var(--font-size-sm);
	font-weight: var(--font-weight-medium);
	line-height: var(--line-height-snug);
}

.hero__stars {
	display: block;
	width: calc(var(--hero-star-size) * 5);
	height: var(--hero-star-size);
	background: linear-gradient(90deg, var(--color-rating) var(--rating, 0%), var(--color-rating-empty) var(--rating, 0%));
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E") 0 0 / var(--hero-star-size) var(--hero-star-size) repeat-x;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E") 0 0 / var(--hero-star-size) var(--hero-star-size) repeat-x;
}

.hero__rating-label {
	font-family: var(--font-body);
	font-size: var(--font-size-xs);
	line-height: var(--line-height-snug);
	text-transform: uppercase;
}

/* ---------- Logo strip ---------- */

.hero__logos {
	display: grid;
	gap: var(--space-md);
	padding-top: var(--space-lg);
	border-top: 1px solid var(--color-border-inverse);
	text-align: center;
}

.hero__logos-heading {
	margin: 0;
	font-family: var(--font-heading);
	font-size: var(--font-size-sm);
	font-weight: var(--font-weight-medium);
	line-height: var(--line-height-body);
}

/* Mobile: logos scroll sideways (frame shows them running off-screen). */
.hero__logos-list {
	display: flex;
	align-items: center;
	gap: var(--space-xl);
	margin: 0;
	padding: 0 0 var(--space-xs);
	overflow-x: auto;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
	list-style: none;
}

.hero__logos-list::-webkit-scrollbar {
	display: none;
}

.hero__logos-list:focus-visible {
	outline: 2px solid var(--color-focus);
	outline-offset: 4px;
}

.hero__logos-item {
	flex: 0 0 auto;
	scroll-snap-align: start;
}

.hero__logo {
	display: block;
	width: auto;
	max-width: var(--hero-logo-max-width);
	height: var(--hero-logo-height-mobile);
	object-fit: contain;
}

/* ---------- Video toggle (shared .video-toggle; position only) ---------- */

.hero__video-toggle {
	position: absolute;
	top: var(--space-sm);
	right: var(--container-gutter);
}

/* ---------- Tablet and up ---------- */

@media (min-width: 48em) { /* --bp-md */
	.hero__eyebrow {
		display: block;
	}

	.hero__audience {
		display: flex;
	}

	.hero__actions > .hero__rating {
		padding-left: var(--space-md);
		border-left: 1px solid var(--color-border-inverse);
	}

	.hero--align-left .hero__overlay {
		-webkit-mask-image: linear-gradient(to right, #000 35%, rgba(0, 0, 0, var(--hero-overlay-fade-to)));
		mask-image: linear-gradient(to right, #000 35%, rgba(0, 0, 0, var(--hero-overlay-fade-to)));
	}

	.hero__logos {
		grid-template-columns: minmax(10rem, 16rem) 1fr;
		align-items: center;
		gap: var(--space-xl);
		text-align: left;
	}

	.hero__logos-heading {
		font-size: var(--font-size-xs);
	}

	.hero__logo {
		height: var(--hero-logo-height);
	}
}

/* ---------- Desktop ---------- */

@media (min-width: 64em) { /* --bp-lg */
	.hero__logos-list {
		justify-content: space-around;
		overflow: visible;
	}
}
