/**
 * Reset and element defaults.
 */

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

* {
	margin: 0;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	/* Offset anchor targets so the sticky header does not cover them. */
	scroll-padding-top: 6rem;
}

body {
	min-height: 100vh;
	background-color: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: var(--text-md);
	line-height: var(--leading-normal);
	-webkit-font-smoothing: antialiased;
	/* Nothing should ever scroll sideways, at any width. */
	overflow-x: hidden;
}

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

img {
	/*
	 * Images carry width and height attributes from WordPress; this keeps
	 * them responsive without losing the aspect ratio that reserves space
	 * and prevents layout shift.
	 */
	height: auto;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--font-display);
	font-weight: var(--weight-black);
	line-height: var(--leading-tight);
	text-wrap: balance;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p,
li {
	text-wrap: pretty;
}

a {
	color: inherit;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

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

/* Lists inside prose keep their markers. */
.entry-content ul,
.entry-content ol {
	padding-inline-start: 1.5rem;
	list-style: revert;
}

blockquote {
	margin: 0;
}

figure {
	margin: 0;
}

/* ---------- Focus ---------- */

/*
 * A visible focus ring on every interactive element. :focus-visible keeps it
 * off mouse clicks while guaranteeing it for keyboard users.
 */
:focus-visible {
	outline: 3px solid var(--color-focus);
	outline-offset: 2px;
	border-radius: 2px;
}

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

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	top: var(--space-sm);
	left: var(--space-sm);
	z-index: var(--z-skip-link);
}

.skip-link:focus {
	clip-path: none;
	width: auto;
	height: auto;
	margin: 0;
	padding: var(--space-xs) var(--space-md);
	background: var(--munchi-navy);
	color: var(--color-text-inverse);
	border-radius: var(--radius-pill);
	font-weight: var(--weight-bold);
	text-decoration: none;
}

/* ---------- Prose ---------- */

.entry-content > * + * {
	margin-block-start: var(--space-md);
}

/* Images in page text. "Wide" ones step out of the reading column on large screens. */
.entry-content .wp-block-image img {
	width: 100%;
	height: auto;
	border-radius: var(--radius-lg);
}

.entry-content .alignwide {
	--munchi-wide: min(1120px, 100vw - (var(--gutter) * 2));
	width: var(--munchi-wide);
	max-width: none;
	margin-inline: calc((100% - var(--munchi-wide)) / 2);
	margin-block: var(--space-xl);
}

.entry-content h2,
.entry-content h3 {
	margin-block-start: var(--space-xl);
}

.entry-content a {
	color: var(--color-text);
	text-decoration-color: var(--munchi-yellow);
	text-decoration-thickness: 2px;
}

.entry-content a:hover {
	text-decoration-color: var(--color-text);
}
