/**
 * Base element styles and shared components (docs/design.md §5–§9).
 * Element selectors use :where() (zero specificity) so component styles
 * always win.
 */

/* ---------- Reset ---------- */

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

:where(html) {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

:where(body) {
	margin: 0;
	background: var(--color-surface);
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: var(--step-0);
	line-height: var(--leading-body);
	-webkit-font-smoothing: antialiased;
}

:where(img, svg, video) {
	display: block;
	max-width: 100%;
	height: auto;
}

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

:where(h1, h2, h3, h4, h5, h6) {
	margin: 0 0 var(--space-4);
	color: var(--color-text);
	font-family: var(--font-heading);
	font-weight: 700;
	line-height: var(--leading-heading);
	text-wrap: balance;
}

:where(h1) {
	font-size: var(--step-4);
	letter-spacing: -0.01em;
}

:where(h2) {
	font-size: var(--step-3);
	letter-spacing: -0.01em;
}

:where(h3) {
	font-size: var(--step-2);
	font-weight: 600;
}

:where(h4) {
	font-size: var(--step-1);
	font-weight: 600;
}

:where(h5, h6) {
	font-size: var(--step-0);
	font-weight: 600;
}

:where(p, ul, ol, dl, blockquote, figure, table) {
	margin: 0 0 var(--space-4);
}

:where(strong, b) {
	font-weight: 600;
}

:where(a) {
	color: var(--color-accent);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
	transition:
		color var(--duration-fast) var(--ease),
		text-decoration-thickness var(--duration-fast) var(--ease);
}

:where(a:hover) {
	color: var(--color-accent-hover);
	text-decoration-thickness: 2px;
}

:where(small) {
	font-size: var(--step--1);
}

:where(hr) {
	margin: var(--space-7) 0;
	border: 0;
	border-top: 1px solid var(--color-border);
}

/* Heading looks without heading semantics (visual size ≠ outline level). */
.h1,
.h2,
.h3,
.h4 {
	margin: 0 0 var(--space-4);
	color: var(--color-text);
	font-family: var(--font-heading);
	line-height: var(--leading-heading);
}

.h1 {
	font-size: var(--step-4);
	font-weight: 700;
	letter-spacing: -0.01em;
}

.h2 {
	font-size: var(--step-3);
	font-weight: 700;
	letter-spacing: -0.01em;
}

.h3 {
	font-size: var(--step-2);
	font-weight: 600;
}

.h4 {
	font-size: var(--step-1);
	font-weight: 600;
}

.display {
	font-size: var(--step-5);
	letter-spacing: -0.02em;
}

.lead {
	color: var(--color-text-muted);
	font-size: var(--step-1);
	line-height: 1.5;
}

.eyebrow {
	display: block;
	margin-bottom: var(--space-3);
	color: var(--color-accent);
	font-family: var(--font-heading);
	font-size: var(--step--1);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.text-muted {
	color: var(--color-text-muted);
}

.text-meta {
	color: var(--color-text-subtle);
	font-size: var(--step--1);
}

/* Long-form text: blog posts, rich text sections. */
.prose {
	max-width: var(--measure);
}

.prose :where(h2, h3, h4) {
	margin-top: 1.6em;
}

.prose > :first-child {
	margin-top: 0;
}

.prose :where(ul, ol) {
	padding-left: 1.25em;
}

.prose :where(li + li) {
	margin-top: var(--space-2);
}

.prose :where(blockquote) {
	margin-left: 0;
	padding-left: var(--space-5);
	border-left: 4px solid var(--color-brand);
	color: var(--color-text-muted);
	font-size: var(--step-1);
}

.prose :where(img) {
	border-radius: var(--radius-media);
}

.prose :where(table) {
	width: 100%;
	margin-block: var(--space-5);
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
}

.prose :where(th, td) {
	padding: var(--space-3) var(--space-4);
	border-bottom: 1px solid var(--color-border);
	text-align: left;
	vertical-align: top;
}

.prose :where(thead th) {
	border-bottom: 2px solid var(--color-navy);
	color: var(--color-navy);
	font-family: var(--font-heading);
	font-size: var(--step--1);
}

/* ---------- Layout ---------- */

.container {
	width: 100%;
	max-width: calc(var(--container) + 2 * var(--gutter));
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.section {
	padding-block: var(--section-padding);
}

.section--alt {
	background: var(--color-surface-alt);
}

.section--accent {
	background: var(--color-surface-accent);
}

.section--inverse {
	background: var(--color-surface-inverse);
	color: var(--color-text-inverse);
}

.section--inverse :where(h1, h2, h3, h4) {
	color: var(--color-text-inverse);
}

/*
 * Two sections on the same background read as one block: no doubled gap.
 * The in-page menu is a thin band; the section after it keeps its gap.
 */
.section:not(.section--alt, .section--accent, .section--inverse, .section-page-nav) + .section:not(.section--alt, .section--accent, .section--inverse),
.section--alt:not(.section-page-nav) + .section--alt,
.section--accent:not(.section-page-nav) + .section--accent,
.section--inverse:not(.section-page-nav) + .section--inverse {
	padding-top: 0;
}

.page-header {
	padding-bottom: var(--space-6);
}

.page-header__title {
	margin-bottom: 0;
}

.stack > * + * {
	margin-top: var(--space-4);
}

/* ---------- Breadcrumbs ---------- */

.breadcrumbs {
	margin-bottom: var(--space-4);
	font-size: var(--step--1);
}

.breadcrumbs__list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-1) var(--space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.breadcrumbs__item {
	display: inline-flex;
	gap: var(--space-2);
	align-items: center;
	color: var(--color-text-muted);
}

.breadcrumbs__item + .breadcrumbs__item::before {
	color: var(--color-text-muted);
	content: "›";
}

.breadcrumbs a {
	color: var(--color-navy);
}

/* ---------- Illustration (decorative) ---------- */

/* A site icon in a white circle on the brand pink, with soft shapes and an
   accent dot (rich text, hero). On a pink section the panel turns white. */
.illustration {
	position: relative;
	display: grid;
	aspect-ratio: 1;
	overflow: hidden;
	border-radius: var(--radius-media);
	background: var(--color-surface-accent);
	place-items: center;
}

.illustration::before,
.illustration::after {
	position: absolute;
	border-radius: 50%;
	content: "";
}

.illustration::before {
	top: -18%;
	right: -18%;
	width: 62%;
	height: 62%;
	background: var(--color-brand);
	opacity: 0.12;
}

.illustration::after {
	bottom: -14%;
	left: -14%;
	width: 48%;
	height: 48%;
	background: var(--color-navy);
	opacity: 0.07;
}

.illustration__circle {
	position: relative;
	z-index: 1;
	display: grid;
	width: 58%;
	aspect-ratio: 1;
	border-radius: 50%;
	background: var(--color-surface);
	color: var(--color-navy);
	place-items: center;
}

/* The accent dot on the circle's edge. */
.illustration__circle::after {
	position: absolute;
	top: 8%;
	right: 8%;
	width: 9%;
	height: 9%;
	border-radius: 50%;
	background: var(--color-brand);
	content: "";
}

/* Two classes: wins over the generic .icon size further down. */
.illustration .illustration__icon {
	width: 46%;
	height: 46%;
	stroke-width: 1.5;
}

.section--accent .illustration {
	background: var(--color-surface);
}

.section--accent .illustration__circle {
	background: var(--color-surface-accent);
}

/* ---------- Focus and accessibility helpers ---------- */

:where(:focus-visible) {
	outline: 2px solid var(--color-focus);
	outline-offset: 2px;
}

.section--inverse :where(:focus-visible) {
	outline-color: var(--color-focus-inverse);
}

/* .screen-reader-text: WordPress core markup (pagination headings, etc.). */
.visually-hidden,
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.skip-link {
	position: absolute;
	top: var(--space-2);
	left: var(--space-2);
	z-index: 1000;
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-button);
	background: var(--color-navy);
	color: var(--color-text-inverse);
	font-weight: 600;
	transform: translateY(-200%);
}

.skip-link:focus {
	transform: none;
}

/* ---------- Buttons ---------- */

.button {
	display: inline-flex;
	gap: var(--space-2);
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: var(--space-3) var(--space-5);
	border: 2px solid transparent;
	border-radius: var(--radius-button);
	font-family: var(--font-heading);
	font-size: var(--step--1);
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition:
		background-color var(--duration-fast) var(--ease),
		border-color var(--duration-fast) var(--ease),
		color var(--duration-fast) var(--ease),
		transform var(--duration-fast) var(--ease);
}

.button--primary {
	background: var(--color-accent);
	color: var(--color-text-inverse);
}

.button--primary:hover {
	background: var(--color-accent-hover);
	color: var(--color-text-inverse);
}

.button--secondary {
	border-color: var(--color-navy);
	background: transparent;
	color: var(--color-navy);
}

.button--secondary:hover {
	background: var(--color-navy);
	color: var(--color-text-inverse);
}

.button--inverse {
	background: var(--color-surface);
	color: var(--color-navy);
}

.button--inverse:hover {
	background: var(--color-surface-accent);
	color: var(--color-navy);
}

.button--large {
	min-height: 52px;
	padding: var(--space-4) var(--space-6);
	font-size: var(--step-0);
}

.button[disabled],
.button[aria-disabled="true"] {
	opacity: 0.5;
	cursor: not-allowed;
}

.link-arrow {
	display: inline-flex;
	gap: var(--space-2);
	align-items: center;
	color: var(--color-accent);
	font-family: var(--font-heading);
	font-weight: 600;
	text-decoration: none;
}

.link-arrow:hover {
	color: var(--color-accent-hover);
	text-decoration: underline;
}

/* ---------- Icons ---------- */

.icon {
	display: inline-block;
	flex-shrink: 0;
	width: 1.5rem;
	height: 1.5rem;
	stroke-width: 1.75;
}

.icon--sm {
	width: 1.25rem;
	height: 1.25rem;
}

.icon--lg {
	width: 2rem;
	height: 2rem;
}

/* ---------- Cards, chips, checklist ---------- */

.card {
	padding: var(--space-5);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-card);
	background: var(--color-surface);
}

.chip {
	display: inline-block;
	padding: var(--space-1) var(--space-3);
	border-radius: var(--radius-pill);
	background: var(--color-surface-accent);
	color: var(--color-text);
	font-size: var(--step--1);
	font-weight: 600;
}

.checklist {
	padding: 0;
	list-style: none;
}

.checklist li {
	display: flex;
	gap: var(--space-3);
	align-items: flex-start;
}

.checklist li + li {
	margin-top: var(--space-3);
}

.checklist .icon {
	margin-top: 0.15em;
	color: var(--color-accent);
}

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

.field {
	display: grid;
	gap: var(--space-2);
	margin-bottom: var(--space-5);
}

.field__label {
	font-weight: 600;
}

.field__hint {
	color: var(--color-text-muted);
	font-size: var(--step--1);
}

.field__error {
	color: var(--color-error);
	font-size: var(--step--1);
	font-weight: 600;
}

:where(input:not([type="checkbox"], [type="radio"], [type="submit"]), select, textarea) {
	width: 100%;
	min-height: 44px;
	padding: var(--space-3) var(--space-4);
	border: 1px solid var(--color-border-strong);
	border-radius: var(--radius-sm);
	background: var(--color-surface);
	color: var(--color-text);
	font: inherit;
}

:where(input, textarea)::placeholder {
	color: var(--color-text-muted);
	opacity: 1;
}

:where(textarea) {
	min-height: 8rem;
	resize: vertical;
}

:where(input, select, textarea)[aria-invalid="true"] {
	border-color: var(--color-error);
	border-width: 2px;
}

:where(input[type="checkbox"], input[type="radio"]) {
	width: 1.25rem;
	height: 1.25rem;
	accent-color: var(--color-accent);
}

.choice {
	display: flex;
	gap: var(--space-3);
	align-items: center;
	min-height: 44px;
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {

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