/* ==========================================================================
   575 Timeline - University of Glasgow
   Scoped component: everything lives under .gla-tl so it can sit inside the
   T4 page template next to main.css without touching site styles.
   Breakpoint matches main.css: desktop >= 70em, mobile/tablet below.
   ========================================================================== */

.gla-tl {
	--gla-tl-navy: #011451;
	--gla-tl-white: #fff;
	--gla-tl-accent: #4dbbc6;
	--gla-tl-header: 64px;       /* collapsed #header; JS measures the real fixed header */
	--gla-tl-nav-h: 141px;       /* timeline bar height */
	--gla-tl-ease: cubic-bezier(.65, 0, .25, 1);
	--gla-tl-speed: 1100ms;
	--gla-tl-serif: "Noto Serif Display", "Noto Serif", Georgia, serif;
	--gla-tl-sans: "Noto Sans", sans-serif;

	position: relative;
	/* break out of the Foundation column to full bleed */
	width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	background: var(--gla-tl-navy);
	color: var(--gla-tl-white);
	font-family: var(--gla-tl-sans);
	isolation: isolate;
}

.gla-tl *,
.gla-tl *::before,
.gla-tl *::after {
	box-sizing: border-box;
}

/* Scoped visuallyhidden fallback: the host site's main.css defines this,
   but if the T4 snippet lands on a page without it, screen-reader-only
   text (e.g. "1850s" vs "1850's", "Read all about 1451",
   "(opens in a new tab)") would leak into visible layout. */
.gla-tl .visuallyhidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.gla-tl :focus-visible {
	outline: 3px solid var(--gla-tl-white);
	outline-offset: 3px;
	box-shadow: 0 0 0 6px var(--gla-tl-navy);
}

/* No ring/box when clicked or tapped - keyboard users keep it (WCAG 2.4.7).
   main.css flags mouse/touch input on <html> with data-whatinput. */
.gla-tl :focus:not(:focus-visible),
[data-whatinput="mouse"] .gla-tl :focus,
[data-whatinput="touch"] .gla-tl :focus {
	outline: none;
	box-shadow: none;
}

.gla-tl a,
.gla-tl button {
	-webkit-tap-highlight-color: transparent;
}

.gla-tl h2,
.gla-tl p,
.gla-tl ol,
.gla-tl blockquote {
	margin: 0;
	padding: 0;
}

.gla-tl ol {
	list-style: none;
}

.gla-tl img {
	display: block;
}

/* main.css sizes every content image with a 3-ID selector
   (#content-container #content-container-inner #main-content-wrapper img),
   so the timeline's full-bleed images need !important to keep their box */
.gla-tl-bg img,
.gla-tl-layer img,
.gla-tl-yearmark img {
	max-width: none !important;
	height: 100% !important;
}

/* ---------- Without JS: a readable list of years ---------- */

.gla-tl-slide {
	position: relative;
	min-height: 100vh;         /* fallback for older iOS */
	min-height: 100svh;        /* iOS Safari <=15 overshoots 100vh with URL bar */
	overflow: hidden;
}

.gla-tl-nav,
.gla-tl-cursor,
.gla-tl-readall {
	display: none;
}

/* ---------- Stage (JS enhanced) ---------- */

.gla-tl--js {
	height: max(600px, calc(100svh - var(--gla-tl-header)));
	overflow: hidden;
	touch-action: pan-y;
}

.gla-tl--js .gla-tl-slides {
	position: absolute;
	inset: 0;
}

.gla-tl--js .gla-tl-slide {
	position: absolute;
	inset: 0;
	min-height: 0;
	opacity: 0;
	transition: opacity calc(var(--gla-tl-speed) * .8) var(--gla-tl-ease);
	--gla-tl-pos: 1;
}

.gla-tl--js .gla-tl-slide[data-pos="-1"] { --gla-tl-pos: -1; }
.gla-tl--js .gla-tl-slide[data-pos="0"] { --gla-tl-pos: 0; opacity: 1; z-index: 1; }
.gla-tl--js .gla-tl-slide[data-far] { display: none; }

.gla-tl--js .gla-tl-nav {
	display: block;
}

/* Parallax: each layer travels a different distance (--d) on change */
.gla-tl--js [data-depth] {
	transform: translate3d(calc(var(--gla-tl-pos) * var(--d, 0) * 40vw), 0, 0);
	transition: transform var(--gla-tl-speed) var(--gla-tl-ease);
}

.gla-tl-bg { --d: .08; }
.gla-tl-yearmark { --d: .25; transition-delay: 40ms; }
.gla-tl-media { --d: .55; transition-delay: 80ms; }
.gla-tl-text { --d: .9; transition-delay: 120ms; }

/* ---------- Background ---------- */

.gla-tl-bg {
	position: absolute;
	inset: 0;
	z-index: -2;
}

.gla-tl-bg img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: var(--gla-tl-focal, center);
}

/* Colour washes and accent bands from Figma (position, colour, blend set inline) */
.gla-tl-tint {
	position: absolute;
	top: 0;
	bottom: 0;
}

/* Scrim behind the copy - kept as normal blend so text contrast is
   predictable on every background (WCAG 1.4.3) */
