/* ── About Hero — scroll-driven animation section ── */

/* Hero section — normal flow; ScrollTrigger pins it for the animation duration */
.hero {
	position: relative;
	width: 100%;
	height: 100vh;
	background: var(--wp--preset--color--tone-light);
	transition: background-color 0.6s ease;
}

.hero--inverted {
	background-color: var(--wp--preset--color--primary);
}

.hero--inverted .hero__year,
.hero--inverted .hero__year span {
	color: var(--wp--preset--color--tone-light);
}

.hero__year span {
	color: inherit;
	transition: color 0.6s ease;
}

/* Spacer between the hero and the next section.
   Controls when the next section appears (scrollVH = height / 100vh).
   Set alongside end in ScrollTrigger: spacerVH=7.5, end="+=850%" → 1vh of parallax overlap.
   White background covers the pinned hero during the parallax overlap phase. */
.hero__overlap-spacer {
	height: 750vh;
	background-color: var(--wp--preset--color--secondary);
}

/* ── Text layers (shared base) ── */
.hero__text-dark,
.hero__text-white {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	padding: clamp(2rem, 5vh, 5rem) 3vw;
	padding-top: 4rem;
	pointer-events: none;
}

.hero__line {
	display: block;
	font-size: var(--wp--preset--font-size--display);
	font-weight: 500;
	line-height: 0.88;
	letter-spacing: -0.04em;
	white-space: nowrap;
}

/* Clip container — overflow:hidden masks the inner word during load-in */
.hero__word {
	display: inline-block;
	overflow: hidden;
	vertical-align: bottom;
	padding-top: 0.15em;    /* room for ascenders at tight line-height */
	padding-bottom: 0.12em; /* room for descenders at tight line-height */
	padding-right: 0.06em;  /* room for glyph ink beyond logical char bounds (e.g. s, e) */
	margin-right: -0.06em;  /* cancel the extra inter-word spacing added by the padding */
}

.hero__word-inner {
	display: inline-block;
}

/* Pre-position the white load-in words below their mask before about-hero.js
   runs — prevents a flash of the headline at its resting position while the
   hero media decodes (the JS gates gsap.set(y:110%) behind heroMedia.decode()).
   Scoped to .js so words stay visible if JS is disabled; mirrors how
   .hero__outro-inner is pre-positioned. about-hero.js animates these to y:0%. */
.js .hero__text-white .hero__word-inner {
	transform: translateY(110%);
}

/* Reduced motion: about-hero.js bails before the load-in runs, so undo the
   pre-position or the white headline would stay hidden below its mask. */
@media (prefers-reduced-motion: reduce) {
	.js .hero__text-white .hero__word-inner {
		transform: none;
	}
}

.hero__lines-bottom {
	display: flex;
	flex-direction: column;
}

/* "that have" — right-aligned and pulled up */
.hero__line--right {
	align-self: flex-end;
	margin-bottom: clamp(0.5rem, 1.5vw, 1.5rem);
}

/* Layer 2 — dark text, above thumbs */
.hero__text-dark {
	z-index: 2;
}

.hero__text-dark .hero__line {
	color: var(--wp--preset--color--primary);
}

/* Layer 3 — stage: contains photo, scales as a unit */
.hero__stage {
	position: absolute;
	inset: 0;
	z-index: 3;
	transform-origin: center center;
	will-change: transform;
}

/* Hero photo — fills stage. The poster also paints as a background-image
   (set inline by the render filter) so the first frame shows instantly on
   cold loads, independent of the <video> element's own poster timing. */
.hero__photo {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center 30%;
	background-repeat: no-repeat;
}

.hero__photo img,
.hero__photo video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center 30%;
	display: block;
}

/* The video dark overlay was moved off this ::after (a sibling WAVE can't read)
   onto .hero__masked below, where it's an ANCESTOR of the white headline words —
   so WAVE reads it and the words pass contrast. See about-hero.js (alpha gated to
   the headline scroll window so it only darkens while the headline shows). */

/* Scatter thumbnails container — above year, below text and stage */
.hero__thumbs {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	overflow: visible;
	transform-origin: center center;
}

