/**
 * Reset, fonts, base typography and layout primitives.
 */

/* ---- Fonts (self-hosted, latin subset) ------------------------------- */
@font-face {
	font-family: "Rubik";
	src: url("../fonts/rubik-var.woff2") format("woff2-variations");
	font-weight: 300 900;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: "IBM Plex Mono";
	src: url("../fonts/ibm-plex-mono-400.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: "IBM Plex Mono";
	src: url("../fonts/ibm-plex-mono-500.woff2") format("woff2");
	font-weight: 500;
	font-style: normal;
	font-display: swap;
}

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

* {
	margin: 0;
	padding: 0;
}

html {
	scroll-behavior: smooth;
	/* Offset anchor targets so the fixed nav doesn't cover them. */
	scroll-padding-top: 5.5rem;
	-webkit-text-size-adjust: 100%;
}

body {
	position: relative;
	min-height: 100vh;
	background: var(--c-bg);
	color: var(--c-ink);
	font-family: var(--f-sans);
	font-size: var(--t-body);
	font-weight: 400;
	line-height: var(--lh-body);
	overflow-x: hidden;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Page-level copper glow. Fixed so it stays put while the page scrolls. */
body::before {
	content: "";
	position: fixed;
	inset: 0;
	background: var(--g-page);
	pointer-events: none;
	z-index: 0;
}

body > * {
	position: relative;
	z-index: 1;
}

img,
svg,
video,
canvas {
	display: block;
	max-width: 100%;
}

img {
	height: auto;
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

button {
	background: none;
	border: 0;
	cursor: pointer;
}

ul,
ol {
	list-style: none;
}

table {
	border-collapse: collapse;
	width: 100%;
}

/* ---- Typography ------------------------------------------------------- */
h1,
h2,
h3,
h4 {
	font-weight: 700;
	line-height: var(--lh-heading);
	letter-spacing: -0.02em;
	text-wrap: balance;
}

h1 {
	font-size: var(--t-display);
	font-weight: 800;
	line-height: var(--lh-tight);
	letter-spacing: -0.035em;
}

h2 {
	font-size: var(--t-h2);
	letter-spacing: -0.03em;
}

h3 {
	font-size: var(--t-h3);
}

p {
	text-wrap: pretty;
}

a {
	color: var(--c-sand);
	text-decoration: none;
	transition: color var(--dur-fast) var(--ease);
}

a:hover {
	color: var(--c-ink);
}

strong {
	font-weight: 600;
}

::selection {
	background: var(--c-copper);
	color: #fff;
}

/* ---- Accessibility ---------------------------------------------------- */
:focus-visible {
	outline: 2px solid var(--c-sand);
	outline-offset: 3px;
	border-radius: var(--r-sm);
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	top: -100%;
	left: var(--s-4);
	z-index: 999;
	padding: var(--s-3) var(--s-5);
	background: var(--c-sand);
	color: var(--c-bg);
	border-radius: 0 0 var(--r-md) var(--r-md);
	font-weight: 600;
}

.skip-link:focus {
	top: 0;
	color: var(--c-bg);
}

/* ---- Layout primitives ------------------------------------------------ */
.container {
	width: 100%;
	max-width: var(--container);
	margin-inline: auto;
	padding-inline: var(--s-5);
}

.container--narrow {
	max-width: var(--container-narrow);
}

.section {
	padding-block: var(--s-section);
}

.section--tight {
	padding-block: calc(var(--s-section) * 0.6);
}

/* Hairline between stacked sections, used sparingly. */
.section--ruled {
	border-top: 1px solid var(--c-line-soft);
}

.stack > * + * {
	margin-top: var(--flow, var(--s-4));
}

/* Auto-fitting card grid — the workhorse. Every card section uses this
   rather than redefining its own column rules.
 *
 * --cols-md / --cols-lg are re-declared on every .grid rather than relying on
 * var() fallbacks. Custom properties inherit, so a nested grid would otherwise
 * silently pick up its parent's column count. An inline style still wins over
 * these declarations, so `style="--cols-lg:4"` behaves as expected. */
.grid {
	--cols: 1;
	--cols-md: var(--cols);
	--cols-lg: var(--cols-md);

	display: grid;
	gap: var(--gap, var(--s-4));
	grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
}

@media (min-width: 700px) {
	.grid {
		grid-template-columns: repeat(var(--cols-md), minmax(0, 1fr));
	}
}

@media (min-width: 1000px) {
	.grid {
		grid-template-columns: repeat(var(--cols-lg), minmax(0, 1fr));
	}
}

/* ---- Motion ----------------------------------------------------------- */
@keyframes fadeup {
	from {
		opacity: 0;
		transform: translateY(28px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Dropdown entrance. Deliberately shorter travel than `fadeup`: a menu that
   slides 28px reads as sluggish next to the pointer that opened it. */
@keyframes menu-in {
	from {
		opacity: 0;
		transform: translateY(-6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes slidein {
	from {
		opacity: 0;
		transform: translateX(12px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

@keyframes glowpulse {
	0%,
	100% {
		opacity: 0.55;
	}
	50% {
		opacity: 0.9;
	}
}

@keyframes floaty {
	0%,
	100% {
		transform: translateY(0);
	}
	50% {
		transform: translateY(-10px);
	}
}

@keyframes rot {
	to {
		transform: rotate(360deg);
	}
}

/* Scroll reveal. Starts hidden only when JS is present to un-hide it —
   `no-js` guards against content vanishing if the script fails. */
.js .reveal {
	opacity: 0;
}

.js .reveal.is-in {
	animation: fadeup var(--dur-slow) var(--ease) forwards;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
	}

	.js .reveal {
		opacity: 1;
	}
}
