/**
 * Post/page content elements — single source of truth for frontend + Block + Classic.
 * All values alias design tokens.
 * Scope: :is(.entry-content, .editor-styles-wrapper, body.mce-content-body)
 */

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) {
	--content-stack: var(--space-6);
	--content-stack-sm: var(--space-2);
	--content-indent: var(--space-6);
	--content-indent-nested: var(--space-5);
	--content-pad-block: var(--space-5);
	--content-pad-inline: var(--space-7);
	--content-marker: var(--color-primary);
	--content-quote-border: var(--space-1);
	--content-heading-accent: var(--space-1);
	--content-code-bg: var(--color-bg-alt);
	--content-mark-bg: var(--color-surface-tint-strong);
	--content-leading: var(--leading-relaxed);
	--content-size: clamp(var(--text-md), 1rem + 0.4vw, var(--text-xl));
	--content-h1: var(--text-display-md);
	--content-h2: clamp(var(--text-4xl), 2rem + 0.75vw, var(--text-5xl));
	--content-h3: clamp(var(--text-3xl), 1.7rem + 0.65vw, var(--text-4xl));
	--content-h4: clamp(var(--text-xl), 1.15rem + 0.4vw, var(--text-2xl));
	--content-h5: var(--text-xl);
	--content-h6: var(--text-base);
	--content-quote-size: clamp(var(--text-lg), 1.1rem + 0.45vw, var(--text-xl));
	--content-pullquote-size: clamp(var(--text-xl), 1.2rem + 0.7vw, var(--text-2xl));
	--content-table-size: clamp(var(--text-sm), 0.9rem + 0.25vw, var(--text-base));
	--content-meta-size: var(--text-sm);
	--content-tiny-size: var(--text-xs);
	/* Section breaks: h2 largest top gap, h3 a step under, other headings share the base */
	--content-heading-margin-top: var(--space-16);
	--content-h2-margin-top: var(--space-16);
	--content-h3-margin-top: var(--space-12);
	--content-heading-margin-bottom: var(--space-4);
	--content-media-margin: var(--space-8);
	--content-align-float-width: min(50%, 20rem);
	--content-align-float-gap: var(--space-6);

	font-family: var(--font-body);
	font-size: var(--content-size);
	line-height: var(--content-leading);
	color: var(--color-fg);
}

/* Stack rhythm: frontend + Classic direct children; Block uses layout list */
body.socialbuzz-theme .entry-content > :where(* + *),
body.mce-content-body > :where(* + *),
.editor-styles-wrapper .block-editor-block-list__layout > :where(* + *) {
	margin-block-start: var(--content-stack);
}

