/*
 * Base layer: elements, layout primitives, accessibility.
 *
 * Every colour, size and space below resolves to a --wp--preset--* custom property
 * that WordPress generates from theme.json. Nothing in this file re-declares a
 * palette value; if you find yourself typing a hex here, the token is missing from
 * theme.json and that is where it belongs.
 *
 * The four radii and the border width come from _tokens.css, which is generated
 * alongside theme.json - they have no theme.json home.
 */

/* ---------------------------------------------------------------- reset ---- */

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

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

@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;
	}
}

body {
	margin: 0;
	background: var(--wp--preset--color--canvas);
	color: var(--wp--preset--color--body);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--base);
	line-height: 1.7;
	-webkit-font-smoothing: antialiased;
}

/* ----------------------------------------------------------- typography ---- */

h1,
h2,
h3,
h4 {
	margin: 0 0 var(--wp--preset--spacing--4);
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--display);
	font-weight: 800;
	line-height: 1.05;
	letter-spacing: -0.025em;
	text-wrap: balance;
}

h1 { font-size: var(--wp--preset--font-size--display); }
h2 { font-size: var(--wp--preset--font-size--xxl); }
h3 { font-size: var(--wp--preset--font-size--lg); }
h4 { font-size: var(--wp--preset--font-size--base); }

p,
ul,
ol,
dl,
figure,
table {
	margin: 0 0 var(--wp--preset--spacing--4);
}

a {
	color: var(--wp--preset--color--accent);
	text-underline-offset: 0.18em;
}

a:hover {
	text-decoration-thickness: 2px;
}

strong,
b {
	font-weight: 700;
}

/* --------------------------------------------------------- accessibility --- */

:focus-visible {
	outline: 3px solid var(--wp--preset--color--focus);
	outline-offset: 3px;
	border-radius: var(--radius-sm);
}

/*
 * Focus must remain visible on the fixed dark bands, where the page focus colour
 * would be too dark. The band tokens do not change between schemes, so this one
 * override is safe in both.
 */
.band :focus-visible {
	outline-color: var(--wp--preset--color--band-accent);
}

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 999;
	padding: var(--wp--preset--spacing--3) var(--wp--preset--spacing--4);
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent-contrast);
	font-weight: 700;
	text-decoration: none;
}

.skip-link:focus {
	left: 0;
}

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

.screen-reader-text:focus {
	position: static !important;
	width: auto;
	height: auto;
	clip: auto;
	white-space: normal;
}

/* --------------------------------------------------------------- layout ---- */

.wrap {
	max-width: var(--wp--style--global--wide-size, 82rem);
	margin-inline: auto;
	padding-inline: var(--wp--preset--spacing--4);
}

.measure {
	max-width: var(--wp--style--global--content-size, 38rem);
}

.section {
	padding-block: var(--wp--preset--spacing--7);
}

.section + .section {
	padding-top: 0;
}

.split {
	display: grid;
	gap: var(--wp--preset--spacing--6);
	grid-template-columns: 1fr;
	align-items: center;
}

@media (min-width: 62rem) {
	.split {
		grid-template-columns: 1.05fr 0.95fr;
	}

	.split--flip > :first-child {
		order: 2;
	}
}

/*
 * The bands are the design's signature and they do NOT invert between colour
 * schemes. Painting one with --color-ink is what broke the earlier directions
 * twice: ink flips to near-white in dark mode and the band disappears under its
 * own text. Always use the band tokens here.
 */
.band {
	background: var(--wp--preset--color--band);
	color: var(--wp--preset--color--band-body);
}

.band h1,
.band h2,
.band h3 {
	color: var(--wp--preset--color--band-ink);
}

/*
 * :not(.button) matters. Without it this rule sits at specificity (0,1,1) and beats
 * .button at (0,1,0), so every button inside a band took band-ink for its text
 * instead of accent-contrast. Light mode hid it - near-white on indigo passes by
 * accident - but in dark mode the accent lightens and the button fell to 1.88:1.
 */
.band a:not(.button) {
	color: var(--wp--preset--color--band-ink);
}

.band a:not(.button):hover {
	color: var(--wp--preset--color--band-accent);
}

.band--quiet {
	background: var(--wp--preset--color--band-2);
}

/* --------------------------------------------------------------- tables ---- */

table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--wp--preset--font-size--sm);
}

th,
td {
	padding: var(--wp--preset--spacing--2) var(--wp--preset--spacing--3);
	text-align: left;
	border-bottom: var(--border-width) solid var(--wp--preset--color--line);
}

thead th {
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--xs);
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

td.is-numeric,
th.is-numeric {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

/* Wide content scrolls inside its own container; the page body never does. */
.table-wrap {
	overflow-x: auto;
}

/* --------------------------------------------------------------- forms ----- */

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

input[type="text"],
input[type="email"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
	width: 100%;
	min-height: 2.75rem;
	padding: var(--wp--preset--spacing--2) var(--wp--preset--spacing--3);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	border: var(--border-width) solid var(--wp--preset--color--control);
	border-radius: var(--radius-sm);
}

::placeholder {
	color: var(--wp--preset--color--muted);
	opacity: 1;
}

.button,
button.button,
input[type="submit"] {
	display: inline-block;
	min-height: 2.75rem;
	padding: var(--wp--preset--spacing--3) var(--wp--preset--spacing--5);
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent-contrast);
	border: 2px solid var(--wp--preset--color--accent);
	border-radius: 999px;
	font-weight: 700;
	font-size: var(--wp--preset--font-size--sm);
	text-decoration: none;
	cursor: pointer;
}

.button:hover,
button.button:hover,
input[type="submit"]:hover {
	filter: brightness(1.12);
}

.button--ghost {
	background: transparent;
	border-color: currentColor;
	color: var(--wp--preset--color--band-ink);
}

/* --------------------------------------------------------------- media ----- */

img,
svg,
video {
	max-width: 100%;
	height: auto;
}

/*
 * Image slots are a brief, not filler: the slot id and the intended subject stay
 * visible, and the aspect ratio is correct so the layout is honest before any
 * photograph exists. Replaced from 06-images/manifest.json at stage 6.
 */
.image-slot {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.2rem;
	width: 100%;
	padding: var(--wp--preset--spacing--3);
	background: var(--wp--preset--color--surface-2);
	border: var(--border-width) dashed var(--wp--preset--color--control);
	border-radius: var(--radius-md);
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--xs);
	text-align: center;
}

.image-slot__warn {
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--warning);
}

.image-slot__id {
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wp--preset--color--body);
}

.image-slot__subject {
	max-width: 32ch;
	line-height: 1.35;
}
