/**
 * Reset and global element defaults.
 */

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

* {
	margin: 0;
}

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

	/*
	 * Keeps anchor targets clear of the sticky header added in a later
	 * milestone — WCAG 2.2 §2.4.11 Focus Not Obscured (Minimum).
	 */
	scroll-padding-top: var(--space-20);
}

body {
	min-height: 100vh;
	background-color: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-base);
	font-size: var(--text-base);
	font-weight: var(--weight-regular);
	line-height: var(--leading-base);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

/**
 * Media defaults. Images never overflow their container and keep their
 * intrinsic ratio, which prevents layout shift (CLS).
 */
img,
picture,
video,
canvas,
svg {
	display: block;
	max-width: 100%;
	height: auto;
}

svg {
	fill: currentColor;
}

/* Form controls inherit typography rather than using UA defaults. */
input,
button,
textarea,
select {
	font: inherit;
	color: inherit;
}

textarea {
	resize: vertical;
}

/* Avoid orphaned words breaking out of their box. */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
	overflow-wrap: break-word;
}

/**
 * Focus.
 *
 * The default outline is removed only where a replacement is guaranteed by
 * :focus-visible below. Never remove focus styling without a substitute.
 */
:focus-visible {
	outline: var(--focus-width) solid var(--color-focus);
	outline-offset: var(--focus-offset);
	border-radius: var(--radius-sm);
}

/* Keyboard users get the ring; mouse users do not. */
:focus:not(:focus-visible) {
	outline: none;
}

::selection {
	background-color: var(--color-primary);
	color: var(--color-on-primary);
}

hr {
	height: var(--border-width);
	border: 0;
	background-color: var(--color-border);
}

/**
 * Skip link — visually hidden until focused, then pinned to the top.
 * Referenced by header.php.
 */
.skip-link {
	position: absolute;
	inset-inline-start: var(--space-4);
	inset-block-start: var(--space-4);
	z-index: var(--z-skip-link);
	padding: var(--space-3) var(--space-5);
	border-radius: var(--radius-sm);
	background-color: var(--color-primary);
	color: var(--color-on-primary);
	font-weight: var(--weight-semibold);
	text-decoration: none;
	transform: translateY(-200%);
}

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

/* Motion for the skip link, and for the theme generally, lives in animations.css. */
