/*
 * Homepage hero styles.
 *
 * Ported from the compiled live CSS (index-CTd4ANgl.css, the ._*_1rcms_*
 * home module classes) into plain class names that match front-page.php.
 * Kept in a separate file and enqueued only on the front page, so the hero
 * chrome and blob rules do not load on inner pages. The clientele carousel
 * and featured section rules are added here in later Chat 4 steps.
 *
 * All lengths use rem, so the base font-size steps (21px at 1550px+, 16px at
 * 1240px and below, from main.css) scale the chrome and top bar as on live.
 *
 * DISCREPANCY (reported, not silently resolved): the compiled CSS serves
 * .homeVideo as `height: auto !important; max-height: 100vh` with no
 * `overflow` property. The height auto part collapses a wrap whose only in-flow
 * child is the zero-sized intro layer, which would leave the pinned hero with
 * no height and starve useCoverDimensions of a container to measure, so this
 * file keeps the fullscreen `height: 100vh` from the module source and the
 * build spec. The overflow, however, is now matched to compiled live: no
 * overflow property (effectively visible), so the growing blob is not clipped
 * to the wrap, exactly as served. See the report for the raw compiled rule.
 */

.siteLogo {
	position: fixed;
	left: 6vw;
	top: 0.75rem;
	z-index: 5;
	width: 6rem;
	height: auto;
	z-index: 99;
}

.siteText {
	position: fixed;
	right: 6vw;
	top: 0.9rem;
	z-index: 5;
	z-index: 99;
}

.siteText h5 {
	font-size: 0.95rem;
}

.siteLogo_bg {
	z-index: 90;
	background: var(--secondaryColor);
	position: fixed;
	left: 0;
	right: 0;
	top: 0;
	height: 3.1rem;
	transform: translateY(-100%);
}

.homeVideo {
	background-color: white;
	background-image: var(--hero-poster);
	background-size: cover;
	background-position: center center;
	max-width: 100vw !important;
	width: 100% !important;
	height: 100vh;
}

/*
 * Portrait gets its own hero loading frame. The boundary is written as the
 * negation of landscape rather than as (orientation: portrait) so it matches
 * home.js isPortrait(), which is height > width: (min-aspect-ratio: 1/1) is
 * width >= height, so its negation is width < height exactly. A square viewport
 * is therefore landscape to both, and the still and the video can never disagree
 * about which way up the hero is. The `not all and` form is used rather than the
 * range syntax (aspect-ratio < 1/1) because older iOS Safari drops a rule it
 * cannot parse, which would silently serve the landscape frame on exactly the
 * device this fixes.
 *
 * The nested fallback means an unset portrait frame resolves to the desktop one,
 * so the pair is additive: with no portrait frame chosen, nothing changes.
 */
@media not all and (min-aspect-ratio: 1/1) {
	.homeVideo {
		background-image: var(--hero-poster-portrait, var(--hero-poster));
	}
}

/*
 * Hero cover-fit clip box. The background iframe is sized to cover the viewport,
 * so one axis overflows; this wrapper clips that overflow the way live's
 * .videowrapper does, without clipping .homeVideo itself (the pinned element) or
 * the blob. It fills .homeVideo (which is position:relative via the base rule and
 * 100vh tall), holds only the iframe, and sits behind the intro and blob.
 */
.videowrapper {
	position: absolute;
	inset: 0;
	overflow: hidden;
}

/*
 * Image-mode hero media. Cover-fits the chosen image into the clip box exactly
 * like the video, so it fills the viewport and one axis overflows (clipped by
 * .videowrapper). home.js scales it to 1.5 on the pin (from the centre), matching
 * the video hero animation.
 */
.heroImage {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transform-origin: center center;
}

.introWrap {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 0;
	height: 0;
}

.introWrap > svg {
	position: absolute;
	left: 0;
	top: 0;
	transform: translate(-50%, -50%) scale(0);
	width: 250vw;
	aspect-ratio: 1;
}

.introWrap > svg path {
	fill: var(--secondaryColor);
	stroke: none;
}

.introText {
	color: white;
	font-family: "Kanit", sans-serif;
	position: absolute;
	left: 0;
	top: 0;
	transform: translate(-50%, -50%);
	width: 720px;
	font-size: 2rem;
	line-height: 1.2;
	font-weight: 600;
}

