/*
 * tg-theme — prose.css
 *
 * Styles for the .tg-prose class — the Rich text / Article body section
 * rendered by inc/sections/rich_text.php and output via the layout_rich_text
 * ACF flexible-content layout.
 *
 * Source of truth: org/engagements/2026-08-10-birch-blog-layout/prose-band-spec.md
 * Loaded after patterns.css via tg_enqueue_assets() in functions.php.
 *
 * Design token rule: NEVER use raw hex or px where a CSS custom property exists.
 * Every value references a --wp--preset--* or --wp--custom--* token, or states
 * its literal value with a justification comment.
 *
 * Token source: tg-theme-live/theme.json
 *
 * Responsive targets: 360px / 768px / 1024px — no horizontal scroll at any width.
 * Prose measure caps at 740px on wide viewports via max-width on .tg-prose.
 *
 * Config version: 0.1.0
 */

/* ==========================================================================
   MEASURE & LAYOUT
   740px readable measure with flexible side padding.
   .tg-prose is nested inside .tg-band, which already applies section padding-block
   and padding-inline. The measure sits inside that frame.
   ========================================================================== */

.tg-prose {
	max-width: 740px;
	margin-inline: auto;
	padding-inline: 24px;
}

/* ==========================================================================
   BODY TYPOGRAPHY
   Font family, size, line-height, colour for prose body text.
   ========================================================================== */

.tg-prose {
	font-family: var(--wp--preset--font-family--inter);
	font-size: var(--wp--preset--font-size--base); /* clamp(16px, 1.1vw, 18px) */
	line-height: 1.7;
	color: var(--wp--preset--color--ink);
}

.tg-prose p {
	margin-block: 1.2em;
}

/* First paragraph in the prose body: remove top margin so there is no gap
   between the eyebrow/heading and the first paragraph. */
.tg-prose__body > p:first-child {
	margin-block-start: 0;
}

/* ==========================================================================
   HEADINGS (H2, H3, H4)
   Tuned for reading, not marketing scale.
   Within-article navigation — not hero emphasis.
   ========================================================================== */

.tg-prose h2 {
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: clamp(26px, 2vw, 32px);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.5px;
	color: var(--wp--preset--color--ink);
	margin-block-start: 1.8em;
	margin-block-end: 0.6em;
}

.tg-prose h3 {
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: clamp(20px, 1.4vw, 24px);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.3px;
	color: var(--wp--preset--color--ink);
	margin-block-start: 1.6em;
	margin-block-end: 0.5em;
}

.tg-prose h4 {
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: var(--wp--preset--font-size--lg); /* 20px */
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: -0.2px;
	color: var(--wp--preset--color--ink);
	margin-block-start: 1.4em;
	margin-block-end: 0.4em;
}

/* ==========================================================================
   UNORDERED LISTS
   Disc bullets; terracotta-deep marker; proportional indent.
   ========================================================================== */

.tg-prose ul {
	list-style-type: disc;
	margin-block: 1.2em;
	padding-inline-start: 2.2em;
}

.tg-prose ul li {
	margin-block: 0.6em;
	color: var(--wp--preset--color--ink);
}

.tg-prose ul li::marker {
	color: var(--wp--preset--color--terracotta-deep);
	font-weight: 600;
}

/* ==========================================================================
   ORDERED LISTS
   Decimal numbers; same rhythm as ul.
   ========================================================================== */

.tg-prose ol {
	list-style-type: decimal;
	margin-block: 1.2em;
	padding-inline-start: 2.2em;
}

.tg-prose ol li {
	margin-block: 0.6em;
	color: var(--wp--preset--color--ink);
}

.tg-prose ol li::marker {
	color: var(--wp--preset--color--terracotta-deep);
	font-weight: 600;
}

/* ==========================================================================
   NESTED LISTS
   Indentation stacks; marker colour consistent.
   ========================================================================== */

.tg-prose ul ul,
.tg-prose ol ol,
.tg-prose ul ol,
.tg-prose ol ul {
	margin-block: 0.4em;
	padding-inline-start: 1.8em;
}

.tg-prose ul ul li::marker,
.tg-prose ol ol li::marker,
.tg-prose ul ol li::marker,
.tg-prose ol ul li::marker {
	color: var(--wp--preset--color--terracotta-deep);
}

/* ==========================================================================
   BLOCKQUOTES
   Left rule in terracotta; mist background; italic; ink-soft body.
   ========================================================================== */

.tg-prose blockquote {
	border-left: 3px solid var(--wp--preset--color--terracotta);
	padding-block: 0.8em;
	padding-inline-start: 1.6em;
	padding-inline-end: 1.2em;
	margin-block: 1.4em;
	margin-inline: 0;
	background-color: var(--wp--preset--color--mist);
	font-style: italic;
	color: var(--wp--preset--color--ink-soft);
	line-height: 1.6;
}

.tg-prose blockquote p {
	margin-block: 0.4em;
}

/* ==========================================================================
   LINKS
   Terracotta-deep with underline; hover to terracotta-deeper.
   ========================================================================== */

.tg-prose a {
	color: var(--wp--preset--color--terracotta-deep);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	transition: color 0.2s ease;
}

.tg-prose a:hover {
	color: var(--wp--preset--color--terracotta-deeper);
	text-decoration-color: var(--wp--preset--color--terracotta-deeper);
}

