/* ==========================================================================
   BASE  -  reset + element defaults
   ========================================================================== */

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

* {
	margin: 0;
}

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

	/* Anchored sections land at their own top edge; their padding already
	   clears the fixed header, so no extra offset is needed here. */
	scroll-padding-top: 0;
}

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

	/* Hard guarantee against horizontal scroll at any width. */
	overflow-x: hidden;
	min-height: 100vh;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
	font-family: var(--font-display);
	font-weight: var(--weight-bold);
	line-height: var(--leading-tight);
	letter-spacing: var(--tracking-tight);
	text-wrap: balance;
	color: inherit;
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
	text-wrap: pretty;
}

p + p {
	margin-top: var(--space-sm);
}

a {
	color: inherit;
	text-decoration: none;
	transition: color var(--transition-fast);
}

strong, b {
	font-weight: var(--weight-semi);
}

small {
	font-size: var(--text-sm);
}

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

/* --------------------------------------------------------------------------
   Media  -  never overflow, never shift layout
   -------------------------------------------------------------------------- */

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

svg {
	flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

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

button {
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
}

textarea {
	resize: vertical;
}

/* --------------------------------------------------------------------------
   Focus  -  always visible, never removed
   -------------------------------------------------------------------------- */

:focus-visible {
	outline: 2px solid var(--color-sky);
	outline-offset: 3px;
	border-radius: var(--radius-xs);
}

/* Sections receive focus programmatically after nav jumps; that should move
   the reading position without painting a ring around the whole screen. */
.section:focus,
.section:focus-visible {
	outline: none;
}

::selection {
	background-color: var(--color-sky);
	color: var(--color-navy);
}

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

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	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-skiplink);
	transform: translateY(-200%);
	padding: var(--space-2xs) var(--space-md);
	background-color: var(--color-sky);
	color: var(--color-navy);
	font-size: var(--text-sm);
	font-weight: var(--weight-semi);
	border-radius: var(--radius-pill);
	transition: transform var(--transition-fast);
}

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