/* =========================================================================
   Landing page — one continuous scroll.

   Sections overlap rather than follow one another. Each one is sticky, so
   the section below slides up over the one above it while that one recedes.
   Every effect is driven by scroll position, not by a timer, so it tracks
   the finger exactly and cannot fall out of step.

   Built on CSS scroll-driven animations (animation-timeline) where the
   browser has them, which run on the compositor off the main thread -- the
   only way to get this smooth. Browsers without them fall back to
   IntersectionObserver classes, which still animate, just not scrubbed.
   ====================================================================== */

.landing {
	/* Each child establishes its own stacking context so overlaps are
	   predictable rather than depending on source order alone. */
	position: relative;
	z-index: 0;
}

.scene {
	position: relative;
	z-index: 1;
	min-height: 100svh;
	display: flex;
	align-items: center;
	overflow: clip;
}

/* The stack. Sections pin, then the next slides over the top. */
.scene--pin {
	position: sticky;
	top: 0;
}

/* A scene that scrolls past normally. Mixing these with pinned ones is
   what stops the page reading as the same trick five times. */
.scene--flow { position: relative; z-index: 2; }

/* Rounded leading edge, so a section visibly sits *on top of* the last one
   rather than merely replacing it. This is the detail that sells the
   overlap. */
.scene--over {
	border-radius: 34px 34px 0 0;
	box-shadow: 0 -24px 60px rgb(10 29 61 / 22%), 0 -2px 0 rgb(255 255 255 / 14%);
}

.scene__inner { position: relative; width: 100%; padding-block: clamp(3rem, 9vh, 6rem); overflow: hidden; }

/* Backgrounds ---------------------------------------------------------- */

