/* ==========================================================================
   POOLS PROS — the dive
   A scroll-scrubbed rendered cinematic: frames on desktop, video on mobile.
   ========================================================================== */

.dive {
	position: relative;
	/* Three chapters, 200vh of scroll each. One chapter was 320vh when the
	   section carried a single sequence; at three, the per-chapter rate comes
	   down so the letter still moves at a readable pace instead of a blur. */
	height: 600vh;
	background: #05121d;
	--dive-progress: 0;
	--dive-grade: #e8f2f2;
}

.dive__sticky {
	position: sticky;
	top: 0;
	height: 100svh;
	overflow: hidden;
	background: #05121d;
}

/* the frame or the video, full bleed */
.dive canvas,
.dive video {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.dive video { display: none; }

.dive--video video { display: block; }
.dive--video canvas { display: none; }

/* the wordmark held over the sequence, then the title resolves */
.dive__title {
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	transform: translate3d(0, 26px, 0);
	opacity: 0;
	text-align: center;
	z-index: 4;
	pointer-events: none;
	padding-inline: var(--gutter);
}

.dive__title h2 {
	font-size: clamp(2.6rem, 9vw, 8rem);
	line-height: 0.9;
	letter-spacing: -0.045em;
	font-weight: 600;
	color: #fff;
	text-shadow: 0 10px 60px rgba(0, 20, 30, 0.45);
}

.dive__title span {
	display: block;
	font-family: var(--font-mono);
	font-size: 0.625rem;
	letter-spacing: 0.3em;
	text-transform: uppercase;
	color: #fff;
	margin-bottom: 1.25rem;
	opacity: 0.85;
}

/* corner registration marks */
.dive__marks { position: absolute; inset: 0; pointer-events: none; z-index: 3; }

.dive__marks i {
	position: absolute;
	width: 14px;
	height: 14px;
	border: 1px solid rgba(255, 255, 255, 0.28);
}

.dive__marks i:nth-child(1) { top: calc(var(--header-h) + 14px); left: 16px; border-right: 0; border-bottom: 0; }
.dive__marks i:nth-child(2) { top: calc(var(--header-h) + 14px); right: 16px; border-left: 0; border-bottom: 0; }
.dive__marks i:nth-child(3) { bottom: 16px; left: 16px; border-right: 0; border-top: 0; }
.dive__marks i:nth-child(4) { bottom: 16px; right: 16px; border-left: 0; border-top: 0; }

/* ------------------------------------------------------------- chapters -- */
.dive__chapters {
	position: absolute;
	top: 50%;
	left: var(--gutter);
	transform: translateY(-50%);
	display: grid;
	gap: 1.15rem;
	z-index: 5;
	pointer-events: none;
}

.dive__chapter {
	display: grid;
	gap: 0.3rem;
	opacity: 0.32;
	transform: translateX(-6px);
	transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
	color: #fff;
}

.dive__chapter.is-active { opacity: 1; transform: none; }

.dive__chapter span {
	font-family: var(--font-mono);
	font-size: 0.625rem;
	letter-spacing: 0.16em;
	color: rgba(255, 255, 255, 0.85);
}

.dive__chapter strong {
	font-size: clamp(1.3rem, 2.4vw, 2rem);
	font-weight: 500;
	letter-spacing: -0.03em;
	line-height: 1.05;
}

.dive__chapter em {
	font-style: normal;
	font-family: var(--font-mono);
	font-size: 0.5625rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.6);
}

/* ---------------------------------------------------------------- rail -- */
.dive__rail {
	position: absolute;
	top: 50%;
	right: var(--gutter);
	transform: translateY(-50%);
	width: 1px;
	height: 30vh;
	background: rgba(255, 255, 255, 0.25);
	z-index: 5;
}

/* The sequence runs from a dark pool to a sunlit one, so anything drawn over
   it has to carry its own ground or it disappears at the bright end. */
.dive__chapters::before {
	content: "";
	position: absolute;
	left: calc(var(--gutter) * -1);
	top: -3rem;
	bottom: -3rem;
	width: min(46vw, 30rem);
	background: linear-gradient(to right, rgba(4, 10, 16, 0.72) 0%, rgba(4, 10, 16, 0.42) 46%, rgba(4, 10, 16, 0) 100%);
	z-index: -1;
	pointer-events: none;
}

.dive__chapter { text-shadow: 0 1px 14px rgba(2, 12, 20, 0.85); }
.dive__chapter em { color: rgba(255, 255, 255, 0.78); }

.dive__rail {
	background: rgba(4, 10, 16, 0.3);
	box-shadow: 0 0 0 1px rgba(4, 10, 16, 0.25);
}

.dive__rail i {
	display: block;
	width: 100%;
	height: 100%;
	background: #fff;
	transform-origin: top;
	transform: scaleY(0);
}

/* ------------------------------------------------------------- scrim ---- */
/* keeps the header legible over bright water */
.dive__scrim {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	background:
		linear-gradient(to bottom, rgba(5, 8, 10, 0.72) 0%, rgba(5, 8, 10, 0) 26%),
		linear-gradient(to top, rgba(5, 8, 10, 0.78) 0%, rgba(5, 8, 10, 0) 30%);
}

@media (max-width: 820px) {
	.dive { height: 300vh; }
	.dive__rail { display: none; }
	.dive__chapters { top: auto; bottom: 16%; transform: none; gap: 0.7rem; }
	.dive__chapter strong { font-size: 1.1rem; }
	.dive__chapter em { display: none; }
	.dive__title h2 { font-size: clamp(2rem, 11vw, 3.4rem); }
}

@media (prefers-reduced-motion: reduce) {
	.dive { height: 160vh; }
	.dive__chapter { transition: none; }
}