/**
 * Home page hero.
 * Loaded on the front page only (see vac_enqueue_assets()).
 * Fonts and heading sizes come from style.css.
 */

:root {

	--vac-gutter: clamp(1rem, 4vw, 3rem);
}

/*
 * Fills exactly one screen, header included. The fixed header overlaps the
 * top, so equal space above and below the content centers it in the area
 * under the header. Content taller than the screen grows the hero instead
 * of being cut off.
 */
.vac-hero {
	--hero-space: clamp(1.5rem, 6vh, 4rem);

	position: relative;
	isolation: isolate;
	display: flex;
	align-items: center;
	min-height: 100vh;
	min-height: 100svh;
	padding-block: calc(var(--vac-header-height, 6rem) + var(--hero-space)) var(--hero-space);
	background: var(--color-dark);
	color: var(--color-white);
	overflow: hidden;
}

/* Photo sits behind the text as a real image, so it can load with high priority. */
.vac-hero__media,
.vac-hero__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.vac-hero__media {
	z-index: -1;
}

.vac-hero__media img {
	max-width: none;
	object-fit: cover;
	object-position: 55% 45%;
}

/*
 * Charcoal gradient, left to right. It holds at about 70% up to the right
 * edge of the text, then fades to 12% over the photo. 55% was tested first
 * and failed (2.8:1): the silver car behind the H1 is close to pure white,
 * and the off-white text needs about 68% charcoal there to reach 4.5:1.
 */
.vac-hero__media::after {
	--text-edge: calc(max(var(--vac-gutter), 50% - 620px) + 44rem);
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(
		90deg,
		color-mix(in srgb, var(--color-dark) 70%, transparent) 0%,
		color-mix(in srgb, var(--color-dark) 68%, transparent) var(--text-edge),
		color-mix(in srgb, var(--color-dark) 18%, transparent) calc(var(--text-edge) + 18%),
		color-mix(in srgb, var(--color-dark) 12%, transparent) 100%
	);
}

.vac-hero__inner {
	width: min(100% - 2 * var(--vac-gutter), 1240px);
	margin-inline: auto;
}

.vac-hero__content {
	max-width: 44rem;
}

.vac-hero__title {
	margin: 0;
}

.vac-hero__lead {
	max-width: 32em;
	margin: 1.25rem 0 0;
	font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.3125rem);
	line-height: 1.5;
	color: color-mix(in srgb, var(--color-white) 88%, transparent);
}

.vac-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 2rem;
}

.vac-hero__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.55rem;
	min-height: 3.25rem;
	padding: 0.75rem 1.4rem;
	border: 2px solid transparent;
	border-radius: 3px;
	font-family: var(--font-body);
	font-size: 1.0625rem;
	font-weight: 650;
	line-height: 1.2;
	text-decoration: none;
	transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.vac-hero__btn svg {
	flex: none;
}

.vac-hero__btn:focus-visible {
	outline: 3px solid var(--color-white);
	outline-offset: 3px;
}

.vac-hero__btn--call {
	background: var(--color-red);
	color: var(--color-white);
}

.vac-hero__btn--call:hover {
	background: var(--color-red);
	color: var(--color-white);
}

.vac-hero__btn--text {
	background: var(--color-white);
	color: var(--color-dark);
}

.vac-hero__btn--text:hover {
	background: var(--color-white);
	color: var(--color-dark);
}

.vac-hero__btn--estimate {
	border-color: color-mix(in srgb, var(--color-white) 88%, transparent);
	color: var(--color-white);
}

.vac-hero__btn--estimate:hover {
	background: var(--color-white);
	color: var(--color-dark);
}

.vac-hero__proof {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	margin: 1.5rem 0 0;
	padding: 0.4rem 0.8rem 0.4rem 0.65rem;
	border: 1px solid color-mix(in srgb, var(--color-white) 28%, transparent);
	border-radius: 3px;
	background: color-mix(in srgb, var(--color-dark) 72%, transparent);
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1.3;
	color: var(--color-white);
}

.vac-hero__proof svg {
	color: var(--color-red);
}

/*
 * Phones and portrait tablets: the text spans almost the full width, so it
 * sits on the lower part of the photo and the gradient runs bottom to top.
 * The car stays visible above the text.
 */
@media (max-width: 1023px) {
	.vac-hero {
		align-items: flex-end;
		padding-block: 9rem 2.5rem;
	}

	.vac-hero__media::after {
		background: linear-gradient(
			0deg,
			color-mix(in srgb, var(--color-dark) 90%, transparent) 0%,
			color-mix(in srgb, var(--color-dark) 82%, transparent) 55%,
			color-mix(in srgb, var(--color-dark) 30%, transparent) 80%,
			color-mix(in srgb, var(--color-dark) 15%, transparent) 100%
		);
	}
}

/*
 * Phones: the square mobile crop (car, tail light, technician at the wheel)
 * sits at the top. The text starts over its lower edge, where the gradient
 * is already near solid charcoal. On phones taller than photo plus text,
 * the photo grows to fill the screen, so no empty band is left below.
 */
@media (max-width: 767px) {
	.vac-hero {
		flex-direction: column;
		align-items: stretch;
		padding-block: 0 2.5rem;
	}

	.vac-hero__media {
		position: relative;
		inset: auto;
		flex: 1 0 auto;
		height: auto;
		min-height: 100vw;
	}

	.vac-hero__inner {
		margin-top: -18vw;
	}

	.vac-hero__media img {
		object-position: 50% 50%;
	}

	.vac-hero__media::after {
		background: linear-gradient(
			0deg,
			var(--color-dark) 0%,
			color-mix(in srgb, var(--color-dark) 86%, transparent) 20%,
			color-mix(in srgb, var(--color-dark) 30%, transparent) 48%,
			color-mix(in srgb, var(--color-dark) 10%, transparent) 100%
		);
	}

	.vac-hero__actions {
		flex-direction: column;
	}

	.vac-hero__btn {
		width: 100%;
		min-height: 3.5rem;
	}
}

/* One staggered reveal on load. */
@keyframes vac-hero-rise {
	from {
		opacity: 0;
		transform: translateY(14px);
	}
}

.vac-hero__content > * {
	animation: vac-hero-rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.vac-hero__lead {
	animation-delay: 0.08s;
}

.vac-hero__actions {
	animation-delay: 0.16s;
}

.vac-hero__proof {
	animation-delay: 0.24s;
}

@media (prefers-reduced-motion: reduce) {
	.vac-hero__content > * {
		animation: none;
	}

	.vac-hero__btn {
		transition: none;
	}
}