.scene--navy {
	background: linear-gradient(165deg, var(--navy) 0%, var(--navy-deep) 100%);
	color: #fff;
}
.scene--navy h2, .scene--navy h3 { color: #fff; }

.scene--cream { background: var(--cream); }
.scene--white { background: #fff; }

.scene--deep {
	background: linear-gradient(200deg, var(--navy-deep) 0%, #06122a 100%);
	color: #fff;
}
.scene--deep h2 { color: #fff; }

.scene__glow {
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	background:
		radial-gradient(40rem 26rem at 86% 8%, rgb(217 164 65 / 16%), transparent 66%),
		radial-gradient(36rem 26rem at 6% 94%, rgb(27 127 140 / 18%), transparent 68%);
}
.scene__inner > * { position: relative; z-index: 1; }

/* =========================================================================
   Scroll-driven transitions. One per scene, deliberately different.
   ====================================================================== */

/* =========================================================================
   Choreography

   The weakness of a template is that the whole panel moves as one slab.
   Here each scene moves its parts separately and on its own timing -- the
   heading leads, the supporting text follows, the cards arrive last and
   from their own direction. That difference in timing between elements is
   what separates considered motion from a preset.

   Two motifs recur so the page feels authored rather than assembled:
     · a gold rule that draws itself across as a scene arrives
     · a slow sheen that travels once over glass, like light on a surface
   ====================================================================== */

.landing { perspective: 1800px; perspective-origin: 50% 38%; }
.scene__inner { transform-style: preserve-3d; }

/* The gold rule. Drawn, not faded in. */
.scene__inner::before {
	content: "";
	position: absolute;
	top: 0;
	left: var(--gutter);
	right: var(--gutter);
	height: 2px;
	background: linear-gradient(90deg, var(--gold), var(--gold-light) 45%, transparent);
	transform: scaleX(0);
	transform-origin: left;
	opacity: .85;
	pointer-events: none;
}
.scene--hero .scene__inner::before { display: none; }

/* The sheen. One pass, never looping -- a loop reads as a loading state. */
.scene__inner::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: linear-gradient(105deg, transparent 38%, rgb(255 255 255 / 16%) 50%, transparent 62%);
	transform: translate3d(-120%, 0, 0);
	opacity: 0;
}

@supports (animation-timeline: view()) {
	@media (prefers-reduced-motion: no-preference) {

		.scene__inner::before {
			animation: rule-draw linear both;
			animation-timeline: view();
			animation-range: entry 12% entry 58%;
		}
		.scene__inner::after {
			animation: sheen linear both;
			animation-timeline: view();
			animation-range: entry 25% entry 95%;
		}

		/* ---- 1. HERO — pinned. The camera pulls back and racks focus
		      while the next scene scrolls up in front of it. --------- */
		.scene--hero .scene__inner {
			animation: dolly-out linear both;
			animation-timeline: view();
			animation-range: exit -25% exit 100%;
		}
		.scene--hero .scene__stats {
			animation: stats-deal linear both;
			animation-timeline: view();
			animation-range: entry 55% entry 95%;
		}

		/* ---- 2. COURSES — flows past. Nothing stacks here: the heading
		      arrives from the left, the cards from the right, and they
		      pass each other. A lateral gesture, where everything else on
		      the page is vertical. ----------------------------------- */
		.scene--slide .section__head {
			animation: come-left linear both;
			animation-timeline: view();
			animation-range: entry 10% entry 62%;
		}
		.scene--slide .grid > *:nth-child(1) { --n: 1; }
		.scene--slide .grid > *:nth-child(2) { --n: 2; }
		.scene--slide .grid > *:nth-child(3) { --n: 3; }
		.scene--slide .grid > * {
			animation: come-right linear both;
			animation-timeline: view();
			animation-range: entry calc(16% + var(--n, 1) * 8%) entry calc(70% + var(--n, 1) * 8%);
		}

		/* ---- 3. PROGRAMMES — pinned. Venetian blinds: eight slats turn
		      open in sequence to uncover the scene. Built from a repeating
		      gradient mask, so it is one element, not eight. --------- */
		.scene--blinds .scene__inner {
			animation: blinds linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 72%;
		}
		.scene--blinds .grid > *:nth-child(1) { --n: 1; }
		.scene--blinds .grid > *:nth-child(2) { --n: 2; }
		.scene--blinds .grid > *:nth-child(3) { --n: 3; }
		.scene--blinds .grid > * {
			animation: slat-settle linear both;
			animation-timeline: view();
			animation-range: entry calc(30% + var(--n, 1) * 6%) entry calc(82% + var(--n, 1) * 6%);
		}

		/* ---- 4. COUNSELLING — flows past. Two doors: the text half comes
		      down from above, the picture half comes up from below, and
		      they meet. The only scene where two things move toward each
		      other. -------------------------------------------------- */
		.scene--doors .scene__split > *:first-child {
			animation: door-top linear both;
			animation-timeline: view();
			animation-range: entry 8% entry 72%;
		}
		.scene--doors .scene__art {
			animation: door-bottom linear both;
			animation-timeline: view();
			animation-range: entry 8% entry 72%;
		}

		/* ---- 5. CONTACT — pinned. The page zooms through into it: it
		      grows from small and distant to fill the screen, which reads
		      as arriving rather than sliding. ------------------------ */
		.scene--zoom .scene__inner {
			animation: zoom-through linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 80%;
		}
		.scene--zoom .scene__actions {
			animation: line-rise linear both;
			animation-timeline: view();
			animation-range: entry 50% entry 98%;
		}

		/* ---- Copy inside every scene --------------------------------
		   The scene itself moves as one piece; the words inside it do
		   not. Eyebrow, then heading, then the supporting line, then
		   the buttons — reading order, slightly overlapped so it reads
		   as one gesture rather than four separate ones.

		   Each is scrubbed to the scroll like everything else here, so
		   it tracks the visitor's own movement instead of running on a
		   timer that may finish before they have arrived.

		   Scenes that already animate one of these parts keep their own
		   rule: those selectors are more specific than these.
		   -------------------------------------------------------- */
		.scene__eyebrow,
		.scene__title,
		.scene__lede,
		.scene__actions {
			animation: copy-rise linear both;
			animation-timeline: view();
		}
		.scene__eyebrow { animation-range: entry 14% entry 46%; }
		.scene__title   { animation-range: entry 20% entry 56%; }
		.scene__lede    { animation-range: entry 28% entry 66%; }
		.scene__actions { animation-range: entry 35% entry 74%; }
	}
}

/* ---- Keyframes -------------------------------------------------------- */

@keyframes rule-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@keyframes sheen {
	0%        { transform: translate3d(-120%, 0, 0); opacity: 0; }
	18%       { opacity: 1; }
	70%, 100% { transform: translate3d(120%, 0, 0); opacity: 0; }
}

@keyframes dolly-out {
	from { transform: translate3d(0, 0, 0); opacity: 1; filter: blur(0); }
	to   { transform: translate3d(0, -5vh, -260px); opacity: .18; filter: blur(7px); }
}

@keyframes stats-deal {
	from { transform: translate3d(0, 3vh, 0) scale(.96); opacity: 0; }
	to   { transform: translate3d(0, 0, 0) scale(1); opacity: 1; }
}

@keyframes come-left {
	from { transform: translate3d(-7vw, 0, 0); opacity: 0; }
	to   { transform: translate3d(0, 0, 0); opacity: 1; }
}

@keyframes come-right {
	from { transform: translate3d(9vw, 0, 0) scale(.96); opacity: 0; }
	to   { transform: translate3d(0, 0, 0) scale(1); opacity: 1; }
}

/* Eight slats opening in turn. The mask is a repeating gradient whose dark
   bands shrink to nothing, so the scene is revealed in strips. */
@keyframes blinds {
	from {
		-webkit-mask-image: repeating-linear-gradient(180deg, #000 0 1%, transparent 1% 12.5%);
		mask-image: repeating-linear-gradient(180deg, #000 0 1%, transparent 1% 12.5%);
		opacity: .35;
	}
	to {
		-webkit-mask-image: repeating-linear-gradient(180deg, #000 0 12.5%, transparent 12.5% 12.5%);
		mask-image: repeating-linear-gradient(180deg, #000 0 12.5%, transparent 12.5% 12.5%);
		opacity: 1;
	}
}

@keyframes slat-settle {
	from { transform: translate3d(0, 3vh, 0); opacity: 0; }
	to   { transform: translate3d(0, 0, 0); opacity: 1; }
}

@keyframes door-top {
	from { transform: translate3d(0, -7vh, 0); opacity: 0; }
	to   { transform: translate3d(0, 0, 0); opacity: 1; }
}

@keyframes door-bottom {
	from { transform: translate3d(0, 8vh, 0); opacity: 0; }
	to   { transform: translate3d(0, 0, 0); opacity: 1; }
}

@keyframes zoom-through {
	from { transform: scale(.74) translate3d(0, 4vh, 0); opacity: 0; filter: blur(8px); }
	70%  { filter: blur(1px); }
	to   { transform: scale(1) translate3d(0, 0, 0); opacity: 1; filter: blur(0); }
}

@keyframes copy-rise {
	from { transform: translate3d(0, 1.6vh, 0); opacity: 0; }
	to   { transform: translate3d(0, 0, 0); opacity: 1; }
}

@keyframes line-rise {
	from { transform: translate3d(0, 2.6vh, 0); opacity: 0; }
	to   { transform: translate3d(0, 0, 0); opacity: 1; }
}

/* =========================================================================
   Fallback: browsers without scroll-driven animations (Firefox today).
   JavaScript adds .is-in when a scene enters; the transition does the rest.
   Not scrubbed to the scroll, but it still reads as intentional motion.
   ====================================================================== */

@supports not (animation-timeline: view()) {
	@media (prefers-reduced-motion: no-preference) {
		.scene__inner {
			opacity: 0;
			transform: translate3d(0, 5vh, 0);
			transition: opacity .7s var(--ease-out), transform .8s var(--ease-out), clip-path .8s var(--ease-out);
		}
		.scene--blinds .scene__inner { clip-path: inset(0 0 100% 0); transform: none; }
		.scene--zoom .scene__inner { transform: scale(.88); }
		.scene--slide .scene__inner { transform: translate3d(5vw, 0, 0); }
		.scene--doors .scene__inner { transform: translate3d(0, 4vh, 0); }

		.scene.is-in .scene__inner {
			opacity: 1;
			transform: none;
			clip-path: inset(0 0 0 0);
		}

		/* Same reading-order stagger, on a timer rather than the scroll. */
		.scene__eyebrow,
		.scene__title,
		.scene__lede,
		.scene__actions {
			opacity: 0;
			transform: translate3d(0, 1.6vh, 0);
			transition: opacity .6s var(--ease-out), transform .7s var(--ease-out);
		}
		.scene.is-in .scene__eyebrow,
		.scene.is-in .scene__title,
		.scene.is-in .scene__lede,
		.scene.is-in .scene__actions {
			opacity: 1;
			transform: none;
		}
		.scene.is-in .scene__eyebrow { transition-delay: .06s; }
		.scene.is-in .scene__title   { transition-delay: .14s; }
		.scene.is-in .scene__lede    { transition-delay: .24s; }
		.scene.is-in .scene__actions { transition-delay: .34s; }
	}
}

/* =========================================================================
   Scene furniture
   ====================================================================== */

.scene__eyebrow {
	margin: 0 0 .8em;
	font-size: .78rem;
	font-weight: 700;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--gold-deep);
}
.scene--navy .scene__eyebrow,
.scene--deep .scene__eyebrow { color: var(--gold-light); }

.scene__title {
	margin: 0 0 .5em;
	font-size: clamp(2rem, 5vw, 3.4rem);
	font-weight: 800;
	letter-spacing: -0.028em;
	max-width: 18ch;
}
.scene--centred .scene__title { max-width: 22ch; margin-inline: auto; }

.scene__lede {
	max-width: 56ch;
	font-size: clamp(1.0625rem, 1.5vw, 1.2rem);
	color: var(--muted);
}
.scene--navy .scene__lede,
.scene--deep .scene__lede { color: rgb(255 255 255 / 80%); }
.scene--centred .scene__lede { margin-inline: auto; }
.scene--centred { text-align: center; }

.scene__actions { display: flex; flex-wrap: wrap; gap: .85rem; margin-top: 2rem; }
.scene--centred .scene__actions { justify-content: center; }

.scene__split {
	display: grid;
	grid-template-columns: 1.05fr .95fr;
	gap: clamp(2rem, 5vw, 4.5rem);
	align-items: center;
}

.scene__art {
	position: relative;
	border-radius: var(--radius-lg);
	overflow: hidden;
	box-shadow: var(--shadow-lg);
	aspect-ratio: 4 / 3;
}
.scene__art img { width: 100%; height: 100%; object-fit: cover; }

/* The scroll cue on the hero. Disappears as soon as you move. */
.scroll-cue {
	position: absolute;
	left: 50%;
	bottom: 2rem;
	translate: -50% 0;
	display: grid;
	gap: .5rem;
	justify-items: center;
	font-size: .7rem;
	letter-spacing: .18em;
	text-transform: uppercase;
	color: rgb(255 255 255 / 55%);
	transition: opacity .4s var(--ease);
}
.has-scrolled .scroll-cue { opacity: 0; }

.scroll-cue__track {
	width: 22px;
	height: 36px;
	border: 1.5px solid rgb(255 255 255 / 35%);
	border-radius: 11px;
	position: relative;
}
.scroll-cue__dot {
	position: absolute;
	left: 50%;
	top: 7px;
	width: 3px;
	height: 7px;
	margin-left: -1.5px;
	border-radius: 2px;
	background: var(--gold);
	animation: cue 1.9s var(--ease) infinite;
}
@keyframes cue {
	0%        { transform: translateY(0); opacity: 0; }
	22%       { opacity: 1; }
	70%, 100% { transform: translateY(13px); opacity: 0; }
}

/* Stat strip */
.scene__stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: 1px;
	margin-top: 3rem;
	background: rgb(255 255 255 / 12%);
	border: 1px solid rgb(255 255 255 / 14%);
	border-radius: var(--radius-lg);
	overflow: hidden;
}
.scene__stat {
	padding: 1.4rem 1.2rem;
	background: rgb(10 29 61 / 45%);
	backdrop-filter: blur(14px) saturate(160%);
	-webkit-backdrop-filter: blur(14px) saturate(160%);
	text-align: center;
}
.scene__stat b {
	display: block;
	font-size: 1.9rem;
	font-weight: 800;
	color: var(--gold-light);
	line-height: 1.1;
}
.scene__stat span {
	display: block;
	margin-top: .3rem;
	font-size: .8rem;
	letter-spacing: .06em;
	color: rgb(255 255 255 / 70%);
}

/* ---- Responsive ------------------------------------------------------- */

@media (max-width: 900px) {
	.scene__split { grid-template-columns: 1fr; }
	.scene__art { order: -1; aspect-ratio: 16 / 10; }
	.scene { min-height: auto; }

	/* Pinning on a short screen leaves content cut off. Let it flow. */
	.scene--pin { position: relative; }
	.scene--over { border-radius: 26px 26px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
	.scene--pin { position: relative; }
	.scene__inner,
	.scene__eyebrow,
	.scene__title,
	.scene__lede,
	.scene__actions,
	.scene__art,
	.scene__stats { opacity: 1 !important; transform: none !important; clip-path: none !important; animation: none !important; transition: none !important; }
	.scroll-cue__dot { animation: none; }
}

/* -------------------------------------------------------------------------
   The hero, with a picture beside the words
   ------------------------------------------------------------------------
   The picture is shown whole -- object-fit: contain, never cover -- so
   nothing is cropped on any screen. It has its own column, so the page's
   heading never lands on top of whatever text is printed inside the
   image. And it is sized from the viewport, so it is modest on a phone
   and generous on a desktop without ever being scaled up past its own
   resolution.
   ---------------------------------------------------------------------- */

.hero-grid--with-art {
	display: grid;
	grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
	gap: clamp(1.75rem, 4vw, 3.5rem);
	align-items: center;
}

.hero-grid__text { min-width: 0; }

.hero-grid__art {
	margin: 0;
	min-width: 0;
	display: flex;
	justify-content: center;
	align-items: center;
}

.hero-grid__art img {
	display: block;
	width: auto;
	max-width: 100%;

	/* Sized from the screen, capped so a small source file is never
	   blown up past its natural size. */
	max-height: min(58vh, 480px);
	height: auto;

	object-fit: contain;
	border-radius: var(--radius-lg);
	box-shadow: 0 24px 60px rgb(0 0 0 / 38%);
}

/* Tablets and below: the picture goes under the words, full width but
   shorter, so the first thing on screen is still the message. */
@media (max-width: 900px) {
	.hero-grid--with-art {
		grid-template-columns: minmax(0, 1fr);
		gap: 1.75rem;
	}

	.hero-grid__art img {
		max-height: 38vh;
		max-width: min(100%, 520px);
	}
}

@media (max-width: 560px) {
	.hero-grid__art img {
		max-height: 30vh;
		max-width: 100%;
		border-radius: var(--radius);
	}
}

/* Very short screens, such as a phone held sideways: the picture is the
   first thing to give up its room. */
@media (max-height: 520px) and (max-width: 900px) {
	.hero-grid__art { display: none; }
}

/* ---- The hero's four tiles ------------------------------------------
 * Three navigate, one does not. The difference has to be visible before
 * the pointer arrives, or people click the fourth and nothing happens.
 * -------------------------------------------------------------------- */

.scene__stat--link {
	position: relative;
	color: inherit;
	text-decoration: none;
	border-radius: var(--radius);
	transition: background-color .22s var(--ease), transform .22s var(--ease);
}

.scene__stat--link::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: .55rem;
	width: 0;
	height: 1.5px;
	background: var(--gold-light);
	opacity: .85;
	transform: translateX(-50%);
	transition: width .24s var(--ease);
}

@media (hover: hover) and (pointer: fine) {
	.scene__stat--link:hover {
		background: rgb(255 255 255 / 7%);
	}

	.scene__stat--link:hover::after { width: 38%; }

	.scene__stat--link:hover b { color: var(--gold-light); }
}

.scene__stat--link:focus-visible {
	outline: 2px solid var(--gold-light);
	outline-offset: 3px;
}

/* The tile that leads nowhere says so by not responding at all. */
.scene__stat:not(.scene__stat--link) {
	cursor: default;
}

@media (prefers-reduced-motion: reduce) {
	.scene__stat--link,
	.scene__stat--link::after { transition: none; }
}
