/* ---------------------------------------------------------------- fonts */
@font-face {
	font-family: 'Departure Mono';
	src: url(../fonts/DepartureMono-Regular.woff2) format('woff2');
	font-display: block;
}
@font-face {
	font-family: 'Builder Sans';
	font-weight: 400;
	src: url(../fonts/BuilderSans-Regular.otf) format('opentype');
	font-display: swap;
}
@font-face {
	font-family: 'Builder Sans';
	font-weight: 500;
	src: url(../fonts/BuilderSans-Medium.otf) format('opentype');
	font-display: block;
}
@font-face {
	font-family: 'Builder Sans';
	font-weight: 700;
	src: url(../fonts/BuilderSans-Bold.otf) format('opentype');
	font-display: block;
}

:root {
	--ink: #f4f1ea;
	--gold: #ffb45e;
	--pixel: 'Departure Mono', ui-monospace, monospace;
	--sans: 'Builder Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
	/* Departure Mono is drawn on an 11 px grid: keep sizes at multiples of 11 for crisp pixels */
	--enter-size: 22px;
}

html, body {
	margin: 0;
	min-height: 100%;
	background: #000;
	color: var(--ink);
	-webkit-font-smoothing: antialiased;
}
body.index {
	height: 100%;
	overflow: hidden;
}

/* fade between pages (js/nav.js adds .leaving before navigating) */
body { transition: opacity 0.28s ease; }
html.leaving body { opacity: 0; }
body.page,
body.direct #home.show { animation: page-in 0.6s ease backwards; }
@keyframes page-in {
	from { opacity: 0; }
}

#stage, #home, #intro, #landing-ui {
	position: fixed;
	inset: 0;
}

/* ------------------------------------------------------------- landing */
#stage canvas {
	display: block;
	width: 100%;
	height: 100%;
	cursor: grab;
	touch-action: none;
}
#stage canvas:active { cursor: grabbing; }

#landing-ui {
	z-index: 3;
	display: grid;
	place-items: center;
	pointer-events: none;   /* the black hole stays draggable everywhere except the button */
}

#enter {
	pointer-events: auto;
	position: relative;
	margin: 0;
	padding: 0.55em 0.5em 0.55em 0.8em;
	border: 0;
	font: 400 var(--enter-size)/1 var(--pixel);
	letter-spacing: 0.3em;
	color: var(--ink);
	background: rgba(4, 4, 7, 0.55);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	/* pixel border with notched corners */
	box-shadow:
		0 -2px 0 0 var(--ink),
		0 2px 0 0 var(--ink),
		-2px 0 0 0 var(--ink),
		2px 0 0 0 var(--ink);
	cursor: pointer;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.9s ease, transform 0.9s ease;
}
#enter span::after {
	content: '_';
	margin-left: -0.15em;
	animation: blink 1.05s steps(1) infinite;
}
body.ready #enter { opacity: 1; transform: none; }

#enter:hover,
#enter:focus-visible {
	outline: none;
	color: #000;
	background: var(--ink);
	animation: glitch 0.6s steps(1) infinite;
}

body.warning #enter,
body.entering #enter {
	pointer-events: none;
	animation: enter-out 0.5s steps(1) forwards;
}

