/*
 * base.css — reset + document defaults + a11y floor.
 *
 * Owns: box model, body, media reset, layout container, section rhythm,
 * global focus ring, selection, screen-reader/skip-link helpers, and the
 * reduced-motion kill-switch. Typography lives in typography.css; buttons in
 * components/buttons.css — kept separate to avoid selector-specificity clashes.
 */

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
}

/* The closed mobile drawer is parked off-canvas with a transform, which still
   counts towards the document's scroll width. `clip` contains it without
   creating a scroll container (so position: sticky keeps working). */
html,
body {
	overflow-x: clip;
}

body {
	margin: 0;
	background-color: var(--bg);
	color: var(--text);
	font-family: var(--font-body);
	font-size: var(--fs-body);
	line-height: var(--lh-body);
	font-optical-sizing: auto; /* let Fraunces use its opsz axis at large sizes */
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

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

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

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

/* A colour band (--section--band) needs its own breathing room top and bottom.
   Two plain sections in a row do NOT: their padding would stack into one
   oversized void, so the second one drops its top padding and the pair shares
   a single gap. */
.section:not(.section--band) + .section:not(.section--band) {
	padding-top: 0;
}

/* ---- Focus (keyboard only) ---- */
:focus-visible {
	outline: 2px solid var(--koivu);
	outline-offset: 2px;
	border-radius: 2px;
}

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

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

.skip-link {
	position: absolute;
	left: var(--s-2);
	top: -3rem;
	z-index: 100;
	padding: var(--s-2) var(--s-4);
	background: var(--ink);
	color: var(--birch-white);
	border-radius: var(--radius-btn);
	transition: top var(--dur-fast) var(--ease);
}

.skip-link:focus {
	top: var(--s-2);
}

/* ---- Reduced-motion floor (hard rule) ---- */
@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;
	}
}