.tg-prose a:focus-visible {
	outline: 3px solid rgba(219, 85, 55, 0.3); /* terracotta at 30% opacity — no token exists for rgba variant */
	outline-offset: 2px;
	border-radius: 2px;
}

/* ==========================================================================
   INLINE CODE
   Monospace with cloud tint background; subtle radius.
   ========================================================================== */

.tg-prose code {
	font-family: 'Courier New', Courier, monospace; /* no --wp--preset--font-family--mono token exists */
	font-size: 0.95em;
	background-color: var(--wp--preset--color--cloud);
	color: var(--wp--preset--color--ink-soft);
	padding-inline: 0.4em;
	padding-block: 0.2em;
	border-radius: var(--wp--custom--radius--sm);
	word-break: break-word;
}

/* ==========================================================================
   CODE BLOCKS (pre)
   Full-measure block with horizontal scroll; no overflow clipping.
   ========================================================================== */

.tg-prose pre {
	background-color: var(--wp--preset--color--cloud);
	border: 1px solid var(--wp--preset--color--hairline);
	border-radius: var(--wp--custom--radius--md);
	padding: 1em;
	overflow-x: auto;
	overflow-y: hidden;
	font-family: 'Courier New', Courier, monospace; /* no mono token */
	font-size: 0.9em;
	line-height: 1.5;
	color: var(--wp--preset--color--ink);
	margin-block: 1.4em;
}

/* When <code> nests inside <pre> (common WP WYSIWYG output), remove
   the inline-code tint so only the pre background applies. */
.tg-prose pre code {
	background-color: transparent;
	color: inherit;
	padding: 0;
	border-radius: 0;
	font-size: 1em;
}

/* ==========================================================================
   FIGURES & IMAGES
   Full-measure images with caption styling; radius + subtle shadow.
   ========================================================================== */

.tg-prose figure {
	max-width: 100%;
	margin-block: 1.6em;
	margin-inline: 0;
	text-align: center;
}

.tg-prose figure img {
	max-width: 100%;
	height: auto;
	border-radius: var(--wp--custom--radius--lg);
	box-shadow: var(--wp--custom--elevation--sm);
	display: block;
	margin-inline: auto;
}

.tg-prose figcaption {
	font-size: 0.9em;
	font-style: italic;
	color: var(--wp--preset--color--slate);
	margin-block-start: 0.8em;
	line-height: 1.5;
	padding-inline: 0.5em;
}

/* Standalone img (not inside figure) */
.tg-prose img {
	max-width: 100%;
	height: auto;
	border-radius: var(--wp--custom--radius--lg);
	display: block;
	margin-block: 1.4em;
}

/* ==========================================================================
   HORIZONTAL RULES
   Hairline visual break with generous vertical spacing.
   ========================================================================== */

.tg-prose hr {
	border: none;
	border-top: 1px solid var(--wp--preset--color--hairline);
	margin-block: 2em;
	opacity: 1; /* override WP default (0.3) */
}

/* ==========================================================================
   TABLES
   Basic readable table; no horizontal overflow on narrow viewports.
   ========================================================================== */

.tg-prose table {
	width: 100%;
	border-collapse: collapse;
	margin-block: 1.4em;
	font-size: 0.95em;
}

.tg-prose th,
.tg-prose td {
	padding: 0.6em 0.8em;
	border: 1px solid var(--wp--preset--color--hairline);
	text-align: left;
	vertical-align: top;
}

.tg-prose th {
	font-family: var(--wp--preset--font-family--montserrat);
	font-weight: 700;
	font-size: var(--wp--preset--font-size--xs);
	letter-spacing: 0.5px;
	text-transform: uppercase;
	background-color: var(--wp--preset--color--cloud);
	color: var(--wp--preset--color--ink);
}

.tg-prose caption {
	font-size: 0.9em;
	font-style: italic;
	color: var(--wp--preset--color--slate);
	margin-block-end: 0.6em;
	text-align: left;
}

/* ==========================================================================
   ABBREVIATIONS
   Dotted underline hint for expanded terms.
   ========================================================================== */

.tg-prose abbr[title] {
	text-decoration: underline dotted;
	text-decoration-thickness: 1px;
	cursor: help;
}

/* ==========================================================================
   SUPERSCRIPT / SUBSCRIPT (footnote markers, chemistry)
   ========================================================================== */

.tg-prose sup,
.tg-prose sub {
	font-size: 0.78em;
	line-height: 0; /* keep baseline from shifting */
	position: relative;
}

.tg-prose sup {
	top: -0.5em;
}

.tg-prose sub {
	bottom: -0.25em;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS
   360px / 768px / 1024px — no horizontal scroll at any width.
   ========================================================================== */

/* Mobile (≤560px): reduce list indent and code font size for narrow measure */
@media (max-width: 560px) {
	.tg-prose ul,
	.tg-prose ol {
		padding-inline-start: 2em; /* slightly reduced for narrow measure */
	}

	.tg-prose code {
		font-size: 0.9em; /* slight reduction for density */
	}

	/* Tables: enable horizontal scroll on mobile so they do not overflow */
	.tg-prose table {
		display: block;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
}

/* ==========================================================================
   REDUCED MOTION
   Prose has minimal animation (link colour transitions only).
   The global reduced-motion block in patterns.css kills transitions site-wide;
   this rule ensures the prose link transition also honours the preference.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.tg-prose a {
		transition: none;
	}
}
