/*!
 * CineFrame Articles — front-end stylesheet
 * ------------------------------------------------------------------
 * Everything here is scoped under `.cfa-article` (the wrapper the
 * Content Enhancer places around post content) so the framework can
 * never leak into, or be overridden by, the active theme's own styles.
 * No framework, no build step: plain CSS with custom properties.
 *
 * Table of contents (search for these markers):
 *   1. Design tokens
 *   2. Base layout & typography
 *   3. Meta row / reading time
 *   4. Spoiler banner + spoiler shortcode
 *   5. Quick answer
 *   6. Key takeaways
 *   7. Info / warning / tip boxes
 *   8. Pull quotes + native blockquotes
 *   9. FAQ accordion
 *  10. Tables
 *  11. Images / figures
 *  12. Table of contents (inline card)
 *  13. Floating "Jump to Section" widget
 *  14. Reading progress bar
 *  15. Author box
 *  16. Related posts
 *  17. Responsive
 *  18. Dark mode
 *  19. Accessibility / motion
 * ------------------------------------------------------------------ */

/* 1. Design tokens ------------------------------------------------- */

/* All tokens live at :root — not on `.cfa-article` — so a shortcode
   (Quick Answer, FAQ, a box, ...) still renders fully styled even when it
   appears somewhere the Content Enhancer's `.cfa-article` wrapper never
   gets added, e.g. an author/category archive or search-results excerpt.
   WordPress runs `do_shortcode` on *every* `the_content`/`the_excerpt`
   call regardless of page type, so a post's shortcodes can render on an
   archive page even though the plugin's own singular-only wrapper does
   not. Without root-level tokens, the icon inside `.cfa-quick-answer__icon
   { width:26px }` still gets an explicit pixel size, but anything that
   only had a value via `.cfa-article`-scoped custom properties (padding,
   radius, background) would silently resolve to nothing — the failure
   mode that made an SVG icon render at native, unconstrained size on an
   archive page.
   The plugin's PHP (see class-cineframe-assets.php) prints a second,
   later <style> block that also targets :root with the admin's chosen
   accent/box colors from Settings -> CineFrame Articles; being later in
   source order it wins the cascade and overrides the defaults below
   without needing var()-on-itself tricks, which create an invalid cyclic
   reference in every browser. */
:root {
	--cfa-bg: #ffffff;
	--cfa-surface: #f6f6f9;
	--cfa-surface-2: #eeeef2;
	--cfa-border: #e5e5eb;
	--cfa-text: #17171c;
	--cfa-text-muted: #5b5b66;
	--cfa-radius-sm: 8px;
	--cfa-radius: 14px;
	--cfa-radius-lg: 20px;
	--cfa-shadow: 0 1px 2px rgba(20,20,30,.04), 0 12px 28px rgba(20,20,30,.08);
	--cfa-shadow-sm: 0 1px 2px rgba(20,20,30,.06);
	--cfa-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--cfa-space-1: .5rem;
	--cfa-space-2: 1rem;
	--cfa-space-3: 1.5rem;
	--cfa-space-4: 2.25rem;
	--cfa-space-5: 3.25rem;
	--cfa-max-width: 760px;
	--cfa-accent: #e5122d;
	--cfa-info: #2f80ed;
	--cfa-warning: #e5122d;
	--cfa-tip: #1ba672;
	--cfa-spoiler: #8a3ffc;
}

.cfa-article {
	color: var(--cfa-text);
	font-family: var(--cfa-font);
	max-width: var(--cfa-max-width);
	margin-inline: auto;
	box-sizing: border-box;
}

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

/* Components can also appear standalone outside `.cfa-article` (see the
   note above) — this resets box-sizing for them too. */
.cfa-quick-answer, .cfa-quick-answer *,
.cfa-spoiler-banner, .cfa-spoiler-banner *,
.cfa-spoiler, .cfa-spoiler *,
.cfa-takeaways, .cfa-takeaways *,
.cfa-box, .cfa-box *,
.cfa-quote, .cfa-quote *,
.cfa-faq, .cfa-faq *,
.cfa-table-wrap, .cfa-table-wrap *,
.cfa-toc, .cfa-toc * {
	box-sizing: border-box;
}