/* ----- Headings ----- */
:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(h1, h2, h3, h4, h5, h6) {
	font-family: var(--font-display);
	font-weight: var(--weight-semibold);
	color: var(--color-fg);
	line-height: var(--leading-snug);
	margin: var(--content-heading-margin-top) 0 var(--content-heading-margin-bottom);
	text-wrap: balance;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(h1) {
	font-size: var(--content-h1);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(h2) {
	font-size: var(--content-h2);
	margin-block-start: var(--content-h2-margin-top);
	border-inline-start: var(--content-heading-accent) solid var(--color-primary);
	padding-inline-start: var(--space-4);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(h3) {
	font-size: var(--content-h3);
	margin-block-start: var(--content-h3-margin-top);
	border-inline-start: var(--content-heading-accent) solid var(--color-primary);
	padding-inline-start: var(--space-3);
}

/* After level rules so first in-content heading stays compact under the hero */
body.socialbuzz-theme .entry-content > :where(h1, h2, h3, h4, h5, h6):first-child,
body.mce-content-body > :where(h1, h2, h3, h4, h5, h6):first-child,
.editor-styles-wrapper .block-editor-block-list__layout > :where(h1, h2, h3, h4, h5, h6):first-child {
	margin-block-start: var(--space-4);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(h4) {
	font-size: var(--content-h4);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(h5) {
	font-size: var(--content-h5);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(h6) {
	font-size: var(--content-h6);
	color: var(--color-fg-muted);
	letter-spacing: var(--tracking-wide);
	text-transform: uppercase;
}

/* ----- Text ----- */
:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(p) {
	margin: 0 0 var(--content-stack);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(a) {
	color: var(--color-link);
	text-decoration: underline;
	text-decoration-color: var(--color-border-strong);
	text-underline-offset: var(--space-1);
	transition: color var(--duration-fast) var(--ease-standard);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(a:hover) {
	color: var(--color-link-hover);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(strong, b) {
	font-weight: var(--weight-semibold);
	color: var(--color-fg);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(em, i) {
	font-style: italic;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(small) {
	font-size: var(--content-meta-size);
	color: var(--color-fg-muted);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(mark) {
	background: var(--content-mark-bg);
	color: var(--color-fg);
	padding-inline: var(--space-1);
	border-radius: var(--radius-sm);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(sup, sub) {
	font-size: var(--content-tiny-size);
	line-height: 0;
}

/* ----- Lists ----- */
:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(ul, ol, .wp-block-list) {
	margin-block: 0 var(--content-stack);
	margin-inline: var(--content-indent) 0;
	padding: 0;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(ul) {
	list-style: disc;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(ol) {
	list-style: decimal;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(ul, ol) :where(ul, ol) {
	margin-block: var(--content-stack-sm) 0;
	margin-inline-start: var(--content-indent-nested);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(li) {
	margin-bottom: var(--content-stack-sm);
	padding-inline-start: var(--space-1);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(li)::marker {
	color: var(--content-marker);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(li > ul, li > ol) {
	margin-bottom: 0;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(dl) {
	margin: 0 0 var(--content-stack);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(dt) {
	font-weight: var(--weight-semibold);
	margin-top: var(--content-stack-sm);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(dd) {
	margin-block: 0 var(--content-stack-sm);
	margin-inline: var(--content-indent) 0;
	color: var(--color-fg-muted);
}

/* ----- Quotes ----- */
:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(blockquote, .wp-block-quote) {
	margin: var(--content-media-margin) 0;
	padding: var(--content-pad-block) var(--content-pad-inline);
	background: var(--color-surface-tint);
	border-inline-start: var(--content-quote-border) solid var(--color-primary);
	border-radius: var(--radius-md);
	font-style: italic;
	font-size: var(--content-quote-size);
	line-height: var(--leading-relaxed);
	color: var(--color-fg);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(blockquote p:last-child, .wp-block-quote p:last-child) {
	margin-bottom: 0;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(cite, .wp-block-quote cite) {
	display: block;
	margin-top: var(--space-3);
	font-size: var(--content-meta-size);
	font-style: normal;
	font-weight: var(--weight-medium);
	color: var(--color-fg-muted);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.wp-block-pullquote) {
	margin: var(--content-media-margin) 0;
	padding: var(--content-pad-block) var(--content-pad-inline);
	border-block: var(--border-width) solid var(--color-border-strong);
	background: transparent;
	text-align: center;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.wp-block-pullquote blockquote) {
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	font-size: var(--content-pullquote-size);
	font-family: var(--font-display);
}

/* ----- Code ----- */
:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(code, kbd, samp) {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: var(--content-meta-size);
	background: var(--content-code-bg);
	color: var(--color-fg);
	padding: var(--space-0) var(--space-1);
	border-radius: var(--radius-sm);
	border: var(--border-width) solid var(--color-border);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(kbd) {
	font-weight: var(--weight-medium);
	box-shadow: var(--shadow-sm);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(pre, .wp-block-code, .wp-block-preformatted) {
	margin: 0 0 var(--content-stack);
	padding: var(--content-pad-block) var(--content-pad-inline);
	background: var(--content-code-bg);
	border: var(--border-width) solid var(--color-border);
	border-radius: var(--radius-md);
	overflow-x: auto;
	font-size: var(--content-meta-size);
	line-height: var(--leading-normal);
	color: var(--color-fg);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(pre code, .wp-block-code code) {
	background: transparent;
	border: 0;
	padding: 0;
	font-size: inherit;
	border-radius: 0;
}

/* ----- Media ----- */
:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(img, video, embed, object) {
	max-width: 100%;
	height: auto;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(iframe) {
	max-width: 100%;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.wp-block-embed__wrapper, .wp-block-embed) {
	position: relative;
	max-width: 100%;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.wp-block-embed iframe, .wp-has-aspect-ratio iframe) {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(img) {
	display: block;
	margin: var(--content-media-margin) auto;
	border-radius: var(--radius-md);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(figure, .wp-block-image) {
	margin: var(--content-media-margin) 0;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(figure img, .wp-block-image img) {
	margin: 0 auto;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(figcaption, .wp-caption-text, .wp-element-caption) {
	margin-top: var(--space-2);
	font-size: var(--content-meta-size);
	line-height: var(--leading-normal);
	color: var(--color-fg-muted);
	text-align: center;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.wp-caption) {
	max-width: 100%;
	margin: var(--content-media-margin) auto;
}

/* ----- Alignments (Classic floats + Block wide/full; column-safe) ----- */
:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.alignleft) {
	float: inline-start;
	margin-block: var(--space-2) var(--content-align-float-gap);
	margin-inline: 0 var(--content-align-float-gap);
	max-width: var(--content-align-float-width);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.alignright) {
	float: inline-end;
	margin-block: var(--space-2) var(--content-align-float-gap);
	margin-inline: var(--content-align-float-gap) 0;
	max-width: var(--content-align-float-width);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.aligncenter) {
	display: block;
	float: none;
	margin-block: var(--content-media-margin);
	margin-inline: auto;
	text-align: center;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.alignnone) {
	float: none;
	margin: var(--content-media-margin) 0;
	max-width: 100%;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.alignleft img, .alignright img, .aligncenter img, .alignnone img) {
	margin: 0;
	display: inline-block;
	vertical-align: middle;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.wp-caption.alignleft, .wp-caption.alignright) {
	max-width: var(--content-align-float-width);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.alignwide, .wp-block[data-align='wide'] > *) {
	width: 100%;
	max-width: 100%;
	margin-inline: 0;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.alignfull, .wp-block[data-align='full'] > *) {
	width: 100%;
	max-width: 100%;
	margin-inline: 0;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body)::after {
	content: '';
	display: table;
	clear: both;
}

/* ----- Tables ----- */
:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(table, .wp-block-table table) {
	width: 100%;
	margin: 0 0 var(--content-stack);
	border-collapse: collapse;
	font-size: var(--content-table-size);
	line-height: var(--leading-normal);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(th, td, .wp-block-table th, .wp-block-table td) {
	padding: var(--space-3) var(--space-4);
	border: var(--border-width) solid var(--color-border);
	text-align: start;
	vertical-align: top;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(th, .wp-block-table th) {
	font-weight: var(--weight-semibold);
	background: var(--color-surface-tint);
	color: var(--color-fg);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(thead th) {
	border-bottom-width: calc(var(--border-width) * 2);
	border-bottom-color: var(--color-border-strong);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(tbody tr:nth-child(even)) {
	background: var(--color-bg-alt);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.wp-block-table) {
	margin: 0 0 var(--content-stack);
	overflow-x: auto;
}

/* ----- Rules ----- */
:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(hr, .wp-block-separator) {
	margin: var(--content-media-margin) 0;
	border: 0;
	border-top: var(--border-width) solid var(--color-border);
	background: transparent;
	height: 0;
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.wp-block-separator.is-style-wide) {
	border-top-width: calc(var(--border-width) * 2);
	border-top-color: var(--color-border-strong);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.wp-block-separator.is-style-dots) {
	border: 0;
	text-align: center;
	color: var(--color-fg-subtle);
	letter-spacing: var(--tracking-wider);
}

/* ----- Page links (multipage posts) ----- */
:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.page-links) {
	margin-top: var(--content-stack);
	padding-top: var(--content-stack);
	border-top: var(--border-width) solid var(--color-border);
	font-size: var(--content-meta-size);
	font-weight: var(--weight-medium);
	color: var(--color-fg-muted);
}

:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.page-links a) {
	display: inline-block;
	margin-inline: var(--space-1);
	padding: var(--space-1) var(--space-2);
	border-radius: var(--radius-sm);
	background: var(--color-surface-tint);
	text-decoration: none;
}

/* ----- Mobile spacing + type scale (--bp-md: 768px) ----- */
@media (max-width: 768px) {
	:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) {
		--content-stack: var(--space-5);
		--content-indent: var(--space-5);
		--content-indent-nested: var(--space-4);
		--content-pad-block: var(--space-4);
		--content-pad-inline: var(--space-5);
		--content-heading-margin-top: var(--space-12);
		--content-h2-margin-top: var(--space-12);
		--content-h3-margin-top: var(--space-10);
		--content-heading-margin-bottom: var(--space-3);
		--content-media-margin: var(--space-6);
		--content-align-float-width: 100%;
		--content-align-float-gap: var(--space-4);
		/* Clearer mobile hierarchy: body < h3 (3xl) < h2 (4xl) < h1 (5xl); H3 floor ≥ 1.8rem */
		--content-size: var(--text-md);
		--content-h1: var(--text-5xl);
		--content-h2: var(--text-4xl);
		--content-h3: var(--text-3xl);
		--content-h4: var(--text-xl);
		--content-h5: var(--text-lg);
		--content-h6: var(--text-sm);
		--content-quote-size: var(--text-lg);
		--content-pullquote-size: var(--text-xl);
		--content-table-size: var(--text-sm);
	}

	:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(h2) {
		padding-inline-start: var(--space-3);
	}

	:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(h3) {
		padding-inline-start: var(--space-2);
	}

	:is(body.socialbuzz-theme .entry-content, .editor-styles-wrapper, body.mce-content-body) :where(.alignleft, .alignright) {
		float: none;
		display: block;
		margin-inline: 0;
		max-width: 100%;
	}
}