.gla-tl-slide::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background: linear-gradient(to left, rgba(0, 0, 0, .6) 0%, rgba(0, 0, 0, .35) 40%, rgba(0, 0, 0, 0) 75%);
}

.gla-tl-slide[data-align="left"]::before {
	background: linear-gradient(to right, rgba(0, 0, 0, .6) 0%, rgba(0, 0, 0, .35) 30%, rgba(0, 0, 0, 0) 50%);
}

/* Lighter backgrounds where the accent heading would drop below 3:1 */
.gla-tl-slide--scrim-strong::before {
	background: linear-gradient(to left, rgba(0, 0, 0, .78) 0%, rgba(0, 0, 0, .6) 40%, rgba(0, 0, 0, 0) 80%);
}

.gla-tl-slide--scrim-strong[data-align="left"]::before {
	background: linear-gradient(to right, rgba(0, 0, 0, .78) 0%, rgba(0, 0, 0, .6) 32%, rgba(0, 0, 0, 0) 55%);
}

/* ---------- Year outline (left edge) ---------- */

.gla-tl-yearmark {
	position: absolute;
	top: 0;
	left: -.25%;   /* Figma sits it at x -3 to -7: bleeds off the left edge */
	height: 100%;
	mix-blend-mode: color-dodge;
	pointer-events: none;
}

/* Upright SVGs from Figma, scaled to the stage height at their own widths */
.gla-tl .gla-tl-yearmark img {
	width: auto;
	height: 100% !important;
}

/* ---------- Foreground imagery ---------- */

.gla-tl-media {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

/* Each layer sits in its Figma box (as % of the 1920x1080 / 402x874 frames).
   The parallax transform is on the layer itself so its blend mode still
   mixes with the background rather than being isolated in a wrapper. */
.gla-tl-layer {
	position: absolute;
	left: var(--x);
	top: var(--y);
	width: var(--w);
	height: var(--h);
}

.gla-tl-layer img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center;
}

.gla-tl-layer--video img {
	object-fit: cover;
}

.gla-tl-blend--screen { mix-blend-mode: screen; }
.gla-tl-blend--lighten { mix-blend-mode: lighten; }
.gla-tl-blend--luminosity { mix-blend-mode: luminosity; }
.gla-tl-blend--color-burn { mix-blend-mode: color-burn; }
.gla-tl-blend--hard-light { mix-blend-mode: hard-light; }
.gla-tl-blend--overlay { mix-blend-mode: overlay; }
.gla-tl-blend--multiply { mix-blend-mode: multiply; }
.gla-tl-blend--color-dodge { mix-blend-mode: color-dodge; }

/* ---------- Copy ---------- */

.gla-tl-text {
	position: absolute;
	top: 0;
	bottom: var(--gla-tl-nav-h);
	z-index: 2;   /* copy comes first in the HTML (reading order) but sits above the pictures */
	/* position/width per year from Figma; scales down with the viewport */
	left: var(--gla-tl-tx, calc(58.333% + 17px));
	width: clamp(400px, calc(var(--gla-tl-tw, 626) / 1920 * 100vw * 1.18), calc(var(--gla-tl-tw, 626) * 1px));
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding-block: min(2rem, 3vh);
}

.gla-tl-slide[data-align="left"] .gla-tl-text {
	left: var(--gla-tl-tx, calc(8.333% + 37px));
}

.gla-tl-text-inner {
	max-height: 100%;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: var(--gla-tl-accent) transparent;
}

/* Links: main.css colours every link via #content-container a, so link
   rules below are scoped to the section id */

.gla-tl .gla-tl-heading {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: clamp(14px, min(1.5625vw, 2.78vh), 30px);
	margin-bottom: clamp(16px, min(2.083vw, 3.7vh), 40px);
}

.gla-tl-date {
	display: inline-block;
	padding: 10px;
	background: var(--gla-tl-accent);
	color: var(--gla-tl-navy);
	font-family: var(--gla-tl-serif);
	font-weight: 500;
	font-size: clamp(24px, min(1.77vw, 3.15vh), 34px);
	line-height: 1;
	letter-spacing: -.04em;
}

.gla-tl-title {
	display: block;
	color: var(--gla-tl-title-color, var(--gla-tl-accent));
	font-weight: 800;
	font-size: clamp(30px, min(3.125vw, 5.55vh), 60px);
	line-height: 1.1667;
	letter-spacing: -.03em;
}

.gla-tl-body {
	font-size: clamp(16px, min(1.094vw, 1.95vh), 21px);
	line-height: 1.619;
	letter-spacing: -.01em;
}

.gla-tl-body p + p,
.gla-tl-body p + blockquote,
.gla-tl-body blockquote + p {
	margin-top: min(20px, 1.85vh);
}

.gla-tl-body blockquote {
	border: 0;
	font: inherit;
	color: inherit;
}

.gla-tl-body cite {
	display: block;
	margin-top: 20px;
	font-style: normal;
}

.gla-tl-body cite strong {
	display: block;
	font-weight: 700;
}

/* ---------- Buttons ---------- */

.gla-tl .gla-tl-links {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	margin-top: 40px;
}

