/*
 * ThemeBot base styles. Everything a Section can assume: tokens, type, the wrap,
 * buttons, kickers, post cards and prose. Colours and fonts come only from the
 * Site's Theme tokens (--tb-*).
 */

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

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

body {
	margin: 0;
	background: var(--tb-bg);
	color: var(--tb-ink);
	font-family: var(--tb-font-body);
	font-size: 1.0625rem;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* WordPress's own wrappers must not add spacing between Sections. */
.wp-site-blocks, .wp-block-post-content { padding: 0; }
.wp-site-blocks > *, .wp-block-post-content > .tb-section, main.wp-block-group > *, .wp-block-template-part { margin-block: 0 !important; max-width: none !important; }

img { max-width: 100%; height: auto; display: block; }

.tb-wrap { width: min(100% - 2.5rem, var(--tb-wrap)); margin-inline: auto; }
.tb-wrap--narrow { width: min(100% - 2.5rem, 46rem); }

.tb-section { padding-block: clamp(3rem, 7vw, 6rem); }

.tb-section h1, .tb-section h2, .tb-section h3, .tb-h {
	font-family: var(--tb-font-display);
	font-weight: 500;
	line-height: 1.08;
	letter-spacing: -0.015em;
	margin: 0;
	text-wrap: balance;
}
.tb-section h1 { font-size: clamp(2.4rem, 5.4vw, 4.4rem); }
.tb-section h2 { font-size: clamp(1.8rem, 3.4vw, 2.75rem); }
.tb-section h3 { font-size: clamp(1.25rem, 1.8vw, 1.5rem); line-height: 1.2; }
.tb-section h1 em, .tb-section h2 em { font-style: italic; color: var(--tb-primary); }

:where(.tb-section) p { margin: 0; }

.tb-section a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }

.tb-kicker {
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--tb-primary);
}
.tb-kicker::before { content: ""; width: 2.25rem; height: 1px; background: currentColor; }

.tb-button {
	display: inline-flex;
	align-items: center;
	gap: 0.65rem;
	min-height: 3rem;
	padding: 0.7rem 1.5rem;
	border: 1px solid var(--tb-primary);
	border-radius: var(--tb-radius);
	background: var(--tb-primary);
	color: var(--tb-primary-ink) !important;
	font-weight: 600;
	font-size: 0.98rem;
	text-decoration: none;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tb-button::after { content: "→"; transition: transform 0.2s ease; }
.tb-button:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -12px var(--tb-primary); }
.tb-button:hover::after { transform: translateX(4px); }
.tb-button:focus-visible, .tb-section a:focus-visible { outline: 2px solid var(--tb-primary); outline-offset: 3px; }

.tb-button--ghost { background: transparent; color: inherit !important; border-color: currentColor; }

.tb-section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem 2rem; margin-bottom: clamp(1.75rem, 4vw, 3rem); }
.tb-section-head > div { display: grid; gap: 0.9rem; }
.tb-more { font-weight: 600; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 0.15rem; white-space: nowrap; }
.tb-more:hover { color: var(--tb-primary); }

/* Post cards: shared by every Section that lists posts. */
.tb-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.75rem, 3vw, 2.75rem) clamp(1.25rem, 2.4vw, 2.25rem); }
@media (max-width: 900px) { .tb-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 580px) { .tb-cards { grid-template-columns: minmax(0, 1fr); } }

.tb-card { position: relative; display: flex; flex-direction: column; gap: 0.85rem; }
.tb-card__media { aspect-ratio: 3 / 2; overflow: hidden; border-radius: var(--tb-radius); background: var(--tb-line); }
.tb-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.tb-card:hover .tb-card__media img { transform: scale(1.045); }
.tb-card__meta { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; font-size: 0.76rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tb-muted); }
.tb-card__meta a { color: inherit; text-decoration: none; }
.tb-card__meta a:hover { text-decoration: underline; }
.tb-card__meta .tb-card__cat { color: var(--tb-primary); }
.tb-card__title { font-size: clamp(1.2rem, 1.7vw, 1.42rem) !important; line-height: 1.2 !important; }
.tb-card__title a { text-decoration: none; }
.tb-card__title a::after { content: ""; position: absolute; inset: 0; }
.tb-card:hover .tb-card__title a { text-decoration: underline; text-decoration-thickness: 1px; }
.tb-card__excerpt { color: var(--tb-muted); font-size: 0.98rem; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Prose: long-form text written with ordinary text blocks. */
.tb-prose { width: min(100% - 2.5rem, 44rem); margin-inline: auto; }
div.tb-prose > * { margin-block: 0 1.35em; max-width: none; }
.tb-post-body { padding-top: clamp(2rem, 4vw, 3.25rem); }
div.tb-prose > :last-child { margin-bottom: 0; }
.tb-prose h1 { margin-bottom: 0.6em; }
.tb-prose h2, .tb-prose h3, .tb-prose h4 { margin-top: 1.9em; margin-bottom: 0.6em; }
.tb-prose h4 { font-family: var(--tb-font-body); font-size: 1.05rem; font-weight: 700; }
.tb-prose a { color: var(--tb-primary); }
.tb-prose ul, .tb-prose ol { padding-left: 1.3em; }
.tb-prose li { margin-bottom: 0.45em; }
.tb-prose li::marker { color: var(--tb-primary); }
.tb-prose figure { margin-inline: 0; }
.tb-prose .wp-block-image img { border-radius: var(--tb-radius); width: 100%; }
.tb-prose figcaption { font-size: 0.85rem; color: var(--tb-muted); margin-top: 0.5rem; }
.tb-prose blockquote { margin-inline: 0; padding-left: 1.4rem; border-left: 2px solid var(--tb-primary); font-family: var(--tb-font-display); font-size: 1.25rem; font-style: italic; }
.tb-prose table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.tb-prose .wp-block-table { overflow-x: auto; }
.tb-prose th, .tb-prose td { text-align: left; padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--tb-line); vertical-align: top; }
.tb-prose thead th { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tb-muted); }

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

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
