/* ==========================================================================
   Homepage hero: brand first, 3D second.
   The static image is the LCP element and the permanent fallback; the WebGL
   canvas fades in above it only on capable desktop devices.
   ========================================================================== */

.tarva-hero.wp-block-cover {
	position: relative;
	isolation: isolate;
	align-items: flex-end;
	box-sizing: border-box;
	min-height: max(38rem, 100vh) !important;
	min-height: max(38rem, 100svh) !important;
	padding: calc(var(--tarva-hh) + 3rem) var(--tarva-gutter) clamp(3.5rem, 9vh, 7rem);
	background: var(--tarva-obsidian);
	color: var(--tarva-ivory);
	overflow: hidden;
}

.tarva-hero.wp-block-cover .wp-block-cover__image-background {
	z-index: 0;
}

/* Legibility veil: Obsidian from the left and a floor at the bottom. */
.tarva-hero.wp-block-cover::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0; /* above the canvas (later in DOM), below core's inner container (z 1) */
	pointer-events: none;
	background:
		linear-gradient(90deg, rgba(23, 23, 23, 0.97) 0%, rgba(23, 23, 23, 0.9) 38%, rgba(23, 23, 23, 0.55) 56%, rgba(23, 23, 23, 0.12) 76%, rgba(23, 23, 23, 0) 100%),
		linear-gradient(0deg, rgba(23, 23, 23, 0.94) 0%, rgba(23, 23, 23, 0.7) 20%, rgba(23, 23, 23, 0) 50%),
		linear-gradient(180deg, rgba(23, 23, 23, 0.55) 0%, rgba(23, 23, 23, 0) 22%);
}

.tarva-hero.wp-block-cover .wp-block-cover__inner-container {
	position: relative;
	/* Core shrink-wraps this container; the scroll cue needs the full width. */
	width: 100% !important;
	max-width: 1400px !important;
	margin-inline: auto !important;
}

/* WebGL canvas, inserted by hero-3d.js. */
.tarva-hero__canvas {
	position: absolute;
	inset: 0;
	z-index: 0;
	width: 100%;
	height: 100%;
	display: block;
	opacity: 0;
}

/* The scene fades in over the static image once, then follows the scroll
   hand-off value that hero-3d.js sets (no transition, so it tracks the page). */
.tarva-hero.is-3d-ready .tarva-hero__canvas {
	opacity: var(--tarva-canvas-fade, 1);
	animation: tarva-canvas-in 1.6s var(--tarva-ease) backwards;
}

@keyframes tarva-canvas-in {
	from { opacity: 0; }
}

.tarva-hero__content {
	max-width: 46rem;
}

.tarva-hero__content > * {
	margin-block: 0;
}

.tarva-hero__descriptor {
	display: flex;
	align-items: center;
	gap: 1.1rem;
	margin-bottom: clamp(1.25rem, 3vh, 2rem) !important;
	font-family: var(--tarva-sans);
	font-weight: 500;
	letter-spacing: 0.32em;
	text-transform: uppercase;
	color: var(--tarva-ivory);
}

.tarva-hero__descriptor::before {
	content: "";
	flex: none;
	width: 3.5rem;
	height: 1px;
	background: var(--tarva-champagne);
	transform-origin: left center;
}

.tarva-hero__title {
	margin-bottom: clamp(1.25rem, 3vh, 2rem) !important;
	font-weight: 300;
	line-height: 0.98;
	letter-spacing: -0.015em;
	color: var(--tarva-ivory);
}

.tarva-hero__lede {
	max-width: 34rem;
	margin-bottom: clamp(1.75rem, 4vh, 2.75rem) !important;
	line-height: 1.6;
	color: var(--tarva-stone);
}

.tarva-hero__actions {
	gap: 1rem;
}

/* Scroll cue. */
.tarva-hero__scroll {
	position: absolute;
	right: 0;
	bottom: 0;
	margin: 0;
	letter-spacing: 0.3em;
	text-transform: uppercase;
	font-weight: 500;
	writing-mode: vertical-rl;
}

.tarva-hero__scroll a {
	display: inline-flex;
	align-items: center;
	gap: 1rem;
	padding: 0.5rem;
	color: var(--tarva-ivory);
	text-decoration: none;
	text-shadow: 0 0 14px rgba(23, 23, 23, 0.9);
}

.tarva-hero__scroll a::after {
	content: "";
	width: 1px;
	height: 3.5rem;
	background: var(--tarva-champagne);
	transform-origin: top;
}

.tarva-hero__scroll a:hover {
	color: var(--tarva-ivory);
}

/* ---------- Entrance: one orchestrated moment, only when JS is running ---------- */

@keyframes tarva-line-draw {
	from { transform: scaleX(0); }
}

/* Line by line: the first line is revealed, holds a beat, then the second. */
@keyframes tarva-title-in {
	0% {
		clip-path: inset(0 0 100% 0);
		transform: translateY(0.3em);
	}
	42% {
		clip-path: inset(0 0 50% 0);
		transform: translateY(0.12em);
	}
	58% {
		clip-path: inset(0 0 50% 0);
		transform: translateY(0.12em);
	}
	100% {
		clip-path: inset(0 0 -0.3em 0);
		transform: none;
	}
}

@keyframes tarva-fade-up {
	from {
		opacity: 0;
		transform: translateY(0.9rem);
	}
}

@keyframes tarva-scroll-cue {
	0%   { transform: scaleY(0); transform-origin: top; }
	45%  { transform: scaleY(1); transform-origin: top; }
	55%  { transform: scaleY(1); transform-origin: bottom; }
	100% { transform: scaleY(0); transform-origin: bottom; }
}

.tarva-js .tarva-hero__descriptor::before {
	animation: tarva-line-draw 1s var(--tarva-ease) 0.1s both;
}

.tarva-js .tarva-hero__descriptor {
	animation: tarva-fade-up 0.8s var(--tarva-ease) 0.05s both;
}

/* The headline is text in the HTML from the first byte; this only wipes it in. */
.tarva-js .tarva-hero__title {
	animation: tarva-title-in 1.25s var(--tarva-ease) 0.12s both;
}

.tarva-js .tarva-hero__lede {
	animation: tarva-fade-up 0.9s var(--tarva-ease) 0.85s both;
}

.tarva-js .tarva-hero__actions {
	animation: tarva-fade-up 0.9s var(--tarva-ease) 1.0s both;
}

.tarva-js .tarva-hero__scroll a::after {
	animation: tarva-scroll-cue 2.2s ease-in-out 1.2s 1;
}

/* ---------- Responsive ---------- */

@media (max-width: 767px) {
	.tarva-hero .wp-block-cover__image-background {
		object-position: 66% 50% !important;
	}

	.tarva-hero.wp-block-cover::after {
		background:
			linear-gradient(0deg, rgba(23, 23, 23, 0.96) 0%, rgba(23, 23, 23, 0.78) 42%, rgba(23, 23, 23, 0.1) 78%, rgba(23, 23, 23, 0.35) 100%);
	}

	.tarva-hero__actions {
		flex-direction: column;
		align-items: stretch;
	}

	.tarva-hero__actions .wp-block-button,
	.tarva-hero__actions .wp-block-button__link {
		width: 100%;
	}

	.tarva-hero__scroll {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tarva-js .tarva-hero__descriptor,
	.tarva-js .tarva-hero__descriptor::before,
	.tarva-js .tarva-hero__title,
	.tarva-js .tarva-hero__lede,
	.tarva-js .tarva-hero__actions,
	.tarva-js .tarva-hero__scroll a::after {
		animation: none !important;
	}
}