#gla-tl .gla-tl-btn {
	display: inline-flex;
	align-items: center;
	min-height: 48px;
	padding: 9px 22px;
	border: 1.5px solid var(--gla-tl-white);
	border-radius: 8px;
	background: transparent;
	color: var(--gla-tl-white);
	font: 700 18px/30px var(--gla-tl-sans);
	letter-spacing: -.01em;
	text-decoration: none;
	transition: background-color .2s, color .2s;
}

#gla-tl .gla-tl-btn:hover,
#gla-tl .gla-tl-btn:focus-visible {
	background: var(--gla-tl-white);
	color: var(--gla-tl-navy);
}

/* ---------- Timeline nav ---------- */

.gla-tl-nav {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 5;
	height: var(--gla-tl-nav-h);
	background: linear-gradient(to top, rgba(0, 0, 0, .75), rgba(0, 0, 0, 0));
}

.gla-tl-arrows {
	position: absolute;
	left: 40px;
	bottom: 21px;
	z-index: 2;
	display: flex;
	gap: 12px;
}

.gla-tl .gla-tl-arrow {
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	margin: 0;
	padding: 0;
	border: 1.5px solid var(--gla-tl-white);
	border-radius: 50%;
	background: transparent;
	color: var(--gla-tl-white);
	cursor: pointer;
	transition: background-color .2s, color .2s, opacity .2s;
}

.gla-tl .gla-tl-arrow:hover,
.gla-tl .gla-tl-arrow:focus-visible {
	background: var(--gla-tl-white);
	color: var(--gla-tl-navy);
}

.gla-tl .gla-tl-arrow[aria-disabled="true"] {
	opacity: .4;
	cursor: default;
	background: transparent;
	color: var(--gla-tl-white);
}

.gla-tl-arrow svg {
	width: 24px;
	height: 18px;
	overflow: visible;
}

.gla-tl-trackwrap {
	position: absolute;
	inset: 0 0 0 160px;
	overflow: hidden;
	-webkit-mask-image: linear-gradient(to right, transparent, #000 40px);
	mask-image: linear-gradient(to right, transparent, #000 40px);
}

.gla-tl-track {
	--gla-tl-step: clamp(200px, 15.6vw, 300px);
	display: flex;
	height: 100%;
	transform: translate3d(var(--gla-tl-offset, 0px), 0, 0);
	transition: transform var(--gla-tl-speed) var(--gla-tl-ease);
}

.gla-tl-track li {
	position: relative;
	flex: 0 0 var(--gla-tl-step);
}

/* Line segments either side of each dot, with a gap round the dot (Figma: 8px, 17px round the ring).
   The ring shows on hover too, so the gap opens up with it rather than the ring sitting on the line. */
@property --gla-tl-gap {
	syntax: "<length>";
	inherits: true;
	initial-value: 8px;
}

.gla-tl-track li {
	--gla-tl-gap: 8px;
	transition: --gla-tl-gap .2s;
}

.gla-tl-track li:has([aria-current]),
.gla-tl-track li:has(.gla-tl-marker:hover),
.gla-tl-track li:has(.gla-tl-marker:focus-visible) {
	--gla-tl-gap: 17px;   /* 12px ring + 5px clear */
}

.gla-tl-track li::before,
.gla-tl-track li::after {
	content: "";
	position: absolute;
	bottom: 32.5px;
	height: 1px;
	background: var(--gla-tl-white);
}

.gla-tl-track li::before {
	left: 0;
	right: calc(50% + var(--gla-tl-gap));
}

.gla-tl-track li::after {
	left: calc(50% + var(--gla-tl-gap));
	right: 0;
}

.gla-tl-track li:first-child::before,
.gla-tl-track li:last-child::after {
	display: none;
}

#gla-tl .gla-tl-marker {
	position: absolute;
	left: 50%;
	bottom: 21px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	min-width: 72px;
	padding: 6px 8px 0;
	transform: translateX(-50%);
	color: var(--gla-tl-white);
	font: 400 20px/1 "Noto Serif", Georgia, serif;
	letter-spacing: -.04em;
	text-decoration: none;
	white-space: nowrap;
}

.gla-tl-marker-label {
	padding-bottom: 3px;
	border-bottom: 1px solid transparent;
	transition: border-color .2s;
}

#gla-tl .gla-tl-marker:hover,
#gla-tl .gla-tl-marker:focus,
#gla-tl .gla-tl-marker:visited,
#gla-tl .gla-tl-marker:active {
	color: var(--gla-tl-white);
}

#gla-tl .gla-tl-btn:visited {
	color: var(--gla-tl-white);
}

#gla-tl .gla-tl-marker:hover .gla-tl-marker-label,
#gla-tl .gla-tl-marker:focus-visible .gla-tl-marker-label {
	border-bottom-color: currentColor;
}

.gla-tl-dot {
	position: relative;
	display: grid;
	place-items: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 1px solid transparent;
	transition: border-color .2s;
}

.gla-tl-dot::after {
	content: "";
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--gla-tl-white);
}

#gla-tl .gla-tl-marker:hover .gla-tl-dot,
#gla-tl .gla-tl-marker[aria-current] .gla-tl-dot {
	border-color: var(--gla-tl-white);
}

