/*
 * Rich text typography (§9 module 14 / §10.6): full typographic styles for
 * long-form the_content() output, wrapped in `.rich-text` by
 * templates/single-post.php. Also reused for the wysiwyg
 * challenge/approach/outcome fields on templates/single-case-study.php so
 * both templates share one typographic system. New standalone file per
 * IMPLEMENTATION.md ("add new files only") — do not fold into
 * components.css, and enqueued from its own inc/setup/enqueue-rich-text.php
 * rather than theme-setup.php.
 */

.rich-text {
	max-width: var(--measure);
	color: var(--muted-light);
	font-size: var(--fs-body-lg);
	line-height: 1.6;
}

.rich-text > *:first-child { margin-top: 0; }
.rich-text > *:last-child { margin-bottom: 0; }

.rich-text h2 {
	font-family: var(--font-display);
	font-size: var(--fs-h2); /* issueslog.md #049(b) — design-reference H2 44/30, was 46/28.6 */
	letter-spacing: var(--tracking-display);
	color: var(--ink);
	margin: var(--space-8) 0 var(--space-4);
}

.rich-text h3 {
	font-family: var(--font-display);
	font-size: var(--fs-display-5);
	color: var(--ink);
	margin: var(--space-7) 0 var(--space-3);
}

.rich-text h4 {
	font-size: var(--fs-display-6);
	color: var(--ink);
	margin: var(--space-6) 0 var(--space-3);
}

.rich-text p { margin: 0 0 var(--space-5); max-width: none; }

.rich-text a { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }
.rich-text a:hover { color: var(--ink); }

.rich-text strong { color: var(--ink); font-weight: 600; }

/*
 * issueslog.md #048 — no italic face is loaded (design-reference.html's font
 * request has none, and the theme ships no Karla italic woff2), so a
 * slanted <em> could only ever be the browser's faux italic. Emphasis is
 * set upright instead — the same convention design-reference uses for the
 * headline accent <em> — and carried by ink colour + medium weight against
 * the muted body text, so it stays distinguishable without italics.
 */
.rich-text em, .rich-text i { font-style: normal; color: var(--ink); font-weight: 500; }
.rich-text strong em, .rich-text em strong { font-weight: 600; }

.rich-text ul,
.rich-text ol {
	margin: 0 0 var(--space-5);
	padding-left: var(--space-6);
}
.rich-text li { margin-bottom: var(--space-2); }
.rich-text ul ul,
.rich-text ol ol,
.rich-text ul ol,
.rich-text ol ul { margin: var(--space-2) 0 0; }

.rich-text blockquote {
	margin: var(--space-6) 0;
	padding: var(--space-5) var(--space-6);
	border-left: 3px solid var(--accent);
	background: var(--paper-soft);
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	font-family: var(--font-display);
	font-size: var(--fs-display-6);
	color: var(--ink);
}
.rich-text blockquote p { max-width: none; }
.rich-text blockquote p:last-of-type { margin-bottom: 0; }
.rich-text blockquote cite {
	display: block;
	margin-top: var(--space-3);
	font-family: var(--font-body);
	font-size: var(--fs-interface);
	text-transform: uppercase;
	letter-spacing: var(--tracking-interface);
	color: var(--muted-light);
	font-style: normal;
}

.rich-text code {
	font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
	font-size: 0.9em;
	background: var(--paper-soft);
	padding: 0.15em 0.4em;
	border-radius: var(--radius-sm);
}

.rich-text pre {
	margin: 0 0 var(--space-5);
	padding: var(--space-5);
	background: var(--ink);
	color: var(--paper);
	border-radius: var(--radius-md);
	overflow-x: auto;
}
.rich-text pre code { background: none; padding: 0; color: inherit; }

.rich-text table {
	width: 100%;
	border-collapse: collapse;
	margin: 0 0 var(--space-6);
	display: block;
	overflow-x: auto;
	max-width: 100%;
}
.rich-text th,
.rich-text td {
	padding: var(--space-3) var(--space-4);
	border: 1px solid var(--line-light);
	text-align: left;
	font-size: var(--fs-small);
}
.rich-text th { font-weight: 600; color: var(--ink); background: var(--paper-soft); }

.rich-text img { max-width: 100%; height: auto; border-radius: var(--radius-md); display: block; }

.rich-text figure { margin: var(--space-6) 0; }
.rich-text figcaption {
	margin-top: var(--space-3);
	font-size: var(--fs-interface);
	color: var(--muted-light);
	text-align: center;
}

.rich-text hr { border: none; border-top: 1px solid var(--line-light); margin: var(--space-8) 0; }

/*
 * Callouts. WP core / classic editor has no native callout block, so
 * editors opt in by adding a "callout" custom CSS class to a paragraph or
 * group block (Advanced > Additional CSS Class(es)).
 */
.rich-text .callout {
	margin: var(--space-6) 0;
	padding: var(--space-5) var(--space-6);
	background: var(--paper-soft);
	border: 1px solid var(--line-light);
	border-left: 4px solid var(--accent);
	border-radius: var(--radius-sm);
	max-width: none;
}
.rich-text .callout:last-child { margin-bottom: 0; }

@media (max-width: 767px) {
	.rich-text { font-size: var(--fs-body); }
	.rich-text table { font-size: var(--fs-interface); }
}