/* 2. Base layout & typography ---------------------------------------- */

.cfa-article {
	font-size: 1.0625rem;
	line-height: 1.75;
	counter-reset: cfa-section;
}

.cfa-article p {
	margin: 0;
	padding-bottom: 10px;
}

.cfa-article h2,
.cfa-article h3,
.cfa-article h4 {
	font-family: var(--cfa-font);
	font-weight: 800;
	line-height: 1.25;
	letter-spacing: -0.01em;
	color: var(--cfa-text);
	scroll-margin-top: 96px; /* keeps anchored headings clear of sticky theme headers */
}

.cfa-article h2 {
	counter-increment: cfa-section;
	font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
	margin: var(--cfa-space-5) 0 var(--cfa-space-2);
	padding-top: var(--cfa-space-3);
	border-top: 1px solid var(--cfa-border);
}

/* Numbered "eyebrow" above each H2 — a purely CSS editorial marker (no
   markup changes required) that breaks up what would otherwise read as a
   flat, undifferentiated image/paragraph/image "tape". */
.cfa-article h2::before {
	content: counter(cfa-section, decimal-leading-zero);
	display: block;
	font-size: .8rem;
	font-weight: 800;
	letter-spacing: .16em;
	color: var(--cfa-accent);
	margin-bottom: .5em;
}

.cfa-article > *:first-child h2:first-child,
.cfa-article h2:first-child {
	border-top: 0;
	padding-top: 0;
	margin-top: var(--cfa-space-2);
}

.cfa-article h3 {
	font-size: clamp(1.2rem, 1.05rem + .6vw, 1.4rem);
}

.cfa-article h4 {
	font-size: 1.1rem;
	margin: var(--cfa-space-3) 0 var(--cfa-space-1);
}

.cfa-article a {
	color: var(--cfa-accent);
	text-decoration-thickness: 1.5px;
	text-underline-offset: 3px;
}

.cfa-article a:hover { text-decoration-thickness: 2px; }

.cfa-article ul,
.cfa-article ol {
	margin: 0 0 var(--cfa-space-3);
	padding-left: 1.4em;
}

.cfa-article li { margin-bottom: .4em; }

.cfa-article strong { font-weight: 700; }

.cfa-article hr {
	border: 0;
	border-top: 1px solid var(--cfa-border);
	margin: var(--cfa-space-4) 0;
}

.cfa-article code {
	background: var(--cfa-surface);
	border-radius: 4px;
	padding: .15em .4em;
	font-size: .9em;
}

/* 3. Meta row ---------------------------------------------------- */

.cfa-meta-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .5em;
	color: var(--cfa-text-muted);
	font-size: .82rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .06em;
	margin: 0 0 var(--cfa-space-3);
	padding-bottom: var(--cfa-space-2);
	border-bottom: 2px solid var(--cfa-border);
}

.cfa-meta-row__dot { opacity: .5; }

/* 4. Spoiler banner + spoiler shortcode --------------------------- */

.cfa-spoiler-banner {
	display: flex;
	gap: var(--cfa-space-2);
	align-items: flex-start;
	background: color-mix(in srgb, var(--cfa-spoiler) 10%, var(--cfa-bg));
	border: 1px solid color-mix(in srgb, var(--cfa-spoiler) 30%, transparent);
	border-left: 4px solid var(--cfa-spoiler);
	border-radius: var(--cfa-radius);
	padding: var(--cfa-space-2) var(--cfa-space-3);
	margin: 0 0 var(--cfa-space-3);
}

.cfa-spoiler-banner__icon { font-size: 1.4rem; line-height: 1; }
.cfa-spoiler-banner__title { font-weight: 800; margin: 0 0 .2em; color: var(--cfa-spoiler); }
.cfa-spoiler-banner__text { margin: 0; color: var(--cfa-text-muted); }

.cfa-spoiler {
	border: 1px solid color-mix(in srgb, var(--cfa-spoiler) 35%, transparent);
	border-radius: var(--cfa-radius);
	overflow: hidden;
	margin: var(--cfa-space-3) 0;
	background: var(--cfa-bg);
}

