/*
 * The three fallback templates: page.php (any Page without its own template),
 * index.php (the last-resort archive) and 404.php.
 *
 * They were shipped as unstyled scaffolds, which also meant index.php had no
 * h1 at all. This file gives them the same rhythm, container width and type
 * hierarchy as every designed page: a page header band, one readable measure
 * for the prose, and the card grid from assets/css/cards.css for the archive.
 *
 * Every value is a token from assets/css/design-tokens.css, including the
 * surfaces, so a [data-theme="dark"] remap carries these pages with it.
 */

/* ------------------------------------------------------- the page header --- */

.hcr-page-header {
	background: var(--color-surface);
	border-bottom: var(--border-width) solid var(--color-border);
	padding-block: clamp(var(--space-10), 6vw, var(--space-16));
}

.hcr-page-header__eyebrow {
	margin: 0 0 var(--space-3);
	color: var(--color-primary-700);
	font-family: var(--font-body);
	font-size: var(--text-sm);
	font-weight: var(--weight-medium);
	letter-spacing: var(--letter-wide);
	text-transform: uppercase;
}

.hcr-page-header__title {
	max-width: 28ch;
	margin: 0;
	color: var(--color-text);
	font-family: var(--font-heading);
	font-size: var(--text-3xl);
	font-weight: var(--weight-bold);
	letter-spacing: var(--letter-tight);
	line-height: var(--leading-tight);
}

.hcr-page-header__lede {
	max-width: 56ch;
	margin: var(--space-4) 0 0;
	color: var(--color-text-muted);
	font-family: var(--font-body);
	font-size: var(--text-lg);
	line-height: var(--leading-normal);
}

/* -------------------------------------------------------------- the prose --- */

.hcr-prose {
	max-width: var(--measure);
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: var(--text-base);
	line-height: var(--leading-normal);
}

.hcr-prose > * + * {
	margin-top: var(--space-5);
}

.hcr-prose h2,
.hcr-prose h3,
.hcr-prose h4 {
	margin-top: var(--space-10);
	margin-bottom: var(--space-3);
	color: var(--color-text);
	font-family: var(--font-heading);
	font-weight: var(--weight-semibold);
	letter-spacing: var(--letter-tight);
	line-height: var(--leading-snug);
}

.hcr-prose h2 {
	font-size: var(--text-2xl);
}

.hcr-prose h3 {
	font-size: var(--text-xl);
}

.hcr-prose h4 {
	font-size: var(--text-lg);
}

.hcr-prose a {
	color: var(--color-link);
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.hcr-prose a:hover,
.hcr-prose a:focus-visible {
	color: var(--color-link-hover);
}

.hcr-prose ul,
.hcr-prose ol {
	padding-left: var(--space-6);
}

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

.hcr-prose img {
	max-width: 100%;
	height: auto;
	border-radius: var(--radius-lg);
}

.hcr-prose blockquote {
	margin-inline: 0;
	padding-left: var(--space-5);
	border-left: 3px solid var(--color-primary-300);
	color: var(--color-text-muted);
	font-size: var(--text-lg);
}

.hcr-prose figure {
	margin-inline: 0;
}

.hcr-prose figcaption {
	margin-top: var(--space-2);
	color: var(--color-text-muted);
	font-size: var(--text-sm);
}

/* -------------------------------------------------------- the empty state --- */

.hcr-content-cta {
	margin-top: var(--space-8);
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3);
}

/* ------------------------------------------------------------ the archive --- */

.hcr-archive__grid {
	margin-top: var(--space-2);
}

.hcr-archive__empty {
	max-width: var(--measure);
	color: var(--color-text-muted);
	font-family: var(--font-body);
	font-size: var(--text-lg);
	line-height: var(--leading-normal);
}

.hcr-pagination,
.hcr-archive .navigation {
	margin-top: var(--space-10);
	font-family: var(--font-body);
	font-size: var(--text-sm);
}

.hcr-archive .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}

.hcr-archive .page-numbers {
	display: inline-block;
	padding: var(--space-2) var(--space-3);
	border: var(--border-width) solid var(--color-border);
	border-radius: var(--radius-md);
	color: var(--color-text);
	text-decoration: none;
}

.hcr-archive .page-numbers.current {
	background: var(--color-primary-600);
	border-color: var(--color-primary-600);
	color: var(--color-on-primary);
}

/* ---------------------------------------------------------------- the 404 --- */

.hcr-404__body {
	max-width: var(--measure);
}

.hcr-404__links {
	margin: var(--space-8) 0 0;
	padding: 0;
	list-style: none;
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--space-3);
	font-family: var(--font-body);
}

.hcr-404__links a {
	display: block;
	padding: var(--space-4) var(--space-5);
	background: var(--color-surface);
	border: var(--border-width) solid var(--color-border);
	border-radius: var(--radius-lg);
	color: var(--color-text);
	font-weight: var(--weight-medium);
	text-decoration: none;
	transition:
		background var(--duration-fast) var(--ease-default),
		border-color var(--duration-fast) var(--ease-default);
}

.hcr-404__links a:hover,
.hcr-404__links a:focus-visible {
	background: var(--color-primary-50);
	border-color: var(--color-primary-600);
	color: var(--color-primary-700);
}

@media (min-width: 48em) {
	.hcr-404__links {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
