/**
 * 438 Main — Base
 * ---------------------------------------------------------------------------
 * Reset, element defaults, typography and accessibility utilities.
 * No component styling and no layout live here.
 */

/* ---------------------------------------------------------------------------
 * Reset — modern and minimal. Only rules that pay for themselves.
 * ------------------------------------------------------------------------ */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	/* Offsets in-page anchors so sticky-header does not cover the target. */
	scroll-padding-top: calc(var(--header-h) + var(--sp-5));
	scroll-behavior: smooth;
}

/* Honour the OS setting rather than forcing smooth scroll on everyone. */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
}

body {
	margin: 0;
	background-color: var(--c-bg);
	color: var(--c-text);
	font-family: var(--font-body);
	font-size: var(--fs-body);
	line-height: var(--lh-body);
	font-weight: 400;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	font-optical-sizing: auto;
	/* Prevents horizontal jitter from parallax transforms at the viewport edge. */
	overflow-x: clip;
	text-rendering: optimizeLegibility;
}

/*
 * The [hidden] attribute must win.
 *
 * `[hidden] { display: none }` lives in the user-agent stylesheet, so any author
 * rule that sets `display` on the same element defeats it — a classic and very
 * confusing bug when JavaScript toggles `hidden` on a flex or grid container.
 */
[hidden] {
	display: none !important;
}

/* Wrap long words rather than causing horizontal overflow. */
body,
h1, h2, h3, h4, h5, h6, p, li, dd, dt, figcaption, blockquote, th, td, label, button, a {
	overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6 {
	margin: 0;
	font-weight: 400;
	line-height: var(--lh-tight);
	text-wrap: balance;
}

p, ul, ol, dl, dd, figure, blockquote, pre, table {
	margin: 0;
}

ul, ol {
	padding: 0;
	list-style: none;
}

/* Restore list semantics inside editorial prose only. */
.prose ul,
.prose ol {
	padding-left: 1.25em;
	list-style: revert;
}

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

img,
video {
	height: auto;
}

svg {
	flex-shrink: 0;
}

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

button {
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	text-align: inherit;
}

/* Respect the OS pointer preference on touch devices. */
@media (hover: none) {
	button, a {
		-webkit-tap-highlight-color: rgba(36, 37, 34, 0.08);
	}
}

a {
	color: inherit;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.22em;
	transition: color var(--dur-fast) var(--ease-in-out),
		opacity var(--dur-fast) var(--ease-in-out);
}

hr {
	border: 0;
	border-top: var(--hairline) solid var(--c-line);
	margin: var(--sp-7) 0;
}

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

th {
	text-align: left;
	font-weight: 500;
}

/* iOS zooms in on inputs below 16px. Never let that happen. */
input,
select,
textarea {
	font-size: max(1rem, var(--fs-body));
}

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

/* ---------------------------------------------------------------------------
 * Typography primitives
 * ------------------------------------------------------------------------ */
.display {
	font-family: var(--font-display);
	font-weight: 400;
	line-height: var(--lh-display);
	letter-spacing: var(--ls-display);
	text-wrap: balance;
	/* Instrument Serif has generous sidebearings; pull the optical left edge in. */
	margin-left: -0.02em;
}

.display--xl { font-size: var(--fs-display-xl); }
.display--l  { font-size: var(--fs-display-l); }
.display--m  { font-size: var(--fs-display-m); }
.display--s  { font-size: var(--fs-display-s); letter-spacing: -0.02em; }

/* Each headline line is its own block so lines can reveal in sequence. */
.display--lines .display__line {
	display: block;
}

.eyebrow {
	font-family: var(--font-body);
	font-size: var(--fs-eyebrow);
	font-weight: 500;
	letter-spacing: var(--ls-eyebrow);
	text-transform: uppercase;
	line-height: 1.4;
	color: var(--c-text-muted);
	margin: 0;
}

.lead {
	font-size: var(--fs-lead);
	line-height: 1.6;
	max-width: var(--measure-lead);
	color: var(--c-text);
}

.body-copy {
	max-width: var(--measure-body);
	color: var(--c-text-muted);
}

.text-muted { color: var(--c-text-muted); }
.text-small { font-size: var(--fs-small); }
.text-micro { font-size: var(--fs-micro); }

/* Editorial prose from the block editor. */
.prose {
	max-width: var(--measure-body);
}

.prose > * + * {
	margin-top: 1.15em;
}

.prose > h2,
.prose > h3 {
	font-family: var(--font-display);
	letter-spacing: -0.025em;
	line-height: 1.05;
	margin-top: 2em;
}

.prose > h2 { font-size: var(--fs-display-m); }
.prose > h3 { font-size: var(--fs-display-s); }

.prose a {
	text-decoration: underline;
}

.prose a:hover {
	color: var(--c-forest);
}

.prose blockquote {
	border-left: 2px solid var(--c-line-strong);
	padding-left: var(--sp-5);
	font-family: var(--font-display);
	font-size: var(--fs-display-s);
	line-height: 1.3;
	letter-spacing: -0.02em;
}

.prose figure {
	margin-block: var(--sp-7);
}

.prose figcaption {
	font-size: var(--fs-small);
	color: var(--c-text-muted);
	margin-top: var(--sp-3);
}

/* ---------------------------------------------------------------------------
 * Accessibility
 * ------------------------------------------------------------------------ */

/* Visually hidden but available to screen readers. */
.screen-reader-text,
.visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/*
 * A single, consistent, high-contrast focus ring.
 * :focus-visible only, so mouse users never see a ring — but keyboard and
 * switch-control users always do.
 */
:focus-visible {
	outline: 2px solid var(--c-focus);
	outline-offset: 3px;
	border-radius: var(--radius-sm);
}

/* Older engines: never remove the ring outright, just tune it. */
:focus:not(:focus-visible) {
	outline: none;
}

.skip-link {
	position: absolute;
	top: var(--sp-2);
	left: var(--sp-2);
	z-index: var(--z-skip);
	padding: 0.75rem 1.25rem;
	background-color: var(--c-white);
	color: var(--c-ink);
	font-size: var(--fs-small);
	font-weight: 500;
	border-radius: var(--radius-md);
	box-shadow: 0 4px 20px rgba(36, 37, 34, 0.18);
	transform: translateY(calc(-100% - var(--sp-4)));
	transition: transform var(--dur-base) var(--ease-out);
}

.skip-link:focus {
	transform: translateY(0);
}

/* Windows High Contrast / forced-colors: let the OS win. */
@media (forced-colors: active) {
	.btn,
	.unit-chip,
	.status-dot {
		forced-color-adjust: none;
		border: 1px solid ButtonText;
		color: ButtonText;
		background: ButtonFace;
	}

	:focus-visible {
		outline: 3px solid Highlight;
	}
}