/* ---------------------------------------------- flashing-lights warning */
/* takes ENTER's place in the centre after it's clicked */
#enter, #warning { grid-area: 1 / 1; }
#warning {
	pointer-events: none;
	box-sizing: border-box;
	width: min(340px, calc(100vw - 40px));
	padding: 22px 22px 22px;
	background: rgba(4, 4, 7, 0.72);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	box-shadow:
		0 -1px 0 0 rgba(244, 241, 234, 0.4),
		0 1px 0 0 rgba(244, 241, 234, 0.4),
		-1px 0 0 0 rgba(244, 241, 234, 0.4),
		1px 0 0 0 rgba(244, 241, 234, 0.4);
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity 0.35s ease, transform 0.35s ease, visibility 0s linear 0.35s;
}
body.warning #warning {
	pointer-events: auto;
	opacity: 1;
	visibility: visible;
	transform: none;
	transition: opacity 0.4s ease 0.3s, transform 0.4s ease 0.3s, visibility 0s;
}
body.entering #warning {
	pointer-events: none;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.warning-title {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 14px;
	font: 400 11px/1 var(--pixel);
	letter-spacing: 0.25em;
	color: var(--gold);
}
.warning-icon { flex: none; width: 22px; height: 20px; }
.warning-text {
	margin: 0 0 20px;
	font: 400 14px/1.5 var(--sans);
	color: rgba(244, 241, 234, 0.78);
}
.warning-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}
.pixel-choice {
	margin: 0;
	padding: 0.85em 0.9em 0.85em 1.15em;
	border: 0;
	font: 400 11px/1 var(--pixel);
	letter-spacing: 0.25em;
	color: var(--ink);
	background: transparent;
	box-shadow:
		0 -1px 0 0 var(--ink),
		0 1px 0 0 var(--ink),
		-1px 0 0 0 var(--ink),
		1px 0 0 0 var(--ink);
	cursor: pointer;
}
.pixel-choice-quiet {
	color: rgba(244, 241, 234, 0.62);
	box-shadow:
		0 -1px 0 0 rgba(244, 241, 234, 0.3),
		0 1px 0 0 rgba(244, 241, 234, 0.3),
		-1px 0 0 0 rgba(244, 241, 234, 0.3),
		1px 0 0 0 rgba(244, 241, 234, 0.3);
}
.pixel-choice:hover,
.pixel-choice:focus-visible {
	outline: none;
	color: #000;
	background: var(--ink);
	box-shadow:
		0 -1px 0 0 var(--ink),
		0 1px 0 0 var(--ink),
		-1px 0 0 0 var(--ink),
		1px 0 0 0 var(--ink);
	animation: glitch 0.6s steps(1) infinite;
}

/* SKIP: bottom left while the camera glides and the intro plays */
#skip {
	pointer-events: none;
	position: absolute;
	left: 32px;
	bottom: 28px;
	margin: 0;
	padding: 0.85em 0.9em 0.85em 1.15em;
	border: 0;
	font: 400 11px/1 var(--pixel);
	letter-spacing: 0.25em;
	color: var(--ink);
	background: rgba(4, 4, 7, 0.45);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	box-shadow:
		0 -1px 0 0 rgba(244, 241, 234, 0.4),
		0 1px 0 0 rgba(244, 241, 234, 0.4),
		-1px 0 0 0 rgba(244, 241, 234, 0.4),
		1px 0 0 0 rgba(244, 241, 234, 0.4);
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}
body.entering #skip {
	pointer-events: auto;
	opacity: 1;
	visibility: visible;
	transition: opacity 0.6s ease 0.4s, visibility 0s linear 0.4s;
}
#skip:hover,
#skip:focus-visible {
	outline: none;
	color: #000;
	background: var(--ink);
	box-shadow:
		0 -1px 0 0 var(--ink),
		0 1px 0 0 var(--ink),
		-1px 0 0 0 var(--ink),
		1px 0 0 0 var(--ink);
	animation: glitch 0.6s steps(1) infinite;
}

#hint {
	position: absolute;
	left: 50%;
	bottom: 28px;
	margin: 0;
	transform: translateX(-50%);
	font: 400 11px/1 var(--pixel);
	letter-spacing: 0.25em;
	white-space: nowrap;
	color: rgba(244, 241, 234, 0.45);
	opacity: 0;
	transition: opacity 1.2s ease;
}
body.ready #hint { opacity: 1; }
body.interacted #hint,
body.warning #hint,
body.entering #hint { opacity: 0; transition-duration: 0.4s; }