.introText span {
	display: inline-block;
	opacity: 0;
}

@media ( min-width: 1550px ) {
	/*
	 * Compiled live CSS aligns only the logo to the 1550px content edge at
	 * this breakpoint. The module source also shifted .siteText with a
	 * matching right:calc, but the served CSS does not, so the tagline stays
	 * at right:6vw. Compiled wins over the code.zip source. See the report.
	 */
	.siteLogo {
		left: calc( ( 100vw - 1550px ) / 2 );
	}
	.introText {
		width: 850px;
	}
}

@media ( max-width: 1200px ) {
	.siteText {
		right: auto;
		left: 6vw;
		top: 2.9rem;
	}
	.siteLogo_bg {
		height: 5.4rem;
	}
}

@media ( max-width: 767px ) {
	.introText {
		width: 100vw;
		padding-inline: 6vw !important;
	}
	.introText span {
		display: inline;
	}
}

@media ( max-width: 700px ) {
	.introText {
		font-size: 1.5rem;
		line-height: 1.2;
	}
}

/* Clientele carousel. Ported from the compiled CSS (_clientele_wrap): a full
   width dark strip, logos capped at 3.5rem tall and contained. The w-100 and
   py-4 Bootstrap classes on the wrap supply the width and vertical padding. */
.clientele_wrap {
	padding-inline: 0;
	background: #474748;
}

.clientele_wrap img {
	height: 3.5rem;
	object-fit: contain;
	object-position: center center;
}

/* Featured section. Ported from the compiled CSS (_featuredSection and
   _featuredWrap). The heading is absolutely positioned inside the wrap: the
   base rule (* { position: relative; z-index: 1 }) in main.css makes the wrap
   its positioning context, so no explicit position on the wrap is needed. The
   video is a plain full width 16/9 embed, not cover fit. */
.featuredSection {
	padding: 0px 6vw 6rem;
	background: #fff;
}

.featuredWrap {
	padding: 9rem 6vw 5rem;
	background: var(--secondaryColor);
	max-width: 1550px;
	margin: 0 auto;
}

.featuredWrap iframe {
	width: 100%;
	aspect-ratio: 16/9;
}

.featuredWrap h3 {
	font-size: 4rem;
	z-index: 3;
	position: absolute;
	top: 4.2rem;
	left: 50%;
	transform: translate(-50%);
	line-height: 1.1;
	font-weight: 600;
}

.featuredWrap p {
	font-size: 0.9rem;
	padding-inline: 15%;
}

.featuredWrap p a {
	display: inline-block;
}

.featuredWrap p a::after {
	bottom: -4px;
	left: 0;
	right: 0;
	position: absolute;
	content: '';
	border-bottom: 1px solid white;
}

@media ( max-width: 700px ) {
	.featuredWrap {
		padding: 4rem 1rem;
	}
	.featuredWrap h3 {
		font-size: 2.35rem;
		position: static;
		transform: none;
		padding-bottom: 2rem;
	}
	.featuredWrap p {
		padding-inline: 0;
	}
}

/*
 * Featured section poster bleed (A2, 31 July 2026).
 *
 * The still frame added in A16 is painted as the .featuredVideo background so the
 * section is not a black void while the embed loads. A strip of it stayed visible
 * along the bottom edge once the film was playing.
 *
 * The cause was not a cover-versus-16:9 mismatch. Measured on live: the wrapper
 * was 408x237 while the iframe inside it was 408x230, a 7px gap on the bottom
 * edge only, with zero gap on the right. An iframe is an inline replaced element,
 * so it sits on the text baseline and the line box reserves descender space
 * underneath it. Confirmed by intervention: setting either display:block or
 * vertical-align:bottom took the wrapper from 237 to 230 and the gap to exactly 0.
 *
 * display:block is the fix rather than vertical-align because it also removes the
 * whitespace-sensitivity of an inline child entirely. Nothing else is touched:
 * the iframe keeps its own width and height, and the IntersectionObserver that
 * plays and pauses the film does not read layout.
 *
 * Note this legitimately shortens the section by those 7px, so everything below
 * it on the home page moves up by 7px. That is the bleed being removed.
 */
