/* Home page: "dive into the sea". Scroll from the surface to the seabed and back.
   Loaded on the home page only, on top of style.css. Everything is scoped to body.home.
   home.js sets --d (0 at the surface, 1 at the deepest point) and --p (page progress, 0 to 1). */
/* Defaults on :root, where home.js writes them (declaring them on body would shadow the live values). */
:root { --d: 0; --p: 0; }
body.home { background: #0b2b2e; overflow-x: hidden; }

/* The site header floats over the footage instead of sitting on an ink bar. */
body.home .top { position: fixed; left: 0; right: 0; background: linear-gradient(rgba(11,30,33,.7), rgba(11,30,33,0)); }
body.home .top .brand, body.home .top .nav a { text-shadow: 0 1px 6px rgba(0,0,0,.35); }
@media (max-width: 900px) { body.home .top .nav.open { background: var(--ink); } }

/* Footage stage: three loops that crossfade by scene. */
.home .stage { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #0e3a3d; }
/* The scrubbed shot. Until its first frame arrives, the first frame shows as a background. */
.home .scrub { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #0e3a3d url(/home/scrub/poster.webp) center / cover; }
/* Brighter near the surface, deep teal lower down. Turquoise, never navy. */
.home .tint { position: absolute; inset: 0; pointer-events: none;
	/* Enough shade everywhere for white text, even over the bright sky at the surface; deeper teal lower down. */
	background: linear-gradient(180deg, rgba(8,30,33,calc(0.42 - var(--d) * 0.1)) 0%, rgba(8,30,33,calc(0.28 + var(--d) * 0.15)) 45%, rgba(6,32,35,calc(0.4 + var(--d) * 0.45)) 100%); }
.home .motes { position: absolute; inset: -50% 0; pointer-events: none; background-repeat: repeat; opacity: calc(0.25 + var(--d) * 0.5); will-change: transform; }
.home .motes.m1 { background-image: radial-gradient(circle, rgba(220,250,245,.8) 0 1.2px, transparent 1.6px); background-size: 120px 140px; transform: translate3d(0, calc(var(--p) * -60vh), 0); }
.home .motes.m2 { background-image: radial-gradient(circle, rgba(220,250,245,.55) 0 2px, transparent 2.6px); background-size: 210px 230px; background-position: 60px 90px; transform: translate3d(0, calc(var(--p) * -130vh), 0); }

/* Parallax layers: kelp and passing fish. */
.home .layer { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
.home .kelp svg { position: absolute; bottom: 0; height: 120vh; width: auto; max-width: none; fill: #0b2a2c; opacity: calc(0.15 + var(--d) * 0.75); will-change: transform; }
.home .kelp-l { left: -4vw; transform: translate3d(0, calc((1 - var(--d)) * 70vh), 0); }
.home .kelp-r { right: -6vw; transform: translate3d(0, calc((1 - var(--d)) * 90vh), 0); }
/* Passing fish (bass and a black bream) for the easter egg in fish.js. They swim behind the text, only in the
   kelp and reef sections, and fade with the depth haze so they sit in the footage rather than on it. */
.home .fish { z-index: 3; }
.home .fish .f { position: absolute; left: 0; width: clamp(70px, 10vw, 130px); pointer-events: auto; cursor: crosshair; padding: 14px; box-sizing: content-box;
	-webkit-tap-highlight-color: transparent; touch-action: manipulation; will-change: transform;
	opacity: clamp(0, (var(--d) - 0.3) * 3, 0.88); visibility: var(--fish-vis, visible); }
.home .fish .f svg { display: block; width: 100%; height: auto; filter: blur(.4px) drop-shadow(0 6px 10px rgba(0,20,22,.35)) saturate(.85); }
.home .fish .bob { animation: bob 3.2s ease-in-out infinite; transform-origin: 60% 50%; }
/* fish.js moves each fish (so it can dart, stop dead or swim off trailing); CSS only bobs it. */
.home .fish .f { top: 0; transition: opacity .4s ease; }
.home .fish .f2 .bob { animation-duration: 2.7s; animation-delay: -1s; }
.home .fish .f3 .bob { animation-duration: 3.8s; animation-delay: -2s; }
html[data-scene="compare"] .home .fish, html[data-scene="surface"] .home .fish { visibility: hidden; }
.home .fish .f.darting .bob { animation-duration: .35s; }
.home .fish .f.dead .bob { animation: none; transform: rotate(8deg); transition: transform 1.2s ease; }
.home .fish .f.dead svg { filter: saturate(.6) brightness(.9); }
.home .fish .f.gone { opacity: 0 !important; transition: opacity 1s ease; }
.home .fish .shaft { position: absolute; top: 46%; left: 55%; width: 70px; height: 2px; background: linear-gradient(90deg, #fff, rgba(255,255,255,0)); transform: rotate(-8deg); transform-origin: 0 50%; pointer-events: none; }
.catch-chip { position: fixed; z-index: 7; right: 16px; top: calc(50% + 22vh); font: 700 12px var(--mono); letter-spacing: .06em; color: var(--white); background: rgba(17,24,28,.72); border: 1.5px solid var(--aqua); border-radius: 12px; padding: 7px 11px; cursor: pointer; }
.catch-chip[hidden] { display: none; }
@media (max-width: 760px) { .catch-chip { top: 112px; } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0deg) skewY(0deg); } 25% { transform: translateY(-5px) rotate(-1.5deg) skewY(1deg); } 75% { transform: translateY(5px) rotate(1.5deg) skewY(-1deg); } }
/* The text panels let taps through to the fish behind them; links and the form still take taps. */
.home .dive, .home .dive section.scene, .home .dive .panel, .home .dive .label, .home .dive .sticky-stage { pointer-events: none; }
.home .dive .panel a, .home .dive .panel form, .home .dive .panel button, .home .dive .card, .home .dive .label a { pointer-events: auto; }
/* The fish easter egg (fish.js). */
.home .fish .f.shudder .bob { animation: shudder .24s linear 2; }
@keyframes shudder { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px) rotate(-6deg); } 75% { transform: translateX(4px) rotate(6deg); } }
.spear { position: fixed; z-index: 7; border-radius: 1px; height: 2px; background: linear-gradient(90deg, rgba(255,255,255,.2), #fff); transform-origin: 0 50%; transition: transform .22s cubic-bezier(.2,.8,.3,1), opacity .4s ease; pointer-events: none; box-shadow: 0 0 6px rgba(255,255,255,.6); }
.spear.gone { opacity: 0; }
.catch-toast { position: fixed; z-index: 30; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: var(--white); border: 2px solid var(--aqua); border-radius: 14px; padding: 10px 16px; font: 700 15px var(--font); transition: opacity .25s ease, transform .25s ease; pointer-events: none; white-space: nowrap; }
.catch-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Depth gauge */
.home .gauge { position: fixed; right: 16px; top: 50%; transform: translateY(-50%); z-index: 5; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; color: var(--white); }
.home .gauge-n { font-size: clamp(26px, 3.6vw, 40px); color: var(--aqua); text-shadow: 0 2px 12px rgba(0,0,0,.35); }
.home .gauge-u { font-size: 12px; letter-spacing: .2em; color: rgba(255,255,255,.7); }
.home .gauge-bar { width: 3px; height: 34vh; background: rgba(255,255,255,.18); border-radius: 2px; margin-top: 10px; position: relative; overflow: hidden; }
.home .gauge-bar i { position: absolute; left: 0; right: 0; top: 0; height: calc(var(--d) * 100%); background: var(--aqua); border-radius: 2px; }

/* Scenes */
.home .dive { position: relative; z-index: 4; color: var(--white); }
.home section.scene { position: relative; min-height: 100vh; padding: 0 clamp(20px, 6vw, 90px); }
.home .panel { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; max-width: 1180px; margin: 0 auto; padding: 96px 56px 60px 0; }
.home .panel.sticky { position: sticky; top: 0; }
.home .panel.center { align-items: center; text-align: center; padding-right: 0; }
.home .panel.right { align-items: flex-end; text-align: right; }
.home .panel.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: center; gap: clamp(24px, 5vw, 70px); }
.home .panel.split.rev { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.home .dive h1 { font-size: clamp(52px, 11vw, 132px); line-height: 1.02; letter-spacing: -0.02em; }
.home .dive h2 { font-size: clamp(32px, 6vw, 68px); line-height: 1.04; letter-spacing: -0.02em; }
.home .dive h2.big { font-size: clamp(52px, 10vw, 120px); }
.home .dive h1 em, .home .dive h2 em { color: var(--aqua); }
.home .dive h1, .home .dive h2 { text-shadow: 0 2px 4px rgba(4,30,32,.35), 0 8px 40px rgba(4,30,32,.45); }
.home .dive .caps { color: var(--aqua); margin: 0 0 14px; text-shadow: 0 1px 3px rgba(4,30,32,.55); }
.home .dive .lead { color: rgba(255,255,255,.92); max-width: 34ch; margin: 22px auto 0; text-shadow: 0 1px 3px rgba(4,30,32,.55); }
.home .dive .say { font-size: 17px; line-height: 1.5; max-width: 38ch; color: rgba(255,255,255,.88); margin: 16px 0 0; text-shadow: 0 1px 3px rgba(4,30,32,.6); }
.home .panel.right .say { margin-left: auto; }
.home .dive a:not(.btn) { color: var(--aqua); }
.home .reveal { opacity: 0; transform: translate3d(0, 30px, 0); transition: opacity .7s ease, transform .7s ease; }
.home .reveal.in { opacity: 1; transform: none; }
.home .cue { margin-top: 48px; font-family: var(--mono); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: rgba(255,255,255,.75); }
.home .cue span::after { content: ""; display: block; width: 2px; height: 46px; margin: 12px auto 0; background: linear-gradient(var(--aqua), transparent); animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { 0%, 100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(10px); opacity: 1; } }
.home .beta-line { justify-content: center; margin-top: 18px; }
.home .device { margin: 0; justify-self: center; filter: drop-shadow(0 30px 60px rgba(0,0,0,.45)); }
.home .device.watch { width: min(76vw, 340px); }
.home .device.phone { width: min(62vw, 320px); }

/* The wipe from "most maps" to the survey. --k is this scene's progress, set by home.js. */
.home .compare { --k: 0; padding: 0 !important; }
.home .sticky-stage { position: sticky; top: 0; height: 100vh; overflow: hidden; }
.home .map { position: absolute; inset: 0; background-size: cover; background-position: 50% 40%; transform: scale(calc(1.25 - var(--k) * 0.2)); will-change: transform; }
.home .map.theirs { background-image: url(/home/coarse-looe.png); inset: -30px;
	clip-path: inset(0 0 0 calc(clamp(0, (var(--k) - 0.3) / 0.4, 1) * 100%)); }
.home .wipe-line { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--aqua); box-shadow: 0 0 18px var(--aqua); left: calc(clamp(0, (var(--k) - 0.3) / 0.4, 1) * 100%); opacity: calc(min(1, (var(--k) - 0.28) * 20) * min(1, (0.72 - var(--k)) * 20)); }
.home .sticky-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(8,30,33,.55), transparent 45%, transparent 60%, rgba(8,30,33,.45)); }
.home .label { position: absolute; z-index: 2; max-width: min(520px, 80vw); }
.home .l-theirs { left: clamp(20px, 6vw, 90px); bottom: 14vh; opacity: calc(1 - clamp(0, (var(--k) - 0.35) * 6, 1)); }
.home .l-ours { right: clamp(56px, 7vw, 110px); top: 18vh; text-align: right; opacity: clamp(0, (var(--k) - 0.62) * 6, 1); transform: translate3d(0, calc((1 - clamp(0, (var(--k) - 0.62) * 6, 1)) * 30px), 0); }
.home .l-ours .say { margin-left: auto; }

/* The finale and the sections after it sit on solid colour, above the footage. */
.home .finale { background: linear-gradient(180deg, transparent, var(--ink) 35%); padding-bottom: 72px; }
.home .finale .panel { max-width: 1120px; min-height: auto; padding: 22vh 0 0; }
.home .finale .feature { text-align: left; color: var(--white); margin-top: 40px; }
.home .finale .feature .lead { margin: 18px 0 0; text-align: left; }
/* Above the gauge and the fish, on solid colour, so the footage stops at the end of the story. */
.home .after { position: relative; z-index: 8; }
.home .after > section:not(.dark) { background: var(--canvas); color: var(--ink); }
body.home footer { position: relative; z-index: 8; }
/* The beta card keeps the site's normal ink-on-white form. */
.home .dive .card { color: var(--ink); text-shadow: none; }
.home .dive .card a { color: var(--deep); }
.home .finale .feature p:not(.lead):not(.caps) { color: rgba(255,255,255,.88); }

@media (max-width: 760px) {
	.home .panel { padding: 88px 0 48px; }
	.home .panel.split, .home .panel.split.rev { grid-template-columns: 1fr; gap: 22px; align-content: center; }
	.home .panel.split.rev figure { order: -1; }
	.home .device.watch { width: min(46vw, 190px); }
	.home .device.phone { width: min(40vw, 175px); }
	.home .panel.split h2 { font-size: clamp(28px, 8vw, 40px); }
	.home .dive .say { font-size: 15px; }
	.home .panel.right { align-items: flex-start; text-align: left; }
	.home .panel.right .say { margin-left: 0; }
	.home .gauge { top: 78px; right: 16px; transform: none; flex-direction: row; align-items: baseline; gap: 4px; }
	.home .gauge-n { font-size: 22px; }
	.home .gauge-bar { display: none; }
	.home .kelp svg { height: 85vh; opacity: calc(0.1 + var(--d) * 0.45); }
	.home .l-ours { left: 20px; right: 20px; top: 14vh; text-align: left; }
	.home .l-ours .say { margin-left: 0; }
}

/* Reduced motion: no footage playing, nothing moving; the same story as a calm page. */
@media (prefers-reduced-motion: reduce) {
	.home .layer, .home .cue span::after, .home .motes { display: none; }
		.home .reveal { opacity: 1; transform: none; transition: none; }
	.home .panel.sticky { position: relative; }
	.home section.scene { height: auto !important; }
	.home .sticky-stage { position: relative; height: auto; display: grid; }
	.home .map, .home .map.theirs { position: relative; inset: auto; height: 60vh; transform: none; clip-path: none; }
	.home .wipe-line { display: none; }
	.home .label { position: relative; inset: auto; opacity: 1; transform: none; padding: 30px 20px; text-align: left; }
}

/* Links inside the story text: white and underlined, so they read on bright water. */
.home .dive .say a { color: var(--white); text-decoration: underline; text-underline-offset: 3px; }

/* At the surface the sky is bright: the hero's small caps lines go white so they read. */
.home .dive .panel.center .caps, .home .dive .beta-line { color: var(--white); }