#gla-tl .gla-tl-marker[aria-current] .gla-tl-dot::after {
	width: 5px;
	height: 5px;
}

/* ---------- Circular arrow cursor (mouse only) ---------- */

@media (hover: hover) and (pointer: fine) {
	.gla-tl--js .gla-tl-cursor {
		position: absolute;
		top: 0;
		left: 0;
		z-index: 6;
		display: grid;
		place-items: center;
		width: 100px;
		height: 100px;
		margin: -50px 0 0 -50px;
		border: 1.5px solid var(--gla-tl-white);
		border-radius: 50%;
		color: var(--gla-tl-white);
		pointer-events: none;
		opacity: 0;
		transition: opacity .2s;
	}

	.gla-tl-cursor svg {
		width: 48px;
		height: 36px;
		overflow: visible;
		transition: transform .25s var(--gla-tl-ease);
	}

	.gla-tl--cursor-on .gla-tl-cursor { opacity: 1; }
	.gla-tl--cursor-prev .gla-tl-cursor svg { transform: scaleX(-1); }
	.gla-tl-cursor path { stroke-width: .75; }   /* arrow is drawn at 2x, so 1.5px on screen */
	.gla-tl--cursor-on .gla-tl-slides,
	.gla-tl--cursor-on .gla-tl-slides * { cursor: none; }

	/* Clicking through the timeline shouldn't select the copy */
	.gla-tl--js .gla-tl-slides {
		-webkit-user-select: none;
		user-select: none;
	}
}

/* ---------- Read all dialog (mobile) ---------- */

.gla-tl-dialog {
	position: fixed;
	inset: 0;
	width: 100%;
	max-width: none;
	height: 100%;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: var(--gla-tl-accent);
	color: var(--gla-tl-navy);
	font-family: var(--gla-tl-sans);
	overflow-y: auto;
	overscroll-behavior: contain;
}

.gla-tl-dialog[open] {
	animation: gla-tl-slide-up .5s var(--gla-tl-ease);
}

.gla-tl-dialog::backdrop {
	background: rgba(1, 20, 81, .6);
}

.gla-tl-dialog-inner {
	position: relative;
	max-width: 40rem;
	/* iPhone 14 Pro notch / Android gesture bar: safe-area-inset-top keeps the
	   close button clear of the notch when the dialog goes full-screen on mobile. */
	padding: max(22px, env(safe-area-inset-top)) 20px 48px;
}

.gla-tl-dialog .gla-tl-date {
	background: var(--gla-tl-navy);
	color: var(--gla-tl-accent);
	font-size: 28px;
}

.gla-tl .gla-tl-dialog .gla-tl-heading {
	gap: 20px;
	margin: 0 56px 34px 0;
}

.gla-tl-dialog .gla-tl-title {
	color: var(--gla-tl-navy);
	font-size: clamp(30px, 10vw, 40px);
	line-height: 1.2;
}

.gla-tl-dialog .gla-tl-body {
	font-size: 18px;
	line-height: 1.556;
}

#gla-tl .gla-tl-dialog .gla-tl-btn {
	border-color: var(--gla-tl-navy);
	color: var(--gla-tl-navy);
}

#gla-tl .gla-tl-dialog .gla-tl-btn:hover,
#gla-tl .gla-tl-dialog .gla-tl-btn:focus-visible {
	background: var(--gla-tl-navy);
	color: var(--gla-tl-accent);
}

.gla-tl .gla-tl-close {
	position: absolute;
	top: 20px;
	right: 20px;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--gla-tl-navy);
	border-radius: 50%;
	background: transparent;
	color: var(--gla-tl-navy);
	cursor: pointer;
}

.gla-tl .gla-tl-close:hover {
	background: var(--gla-tl-navy);
	color: var(--gla-tl-accent);
}

.gla-tl-dialog :focus-visible {
	outline-color: var(--gla-tl-navy);
	box-shadow: 0 0 0 6px var(--gla-tl-accent);
}

.gla-tl-dialog.gla-tl-dialog--closing {
	animation: gla-tl-slide-down .4s var(--gla-tl-ease) forwards;
}

.gla-tl-dialog--closing::backdrop {
	opacity: 0;
	transition: opacity .4s;
}

@keyframes gla-tl-slide-up {
	from { transform: translateY(100%); }
	to { transform: translateY(0); }
}

@keyframes gla-tl-slide-down {
	from { transform: translateY(0); }
	to { transform: translateY(100%); }
}

/* ---------- Video slide (1848) ---------- */
/* .gla-tl-layer--video positions the wrapper at the video's figma coords.
   Inside: <video> fills the wrapper, <img.gla-tl-video-frame> is the
   designer-supplied Polaroid frame overlay with a transparent centre, and the
   <button> is positioned bottom-left over the video. */

/* Decorative layers (yearmark, bg colour-dodge accents) use mix-blend-mode which
   creates its own stacking context — that can swallow pointer events over the
   video. Make them click-through, then re-enable pointer-events on the interactive
   video wrapper so the play button can actually be clicked. */
.gla-tl-layer {
	pointer-events: none;
}
.gla-tl-layer--video,
.gla-tl-layer--video * {
	pointer-events: auto;
}
.gla-tl-video-frame {
	pointer-events: none !important; /* frame overlay doesn't block the video / button underneath */
}

