/* ==========================================================================
   ZA APEX — HERO
   The 3D Z-axis scroll banner.

   HOW THE 3D WORKS
   ----------------
   .za-hero__deck sets `perspective`, which creates the vanishing point.
   .za-hero__deck-stage sets `transform-style: preserve-3d` so its children
   keep their own Z position rather than being flattened.
   Each .za-hero__card is absolutely positioned at the same spot and pushed
   back along Z by (index × --spread). hero-3d.js then animates the *stage*
   forward on Z as the user scrolls, so the cards fly past the camera one at
   a time — the deck itself never moves, the camera does. That is what makes
   the motion feel like a dolly shot rather than a slideshow.

   Without JS, the CSS below still lays the cards out in depth and the first
   one is readable — the hero degrades to a static 3D still, never a blank box.
   ========================================================================== */

.za-hero {
	position: relative;
	min-height: var(--za-hero-h);
	padding-top: calc(var(--za-hdr-h) + var(--za-hero-pt));
	display: flex;
	align-items: flex-end;
	overflow: hidden;
	isolation: isolate;
}

.za-hero--align-center { text-align: center; }
.za-hero--align-center .za-hero__sub { margin-inline: auto; }
.za-hero--align-center .za-hero__actions { justify-content: center; }
.za-hero--align-right { text-align: right; }
.za-hero--align-right .za-hero__sub { margin-left: auto; }
.za-hero--align-right .za-hero__actions { justify-content: flex-end; }

/* --------------------------------------------------------------------------
   BACKGROUND STACK
   -------------------------------------------------------------------------- */
.za-hero__bg {
	position: absolute;
	inset: 0;
	z-index: -1;
	overflow: hidden;
}

.za-hero__gradient {
	position: absolute;
	inset: 0;
	background:
		radial-gradient(130% 80% at 8% 8%, rgba(var(--za-primary-rgb), .12), transparent 55%),
		radial-gradient(90% 70% at 92% 96%, rgba(var(--za-accent-rgb), .10), transparent 60%),
		linear-gradient(var(--za-hero-ga), var(--za-hero-g1), var(--za-hero-g2));
}

.za-hero__media {
	position: absolute;
	inset: -6% 0 0;
	display: block;
}
.za-hero__media--img,
.za-hero__media .za-img,
.za-hero__media .za-img__el {
	width: 100%;
	height: 112%;
	object-fit: cover;
	border-radius: 0;
}
.za-hero__media--video {
	width: 100%;
	height: 112%;
	object-fit: cover;
}

.za-hero__overlay {
	position: absolute;
	inset: 0;
	background: var(--za-hero-ov);
	opacity: var(--za-hero-ov-a);
	mix-blend-mode: multiply;
}

/* The cape. Sits behind the copy, in front of the media. */
.za-hero__cape {
	position: absolute;
	right: -6%;
	top: -12%;
	width: min(82vw, 1180px);
	height: 124%;
	opacity: var(--za-cape-a);
	pointer-events: none;
	will-change: transform;
	mix-blend-mode: screen;
}
.za-hero__cape-front,
.za-hero__cape-back { transition: d .8s var(--za-ease); }

/* Film grain — a CSS-only fractal, no image request. */
.za-hero__grain {
	position: absolute;
	inset: -50%;
	opacity: var(--za-grain-a);
	pointer-events: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
	animation: za-grain 700ms steps(4) infinite;
}
@keyframes za-grain {
	0%   { transform: translate(0, 0); }
	25%  { transform: translate(-2%, 1%); }
	50%  { transform: translate(1%, -2%); }
	75%  { transform: translate(-1%, -1%); }
	100% { transform: translate(0, 0); }
}

/* --------------------------------------------------------------------------
   COPY
   -------------------------------------------------------------------------- */
.za-hero__inner {
	position: relative;
	z-index: 2;
	width: 100%;
	padding-bottom: clamp(3.5rem, 8vh, 8rem);
}

.za-hero__title {
	font-size: var(--za-hero-fluid);
	max-width: 16ch;
	margin-bottom: 1.8rem;
}
.za-hero--align-center .za-hero__title,
.za-hero--align-right .za-hero__title { max-width: none; }

.za-hero__sub {
	max-width: 52ch;
	color: rgba(var(--za-bone-rgb), .74);
	font-size: clamp(.98rem, .9rem + .3vw, 1.16rem);
}
.za-hero__sub p + p { margin-top: .8em; }

.za-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	margin-top: 2.4rem;
}

/* --------------------------------------------------------------------------
   THE 3D DECK
   -------------------------------------------------------------------------- */
.za-hero__deck {
	position: absolute;
	inset: 0;
	z-index: 3;
	perspective: var(--persp, var(--za-deck-persp));
	perspective-origin: 50% 46%;
	pointer-events: none;
	display: grid;
	place-items: center;
}

.za-hero__deck-stage {
	position: relative;
	width: min(420px, 78vw);
	height: min(460px, 62vh);
	transform-style: preserve-3d;
	will-change: transform;
	/* JS drives this; the fallback keeps card 1 at the camera. */
	transform: translate3d(0, 0, 0);
}

.za-hero__card {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	gap: .55rem;
	padding: clamp(1.5rem, 3vw, 2.2rem);
	background:
		linear-gradient(160deg, rgba(var(--za-bone-rgb), .07), rgba(var(--za-void-rgb), .55));
	border: 1px solid rgba(var(--za-bone-rgb), .13);
	border-radius: calc(var(--za-radius) + 6px);
	-webkit-backdrop-filter: blur(14px) saturate(140%);
	backdrop-filter: blur(14px) saturate(140%);
	box-shadow: var(--za-shadow-lg);
	transform-style: preserve-3d;
	pointer-events: auto;
	will-change: transform, opacity;

	/* Depth: card N sits N spreads behind the front of the stage.
	   --yaw alternates per card (set by :nth-child below) so the deck reads
	   as hand-stacked rather than machined. */
	--yaw: 1;
	transform:
		translate3d(0, 0, calc(var(--i) * (0px - var(--spread, 1400px))))
		rotateX(calc(var(--tilt, 8deg) * 0.35))
		rotateY(calc(var(--tilt, 8deg) * var(--yaw)));
}
.za-hero__card:nth-child(even) { --yaw: -1; }