.featuredVideo iframe {
	display: block;
}

/*
 * Fixed chrome legibility scrim (A4, divergence 12, 31 July 2026).
 *
 * The white logo and tagline are fixed, so they sit over the hero film at the top
 * of the page and over the cream sections once you scroll. Both can leave them
 * unreadable. Colour detection is impossible (cross-origin iframe) and a
 * timestamp timeline would break whenever an editor changes the hero, so a scrim
 * is the only approach that is correct for media nobody has chosen yet.
 *
 * Stacking is the hazard, and the first attempt got it wrong. main.css sets
 * * { position: relative; z-index: 1 }, which makes .page_content_wrap a stacking
 * context at z-index 1. Painted from body::before, the scrim was a sibling of that
 * whole wrapper at z-index 2, so it beat the wrapper and everything inside it,
 * including the chrome its own z-index 99 was supposed to protect. It was dimming
 * the logo and tagline rather than the background behind them.
 *
 * Painting it from .page_content_wrap::before instead puts it inside the same
 * stacking context as the chrome, where 2 < 99 actually holds: above the hero at
 * the base z-index 1, below siteLogo_bg 90, the logo and tagline 99, and every
 * overlay above those. position: fixed is kept so it still covers the viewport,
 * which is only safe because no ancestor carries transform, filter, perspective
 * or will-change; any of those would make an ancestor the containing block and
 * the scrim would scroll with the page.
 *
 * Deliberately no transform, filter, backdrop-filter, perspective, will-change or
 * contain anywhere in this rule. Any of those would make this element a containing
 * block for fixed descendants and trap the overlays it is supposed to sit under.
 * pointer-events: none means it can never intercept a click.
 */
.page_content_wrap {
	/*
	 * Drives the scrim's opacity. A pseudo-element cannot be a GSAP target, so the
	 * hero timeline tweens this custom property on the originating element and the
	 * pseudo inherits it. Declared here so GSAP reads a real starting value of 1
	 * rather than an empty string.
	 */
	--scrim-opacity: 1;
}

.page_content_wrap::before {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 18vh;
	z-index: 2;
	pointer-events: none;
	opacity: var( --scrim-opacity, 1 );
	/*
	 * Stop positions, not stop values, carry the legibility here.
	 *
	 * At 1600 the tagline sits 12% to 27% down this box; at 390 the layout pushes
	 * it to 30% to 43%, which under the original 0.55 at 25% landed in the falloff
	 * and measured 3.52:1 average on the pixels behind the glyphs. Moving 0.55 down
	 * to 45% and 0.25 to 70% holds alpha across the band the mobile tagline
	 * actually occupies.
	 *
	 * The top edge stays at 0.75 and the box stays at 18vh deliberately: darkening
	 * the top or restoring the height would both cost more of the film than this
	 * does, and neither is needed once the stops sit in the right place.
	 */
	background: linear-gradient(
		to bottom,
		rgba( 0, 0, 0, 0.75 ) 0%,
		rgba( 0, 0, 0, 0.55 ) 45%,
		rgba( 0, 0, 0, 0.25 ) 70%,
		rgba( 0, 0, 0, 0 ) 100%
	);
}

/*
 * Reduced motion fallback.
 *
 * Under prefers-reduced-motion the hero ScrollTrigger is never created, so the
 * fade tween does not exist and --scrim-opacity stays at 1 forever. A fixed scrim
 * would then sit over the works grid and the cream sections for the whole visit,
 * which is the exact fault this change exists to remove.
 *
 * Switching to absolute positioning makes it scroll away with the document
 * instead. It still covers the chrome at rest, where legibility actually matters,
 * and it is out of the viewport by the time any content scrolls up behind the
 * fixed logo. No scroll listener and no second ScrollTrigger, which is what the
 * fixed version needs and cannot have here.
 *
 * This anchors to .page_content_wrap because main.css sets * { position: relative },
 * so the wrapper is already a positioned ancestor and top: 0 is the top of the page.
 */
@media ( prefers-reduced-motion: reduce ) {
	.page_content_wrap::before {
		position: absolute;
	}
}
