/* Reset, typography and the shared components every block builds on. */

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

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

body {
	margin: 0;
	background: var(--th-white);
	color: var(--th-text);
	font-family: var(--th-font-body);
	font-size: var(--th-fs-body);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

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

/* WebP Express (production only) wraps uploads in <picture>; keep the <img> as the
   layout box so flex/grid rules written for it still apply. */
picture {
	display: contents;
}

h1,
h2,
h3,
h4 {
	margin: 0;
	color: var(--th-heading, inherit);
	font-family: var(--th-font-heading);
	font-weight: 800;
	line-height: 1.15;
}

h1 {
	font-size: var(--th-fs-h1);
	line-height: 1.06;
	letter-spacing: -0.025em;
}

h2 {
	font-size: var(--th-fs-h2);
	letter-spacing: -0.02em;
}

h3 {
	font-size: var(--th-fs-h3);
	font-weight: 700;
	line-height: 1.3;
}

p {
	margin: 0;
}

a {
	color: var(--th-link, var(--th-navy));
}

a:hover {
	color: var(--th-link-hover, var(--th-navy-dark));
}

summary {
	cursor: pointer;
}

:focus-visible {
	outline: var(--th-focus);
	outline-offset: 2px;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

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

.th-container {
	max-width: var(--th-container);
	margin-inline: auto;
	padding-inline: var(--th-gutter);
}

.th-container--narrow {
	max-width: var(--th-container-narrow);
}

.th-section {
	padding-block: var(--th-section-y);
	background: var(--th-bg, var(--th-white));
	color: var(--th-fg, var(--th-text));
}

.th-section--flush-top {
	padding-top: 0;
}

.th-page-header {
	padding-block: clamp(40px, 6vw, 64px);
	border-bottom: 1px solid var(--th-border);
}

.th-stack {
	display: flex;
	flex-direction: column;
	gap: var(--th-stack-gap, 40px);
}

/* Intro on the left, content on the right; wraps to one column on small screens. */
.th-split {
	display: flex;
	flex-wrap: wrap;
	gap: var(--th-split-gap, 48px);
	align-items: var(--th-split-align, stretch);
}

.th-split > :first-child {
	flex: 1 1 340px;
}

.th-split > :last-child {
	flex: 999 1 520px;
	min-width: 0;
}

/* Background themes. Each sets the colours its children inherit. */
.th-bg-white {
	--th-bg: var(--th-white);
}

.th-bg-light {
	--th-bg: var(--th-surface-light);
}

.th-bg-sand {
	--th-bg: var(--th-surface-sand);
}

.th-bg-navy,
.th-bg-dark {
	--th-bg: var(--th-navy);
	--th-fg: var(--th-on-dark);
	--th-heading: var(--th-on-dark);
	--th-muted: var(--th-on-dark-muted);
	--th-lead: var(--th-on-dark-text);
	--th-eyebrow-color: var(--th-blue);
	--th-link: var(--th-on-dark);
	--th-link-hover: var(--th-on-dark-text);
	--th-btn-bg: var(--th-blue);
	--th-btn-fg: var(--th-navy-dark);
	--th-btn-outline: var(--th-on-dark-outline);
	--th-btn-outline-fg: var(--th-on-dark);
	--th-highlight: var(--th-blue);
}

.th-bg-dark {
	--th-bg: var(--th-navy-dark);
}

/* ---------- Section intro (eyebrow, heading, text) ---------- */

.th-intro {
	display: flex;
	flex-direction: column;
	gap: 12px;
	max-width: var(--th-measure);
}

.th-eyebrow {
	color: var(--th-eyebrow-color, var(--th-eyebrow));
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.th-lead {
	color: var(--th-lead, var(--th-text-muted));
	font-size: var(--th-fs-body-lg);
	line-height: 1.65;
}

.th-lead a {
	font-weight: 600;
}

.th-lead p + p {
	margin-top: 1em;
}

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

.th-highlight {
	color: var(--th-highlight, var(--th-blue));
}

.th-arrow-link {
	font-weight: 600;
}

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

.th-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.th-btn {
	display: inline-block;
	padding: 14px 22px;
	border: 1.5px solid transparent;
	border-radius: var(--th-radius-sm);
	background: var(--th-btn-bg, var(--th-navy));
	color: var(--th-btn-fg, var(--th-white));
	font-size: var(--th-fs-body);
	font-weight: 600;
	line-height: 1.25;
	text-decoration: none;
	transition: filter 0.15s ease, background-color 0.15s ease;
}

.th-btn:hover {
	color: var(--th-btn-fg, var(--th-white));
	filter: brightness(1.12);
}

.th-btn--outline {
	border-color: var(--th-btn-outline, var(--th-navy));
	background: transparent;
	color: var(--th-btn-outline-fg, var(--th-navy));
}

.th-btn--outline:hover {
	background: color-mix(in srgb, var(--th-btn-outline, var(--th-navy)) 14%, transparent);
	color: var(--th-btn-outline-fg, var(--th-navy));
	filter: none;
}

.th-btn--lg {
	padding: 16px 26px;
}

/* ---------- Cards ---------- */

.th-card-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
}

.th-card {
	display: flex;
	flex: 1 1 var(--th-card-min, 300px);
	flex-direction: column;
	gap: 8px;
	padding: 26px;
	border-radius: var(--th-radius);
	background: var(--th-white);
	color: var(--th-text);
	text-decoration: none;
}

a.th-card:hover {
	color: var(--th-text);
}

.th-card--outline {
	border: 1px solid var(--th-border);
}

a.th-card--outline:hover {
	border-color: var(--th-border-strong);
	box-shadow: 0 6px 20px rgb(2 27 91 / 0.07);
}

.th-card--soft {
	padding: 24px;
	background: var(--th-surface-light);
}

a.th-card--soft:hover {
	background: var(--th-surface-blue);
}

.th-card__title {
	color: var(--th-card-title, inherit);
	font-size: 1.25rem;
}

.th-card__text {
	color: var(--th-text-muted);
	font-size: var(--th-fs-sm);
	line-height: 1.55;
}

.th-card__cta {
	color: var(--th-navy);
	font-size: var(--th-fs-sm);
	font-weight: 600;
}

/* Card image (or a branded stand-in) and the small label above the title. */
.th-card__media {
	overflow: hidden;
	height: 140px;
	border-radius: var(--th-radius-sm);
	background: var(--th-placeholder);
}

.th-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.th-card__placeholder {
	display: flex;
	align-items: flex-end;
	height: 100%;
	padding: 18px 20px;
	background:
		radial-gradient(circle at 85% 20%, rgb(0 151 225 / 0.55), transparent 55%),
		linear-gradient(135deg, var(--th-navy) 0%, var(--th-navy-dark) 100%);
	color: var(--th-white);
	font-family: var(--th-font-heading);
	font-size: 1.125rem;
	font-weight: 800;
	letter-spacing: -0.01em;
}

.th-card__kicker {
	color: var(--th-eyebrow);
	font-size: var(--th-fs-xs);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* Post cards (blog listings, Latest posts block): media card with a date at the foot. */
/* A real grid, so a lone card on the last row keeps its column width instead of stretching. */
.th-post-grid {
	--th-card-min: 300px;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--th-card-min)), 1fr));
}