/* Wrapper above the K accent / background layers so the video sits on top.
   aspect-ratio locks the Polaroid to the frame image's shape (2560x1538 = 1.665)
   so the video stays properly proportioned regardless of viewport height. */
.gla-tl .gla-tl-video-wrap {
	overflow: visible;
	z-index: 3;
	isolation: isolate;
	aspect-ratio: 2560 / 1538;
	height: auto;
}

/* Read all stays on 1848 per designer's mobile reference (shows below the
   title with an up-arrow). On desktop it's already display:none by default. */

/* ==========================================================================
   1848 Polaroid — explicit per-breakpoint sizing. Overrides the --mx/--my/--mw/--mh
   inline-style vars from figma-frames.json so each range is independent and
   doesn't bleed into the next. Height is derived from aspect-ratio on the
   wrapper (2560 / 1538 = 1.665), so we only set width + position.
   ========================================================================== */

/* All mobile/tablet variants: Polaroid is anchored HIGH on the slide (just
   below the timeline markers), matching the designer's Figma layout where
   the Polaroid is in the upper portion with the K accent visible in the gap
   BELOW it, not above. Uses `top:` positioning (not `bottom:`) so gap grows
   downward (which the text block absorbs) rather than upward. */

/* Mobile (320–767px) — uses CSS calc so the top position scales with viewport
   height: on tall viewports (phone portrait), Polaroid sits in the upper third
   with the K accent visible above; on short viewports (phone landscape, short
   dev tools heights), it moves up so the text block below still fits. */

/* Small mobile (320–479px) — portrait phones, tall viewports (>700).
   Keep frame's natural 1.665 aspect (no stretching) — Alec's feedback was the
   previous squish looked wrong. Width is nearly full viewport so the Polaroid
   makes the most of the horizontal space available. */
@media (max-width: 29.9375em) and (min-height: 43.75em) {
	.gla-tl--js .gla-tl-layer--video.gla-tl-video-wrap {
		bottom: auto;
		top: 20%;
		width: 95%;
		left: 2.5%;
		height: auto;
		/* aspect-ratio inherits natural 2560/1538 (1.665) from the parent rule */
	}
}

/* Small mobile with SHORT viewport (iPhone 8 portrait and similar, 600–700 tall) */
@media (max-width: 29.9375em) and (max-height: 43.6875em) and (min-height: 37.5625em) {
	.gla-tl--js .gla-tl-layer--video.gla-tl-video-wrap {
		bottom: auto;
		top: 15%;
		left: 7.5%;
		width: 85%;
		height: auto;
	}
}

/* Standard mobile (480–767px) — portrait phones, tall viewports */
@media (min-width: 30em) and (max-width: 47.9375em) and (min-height: 43.75em) {
	.gla-tl--js .gla-tl-layer--video.gla-tl-video-wrap {
		bottom: auto;
		top: 21%;      /* ~equal gaps above + below */
		width: min(75%, 420px);
		left: calc(50% - min(37.5%, 210px));
		height: auto;
	}
}

/* Standard mobile with SHORT viewport (iPhone 8-ish 375x667) */
@media (min-width: 30em) and (max-width: 47.9375em) and (max-height: 43.6875em) and (min-height: 37.5625em) {
	.gla-tl--js .gla-tl-layer--video.gla-tl-video-wrap {
		bottom: auto;
		top: 14%;
		width: min(75%, 420px);
		left: calc(50% - min(37.5%, 210px));
		height: auto;
	}
}

/* Very short mobile (iPhone SE 320x568, landscape phones <600px tall) — Polaroid
   needs to be smaller AND stay anchored to the top so the text block fits.    */
@media (max-width: 47.9375em) and (max-height: 37.5em) {
	.gla-tl--js .gla-tl-layer--video.gla-tl-video-wrap {
		bottom: auto;
		top: 13%;
		width: min(45%, 220px);
		left: calc(50% - min(22.5%, 110px));
	}
}

/* Tablet width (768–1119px) with SHORT viewport (laptop landscape, <900px tall).
   Polaroid at 70% / max 560px with ~40px gap above (clear separation from the
   timeline markers) and ~50-75px gap below (to 1848 tag). Natural 1.665 aspect. */
@media (min-width: 48em) and (max-width: 69.99875em) and (max-height: 56.25em) {
	.gla-tl--js .gla-tl-layer--video.gla-tl-video-wrap {
		bottom: auto;
		top: 14%;
		width: min(70%, 560px);
		left: calc(50% - min(35%, 280px));
		height: auto;
	}
}

/* Tablet width (768–1119px) with TALL viewport (iPad portrait, 900px+ tall)
   — plenty of vertical room so Polaroid can be the designer's intended 85%. */
@media (min-width: 48em) and (max-width: 69.99875em) and (min-height: 56.3125em) {
	.gla-tl--js .gla-tl-layer--video.gla-tl-video-wrap {
		bottom: auto;
		top: 14%;
		left: 7.5%;
		width: 85%;
		height: auto;
	}
}