@keyframes blink {
	50% { opacity: 0; }
}
@keyframes glitch {
	0%   { text-shadow: 2px 0 rgba(255, 0, 72, 0.75), -2px 0 rgba(0, 210, 255, 0.75); transform: translateX(0); }
	20%  { text-shadow: -2px 0 rgba(255, 0, 72, 0.75), 2px 0 rgba(0, 210, 255, 0.75); transform: translateX(1px); }
	40%  { text-shadow: none; transform: translateX(0); }
	70%  { text-shadow: 1px 0 rgba(255, 0, 72, 0.6), -1px 0 rgba(0, 210, 255, 0.6); transform: translateX(-1px); }
	100% { text-shadow: none; transform: translateX(0); }
}
@keyframes enter-out {
	0%   { opacity: 1; transform: translateX(0); text-shadow: 3px 0 rgba(255, 0, 72, 0.8), -3px 0 rgba(0, 210, 255, 0.8); }
	15%  { opacity: 0.3; transform: translateX(4px); }
	30%  { opacity: 1; transform: translateX(-3px); }
	45%  { opacity: 0.6; transform: translateX(2px) scaleY(0.6); }
	60%  { opacity: 0.9; transform: translateX(0) scaleY(0.25); }
	80%  { opacity: 0.4; transform: scaleX(0.6) scaleY(0.08); }
	100% { opacity: 0; transform: scaleX(0) scaleY(0.04); }
}

/* --------------------------------------------------------------- video */
#intro {
	z-index: 2;
	width: 100%;
	height: 100%;
	object-fit: cover;
	background: #000;
	visibility: hidden;
	pointer-events: none;
}
#intro.show { visibility: visible; }
#intro.out { opacity: 0; transition: opacity 0.6s ease; }

/* ----------------------------------------------------------- main page */
#home {
	z-index: 1;
	visibility: hidden;
}
#home.show { visibility: visible; }
#endcard {
	display: block;
	width: 100%;
	height: 100%;
}

/* ------------------------------------------------------------- links */
/* The words under the name. The canvas draws them; these sit exactly on top
   (js/endcard.js positions them) so they click, tab and read like links. */
.sub-links a {
	position: absolute;
	z-index: 2;
	color: transparent;
	font-size: 1px;
	overflow: hidden;
	text-decoration: none;
	pointer-events: none;
	-webkit-tap-highlight-color: transparent;
}
.sub-links.live a { pointer-events: auto; }
.sub-links a:focus { outline: none; }
.sub-links a:focus-visible { outline: 1px solid rgba(255, 180, 94, 0.55); outline-offset: -4px; }

/* blog: a little pixel notebook in the top right of the main page */
.blog-link {
	position: fixed;
	z-index: 4;
	top: 22px;
	right: 26px;
	display: block;
	width: 32px;
	height: 32px;
	padding: 6px;
	color: rgba(244, 241, 234, 0.85);
	opacity: 0;
	transition: opacity 1s ease 0.6s, color 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}
#home.show .blog-link { opacity: 1; }
body.direct .blog-link { transition-delay: 0s, 0s; }
.blog-link svg {
	display: block;
	width: 100%;
	height: 100%;
}
.blog-link .ribbon { fill: var(--gold); }
.blog-link:hover,
.blog-link:focus-visible {
	outline: none;
	color: var(--ink);
	animation: icon-glitch 0.6s steps(1) infinite;
}
@keyframes icon-glitch {
	0%   { filter: drop-shadow(2px 0 rgba(255, 0, 72, 0.8)) drop-shadow(-2px 0 rgba(0, 210, 255, 0.8)); transform: translateX(0); }
	20%  { filter: drop-shadow(-2px 0 rgba(255, 0, 72, 0.8)) drop-shadow(2px 0 rgba(0, 210, 255, 0.8)); transform: translateX(1px); }
	40%  { filter: none; transform: translateX(0); }
	70%  { filter: drop-shadow(1px 0 rgba(255, 0, 72, 0.6)) drop-shadow(-1px 0 rgba(0, 210, 255, 0.6)); transform: translateX(-1px); }
	100% { filter: none; transform: translateX(0); }
}

