/* =====================================================================
   base.css
   The reset and the site-wide defaults every page starts from: box
   sizing, typography, focus states, and the safe-area handling that
   keeps content clear of a phone's notch and home-bar. No layout or
   component rules belong in this file — those live in layout.css and
   components.css, loaded after this one.
   ===================================================================== */

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

:root {
	/* Reserves space for a phone's status bar / home-indicator so fixed
	   headers and full-height sections don't sit underneath them. Zero
	   on desktop, where these env() values simply don't exist. */
	padding-top: env(safe-area-inset-top, 0px);
	padding-bottom: env(safe-area-inset-bottom, 0px);
}

html {
	background: var(--paper);
	scroll-behavior: smooth;
	scroll-padding-top: calc(env(safe-area-inset-top, 0px) + var(--header-height));
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: var(--text-base);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

/* ---- Elements ------------------------------------------------------ */

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

a {
	color: inherit;
}

button {
	font-family: inherit;
}

h1, h2, h3, h4, h5 {
	font-family: var(--font-ui);
	margin: 0;
	font-weight: 800;
	letter-spacing: -0.015em;
	line-height: 1.08;
}

p {
	margin: 0;
}

ul, ol {
	margin: 0;
	padding: 0;
}

hr {
	border: 0;
	border-top: 1px solid var(--line);
	margin: 0;
}

/* ---- Forms ----------------------------------------------------------
   A plain, theme-wide baseline; component-specific styling (the
   contact form, admin-style fields) can still override this. */

input, textarea, select {
	font: inherit;
	color: var(--ink);
	background: var(--surface);
	border: 1.5px solid var(--line);
	border-radius: var(--radius-sm);
}

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

:focus-visible {
	outline: 3px solid var(--brand-text);
	outline-offset: 3px;
	border-radius: 4px;
}

/* Visually hides content while keeping it available to screen readers
   — used for things like "Skip to content" and icon-only buttons. */
.screen-reader-text {
	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: fixed;
	top: -100px;
	left: var(--space-4);
	z-index: 100;
	background: var(--ink);
	color: var(--paper);
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-sm);
	text-decoration: none;
	font-family: var(--font-ui);
	font-weight: 600;
	transition: top var(--duration) var(--ease);
}
.skip-link:focus {
	top: calc(env(safe-area-inset-top, 0px) + var(--space-3));
}

/* ---- Motion ----------------------------------------------------------
   Every animated or transitioning element in the theme is expected to
   respect this — it's the one place that preference is enforced
   globally, rather than repeating the media query in every component. */
@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;
		scroll-behavior: auto !important;
	}
}