.cfa-spoiler__header {
	display: flex;
	align-items: center;
	gap: .6em;
	padding: .9em 1.1em;
	background: color-mix(in srgb, var(--cfa-spoiler) 12%, var(--cfa-bg));
}

.cfa-spoiler__icon { color: var(--cfa-spoiler); display: inline-flex; width: 18px; height: 18px; }
.cfa-spoiler__icon svg { width: 100%; height: 100%; }
.cfa-spoiler__title { font-weight: 800; margin-right: auto; }

.cfa-spoiler__toggle {
	font: inherit;
	font-size: .85rem;
	font-weight: 700;
	cursor: pointer;
	border: 1px solid color-mix(in srgb, var(--cfa-spoiler) 50%, transparent);
	background: var(--cfa-bg);
	color: var(--cfa-spoiler);
	border-radius: 999px;
	padding: .4em 1em;
}
.cfa-spoiler__toggle:hover { background: var(--cfa-spoiler); color: #fff; }

.cfa-spoiler__content {
	padding: 1.1em;
	filter: blur(6px);
	user-select: none;
	max-height: 4.5em;
	overflow: hidden;
	position: relative;
	transition: filter .25s ease, max-height .35s ease;
}

.cfa-spoiler__content > p:last-child { margin-bottom: 0; }

.cfa-spoiler.is-open .cfa-spoiler__content {
	filter: none;
	user-select: auto;
	max-height: none;
}

/* 5. Quick answer -------------------------------------------------- */

.cfa-quick-answer {
	display: flex;
	gap: var(--cfa-space-2);
	align-items: flex-start;
	background: color-mix(in srgb, var(--cfa-accent) 8%, var(--cfa-bg));
	border: 1px solid color-mix(in srgb, var(--cfa-accent) 25%, transparent);
	border-radius: var(--cfa-radius);
	padding: var(--cfa-space-3);
	margin: 0 0 var(--cfa-space-3);
}

.cfa-quick-answer__icon {
	flex: none;
	width: 26px; height: 26px;
	color: var(--cfa-accent);
}
.cfa-quick-answer__icon svg { width: 100%; height: 100%; }
.cfa-quick-answer__title {
	margin: 0 0 .3em;
	font-weight: 800;
	text-transform: uppercase;
	font-size: .78rem;
	letter-spacing: .06em;
	color: var(--cfa-accent);
}
.cfa-quick-answer__content { font-size: 1.05rem; }
.cfa-quick-answer__content > *:last-child { margin-bottom: 0; }

/* 6. Key takeaways --------------------------------------------------- */

.cfa-takeaways {
	background: var(--cfa-surface);
	border: 1px solid var(--cfa-border);
	border-radius: var(--cfa-radius);
	padding: var(--cfa-space-3);
	margin: var(--cfa-space-3) 0;
}
.cfa-takeaways__title {
	display: flex;
	align-items: center;
	gap: .5em;
	font-weight: 800;
	font-size: 1.05rem;
	margin: 0 0 .8em;
}
.cfa-takeaways__icon { width: 20px; height: 20px; color: var(--cfa-tip); flex: none; }
.cfa-takeaways__icon svg { width: 100%; height: 100%; }
.cfa-takeaways__list { list-style: none !important; margin: 0; padding: 0; }
.cfa-takeaways__list li {
	list-style-type: none !important;
	position: relative;
	padding-left: 1.6em;
	margin-bottom: .6em;
}
.cfa-takeaways__list li::before {
	content: "";
	position: absolute;
	left: 0; top: .35em;
	width: 18px; height: 18px;
	border-radius: 50%;
	background: var(--cfa-tip);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/60% no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/60% no-repeat;
}
.cfa-takeaways__list li:last-child { margin-bottom: 0; }

/* 7. Info / warning / tip boxes -------------------------------------- */

.cfa-box {
	display: flex;
	gap: var(--cfa-space-2);
	align-items: flex-start;
	border-radius: var(--cfa-radius);
	padding: var(--cfa-space-3);
	margin: var(--cfa-space-3) 0;
	border: 1px solid var(--cfa-border);
	border-left-width: 4px;
	background: var(--cfa-surface);
}
.cfa-box__icon { flex: none; width: 22px; height: 22px; margin-top: .1em; }
.cfa-box__icon svg { width: 100%; height: 100%; }
.cfa-box__title { font-weight: 800; margin: 0 0 .3em; }
.cfa-box__content { color: var(--cfa-text); }
.cfa-box__content > *:last-child { margin-bottom: 0; }

.cfa-box--info    { border-left-color: var(--cfa-info); }
.cfa-box--info    .cfa-box__icon, .cfa-box--info .cfa-box__title    { color: var(--cfa-info); }
.cfa-box--warning { border-left-color: var(--cfa-warning); }
.cfa-box--warning .cfa-box__icon, .cfa-box--warning .cfa-box__title { color: var(--cfa-warning); }
.cfa-box--tip     { border-left-color: var(--cfa-tip); }
.cfa-box--tip     .cfa-box__icon, .cfa-box--tip .cfa-box__title     { color: var(--cfa-tip); }

/* 8. Pull quotes + native blockquotes --------------------------------- */

.cfa-quote {
	position: relative;
	margin: var(--cfa-space-4) 0;
	padding: var(--cfa-space-3) var(--cfa-space-4);
	border-radius: var(--cfa-radius);
	background: var(--cfa-surface);
}
.cfa-quote__mark {
	position: absolute;
	top: .6rem; left: 1rem;
	width: 30px; height: 30px;
	color: var(--cfa-accent);
	opacity: .35;
}
.cfa-quote__mark svg { width: 100%; height: 100%; }
.cfa-quote__text {
	margin: 0;
	font-size: 1.3rem;
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: -0.01em;
}
.cfa-quote__text p { margin: 0; }
.cfa-quote__caption {
	display: block;
	margin-top: .8em;
	font-size: .9rem;
	font-weight: 700;
	color: var(--cfa-text-muted);
}
.cfa-quote__role {
	font-weight: 400;
	margin-left: .4em;
}
.cfa-quote__role::before { content: "— "; }

.cfa-blockquote {
	margin: var(--cfa-space-3) 0;
	padding: .2em 0 .2em var(--cfa-space-3);
	border-left: 4px solid var(--cfa-accent);
	font-size: 1.1rem;
	font-style: italic;
	color: var(--cfa-text-muted);
}
.cfa-blockquote p:last-child { margin-bottom: 0; }

/* 9. FAQ accordion ---------------------------------------------------- */

.cfa-faq {
	margin: var(--cfa-space-4) 0;
	border-top: 1px solid var(--cfa-border);
	padding-top: var(--cfa-space-3);
}
.cfa-faq__title {
	font-size: 1.3rem;
	font-weight: 800;
	margin: 0 0 var(--cfa-space-2);
}
.cfa-faq__item {
	border: 1px solid var(--cfa-border);
	border-radius: var(--cfa-radius-sm);
	margin-bottom: .7em;
	overflow: hidden;
}
.cfa-faq__question { margin: 0; font-size: 1rem; }
.cfa-faq__trigger {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
	text-align: left;
	font: inherit;
	font-weight: 700;
	background: var(--cfa-bg);
	border: 0;
	cursor: pointer;
	padding: .95em 1.1em;
	color: var(--cfa-text);
}
.cfa-faq__trigger:hover { background: var(--cfa-surface); }
.cfa-faq__chevron { flex: none; width: 16px; height: 16px; transition: transform .2s ease; color: var(--cfa-text-muted); }
.cfa-faq__chevron svg { width: 100%; height: 100%; }
.cfa-faq__trigger[aria-expanded="true"] .cfa-faq__chevron { transform: rotate(180deg); }

.cfa-faq__answer {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows .25s ease;
	background: var(--cfa-surface);
}
.cfa-faq__answer > * { overflow: hidden; }
.cfa-faq__item.is-open .cfa-faq__answer { grid-template-rows: 1fr; }
.cfa-faq__answer-inner,
.cfa-faq__answer p {
	margin: 0;
	padding: 0 1.1em;
}
.cfa-faq__answer p:first-child { padding-top: .9em; }
.cfa-faq__answer p:last-child { padding-bottom: .9em; margin-bottom: 0; }

/* 10. Tables ------------------------------------------------------ */

.cfa-table-wrap {
	margin: var(--cfa-space-3) 0;
	overflow-x: auto;
	border: 1px solid var(--cfa-border);
	border-radius: var(--cfa-radius);
	-webkit-overflow-scrolling: touch;
	background:
		linear-gradient(to right, var(--cfa-bg) 30%, rgba(255,255,255,0)),
		linear-gradient(to left, var(--cfa-bg) 30%, rgba(255,255,255,0)) 100% 0,
		linear-gradient(to right, rgba(20,20,30,.08), rgba(20,20,30,0) 30%),
		linear-gradient(to left, rgba(20,20,30,.08), rgba(20,20,30,0) 30%) 100% 0;
	background-repeat: no-repeat;
	background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
	background-attachment: local, local, scroll, scroll;
}
.cfa-table__caption {
	font-weight: 700;
	font-size: .95rem;
	padding: .8em 1em 0;
	margin: 0;
	color: var(--cfa-text-muted);
}
table.cfa-table {
	width: 100%;
	border-collapse: collapse;
	font-size: .95rem;
	min-width: 480px;
}
table.cfa-table th,
table.cfa-table td {
	padding: .75em 1em;
	text-align: left;
	border-bottom: 1px solid var(--cfa-border);
}
table.cfa-table thead th {
	background: var(--cfa-surface);
	font-weight: 800;
	white-space: nowrap;
}
table.cfa-table tbody tr:last-child td { border-bottom: 0; }
table.cfa-table tbody tr:hover { background: var(--cfa-surface); }

/* 11. Images / figures ---------------------------------------------- */

.cfa-figure,
.cfa-article figure.wp-caption,
.cfa-article figure.wp-block-image {
	margin: var(--cfa-space-4) 0;
}
.cfa-figure img,
.cfa-article figure img {
	display: block;
	/* !important: themes commonly ship their own `.entry-content img` (or
	   similar) rule that caps images at their native pixel size instead of
	   the container width; without it, a smaller source image (e.g. a
	   399px-wide screenshot) rendered at native size instead of filling
	   the article column like every other figure. */
	width: 100% !important;
	height: auto !important;
	/* A fixed aspect ratio + object-fit crops every source image — whatever
	   its native dimensions — into one consistent frame. Without this, a
	   portrait screenshot next to a widescreen still made the article read
	   like a raw dump of mismatched images instead of an edited, curated
	   photo story. */
	aspect-ratio: 16 / 9;
	object-fit: cover;
	object-position: center 30%;
	border-radius: var(--cfa-radius);
	box-shadow: var(--cfa-shadow-sm);
}
.cfa-figure figcaption,
.cfa-article figure figcaption,
.cfa-article .wp-caption-text {
	margin-top: .7em;
	font-size: .88rem;
	color: var(--cfa-text-muted);
	text-align: center;
}

/* 12. Table of contents (inline card) -------------------------------- */

.cfa-toc {
	background: var(--cfa-surface);
	border: 1px solid var(--cfa-border);
	border-radius: var(--cfa-radius);
	margin: 0 0 var(--cfa-space-4);
	overflow: hidden;
}
.cfa-toc__toggle {
	width: 100%;
	display: flex;
	align-items: center;
	gap: .6em;
	background: transparent;
	border: 0;
	cursor: pointer;
	font: inherit;
	font-weight: 800;
	padding: 1em 1.2em;
	color: var(--cfa-text);
}
.cfa-toc__icon { width: 18px; height: 18px; color: var(--cfa-accent); flex: none; }
.cfa-toc__icon svg { width: 100%; height: 100%; }
.cfa-toc__title { flex: 1 1 auto; text-align: left; }
.cfa-toc__chevron { width: 14px; height: 14px; transition: transform .2s ease; }
.cfa-toc__chevron svg { width: 100%; height: 100%; }
.cfa-toc__toggle[aria-expanded="false"] .cfa-toc__chevron { transform: rotate(-90deg); }

.cfa-toc__list {
	list-style: none !important;
	margin: 0;
	padding: 0 1.2em 1.1em;
	counter-reset: cfa-toc-counter;
}
.cfa-toc__list[hidden] { display: none; }
.cfa-toc__item {
	list-style-type: none !important;
	margin: 0 0 .5em;
}
/* Only top-level entries advance the visible number — a sub-entry (h3
   under an h2) shows a dash instead (see .cfa-toc__item--sub below), but
   without this :not() the shared counter still incremented for every
   sub-entry, so the next top-level number silently skipped ahead by
   however many sub-headings sat between it and the previous one. */
.cfa-toc__item:not(.cfa-toc__item--sub) { counter-increment: cfa-toc-counter; }
.cfa-toc__item a {
	display: block;
	color: var(--cfa-text);
	text-decoration: none;
	font-size: .95rem;
	padding: .25em 0;
	border-bottom: 1px dashed transparent;
}
.cfa-toc__item a::before {
	content: counter(cfa-toc-counter) ".";
	color: var(--cfa-accent);
	font-weight: 800;
	margin-right: .5em;
}
.cfa-toc__item a:hover { border-bottom-color: var(--cfa-accent); }
.cfa-toc__item--sub { margin-left: 1.4em; }
.cfa-toc__item--sub a::before { content: "\2013"; }
.cfa-toc__item.is-active > a { color: var(--cfa-accent); }

/* 13. Floating "Jump to Section" widget ------------------------------- */

.cfa-toc-float {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 60;
	display: none;
	font-family: var(--cfa-font);
}
.cfa-toc-float__button {
	display: flex;
	align-items: center;
	gap: .5em;
	background: var(--cfa-text);
	color: #fff;
	border: 0;
	border-radius: 999px;
	padding: .85em 1.2em;
	font: inherit;
	font-weight: 700;
	font-size: .9rem;
	cursor: pointer;
	box-shadow: var(--cfa-shadow);
}
.cfa-toc-float__button svg { width: 16px; height: 16px; }
.cfa-toc-float__button:hover { background: var(--cfa-accent); }
.cfa-toc-float__panel {
	position: absolute;
	right: 0;
	bottom: calc(100% + 10px);
	width: 280px;
	max-height: 60vh;
	overflow-y: auto;
	background: var(--cfa-bg);
	border: 1px solid var(--cfa-border);
	border-radius: var(--cfa-radius);
	box-shadow: var(--cfa-shadow);
	padding: 1em 1.2em;
}
.cfa-toc-float__panel[hidden] { display: none; }
.cfa-toc-float__heading { font-weight: 800; margin: 0 0 .6em; }
.cfa-toc-float__list { list-style: none !important; margin: 0; padding: 0; }
.cfa-toc-float__list li { list-style-type: none !important; margin-bottom: .5em; }
.cfa-toc-float__list a {
	color: var(--cfa-text);
	text-decoration: none;
	font-size: .9rem;
}
.cfa-toc-float__list a:hover { color: var(--cfa-accent); }

@media (min-width: 1300px) {
	.cfa-toc-float { display: block; }
}

/* 14. Reading progress bar ------------------------------------------- */

.cfa-progress {
	position: fixed;
	top: 0; left: 0;
	width: 100%;
	height: 3px;
	background: transparent;
	z-index: 70;
}
.cfa-progress__bar {
	display: block;
	height: 100%;
	width: 0%;
	background: var(--cfa-accent);
	transition: width .1s linear;
}

/* 15. Author box ----------------------------------------------------- */

.cfa-author-box {
	display: flex;
	gap: var(--cfa-space-3);
	align-items: flex-start;
	background: var(--cfa-surface);
	border: 1px solid var(--cfa-border);
	border-radius: var(--cfa-radius-lg);
	padding: var(--cfa-space-3);
	margin: var(--cfa-space-5) 0 var(--cfa-space-4);
}
.cfa-author-box__avatar-link { flex: none; }
.cfa-author-box__avatar { border-radius: 50%; display: block; }
.cfa-author-box__label {
	margin: 0;
	text-transform: uppercase;
	font-size: .72rem;
	font-weight: 800;
	letter-spacing: .08em;
	color: var(--cfa-text-muted);
}
.cfa-author-box__name {
	display: inline-block;
	font-size: 1.15rem;
	font-weight: 800;
	color: var(--cfa-text);
	text-decoration: none;
	margin: .1em 0 .4em;
}
.cfa-author-box__name:hover { color: var(--cfa-accent); }
.cfa-author-box__bio { margin: 0 0 .6em; color: var(--cfa-text-muted); font-size: .95rem; }
.cfa-author-box__links { display: flex; gap: 1em; flex-wrap: wrap; }
.cfa-author-box__link { font-size: .85rem; font-weight: 700; }

/* 16. Related posts ---------------------------------------------------- */

.cfa-related { margin: var(--cfa-space-4) 0 0; }
.cfa-related__title {
	font-size: 1.3rem;
	font-weight: 800;
	margin: 0 0 var(--cfa-space-2);
}
.cfa-related__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--cfa-space-2);
}
.cfa-related__card {
	display: block;
	text-decoration: none;
	color: var(--cfa-text);
	border-radius: var(--cfa-radius);
	overflow: hidden;
	background: var(--cfa-surface);
	border: 1px solid var(--cfa-border);
	transition: transform .18s ease, box-shadow .18s ease;
}
.cfa-related__card:hover { transform: translateY(-3px); box-shadow: var(--cfa-shadow); }
.cfa-related__thumb { display: block; aspect-ratio: 16 / 10; overflow: hidden; }
.cfa-related__thumb img {
	/* !important: WordPress prints these thumbnails with the theme's own
	   `.wp-post-image` / `.attachment-medium_large` classes and a srcset,
	   which themes commonly pair with their own sizing rule (e.g. `height:
	   auto`) that outranks a plain, unqualified declaration here — letting
	   the image render at its native proportions instead of filling this
	   fixed-aspect-ratio card and stretching tall. */
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	display: block;
}
.cfa-related__card-title {
	display: block;
	padding: .9em 1em;
	font-weight: 700;
	font-size: .95rem;
	line-height: 1.4;
}