.th-post-card {
	min-width: 0;
	gap: 10px;
	overflow-wrap: anywhere;
}

.th-post-card .th-card__media {
	height: auto;
	aspect-ratio: 16 / 9;
}

.th-post-card .th-card__title {
	color: var(--th-navy);
	font-size: var(--th-fs-h3);
}

.th-post-card__date {
	margin-top: auto;
	padding-top: 6px;
	color: var(--th-text-muted);
	font-size: var(--th-fs-xs);
}

/* ---------- Pagination (blog listings, Latest posts block with page links) ---------- */

.th-pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
}

.th-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 14px;
	border: 1px solid var(--th-border);
	border-radius: var(--th-radius-sm);
	color: var(--th-navy);
	font-weight: 600;
	text-decoration: none;
}

.th-pagination a.page-numbers:hover {
	border-color: var(--th-border-strong);
	background: var(--th-surface-light);
}

.th-pagination .page-numbers.current {
	border-color: var(--th-navy);
	background: var(--th-navy);
	color: var(--th-white);
}

.th-pagination .page-numbers.dots {
	border-color: transparent;
}

/* ---------- Editor-only notes shown in block previews ---------- */

.th-editor-note {
	padding: 16px 20px;
	border: 1.5px dashed var(--th-border-dashed);
	border-radius: var(--th-radius-sm);
	color: var(--th-text-muted);
	font-size: var(--th-fs-sm);
}

/* ---------- Plain content column (posts, legacy pages); typography is in prose.css ---------- */

.th-entry > :not(.th-section) {
	max-width: calc(var(--th-measure) + 2 * var(--th-gutter));
	margin-inline: auto;
	padding-inline: var(--th-gutter);
}
