/**
 * MarketForge — blog articles.
 *
 * Styles every blog post (native WordPress editor, Elementor's Post Content
 * widget, any theme): the plugin wraps the post content in .mf-article.
 * Colours and fonts are the Design settings tokens (--mf-*), so posts follow
 * the site's design, light and dark. Article components use the mfa- prefix:
 * mfa-lead, mfa-takeaways, mfa-toc, mfa-figure, mfa-checklist, mfa-stats,
 * mfa-steps, mfa-proscons, mfa-note / mfa-tip / mfa-warning, mfa-table,
 * mfa-faq, mfa-sources, mfa-cta, mfa-btn.
 */

.mf-article {
	--mfa-primary: var(--mf-primary, #4f46e5);
	--mfa-accent: var(--mf-accent, #f59e0b);
	--mfa-text: var(--mf-text, #0f172a);
	--mfa-muted: var(--mf-text-muted, #64748b);
	--mfa-border: var(--mf-border, #e2e8f0);
	--mfa-surface: var(--mf-surface, #ffffff);
	--mfa-soft: var(--mf-surface-alt, #f8fafc);
	--mfa-success: var(--mf-success, #16a34a);
	--mfa-warning: var(--mf-warning, #d97706);
	--mfa-radius: var(--mf-radius, 12px);
	--mfa-primary-soft: color-mix(in srgb, var(--mfa-primary) 9%, var(--mfa-surface));
	--mfa-accent-soft: color-mix(in srgb, var(--mfa-accent) 13%, var(--mfa-surface));
	--mfa-success-soft: color-mix(in srgb, var(--mfa-success) 11%, var(--mfa-surface));
	--mfa-warning-soft: color-mix(in srgb, var(--mfa-warning) 12%, var(--mfa-surface));

	/* No width of its own: the theme or page builder decides (Settings → Blog articles can set one). */
	box-sizing: border-box;
	color: var(--mfa-text);
	font-family: var(--mf-font-body, inherit);
	font-size: 1.0625rem;
	line-height: 1.75;
	overflow-wrap: break-word;
	-webkit-font-smoothing: antialiased;
}

.mf-article *,
.mf-article *::before,
.mf-article *::after {
	box-sizing: inherit;
}

/* ---------- Text ---------- */

.mf-article p,
.mf-article ul,
.mf-article ol,
.mf-article dl,
.mf-article table,
.mf-article pre {
	margin: 0 0 1.25em;
}

.mf-article h2,
.mf-article h3,
.mf-article h4 {
	font-family: var(--mf-font-heading, inherit);
	color: var(--mfa-text);
	line-height: 1.25;
	letter-spacing: -0.015em;
	scroll-margin-top: calc(90px + var(--wp-admin--admin-bar--height, 0px));
}

.mf-article h2 {
	margin: 2.1em 0 0.6em;
	font-size: clamp(1.5rem, 1.1rem + 1.4vw, 1.95rem);
	font-weight: 800;
}

.mf-article h3 {
	margin: 1.7em 0 0.45em;
	font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.35rem);
	font-weight: 700;
}

.mf-article h4 {
	margin: 1.4em 0 0.4em;
	font-size: 1.08rem;
	font-weight: 700;
}

.mf-article a {
	color: var(--mfa-primary);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

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

.mf-article a:focus-visible {
	outline: 2px solid var(--mfa-primary);
	outline-offset: 2px;
	border-radius: 3px;
}

.mf-article strong {
	font-weight: 700;
	color: var(--mfa-text);
}

.mf-article ul,
.mf-article ol {
	padding-left: 1.35em;
}

.mf-article li {
	margin: 0.4em 0;
}

.mf-article li::marker {
	color: var(--mfa-primary);
	font-weight: 700;
}

.mf-article hr,
.mf-article .wp-block-separator {
	margin: 2.4em 0;
	border: 0;
	border-top: 1px solid var(--mfa-border);
}

.mf-article code {
	padding: 0.12em 0.4em;
	border-radius: 6px;
	background: var(--mfa-soft);
	font-size: 0.9em;
}

.mf-article pre {
	padding: 1em 1.2em;
	overflow-x: auto;
	border: 1px solid var(--mfa-border);
	border-radius: var(--mfa-radius);
	background: var(--mfa-soft);
	font-size: 0.9em;
	line-height: 1.6;
}

.mf-article pre code {
	padding: 0;
	background: none;
}

/* ---------- Quotes ---------- */

.mf-article blockquote,
.mf-article .wp-block-quote {
	margin: 1.8em 0;
	padding: 0.4em 0 0.4em 1.2em;
	border-left: 4px solid var(--mfa-primary);
	color: var(--mfa-text);
	font-size: 1.08em;
}

.mf-article blockquote p:last-child {
	margin-bottom: 0;
}

.mf-article blockquote cite,
.mf-article .wp-block-quote cite {
	display: block;
	margin-top: 0.5em;
	color: var(--mfa-muted);
	font-size: 0.85em;
	font-style: normal;
}

.mf-article .wp-block-pullquote {
	margin: 2em 0;
	padding: 1.4em 1.6em;
	border: 0;
	border-radius: var(--mfa-radius);
	background: var(--mfa-primary-soft);
	text-align: left;
}

.mf-article .wp-block-pullquote blockquote {
	margin: 0;
	padding: 0;
	border: 0;
	font-family: var(--mf-font-heading, inherit);
	font-size: 1.3em;
	font-weight: 700;
	line-height: 1.4;
}

/* ---------- Images ---------- */

.mf-article img {
	max-width: 100%;
	height: auto;
}

.mf-article figure,
.mf-article .wp-block-image {
	margin: 2em 0;
}

.mf-article .wp-block-image img,
.mf-article .mfa-figure img {
	display: block;
	width: 100%;
	border: 1px solid var(--mfa-border);
	border-radius: var(--mfa-radius);
}

.mf-article figcaption,
.mf-article .wp-element-caption {
	margin-top: 0.7em;
	color: var(--mfa-muted);
	font-size: 0.88em;
	line-height: 1.5;
	text-align: center;
}

/* ---------- Tables ---------- */

.mf-article .mfa-table,
.mf-article .wp-block-table {
	margin: 1.8em 0;
	overflow-x: auto;
	border: 1px solid var(--mfa-border);
	border-radius: var(--mfa-radius);
	-webkit-overflow-scrolling: touch;
}

.mf-article table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.94em;
	line-height: 1.5;
}

.mf-article .mfa-table table,
.mf-article .wp-block-table table {
	margin: 0;
}

.mf-article th,
.mf-article td {
	padding: 0.75em 0.9em;
	border-bottom: 1px solid var(--mfa-border);
	text-align: left;
	vertical-align: top;
}

.mf-article thead th {
	background: var(--mfa-soft);
	font-weight: 700;
	white-space: nowrap;
}

.mf-article tbody tr:last-child td {
	border-bottom: 0;
}

/* ---------- Buttons (native and article) ---------- */

.mf-article .wp-block-button__link,
.mf-article .mfa-btn {
	display: inline-block;
	padding: 0.75em 1.3em;
	border: 1.5px solid var(--mfa-primary);
	border-radius: 10px;
	background: var(--mfa-primary);
	color: var(--mf-on-primary, #fff);
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
}

.mf-article .wp-block-button__link:hover,
.mf-article .mfa-btn:hover {
	filter: brightness(0.92);
	text-decoration: none;
}

/* ---------- Article components ---------- */

.mf-article .mfa-lead {
	font-size: 1.2em;
	line-height: 1.6;
	color: var(--mfa-text);
}

.mf-article .mfa-takeaways,
.mf-article .mfa-toc,
.mf-article .mfa-note,
.mf-article .mfa-tip,
.mf-article .mfa-warning {
	margin: 1.8em 0;
	padding: 1.2em 1.4em;
	border: 1px solid var(--mfa-border);
	border-radius: var(--mfa-radius);
	background: var(--mfa-soft);
}

.mf-article .mfa-takeaways {
	border-left: 4px solid var(--mfa-primary);
	background: var(--mfa-primary-soft);
}

.mf-article .mfa-takeaways__title,
.mf-article .mfa-toc__title,
.mf-article .mfa-note__title {
	margin: 0 0 0.5em;
	font-family: var(--mf-font-heading, inherit);
	font-weight: 800;
	font-size: 1.05em;
	color: var(--mfa-text);
}

.mf-article .mfa-takeaways ul,
.mf-article .mfa-toc ol {
	margin: 0;
}

.mf-article .mfa-toc ol {
	columns: 2;
	column-gap: 2em;
}

.mf-article .mfa-toc li {
	break-inside: avoid;
	margin: 0.25em 0;
}

.mf-article .mfa-toc a {
	text-decoration: none;
}

.mf-article .mfa-toc a:hover {
	text-decoration: underline;
}

.mf-article .mfa-note p:last-child,
.mf-article .mfa-tip p:last-child,
.mf-article .mfa-warning p:last-child {
	margin-bottom: 0;
}

.mf-article .mfa-tip {
	border-left: 4px solid var(--mfa-success);
	background: var(--mfa-success-soft);
}

.mf-article .mfa-warning {
	border-left: 4px solid var(--mfa-warning);
	background: var(--mfa-warning-soft);
}

.mf-article .mfa-figure {
	margin: 2.2em 0;
}

.mf-article .mfa-checklist {
	list-style: none;
	margin: 1.6em 0;
	padding: 1.2em 1.4em;
	border: 1px solid color-mix(in srgb, var(--mfa-success) 35%, var(--mfa-border));
	border-radius: var(--mfa-radius);
	background: var(--mfa-success-soft);
}

.mf-article .mfa-checklist li {
	position: relative;
	padding-left: 2em;
}

.mf-article .mfa-checklist li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.28em;
	width: 1.25em;
	height: 1.25em;
	border-radius: 50%;
	background: var(--mfa-success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 0.75em no-repeat;
}

.mf-article .mfa-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 0.8em;
	margin: 1.8em 0;
}

.mf-article .mfa-stat {
	padding: 1em 1.1em;
	border: 1px solid var(--mfa-border);
	border-radius: var(--mfa-radius);
	background: var(--mfa-surface);
}

.mf-article .mfa-stat strong {
	display: block;
	font-family: var(--mf-font-heading, inherit);
	font-size: 1.7em;
	line-height: 1.15;
	color: var(--mfa-primary);
}

.mf-article .mfa-stat span {
	display: block;
	margin-top: 0.3em;
	color: var(--mfa-muted);
	font-size: 0.85em;
	line-height: 1.45;
}

.mf-article .mfa-steps {
	list-style: none;
	counter-reset: mfa-step;
	padding: 0;
}

.mf-article .mfa-steps > li {
	position: relative;
	counter-increment: mfa-step;
	margin: 0 0 1em;
	padding-left: 2.8em;
}

.mf-article .mfa-steps > li::before {
	content: counter(mfa-step);
	position: absolute;
	left: 0;
	top: 0.05em;
	display: grid;
	place-items: center;
	width: 1.9em;
	height: 1.9em;
	border-radius: 50%;
	background: var(--mfa-primary);
	color: var(--mf-on-primary, #fff);
	font-weight: 800;
	font-size: 0.9em;
}

.mf-article .mfa-proscons {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 0.8em;
	margin: 1.8em 0;
}

.mf-article .mfa-pros,
.mf-article .mfa-cons {
	padding: 1em 1.2em;
	border: 1px solid var(--mfa-border);
	border-radius: var(--mfa-radius);
}

.mf-article .mfa-pros {
	background: var(--mfa-success-soft);
}

.mf-article .mfa-cons {
	background: var(--mfa-warning-soft);
}

.mf-article .mfa-pros ul,
.mf-article .mfa-cons ul {
	margin: 0;
}

.mf-article .mfa-faq details,
.mf-article details.wp-block-details {
	margin: 0.6em 0;
	padding: 0.9em 1.1em;
	border: 1px solid var(--mfa-border);
	border-radius: var(--mfa-radius);
	background: var(--mfa-surface);
}

.mf-article .mfa-faq summary,
.mf-article details.wp-block-details summary {
	cursor: pointer;
	font-family: var(--mf-font-heading, inherit);
	font-weight: 700;
}

.mf-article .mfa-faq details[open] summary,
.mf-article details.wp-block-details[open] summary {
	margin-bottom: 0.5em;
}

.mf-article .mfa-sources {
	margin-top: 2.4em;
	padding-top: 1em;
	border-top: 1px solid var(--mfa-border);
	color: var(--mfa-muted);
	font-size: 0.86em;
}

.mf-article .mfa-sources ol {
	margin: 0;
}

.mf-article .mfa-cta {
	display: flex;
	flex-wrap: wrap;
	gap: 1.1em;
	align-items: center;
	justify-content: space-between;
	margin: 2.4em 0;
	padding: 1.6em;
	border-radius: calc(var(--mfa-radius) + 4px);
	background: linear-gradient(135deg, color-mix(in srgb, var(--mfa-primary) 35%, #0b1120), var(--mfa-primary));
	color: #fff;
}

.mf-article .mfa-cta__title {
	margin: 0 0 0.2em;
	font-family: var(--mf-font-heading, inherit);
	font-size: 1.3em;
	font-weight: 800;
	line-height: 1.3;
	color: #fff;
}

.mf-article .mfa-cta p {
	margin: 0.25em 0;
	color: color-mix(in srgb, #fff 85%, var(--mfa-primary));
}

.mf-article .mfa-cta__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6em;
}

.mf-article .mfa-cta .mfa-btn {
	border-color: #fff;
	background: #fff;
	color: color-mix(in srgb, var(--mfa-primary) 75%, #000);
}

.mf-article .mfa-cta .mfa-btn--ghost {
	border-color: color-mix(in srgb, #fff 60%, transparent);
	background: transparent;
	color: #fff;
}

.mf-article .mfa-author {
	display: flex;
	gap: 1em;
	align-items: flex-start;
	margin-top: 2.6em;
	padding: 1.2em 1.4em;
	border: 1px solid var(--mfa-border);
	border-radius: var(--mfa-radius);
}

.mf-article .mfa-author__name {
	margin: 0;
	font-weight: 800;
}

.mf-article .mfa-author__bio {
	margin: 0.2em 0 0;
	color: var(--mfa-muted);
	font-size: 0.92em;
}

/* A link to an article that is not published yet shows as plain text. */
.mf-article .mfa-soon {
	color: inherit;
}

@media (max-width: 640px) {
	.mf-article {
		font-size: 1rem;
	}

	.mf-article .mfa-toc ol {
		columns: 1;
	}

	.mf-article .mfa-cta {
		padding: 1.3em;
	}
}

@media print {
	.mf-article .mfa-cta,
	.mf-article .mfa-toc {
		display: none;
	}
}

/* ------------------------------------------------------------------------
 * Article shell: header (category, title, summary, byline, cover image),
 * content and footer (tags, author box). --mfa-w is the text width from
 * Settings → Blog articles (none = the theme's width), --mfa-space the room
 * above and below.
 * --------------------------------------------------------------------- */

.mf-article-shell {
	--mfa-primary: var(--mf-primary, #4f46e5);
	--mfa-accent: var(--mf-accent, #f59e0b);
	--mfa-text: var(--mf-text, #0f172a);
	--mfa-muted: var(--mf-text-muted, #64748b);
	--mfa-border: var(--mf-border, #e2e8f0);
	--mfa-surface: var(--mf-surface, #ffffff);
	--mfa-radius: var(--mf-radius, 12px);
	--mfa-gap: clamp(28px, 4vw, 44px);
	position: relative;
	box-sizing: border-box;
	padding-block: clamp(calc(var(--mfa-space, 48px) * 0.5), 5vw, var(--mfa-space, 48px));
	color: var(--mfa-text);
	font-family: var(--mf-font-body, inherit);
}

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

/* The full-width colour bands never cause sideways scrolling. */
body.mf-article-page {
	overflow-x: clip;
}

body.mf-article-page--bg-page {
	background-image: linear-gradient(180deg, color-mix(in srgb, var(--mf-primary, #4f46e5) 8%, var(--mf-bg, #fff)) 0, color-mix(in srgb, var(--mf-accent, #f59e0b) 5%, var(--mf-bg, #fff)) 420px, var(--mf-bg, #fff) 900px);
	background-repeat: no-repeat;
}

/* Header ------------------------------------------------------------------ */

.mfa-hero {
	position: relative;
	isolation: isolate;
	margin: 0 0 var(--mfa-gap);
}

.mfa-hero__inner {
	display: grid;
	justify-items: start;
	gap: 14px;
	max-width: var(--mfa-w, none);
	margin-inline: auto;
}

.mfa-hero__inner > * {
	margin: 0;
}

/* Soft colour band behind the header: full width of the window, fading out. */
.mf-article-shell--hero .mfa-hero::before {
	content: "";
	position: absolute;
	z-index: -1;
	inset-block: calc(-1 * clamp(calc(var(--mfa-space, 48px) * 0.5), 5vw, var(--mfa-space, 48px))) 0;
	inset-inline: calc(50% - 50vw);
	background:
		radial-gradient(60% 120% at 12% 0%, color-mix(in srgb, var(--mfa-primary) 14%, transparent), transparent 70%),
		radial-gradient(50% 100% at 92% 10%, color-mix(in srgb, var(--mfa-accent) 12%, transparent), transparent 70%),
		linear-gradient(180deg, color-mix(in srgb, var(--mfa-primary) 6%, var(--mf-bg, #fff)), var(--mf-bg, #fff));
}

/* With a cover image the band stops halfway down the image. */
.mf-article-shell--hero .mfa-hero:has(.mfa-cover)::before {
	inset-block-end: clamp(120px, 18vw, 260px);
}

.mfa-hero__cat {
	display: inline-flex;
	align-items: center;
	padding: 5px 12px;
	border: 1px solid color-mix(in srgb, var(--mfa-primary) 25%, transparent);
	border-radius: 999px;
	background: color-mix(in srgb, var(--mfa-primary) 9%, var(--mfa-surface));
	color: var(--mfa-primary) !important;
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	line-height: 1.3;
	text-decoration: none !important;
	text-transform: uppercase;
}

.mfa-hero__cat:hover,
.mfa-hero__cat:focus-visible {
	background: color-mix(in srgb, var(--mfa-primary) 15%, var(--mfa-surface));
}

.mfa-hero__title {
	color: var(--mfa-text);
	font-family: var(--mf-font-heading, inherit);
	font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3rem);
	font-weight: var(--mf-heading-weight, 800);
	letter-spacing: -0.02em;
	line-height: 1.15;
	overflow-wrap: break-word;
	text-wrap: balance;
}

.mfa-hero__summary {
	max-width: 62ch;
	color: var(--mfa-muted);
	font-size: clamp(1.05rem, 1rem + 0.35vw, 1.22rem);
	line-height: 1.6;
}

.mfa-hero__meta {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 4px !important;
}

.mfa-hero__avatar,
.mfa-writer__avatar {
	position: relative;
	display: grid;
	flex: 0 0 auto;
	place-items: center;
	overflow: hidden;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--mfa-primary), color-mix(in srgb, var(--mfa-primary) 55%, var(--mfa-accent)));
	color: var(--mf-on-primary, #fff);
	font-weight: 800;
}

.mfa-hero__avatar {
	width: 42px;
	height: 42px;
	font-size: 1rem;
}

.mfa-hero__avatar img,
.mfa-writer__avatar img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.mfa-hero__by {
	display: grid;
	gap: 1px;
	line-height: 1.35;
}

.mfa-hero__author {
	font-weight: 700;
}

.mfa-hero__facts {
	display: flex;
	flex-wrap: wrap;
	gap: 0 8px;
	color: var(--mfa-muted);
	font-size: 0.9rem;
}

/* Cover image ------------------------------------------------------------- */

.mfa-cover {
	max-width: var(--mfa-w, none);
	margin: var(--mfa-gap) auto 0;
	padding: 0;
}

.mfa-cover--wide {
	max-width: calc(var(--mfa-w, 100%) + 160px);
}

.mfa-cover__img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: calc(var(--mfa-radius) * 1.4);
	box-shadow: 0 1px 2px rgb(15 23 42 / 0.06), 0 18px 40px -18px rgb(15 23 42 / 0.35);
	aspect-ratio: auto;
}

/* Footer: tags and the author box ----------------------------------------- */

.mfa-end {
	display: grid;
	gap: 22px;
	max-width: var(--mfa-w, none);
	margin: var(--mfa-gap) auto 0;
	padding-top: var(--mfa-gap);
	border-top: 1px solid var(--mfa-border);
}

.mfa-end__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.mfa-end__tags a {
	display: inline-flex;
	padding: 5px 12px;
	border: 1px solid var(--mfa-border);
	border-radius: 999px;
	background: var(--mfa-surface);
	color: var(--mfa-muted) !important;
	font-size: 0.86rem;
	font-weight: 600;
	text-decoration: none !important;
}

.mfa-end__tags a:hover,
.mfa-end__tags a:focus-visible {
	border-color: color-mix(in srgb, var(--mfa-primary) 40%, var(--mfa-border));
	color: var(--mfa-primary) !important;
}

.mfa-writer {
	display: flex;
	align-items: flex-start;
	gap: 18px;
	padding: 22px 24px;
	border: 1px solid color-mix(in srgb, var(--mfa-primary) 18%, var(--mfa-border));
	border-radius: calc(var(--mfa-radius) * 1.2);
	background: linear-gradient(135deg, color-mix(in srgb, var(--mfa-primary) 7%, var(--mfa-surface)), var(--mfa-surface) 70%);
}

.mfa-writer__avatar {
	width: 64px;
	height: 64px;
	font-size: 1.5rem;
}

.mfa-writer__body > * {
	margin: 0;
}

.mfa-writer__label {
	color: var(--mfa-muted);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.mfa-writer__name {
	margin-top: 2px !important;
	font-family: var(--mf-font-heading, inherit);
	font-size: 1.15rem;
	font-weight: 800;
}

.mfa-writer__bio {
	margin-top: 6px !important;
	color: var(--mfa-muted);
	font-size: 0.95rem;
	line-height: 1.6;
}

@media (max-width: 560px) {
	.mfa-writer {
		flex-direction: column;
		gap: 12px;
		padding: 18px;
	}

	.mfa-cover__img {
		border-radius: var(--mfa-radius);
	}
}
