/* DEAD AIR chassis tokens (BRIEF §6). Shared, never overridden by stations.
   Stations define the --st-* names; the chassis only reads them. */

/* Chassis faces. Weight axis only, Latin subset: the dial is on every first viewport,
   so it gets the 24KB + 23KB files, not the 57KB + 38KB width-axis ones.
   Family names are chassis-specific so a station's own Anybody / Martian Mono
   (with the width axis) never gets matched and downloaded for chassis text. */
@font-face {
	font-family: "Anybody Chassis";
	src: url("/fonts/anybody-latin-wght-normal.3df452b4.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
	unicode-range:
		U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
		U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Martian Mono Chassis";
	src: url("/fonts/martian-mono-latin-wght-normal.d0be3a78.woff2") format("woff2");
	font-weight: 100 800;
	font-style: normal;
	font-display: swap;
	unicode-range:
		U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
		U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Metric-matched fallbacks, so the swap moves nothing (CLS 0).
   Measured in Chromium at 100px: Anybody ascent .79 / descent .245 / no line gap, average
   advance 1.13 × local Arial (rendered at wght 400–600); Martian Mono ascent 1.00 / descent .20, advance .70em
   = 1.166 × Courier New. Overrides are divided by size-adjust. */
@font-face {
	font-family: "Anybody Chassis Fallback";
	src:
		local("Arial"), local("ArialMT"), local("Liberation Sans"), local("Arimo");
	size-adjust: 113%;
	ascent-override: 69.9%;
	descent-override: 21.7%;
	line-gap-override: 0%;
}

@font-face {
	font-family: "Martian Mono Chassis Fallback";
	src:
		local("Courier New"), local("CourierNewPSMT"), local("Liberation Mono"),
		local("Cousine");
	size-adjust: 116.6%;
	ascent-override: 85.8%;
	descent-override: 17.2%;
	line-gap-override: 0%;
}

@layer chassis {
	:root {
		/* Spacing: 4px base */
		--sp-1: 0.25rem;
		--sp-2: 0.5rem;
		--sp-3: 0.75rem;
		--sp-4: 1rem;
		--sp-5: 1.25rem;
		--sp-6: 1.5rem;
		--sp-8: 2rem;
		--sp-10: 2.5rem;
		--sp-12: 3rem;
		--sp-16: 4rem;
		--sp-24: 6rem;

		/* Z layers */
		--z-band: 1;
		--z-station: 10;
		--z-dial: 100;
		--z-skip: 200;

		/* Focus (stations restyle the ring, but never thinner than this) */
		--focus-width: 3px;
		--focus-offset: 2px;

		/* Motion durations (stations own easing via --st-ease / --st-dur) */
		--dur-instant: 0ms;
		--dur-1: 80ms;
		--dur-2: 150ms;
		--dur-3: 300ms;
		--dur-4: 600ms;
		--dur-5: 900ms;

		/* Chassis type */
		--font-ui:
			"Anybody Chassis", "Anybody Chassis Fallback", system-ui, sans-serif;
		--font-mono:
			"Martian Mono Chassis", "Martian Mono Chassis Fallback", ui-monospace,
			monospace;

		/* The dial */
		--dial-h: 4.5rem;
		--dial-readout-w: 13rem;
		--dial-gutter: var(--sp-8);
		--dial-space: calc(var(--dial-h) + env(safe-area-inset-bottom, 0px));
		--pad-start: var(--sp-4);
		--pad-end: calc(var(--dial-space) + var(--sp-4));

		/* Static band */
		--static-h: 40svh;
		--static-rm-h: 8px;
		/* Grain: feTurbulence noise, rasterised once per tile (static bands, page-swap frame). */
		--grain:
			url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")
			0 0 / 160px 160px;
	}

	@media (width < 54rem) {
		:root {
			--dial-gutter: var(--sp-6);
		}
	}

	/* Keep focused and scrolled-to content clear of the fixed dial (BRIEF §8). */
	html {
		scroll-padding-block: var(--pad-start) var(--pad-end);
	}

	body {
		padding-block-end: var(--dial-space);
	}

	/* Very short viewports: the dial moves to the top. */
	@media (max-height: 30rem) {
		:root {
			--dial-space: var(--dial-h);
			--pad-start: calc(var(--dial-space) + var(--sp-4));
			--pad-end: var(--sp-4);
		}

		body {
			padding-block: var(--dial-space) 0;
		}
	}
}
