@font-face {
	font-family: "Instrument Serif";
	src: url("../fonts/instrument-serif-400.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: "TASA Orbiter";
	src: url("../fonts/tasa-orbiter-400.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

/* Every value reaches its Figma size at 1920px wide and scales down from there. */
:root {
	--ink: #0b0b14;
	--black: #000;
	--text: #e1e1eb;
	--accent: #8ee3ef;
	--margin: clamp(1.5rem, 2.5vw, 3rem);
	--size-small: clamp(1rem, 0.25rem + 0.8333vw, 1.25rem);
	--size-heading: clamp(2.5rem, 4.6875vw, 5.625rem);
}

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

html {
	background: var(--black);
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	display: grid;
	grid-template-rows: auto 1fr auto;
	justify-items: center;
	min-height: 100vh;
	min-height: 100svh;
	margin: 0;
	padding: var(--margin);
	/* The gradient from the design. scripts/gradient.js layers a dithered copy
	   on top (--dither) to remove banding; this plain one is the fallback. */
	background-color: var(--black);
	background-image: var(--dither, none), linear-gradient(to bottom, var(--ink) 50%, var(--black) 100%);
	background-size: var(--dither-size, auto), auto;
	background-repeat: repeat-x, no-repeat;
	color: var(--text);
	font: 400 var(--size-small)/1.3 "TASA Orbiter", system-ui, sans-serif;
	letter-spacing: 0.02em;
	text-align: center;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

header,
main,
footer {
	animation: fade-in 1.2s ease-out both;
}

p,
h1 {
	margin: 0;
}

header,
footer {
	display: flex;
}

nav {
	display: flex;
	gap: 1.2em;
}

/* The heading sits one margin above centre, as in the design. */
main {
	display: grid;
	place-items: center;
	padding-block: var(--margin) calc(var(--margin) * 3);
}

h1 {
	max-width: 11.72em;
	font: 400 var(--size-heading)/1.15 "Instrument Serif", Georgia, serif;
	letter-spacing: -0.01em;
	text-wrap: balance;
}

a {
	position: relative;
	display: block;
	color: var(--accent);
	text-decoration: none;
}

/* Larger tap target, half the gap wide so neighbouring links never overlap */
a::before {
	content: "";
	position: absolute;
	inset: -1.125rem -0.6em;
}

a::after {
	content: "";
	position: absolute;
	inset: auto 0 -0.5em;
	height: 1px;
	background: currentColor;
	transform: scaleX(0);
	transform-origin: right;
	transition: transform 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}

a:hover::after,
a:focus-visible::after {
	transform: scaleX(1);
	transform-origin: left;
}

a:focus-visible {
	outline: 1px solid currentColor;
	outline-offset: 1rem;
}

/* No hover on touch screens, so the line is always there. */
@media (hover: none) {
	a::after {
		transform: none;
	}
}

/* Trim to cap height and baseline, like Figma's vertical trim. */
p,
h1,
a {
	text-box: trim-both cap alphabetic;
}

@supports not (text-box: trim-both cap alphabetic) {
	p,
	a {
		margin-block: -0.3em;
	}

	a::after {
		bottom: -0.2em;
	}

	h1 {
		margin-block: -0.2em -0.23em;
	}
}

/* Desktop Safari draws a 6px near-black strip under its toolbar that reads as
   part of the page, so the name is lifted to look level with Contact. */
@supports (font: -apple-system-body) {
	@media (hover: hover) and (pointer: fine) {
		header {
			translate: 0 -6px;
		}
	}
}

/* iPhone Safari leaves black space above its floating address bar, so the links
   drop to put their underlines as far from the bar as the name is from the top.
   The tap area shifts up by the same amount so the page doesn't gain a scroll. */
@supports (-webkit-touch-callout: none) {
	@media (hover: none) and (orientation: portrait) and (max-width: 500px) {
		footer {
			translate: 0 8px;
		}

		a::before {
			inset: -1.625rem -0.6em -0.625rem;
		}
	}
}

@keyframes fade-in {
	from {
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	header,
	main,
	footer {
		animation: none;
	}

	a::after {
		transition: none;
	}
}