/* Each thumbnail — centered by default, JS sets scatter position */
.thumb {
	position: absolute;
	top: 50%;
	left: 50%;
	width: clamp(50px, 28vw, 530px);
	height: auto;
	aspect-ratio: 3/2;
	object-fit: cover;
	border-radius: 4px;
	opacity: 0;
}

/* Layer 0 — year counter (behind all images and text) */
.hero__year {
	position: absolute;
	inset: 0;
	z-index: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	font-size: clamp(6rem, 28vw, 80rem);
	font-weight: 500;
	line-height: 0.9;
	letter-spacing: -0.02em;
	color: var(--wp--preset--color--primary);
	opacity: 0;
	pointer-events: none;
	user-select: none;
	font-variant-numeric: tabular-nums;
}

/* Layer 4 — white text clip container */
.hero__masked {
	position: absolute;
	inset: 0;
	z-index: 4;
	clip-path: inset(0px);
	pointer-events: none;
	/* Dark overlay for the white headline, hosted here (an ancestor of the words)
	   so WAVE reads it and the words pass AA (white on this ≈5:1 over the light
	   hero bg). 0.55 is the AA floor; about-hero.js fades the alpha to 0 as the
	   headline scrolls away so later phases aren't dimmed. Static fallback if JS
	   is off. The clip-path above confines it to the video frame. */
	background-color: rgba(0, 0, 0, 0.55);
}

.hero__text-white {
	position: absolute;
	inset: 0;
}

.hero__text-white .hero__line {
	color: var(--wp--preset--color--secondary);
}

/* ── Outro paragraph — scroll-driven masked word reveal ── */
.hero__outro {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 3vw;
	pointer-events: none;
}

.hero__outro p {
	font-size: clamp(1.6rem, 2.4vw, 4rem);
	font-weight: 400;
	line-height: 1.15;
	letter-spacing: -0.03em;
	text-align: center;
	max-width: min(875px, 80vw);
	margin: 0 auto;
	color: var(--wp--preset--color--primary);
	transition: color 0.6s ease;
}

.hero--inverted .hero__outro p {
	color: var(--wp--preset--color--tone-light);
}

/* Clip container — each word is masked so the inner can slide up through it */
.hero__outro-word {
	display: inline-block;
	overflow: hidden;
	vertical-align: bottom;
	margin-right: 0.1em;
}

.hero__outro-word:last-child {
	margin-right: 0;
}

/* Inner word — starts below the clip, JS drives it up to translateY(0) */
.hero__outro-inner {
	display: inline-block;
	transform: translateY(110%);
	will-change: transform;
}

/* Phrase wrapper — single solid border-bottom under "So did we." */
.hero__outro-phrase {
	display: inline;
	position: relative;
	white-space: nowrap;
}

.hero__outro-phrase::after {
	content: '';
	position: absolute;
	bottom: -0.18em;
	left: 0;
	width: 100%;
	height: 3px;
	background: currentColor;
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 0.6s cubic-bezier(0.76, 0, 0.24, 1);
}

.hero__outro--underline-active .hero__outro-phrase::after {
	transform: scaleX(1);
}

/* ── Video pause button — bottom-right, above all hero layers ── */
.hero__video-pause-btn {
	position: absolute;
	bottom: 1.5rem;
	right: 3vw;
	z-index: 6; /* above .hero__outro (5) */
	transition: opacity 0.3s ease;
}

/* ── Header — fully transparent on page load at hero top ── */
/* JS adds .hero-header-at-top to the header template-part wrapper initially,
   removes it in onLeave (header returns after pin), re-adds in onLeaveBack. */
.hero-header-at-top .atmdst-header {
	background-color: transparent !important;
	-webkit-backdrop-filter: none !important;
	backdrop-filter: none !important;
}

@media (max-width: 767px) {
	.hero__year {
		font-size: 54vw;
	}

	/* Scale the headline down so the longest nowrap line ("We work with
	   brands" / "something to prove.") fits the viewport instead of bleeding
	   off the right edge. The display preset floors at 3.5rem (56px), far too
	   wide here. ~7vw keeps the 19-char line inside the 94vw text column
	   across 320–767px; capped at 3rem so it doesn't balloon near the
	   breakpoint. */
	.hero__line {
		font-size: clamp(1.25rem, 7vw, 3rem);
	}
}