/* Inset the video so it fits inside the Polaroid frame's inner transparent cutout.
   Measured from video-frame.png (2560x1538): inner cutout is 92.81% x 86.87%
   positioned at (3.59%, 6.63%) — thin side borders, slightly thicker top/bottom.
   object-position: center bottom anchors cropping to top so the burned-in
   subtitles at the bottom of the source footage are preserved even when the
   viewport aspect ratio causes vertical overflow with object-fit:cover. */
.gla-tl .gla-tl-video {
	position: absolute;
	top: 6.63%;
	left: 3.59%;
	width: 92.81%;
	height: 86.87%;
	object-fit: cover;
	object-position: center bottom;
	background: #000;
	border: 0;
	display: block;
}

/* Designer's Polaroid frame overlay. 2560x1538 PNG, transparent centre.
   Wrapper aspect now matches the frame (1.665) via figma-frames.json, so the
   overlay fills the wrapper 1-to-1. pointer-events: none → clicks pass through
   to video / button. */
.gla-tl .gla-tl-video-frame {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: fill;
	pointer-events: none;
	z-index: 2;
}

/* Play/pause button — bottom-left of the VIDEO (inside the frame cutout, clear of the Polaroid border).
   Position matches the video's inner coords (3.59%/6.63%/92.81%/86.87% of wrapper):
   8% from left ≈ 4% into the video from its left edge
   15% from bottom ≈ 9% into the video from its bottom edge. */
.gla-tl .gla-tl-video-btn {
	position: absolute;
	left: 6%;
	bottom: 12%;
	width: 4rem;        /* was 3.25rem — bumped up at desktop too */
	height: 4rem;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 50%;
	color: #fff;
	cursor: pointer;
	transition: transform 0.15s ease;
	-webkit-tap-highlight-color: transparent;
	z-index: 10; /* above .gla-tl-nav (z-index: 5) and .gla-tl-arrows (z-index: 2) */
}

/* Keyboard focus: soft white glow instead of a hard outline, so it doesn't
   read as a second circle around the icon. Preserved for accessibility —
   just visually quieter. */
.gla-tl .gla-tl-video-btn:focus-visible {
	outline: none;
	filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.9));
}
.gla-tl .gla-tl-video-btn:hover {
	transform: scale(1.05);
}
.gla-tl .gla-tl-video-btn:active {
	transform: scale(0.96);
}

.gla-tl .gla-tl-video-btn-play,
.gla-tl .gla-tl-video-btn-pause {
	display: block;
	width: 100%;
	height: 100%;
}

/* Toggle: JS adds .is-playing when the video is playing — swaps icon ↔ bars */
.gla-tl .gla-tl-video-btn .gla-tl-video-btn-pause { display: none; }
.gla-tl .gla-tl-video-btn.is-playing .gla-tl-video-btn-play { display: none; }
.gla-tl .gla-tl-video-btn.is-playing .gla-tl-video-btn-pause { display: block; }

/* Phone (<48em / ~768): button a touch smaller + inset further from the Polaroid edge */
@media (max-width: 47.9375em) {
	.gla-tl .gla-tl-video-btn {
		width: 2.5rem;
		height: 2.5rem;
		left: 8%;
		bottom: 14%;
	}
}

/* Tablet (768–1119): bigger play button per Alec's feedback. */
@media (min-width: 48em) and (max-width: 69.99875em) {
	.gla-tl .gla-tl-video-btn {
		width: 4.5rem;
		height: 4.5rem;
		left: 6%;
		bottom: 12%;
	}
}

/* Respect reduced motion — remove button transitions */
@media (prefers-reduced-motion: reduce) {
	.gla-tl .gla-tl-video-btn,
	.gla-tl .gla-tl-video-btn:hover,
	.gla-tl .gla-tl-video-btn:active {
		transition: none;
		transform: none;
	}
}

/* ---------- Closing frame (2026) ---------- */

.gla-tl-slide--closing .gla-tl-text {
	left: 0;
	right: 0;
	width: 100%;
	text-align: center;
}

.gla-tl-slide--closing .gla-tl-text-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.gla-tl .gla-tl-lockup {
	width: clamp(260px, 37.5vw, 720px);
	height: auto !important;
	margin-bottom: clamp(32px, min(6vw, 10.6vh), 115px);
}

.gla-tl .gla-tl-slide--closing .gla-tl-heading {
	align-items: center;
	margin-bottom: clamp(28px, min(5.7vw, 10.2vh), 110px);
}

/* Figma: one tab, Noto Sans ExtraBold 84/70, 24px 20px padding, never wraps on desktop */
.gla-tl-slide--closing .gla-tl-title {
	padding: .286em .238em;
	background: var(--gla-tl-accent);
	color: var(--gla-tl-navy);
	font-size: clamp(40px, min(4.375vw, 7.8vh), 84px);
	line-height: .833;
	letter-spacing: -.03em;
	white-space: nowrap;
}

/* Figma: Noto Serif 54/70 white, "Join us." in bold, soft black glow.
   ID-scoped: main.css sets every content <p> to Noto Sans via #content-container p */