/* 17. Responsive ------------------------------------------------------- */

@media (max-width: 640px) {
	.cfa-article { font-size: 1.02rem; }
	.cfa-quote__text { font-size: 1.1rem; }
	.cfa-related__grid { grid-template-columns: 1fr 1fr; }
	.cfa-author-box { flex-direction: column; align-items: flex-start; }
	.cfa-toc-float__panel { width: min(280px, 80vw); }
}

@media (max-width: 420px) {
	.cfa-related__grid { grid-template-columns: 1fr; }
}

/* 18. Dark mode ---------------------------------------------------------- */

/* Opt-in only (Settings -> CineFrame Articles -> "Dark mode variant"), via
   a `.cfa-dark-mode` class the Content Enhancer adds to the wrapper. This
   is deliberately NOT keyed off `prefers-color-scheme`: the article sits
   inside a theme-controlled page whose background we don't control, so
   following the visitor's OS-level preference independently of the theme
   produces mismatched light-theme-page + dark-article results. */
.cfa-article.cfa-dark-mode {
	--cfa-bg: #121216;
	--cfa-surface: #1b1b21;
	--cfa-surface-2: #232329;
	--cfa-border: #2c2c34;
	--cfa-text: #f2f2f5;
	--cfa-text-muted: #a6a6b3;
	--cfa-shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 28px rgba(0,0,0,.45);
	--cfa-shadow-sm: 0 1px 3px rgba(0,0,0,.4);
}
.cfa-article.cfa-dark-mode .cfa-toc-float__button { background: var(--cfa-accent); }
.cfa-article.cfa-dark-mode table.cfa-table thead th { background: var(--cfa-surface-2); }

/* 19. Accessibility / motion ---------------------------------------------- */

.cfa-article :focus-visible,
.cfa-toc-float :focus-visible {
	outline: 2px solid var(--cfa-accent);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.cfa-article *,
	.cfa-toc-float * ,
	.cfa-progress__bar {
		transition-duration: 0.001ms !important;
		animation-duration: 0.001ms !important;
	}
}

.cfa-article [hidden] { display: none !important; }