/* the Home button on the other pages */
.home-link {
	display: inline-block;
	padding: 0.85em 0.9em 0.85em 1.15em;   /* extra left pad balances the trailing letter-spacing */
	color: var(--ink);
	text-decoration: none;
	background: rgba(4, 4, 7, 0.45);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	/* pixel border with notched corners, like ENTER */
	box-shadow:
		0 -1px 0 0 rgba(244, 241, 234, 0.4),
		0 1px 0 0 rgba(244, 241, 234, 0.4),
		-1px 0 0 0 rgba(244, 241, 234, 0.4),
		1px 0 0 0 rgba(244, 241, 234, 0.4);
}
.home-link:hover,
.home-link:focus-visible {
	outline: none;
	color: #000;
	background: var(--ink);
	box-shadow:
		0 -1px 0 0 var(--ink),
		0 1px 0 0 var(--ink),
		-1px 0 0 0 var(--ink),
		1px 0 0 0 var(--ink);
	animation: glitch 0.6s steps(1) infinite;
}

/* --------------------------------------------------------- inner pages */
/* soft black fades at the top and bottom edges as the content scrolls */
body.page::before,
body.page::after {
	content: '';
	position: fixed;
	left: 0;
	right: 0;
	z-index: 3;
	pointer-events: none;
}
body.page::before { top: 0; height: 104px; background: linear-gradient(#000 40%, rgba(0, 0, 0, 0)); }
body.page::after { bottom: 0; height: 88px; background: linear-gradient(rgba(0, 0, 0, 0), #000 60%); }

.page-body {
	box-sizing: border-box;
	max-width: 1080px;
	min-height: 100vh;
	margin: 0 auto;
	padding: 136px 32px 128px;
}
.home-link {
	position: fixed;
	z-index: 4;
	left: 32px;
	bottom: 28px;
	font: 400 11px/1 var(--pixel);
	letter-spacing: 0.25em;
	text-transform: uppercase;
}

.page-head { margin-bottom: 64px; }
.page-title {
	margin: 0;
	font: 700 44px/1.05 var(--sans);
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--ink);
}
.page-title + .rule {
	width: min(320px, 60%);
	height: 1px;
	margin-top: 26px;
	background: linear-gradient(90deg, rgba(244, 241, 234, 0.9), rgba(244, 241, 234, 0));
	box-shadow: 0 0 12px rgba(255, 180, 94, 0.35);
}

.eyebrow {
	margin: 0 0 16px;
	font: 400 11px/1.4 var(--pixel);
	letter-spacing: 0.25em;
	text-transform: uppercase;
	color: var(--gold);
}
.prose {
	max-width: 660px;
	font: 400 17px/1.7 var(--sans);
	color: rgba(244, 241, 234, 0.8);
}
.prose p { margin: 0 0 1.15em; }
.prose strong { font-weight: 500; color: var(--ink); }

.pixel-btn {
	display: inline-block;
	padding: 0.85em 0.9em 0.85em 1.15em;
	font: 400 11px/1 var(--pixel);
	letter-spacing: 0.25em;
	text-transform: uppercase;
	color: var(--gold);
	text-decoration: none;
	box-shadow:
		0 -1px 0 0 var(--gold),
		0 1px 0 0 var(--gold),
		-1px 0 0 0 var(--gold),
		1px 0 0 0 var(--gold);
}
.pixel-btn:hover,
.pixel-btn:focus-visible {
	outline: none;
	color: #000;
	background: var(--gold);
	animation: glitch 0.6s steps(1) infinite;
}

/* research */
.paper h2 {
	max-width: 780px;
	margin: 0 0 22px;
	font: 700 30px/1.25 var(--sans);
	color: var(--ink);
}
.paper .actions {
	display: flex;
	align-items: center;
	gap: 18px;
	margin-top: 30px;
}
.note {
	font: 400 11px/1 var(--pixel);
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: rgba(244, 241, 234, 0.4);
}

/* projects */
.project-group + .project-group { margin-top: 64px; }
.group-label {
	display: flex;
	align-items: center;
	gap: 16px;
	margin: 0 0 22px;
	font: 400 11px/1 var(--pixel);
	letter-spacing: 0.25em;
	text-transform: uppercase;
	color: var(--gold);
}
.group-label::after {
	content: '';
	flex: 1;
	height: 1px;
	background: linear-gradient(90deg, rgba(255, 180, 94, 0.45), rgba(255, 180, 94, 0));
}
.cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 18px;
}
.card {
	display: flex;
	flex-direction: column;
	padding: 24px 24px 22px;
	background: rgba(244, 241, 234, 0.025);
	box-shadow:
		0 -1px 0 0 rgba(244, 241, 234, 0.16),
		0 1px 0 0 rgba(244, 241, 234, 0.16),
		-1px 0 0 0 rgba(244, 241, 234, 0.16),
		1px 0 0 0 rgba(244, 241, 234, 0.16);
	transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
.card:hover {
	transform: translateY(-2px);
	background: rgba(244, 241, 234, 0.045);
	box-shadow:
		0 -1px 0 0 rgba(244, 241, 234, 0.5),
		0 1px 0 0 rgba(244, 241, 234, 0.5),
		-1px 0 0 0 rgba(244, 241, 234, 0.5),
		1px 0 0 0 rgba(244, 241, 234, 0.5);
}
.card .meta {
	flex: none;
	margin: 0 0 14px;
	font: 400 11px/1.4 var(--pixel);
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: rgba(244, 241, 234, 0.45);
}
.card h3 {
	margin: 0 0 12px;
	font: 700 20px/1.3 var(--sans);
	color: var(--ink);
}
.card p {
	flex: 1;
	margin: 0 0 20px;
	font: 400 15px/1.6 var(--sans);
	color: rgba(244, 241, 234, 0.72);
}
.tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 14px;
	margin: 0;
	padding: 0;
	list-style: none;
	font: 400 11px/1 var(--pixel);
	letter-spacing: 0.15em;
	text-transform: uppercase;
	color: var(--gold);
}

/* about */
.about {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 260px;
	gap: 64px;
	align-items: start;
}
/* right column: the Contacts box at the top (lined up with the page title),
   with room underneath for another box the same size */
.about-side {
	display: flex;
	flex-direction: column;
	gap: 24px;
}
.side-box {
	padding: 22px 22px 6px;
	box-shadow:
		0 -1px 0 0 rgba(244, 241, 234, 0.16),
		0 1px 0 0 rgba(244, 241, 234, 0.16),
		-1px 0 0 0 rgba(244, 241, 234, 0.16),
		1px 0 0 0 rgba(244, 241, 234, 0.16);
}
.side-title {
	margin: 0 0 22px;
	font: 700 14px/1 var(--sans);
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--ink);
}
.facts { margin: 0; }
.facts dt {
	font: 400 11px/1 var(--pixel);
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--gold);
}
.facts dd {
	margin: 8px 0 18px;
	font: 400 15px/1.5 var(--sans);
	color: var(--ink);
	overflow-wrap: anywhere;
}
.facts a {
	color: inherit;
	text-decoration: none;
	transition: color 0.2s ease;
}
.facts a:hover,
.facts a:focus-visible {
	outline: none;
	color: var(--gold);
	text-decoration: underline;
	text-underline-offset: 3px;
}

@media (max-width: 760px) {
	.page-body { padding: 112px 20px 112px; }
	.page-title { font-size: 30px; letter-spacing: 0.16em; }
	.paper h2 { font-size: 23px; }
	.about { grid-template-columns: 1fr; gap: 36px; }
	.home-link { left: 16px; }
	#skip { left: 16px; }
	.blog-link { top: 12px; right: 10px; }
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

@media (prefers-reduced-motion: reduce) {
	#enter:hover, #enter:focus-visible,
	.home-link:hover, .home-link:focus-visible,
	.pixel-choice:hover, .pixel-choice:focus-visible,
	#skip:hover, #skip:focus-visible,
	.blog-link:hover, .blog-link:focus-visible { animation: none; }
	body.page, body.direct #home.show { animation: none; }
	#enter span::after { animation: none; }
}