#gla-tl .gla-tl-tagline {
	font-family: "Noto Serif", Georgia, serif;
	font-weight: 400;
	font-size: clamp(26px, min(2.8125vw, 5vh), 54px);
	line-height: 1.3;
	letter-spacing: -.04em;
	text-shadow: 0 0 30px #000;
}

.gla-tl-tagline strong {
	font-weight: 700;
}

.gla-tl-br-mobile {
	display: none;
}

.gla-tl .gla-tl-slide--closing .gla-tl-links {
	justify-content: center;
	margin-top: 40px;
}

.gla-tl-slide--closing .gla-tl-btn {
	min-width: 140px;
	justify-content: center;
}

/* ==========================================================================
   Mobile / tablet (matches main.css max-width:69.99875em)
   Also used on short desktop viewports and high zoom so copy never clips.
   ========================================================================== */

@media screen and (max-width: 69.99875em), screen and (max-height: 37.5em) {
	.gla-tl {
		--gla-tl-header: 0px;   /* mobile header scrolls away */
		--gla-tl-nav-h: 90px;
	}

	.gla-tl--js {
		height: max(560px, 100svh);
	}

	.gla-tl-slide::before,
	.gla-tl-slide[data-align="left"]::before {
		top: auto;
		height: 46%;
		background: linear-gradient(to top, rgba(0, 0, 0, .8), rgba(0, 0, 0, 0));
	}

	.gla-tl-tint {
		left: 0 !important;
		width: 100% !important;
	}

	.gla-tl-tint--band,
	.gla-tl-yearmark,
	.gla-tl-layer--desktop {
		display: none;
	}

	/* Mobile boxes from the 402x874 frames */
	.gla-tl-layer {
		left: var(--mx);
		top: var(--my);
		width: var(--mw);
		height: var(--mh);
	}

	/* Short landscape screens use this layout too: keep layers inside the top half */
	.gla-tl-layer img {
		object-position: center top;
	}

	.gla-tl-text,
	.gla-tl-slide[data-align="left"] .gla-tl-text {
		top: auto;
		bottom: 0;
		left: 0;
		width: 100%;
		max-height: 50%;
		padding: 0 20px 20px;
		justify-content: flex-end;
	}

	.gla-tl-text-inner {
		overflow: visible;
	}

	.gla-tl--js .gla-tl-text .gla-tl-body,
	.gla-tl--js .gla-tl-text .gla-tl-links {
		display: none;
	}

	.gla-tl .gla-tl-heading {
		gap: 20px;
		margin-bottom: 0;
	}

	.gla-tl-date {
		font-size: 28px;
	}

	.gla-tl-title {
		font-size: clamp(30px, 10vw, 40px);
		line-height: 1.2;
	}

	.gla-tl--js .gla-tl-readall {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 6px;
		align-self: center;
		min-width: 88px;
		min-height: 48px;
		margin: 24px auto 0;
		padding: 4px 8px;
		border: 0;
		background: transparent;
		color: var(--gla-tl-white);
		font: 700 16px/1.6 var(--gla-tl-sans);
		cursor: pointer;
	}

	.gla-tl-readall svg {
		width: 18px;
		height: 24px;
		overflow: visible;
	}

	/* closing frame keeps its call to action and sits centred */
	.gla-tl-slide--closing .gla-tl-text {
		top: var(--gla-tl-nav-h);
		max-height: none;
		width: 100%;
		justify-content: center;
		text-align: center;
	}

	.gla-tl--js .gla-tl-slide--closing .gla-tl-links {
		display: flex;
		margin-top: 30px;
	}

	.gla-tl .gla-tl-lockup {
		width: min(340px, 85vw);
		margin-bottom: 40px;
	}

	/* Figma mobile: two stacked tabs, the second offset right */
	.gla-tl-slide--closing .gla-tl-title {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		padding: 0;
		background: none;
		font-size: clamp(26px, 8.5vw, 34px);
	}

	.gla-tl-slide--closing .gla-tl-tab {
		padding: .41em .29em;
		background: var(--gla-tl-accent);
	}

	.gla-tl-slide--closing .gla-tl-tab + .gla-tl-tab {
		margin: -.12em 0 0 2.4em;
	}

	.gla-tl .gla-tl-slide--closing .gla-tl-heading {
		margin-bottom: 36px;
	}

	#gla-tl .gla-tl-tagline {
		font-size: clamp(20px, 6vw, 24px);
		line-height: 1.167;
	}

	.gla-tl-br-mobile {
		display: inline;
	}

	.gla-tl-slide--closing .gla-tl-btn {
		font-size: 16px;
	}

	/* Darker scrim behind the heading where Alec flagged readability */
	.gla-tl-slide--mscrim-strong::before,
	.gla-tl-slide--mscrim-strong[data-align="left"]::before {
		height: 60%;
		background: linear-gradient(to top, rgba(0, 0, 0, .92) 0%, rgba(0, 0, 0, .78) 45%, rgba(0, 0, 0, 0) 100%);
	}

	/* nav moves to the top */
	.gla-tl-nav {
		top: 0;
		bottom: auto;
		background: linear-gradient(to bottom, rgba(0, 0, 0, .5), rgba(0, 0, 0, 0));
	}

	.gla-tl-arrows {
		display: none;
	}

	.gla-tl-trackwrap {
		left: 0;
		-webkit-mask-image: none;
		mask-image: none;
	}

	.gla-tl-track {
		--gla-tl-step: 80px;
	}

	.gla-tl-track li::before,
	.gla-tl-track li::after {
		top: 24.5px;   /* 1px line centred on the dot centre (25px) */
		bottom: auto;
	}

	#gla-tl .gla-tl-marker {
		top: 13px;
		bottom: auto;
		flex-direction: column-reverse;
		justify-content: flex-end;   /* with column-reverse this packs to the top: dot on the line */
		gap: 12px;
		min-width: 0;
		min-height: 64px;
		padding: 0 6px;
		font-size: 18px;
	}
}