.za-hero__card-rule {
	position: absolute;
	left: 0; top: 0;
	width: 100%;
	height: 3px;
	background: var(--card-accent, var(--za-primary));
	border-radius: 3px 3px 0 0;
}

.za-hero__card-index {
	font-size: .74rem;
	letter-spacing: .28em;
	color: var(--card-accent, var(--za-primary));
	font-weight: 600;
}

.za-hero__card-title {
	font-size: clamp(1.9rem, 1rem + 3vw, 3.1rem);
	line-height: .98;
	letter-spacing: -.025em;
}

.za-hero__card-body {
	color: rgba(var(--za-bone-rgb), .78);
	font-size: .95rem;
	line-height: 1.6;
	max-width: 34ch;
}

.za-hero__card-meta {
	font-size: .72rem;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--za-muted);
	padding-top: .8rem;
	margin-top: .3rem;
	border-top: 1px solid rgba(var(--za-bone-rgb), .1);
}

.za-hero__card-img {
	position: absolute;
	inset: 0;
	z-index: -1;
	opacity: .3;
	border-radius: inherit;
	overflow: hidden;
}
.za-hero__card-img .za-img,
.za-hero__card-img .za-img__el {
	width: 100%; height: 100%;
	aspect-ratio: auto;
	border-radius: inherit;
}

/* --------------------------------------------------------------------------
   DECK RAIL — progress + a11y fallback navigation
   -------------------------------------------------------------------------- */
.za-hero__deck-rail {
	position: absolute;
	right: clamp(1rem, 3vw, 2.6rem);
	top: 50%;
	transform: translateY(-50%);
	display: flex;
	flex-direction: column;
	gap: 1.1rem;
	pointer-events: auto;
	z-index: 4;
}

.za-hero__deck-step { opacity: .38; transition: opacity .4s var(--za-ease); }
.za-hero__deck-step.is-active { opacity: 1; }

.za-hero__deck-btn {
	display: flex;
	align-items: center;
	gap: .7rem;
	font-size: .7rem;
	letter-spacing: .18em;
	text-transform: uppercase;
	color: var(--za-bone);
	transition: color .3s ease;
}
.za-hero__deck-step.is-active .za-hero__deck-btn { color: var(--za-primary); }

.za-hero__deck-num {
	font-variant-numeric: tabular-nums;
	opacity: .7;
}
.za-hero__deck-label { white-space: nowrap; }

.za-hero__deck-progress {
	position: absolute;
	left: -14px;
	top: 0;
	width: 2px;
	height: 100%;
	background: rgba(var(--za-bone-rgb), .12);
	overflow: hidden;
}
.za-hero__deck-progress::after {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 100%;
	background: linear-gradient(var(--za-primary), var(--za-accent));
	transform: scaleY(var(--progress, 0));
	transform-origin: 50% 0;
	transition: transform .12s linear;
}

/* --------------------------------------------------------------------------
   SCROLL CUE
   -------------------------------------------------------------------------- */
.za-hero__cue {
	position: absolute;
	left: 50%;
	bottom: 1.6rem;
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: .8rem;
	z-index: 4;
	pointer-events: none;
}
.za-hero__cue-line {
	width: 1px;
	height: 46px;
	background: linear-gradient(rgba(var(--za-bone-rgb), 0), var(--za-primary));
	position: relative;
	overflow: hidden;
}
.za-hero__cue-line::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	height: 40%;
	background: var(--za-primary);
	animation: za-cue 2.1s var(--za-ease) infinite;
}
@keyframes za-cue {
	0%   { transform: translateY(-120%); opacity: 0; }
	40%  { opacity: 1; }
	100% { transform: translateY(260%); opacity: 0; }
}
.za-hero__cue-text {
	font-size: .66rem;
	letter-spacing: .22em;
	text-transform: uppercase;
	color: var(--za-muted);
}

/* --------------------------------------------------------------------------
   VARIANTS
   -------------------------------------------------------------------------- */
.za-hero--cinematic .za-hero__deck,
.za-hero--minimal .za-hero__deck { display: none; }

.za-hero--minimal { min-height: 72vh; align-items: center; }
.za-hero--minimal .za-hero__inner { padding-bottom: 0; }

.za-hero--split .za-hero__deck {
	inset: auto 0 0 auto;
	width: 46%;
	height: 100%;
	place-items: center;
}
.za-hero--split .za-hero__inner { max-width: 54%; }

/* When the deck is on, the copy sits left and the deck occupies the right
   half on wide screens so the two never collide. */
@media (min-width: 1100px) {
	.za-hero--has-deck.za-hero--align-left .za-hero__inner { max-width: min(58%, 900px); }
	.za-hero--has-deck.za-hero--align-left .za-hero__deck {
		left: auto;
		right: 0;
		width: 46%;
	}
	.za-hero--has-deck.za-hero--align-left .za-hero__deck-rail { right: auto; left: -2.5rem; }
}

/* --------------------------------------------------------------------------
   PINNED STATE — applied by hero-3d.js while ScrollTrigger holds the section
   -------------------------------------------------------------------------- */
.za-hero.is-pinned .za-hero__cue { opacity: 0; transition: opacity .4s ease; }
