/**
 * base.css — reset, base typography and accessibility utilities.
 * Consumes Design System tokens (tokens.css). Mobile-first.
 */

/* ---- Metric-adjusted fallback fonts ----
 * Match Poppins/Inter metrics with a local Arial so the swap from fallback
 * to the web font does not reflow text (minimizes CLS). Values per Fontaine.
 */
@font-face {
	font-family: "Poppins Fallback";
	src: local("Arial");
	ascent-override: 93.62%;
	descent-override: 31.21%;
	line-gap-override: 8.92%;
	size-adjust: 112.15%;
}

@font-face {
	font-family: "Inter Fallback";
	src: local("Arial");
	ascent-override: 90.2%;
	descent-override: 22.48%;
	line-gap-override: 0%;
	size-adjust: 107.4%;
}

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

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	scrollbar-gutter: stable; /* reserve scrollbar space → no horizontal CLS */
}

body {
	margin: 0;
	background-color: var(--color-bg);
	color: var(--color-text-muted);
	font-family: var(--font-body);
	font-size: var(--fs-400);
	font-weight: var(--fw-regular);
	line-height: var(--lh-base);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* Media defaults — prevent CLS, keep responsive */
img,
picture,
video,
canvas,
svg,
iframe {
	display: block;
	max-width: 100%;
	height: auto;
}

/* ---- Headings ---- */
h1,
h2,
h3,
h4,
h5,
h6 {
	margin: 0 0 var(--space-4);
	color: var(--color-text);
	font-family: var(--font-heading);
	font-weight: var(--fw-bold);
	line-height: var(--lh-tight);
}

h1 {
	font-size: var(--fs-900);
}

h2 {
	font-size: var(--fs-800);
}

h3 {
	font-size: var(--fs-700);
}

h4 {
	font-size: var(--fs-600);
}

p {
	margin: 0 0 var(--space-4);
}

/* ---- Links ---- */
a {
	color: var(--color-brand-bright);
	text-decoration: underline;
	text-underline-offset: 0.15em;
	transition: color var(--transition);
}

a:hover,
a:focus {
	color: var(--color-text);
}

/* ---- Visible focus (never remove) ---- */
:focus-visible {
	outline: 2px solid var(--color-focus);
	outline-offset: 2px;
	border-radius: var(--radius-sm);
}

/* ---- Layout container ----
 * .site-header is intentionally NOT here: the bar spans full width while its
 * inner (.site-header__inner) stays contained. Same for the footer bar. */
.container,
.site-main,
.site-footer__inner {
	width: 100%;
	max-width: var(--container-max);
	margin-inline: auto;
	padding-inline: var(--container-pad);
}

/* ---- Accessibility utilities (from _s) ---- */
.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}

.screen-reader-text:focus {
	background-color: var(--color-surface-2);
	border-radius: var(--radius-sm);
	box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
	clip: auto !important;
	clip-path: none;
	color: var(--color-text);
	display: block;
	font-size: var(--fs-500);
	font-weight: var(--fw-semibold);
	height: auto;
	left: var(--space-2);
	line-height: normal;
	padding: var(--space-3) var(--space-5);
	text-decoration: none;
	top: var(--space-2);
	width: auto;
	z-index: 100000;
}

.skip-link {
	position: absolute;
	left: -9999rem;
	top: var(--space-2);
}

.skip-link:focus {
	left: var(--space-2);
}

/* WP alignment helpers */
.alignleft {
	float: left;
	margin-right: var(--space-5);
}

.alignright {
	float: right;
	margin-left: var(--space-5);
}

.aligncenter {
	clear: both;
	display: block;
	margin-inline: auto;
}

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

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