/* ==========================================================================
   Tablet: same layout as mobile, scaled up to use the screen (Alec, 26 Oct).
   Min-height keeps landscape phones on the phone sizes.
   ========================================================================== */

@media screen and (min-width: 40em) and (max-width: 69.99875em) and (min-height: 40em) {
	.gla-tl {
		--gla-tl-nav-h: 110px;
		--gla-tl-mk: 1.15;         /* how much taller the image area gets than on a phone */
		--gla-tl-mtop: 1.04;
	}

	/* Imagery: grow each layer's box from the mobile frame so photos fill the taller screen */
	.gla-tl-layer {
		top: calc(var(--my) * var(--gla-tl-mtop));
		height: calc(var(--mh) * var(--gla-tl-mk));
	}

	/* Copy */
	.gla-tl-text,
	.gla-tl-slide[data-align="left"] .gla-tl-text {
		max-height: 38%; /* was 42% — leaves clearance for the Polaroid on 1848 */
		padding: 0 6vw 28px;
	}

	.gla-tl .gla-tl-heading {
		gap: 24px;
	}

	.gla-tl-date {
		font-size: clamp(30px, 4.2vw, 40px);
	}

	.gla-tl-title {
		/* Scaled down from 72 → 56 max so the Kelvin title fits in 2 lines at
		   the designer's 768 / 1024 breakpoints (3-line wrap only at 1440+). */
		font-size: clamp(40px, 5.5vw, 56px);
		line-height: 1.12;
	}

	.gla-tl--js .gla-tl-readall {
		gap: 8px;
		margin-top: 24px; /* tighter stack between title and Read all */
		font-size: 18px;
	}

	.gla-tl-readall svg {
		width: 22px;
		height: 30px;
	}

	.gla-tl-slide::before,
	.gla-tl-slide[data-align="left"]::before {
		height: 50%;
	}

	/* Timeline: desktop-like spacing, kept at the top */
	.gla-tl-track {
		--gla-tl-step: clamp(170px, 24vw, 250px);
	}

	.gla-tl-track li::before,
	.gla-tl-track li::after {
		top: 32.5px;
	}

	#gla-tl .gla-tl-marker {
		top: 21px;   /* dot centre at 33px, on the line */
		gap: 16px;
		font-size: 20px;
	}

	/* Read all pop-up */
	.gla-tl-dialog-inner {
		max-width: 52rem;
		padding: 48px 6vw 64px;
	}

	.gla-tl .gla-tl-close {
		top: 40px;
		right: 6vw;
		width: 56px;
		height: 56px;
	}

	.gla-tl .gla-tl-dialog .gla-tl-heading {
		gap: 28px;
		margin: 0 80px 40px 0;
	}

	.gla-tl-dialog .gla-tl-date {
		font-size: clamp(30px, 4.2vw, 40px);
	}

	.gla-tl-dialog .gla-tl-title {
		font-size: clamp(44px, 6.5vw, 64px);
		line-height: 1.12;
	}

	.gla-tl-dialog .gla-tl-body {
		font-size: 21px;
		line-height: 1.62;
	}

	/* Closing frame */
	.gla-tl .gla-tl-lockup {
		width: min(560px, 70vw);
		margin-bottom: 56px;
	}

	.gla-tl-slide--closing .gla-tl-title {
		font-size: clamp(44px, 6.5vw, 64px);
	}

	#gla-tl .gla-tl-tagline {
		font-size: clamp(28px, 4.4vw, 40px);
	}

	.gla-tl-slide--closing .gla-tl-btn {
		font-size: 18px;
	}
}

/* Landscape tablets: less height to share, so the images grow less */
@media screen and (min-width: 40em) and (max-width: 69.99875em) and (min-height: 40em) and (orientation: landscape) {
	.gla-tl {
		--gla-tl-mk: 1;
		--gla-tl-mtop: 1;
	}

	.gla-tl-title {
		font-size: clamp(40px, 5vw, 56px);
	}
}

/* ---------- Reduced motion: no parallax, no slide-in ---------- */

@media (prefers-reduced-motion: reduce) {
	.gla-tl {
		--gla-tl-speed: 1ms;
	}

	.gla-tl--js [data-depth] {
		transform: none;
	}

	.gla-tl-dialog[open] {
		animation: none;
	}
}

/* ---------- Windows high contrast ---------- */

@media (forced-colors: active) {
	.gla-tl-date {
		border: 1px solid CanvasText;
	}

	.gla-tl-dot::after {
		background: CanvasText;
	}
}
