/*
 * base.css — reset, elements, typography.
 *
 * Design tokens come from theme.json (--wp--preset--* custom properties).
 * This file wires them onto element defaults. Theme-authored tokens use
 * the --jm-* namespace; the bands they change at are the old site's
 * breakpoints, read off its settings: 1200px, 1024px (tablet)
 * and 767px (mobile).
 */

:root {
	--jm-measure: var(--wp--style--global--content-size, 44.44rem);

	/* The page's side padding and the space between things. */
	--jm-pad: 50px;
	--jm-gap: 50px;

	/* Project grids: columns across. */
	--jm-cols: 3;
}

@media (max-width: 1200px) {
	:root {
		--jm-cols: 2;
	}
}

@media (max-width: 1024px) {
	:root {
		--jm-pad: 30px;
		--jm-gap: 30px;
	}
}

@media (max-width: 767px) {
	:root {
		--jm-pad: 20px;
		--jm-cols: 1;
	}
}

/* --- Reset --- */

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

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

body {
	margin: 0;
	background-color: var(--wp--preset--color--background);
	color: var(--wp--preset--color--foreground);
	font-family: var(--wp--preset--font-family--serif);
	font-size: var(--wp--preset--font-size--base);
	line-height: 1.5;
	/* The old site's custom CSS: Caslon's old-style figures, everywhere. */
	font-variant-numeric: oldstyle-nums;
}

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

img {
	display: block;
}

/* --- Typography --- */

h1, h2, h3, h4, h5, h6 {
	margin: 0;
	color: var(--wp--preset--color--accent);
	font-family: var(--wp--preset--font-family--sans);
	font-weight: 500;
	line-height: 1;
	letter-spacing: 2px;
	text-transform: uppercase;
}

h1 {
	font-size: var(--wp--preset--font-size--3-xl);
	letter-spacing: 3px;
}

h2,
h3 {
	font-size: var(--wp--preset--font-size--xl);
}

p,
ul,
ol,
blockquote,
figure,
table {
	margin: 0 0 0.9rem;
}

a {
	color: var(--wp--preset--color--accent);
	text-decoration: none;
}

/*
 * Prose — text Joe writes in the editor (the About page's text, Contact,
 * Training & Skills, Awards & Exhibitions). Live rendered these through
 * the old theme's reset: headings half a rem above and a rem below at
 * 1.2, paragraphs 0.9rem apart — the last one's margin included, which
 * the spacing after each block counts on.
 */
.jm-prose {
	display: flow-root;
}

.jm-prose h1,
.jm-prose h2,
.jm-prose h3,
.jm-prose h4 {
	margin: 0.5rem 0 1rem;
	font-size: var(--wp--preset--font-size--xl);
	line-height: 1.2;
}

/*
 * Links that underline themselves on hover: a 1px cyan rule sweeping in
 * from the left. The old site's custom CSS, for the `underline-links` class.
 */
.underline-links a {
	position: relative;
	display: inline-block;
}

.underline-links a::before {
	content: "";
	position: absolute;
	z-index: 0;
	left: 0;
	right: 100%;
	bottom: 0;
	height: 1px;
	background: var(--wp--preset--color--accent);
	transition: right 0.2s ease-out;
}

.underline-links a:hover::before,
.underline-links a:focus-visible::before {
	right: 0;
}

/*
 * An introduction: its first paragraph larger. The old site's custom CSS, for the
 * `intro` class, at its own 1200px breakpoint.
 */
.intro p:first-of-type {
	font-size: 1.5em;
	line-height: 1.25em;
}

@media (max-width: 1199px) {
	.intro p:first-of-type {
		font-size: 1.25em;
	}
}

/* --- Forms --- */

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

.search-field {
	padding: 0.4em 0.6em;
	border: 1px solid var(--wp--preset--color--rule);
	background: var(--wp--preset--color--background);
}

.search-submit {
	padding: 0.4em 0.9em;
	border: 1px solid var(--wp--preset--color--foreground);
	background: var(--wp--preset--color--foreground);
	color: var(--wp--preset--color--background);
	cursor: pointer;
}

/* --- Accessibility helpers --- */

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

.skip-link {
	position: absolute;
	left: -9999px;
	z-index: 100;
	padding: 0.6em 1em;
	background: var(--wp--preset--color--foreground);
	color: var(--wp--preset--color--background);
}

.skip-link:focus {
	left: 0.5rem;
	top: 0.5rem;
}

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