/**
 * Trihead Scroll Cinematic widget.
 *
 * Two layouts in one stylesheet:
 *   - BASE (default): everything in normal document flow, fully readable with
 *     no JS — used in the Elementor editor, on mobile, and with reduced motion.
 *   - .is-animated: the pinned, layered layout GSAP scrubs through. The script
 *     adds this class only on the desktop frontend.
 *
 * @package Trihead_Elementor_Widgets
 */

/* ---------------------------------------------------------------------------
 * BASE / STATIC LAYOUT
 * ------------------------------------------------------------------------- */
.trihead-scrollcine {
	--thsc-overlay: rgba( 10, 10, 10, 0.45 );
	color: #ffffff;
}

.trihead-scrollcine__pin {
	position: relative;
}

.trihead-scrollcine__media {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: 6px;
	background: #0a0a0a;
}

.trihead-scrollcine__media video,
.trihead-scrollcine__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.trihead-scrollcine__overlay {
	position: absolute;
	inset: 0;
	background: var( --thsc-overlay );
	pointer-events: none;
	display: none; /* only meaningful in the animated/fullscreen layout */
}

.trihead-scrollcine__stage {
	display: block;
}

.trihead-scrollcine__stage-inner {
	width: 100%;
	padding: 32px 0;
}

.trihead-scrollcine__text {
	margin: 0;
	font-size: 24px;
	line-height: 1.45;
	font-weight: 400;
	color: #e9e9e9;
}

.trihead-scrollcine__headline {
	margin: 0;
	font-size: 34px;
	line-height: 1.25;
	font-weight: 400;
	color: #f2f2f2;
}

/* Stats */
.trihead-scrollcine__stats {
	display: grid;
	grid-template-columns: repeat( 3, 1fr );
	gap: 24px;
	width: 100%;
}

@media ( max-width: 767px ) {
	.trihead-scrollcine__stats {
		grid-template-columns: 1fr;
	}
}

.trihead-scrollcine__stat {
	padding: 24px 0 18px;
	border-top: 1px solid rgba( 255, 255, 255, 0.35 );
}

.trihead-scrollcine__stat-figure {
	display: flex;
	align-items: baseline;
	gap: 4px;
	line-height: 1;
}

.trihead-scrollcine__num {
	font-size: 72px;
	font-weight: 400;
	color: #ffffff;
}

.trihead-scrollcine__suffix {
	font-size: 26px;
	font-weight: 400;
	color: #ffffff;
}

.trihead-scrollcine__stat-label {
	margin-top: 14px;
	font-size: 16px;
	color: #d6d6d6;
}

/* Buttons */
.trihead-scrollcine__button {
	display: inline-block;
	margin-top: 28px;
	padding: 16px 26px;
	font-size: 16px;
	line-height: 1;
	text-decoration: none;
	color: #ffffff;
	background: rgba( 255, 255, 255, 0.12 );
	border: 1px solid rgba( 255, 255, 255, 0.18 );
	border-radius: 4px;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.trihead-scrollcine__button:hover {
	background: rgba( 255, 255, 255, 0.22 );
	color: #ffffff;
}

/* ---------------------------------------------------------------------------
 * ANIMATED / PINNED LAYOUT
 * ------------------------------------------------------------------------- */
.trihead-scrollcine.is-animated .trihead-scrollcine__pin {
	position: relative;
	height: 100vh;
	width: 100%;
	overflow: hidden;
}

/* Media becomes an absolutely-positioned panel; GSAP drives top/left/size. */
.trihead-scrollcine.is-animated .trihead-scrollcine__media {
	position: absolute;
	top: 12%;
	left: 6%;
	width: 42%;
	height: 76%;
	aspect-ratio: auto;
	z-index: 1;
	will-change: top, left, width, height;
}

.trihead-scrollcine.is-animated .trihead-scrollcine__overlay {
	display: block;
}

/* Each stage is a full-bleed flex layer; GSAP animates the inner box. */
.trihead-scrollcine.is-animated .trihead-scrollcine__stage {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	padding: 6vh 6%;
	pointer-events: none;
}

.trihead-scrollcine.is-animated .trihead-scrollcine__stage-inner {
	width: auto;
	max-width: 42%;
	padding: 0;
	pointer-events: auto;
}

/* Stage 1 — intro text on the right, vertically centered. */
.trihead-scrollcine.is-animated .trihead-scrollcine__stage--1 {
	justify-content: flex-end;
	align-items: center;
}

/* Stage 2 — expertise text on the left, vertically centered. */
.trihead-scrollcine.is-animated .trihead-scrollcine__stage--2 {
	justify-content: flex-start;
	align-items: center;
}

.trihead-scrollcine.is-animated .trihead-scrollcine__stage--2 .trihead-scrollcine__stage-inner {
	max-width: 46%;
}

/* Stage 3 — headline centered, sitting in the upper third. */
.trihead-scrollcine.is-animated .trihead-scrollcine__stage--3 {
	justify-content: center;
	align-items: flex-start;
	padding-top: 12vh;
}

.trihead-scrollcine.is-animated .trihead-scrollcine__stage--3 .trihead-scrollcine__stage-inner {
	max-width: 60%;
	text-align: center;
}

/* Stage 4 — stats row spanning the width, lower-centered. */
.trihead-scrollcine.is-animated .trihead-scrollcine__stage--4 {
	justify-content: center;
	align-items: center;
}

.trihead-scrollcine.is-animated .trihead-scrollcine__stage--4 .trihead-scrollcine__stage-inner {
	max-width: 88%;
	width: 88%;
	text-align: center;
}

.trihead-scrollcine.is-animated .trihead-scrollcine__stat {
	text-align: left;
}

.trihead-scrollcine.is-animated .trihead-scrollcine__button {
	pointer-events: auto;
}

/* ---------------------------------------------------------------------------
 * REDUCED MOTION — force the readable static layout.
 * ------------------------------------------------------------------------- */
@media ( prefers-reduced-motion: reduce ) {
	.trihead-scrollcine.is-animated .trihead-scrollcine__pin {
		height: auto;
		overflow: visible;
	}
}
