/* ========================================================================== 
   SDB — Kingster Adapter | Tipografia editorial partilhada

   Contrato unico para o corpo de noticias no frontend e no Gutenberg.
   A semantica continua a vir do HTML (H2 -> H3 -> H4); este ficheiro controla
   apenas a apresentacao e o ritmo editorial. Nao altera headings globais do
   Kingster, paginas, plugins ou outros post types.

   Os tokens --sdb-* pertencem ao SDB — Design System. O child theme apenas os
   consome; variaveis --kingster-article-* sao locais a esta adaptacao.
   ========================================================================== */

body.sdb-kingster-child.single-post .kingster-single-article-content,
.editor-styles-wrapper {
	--kingster-article-body-size: var(--sdb-type-body-md-size, 1rem);
	--kingster-article-body-line-height: var(--sdb-line-height-body, 1.74);
	--kingster-article-body-color: var(--sdb-color-text, #6b7785);
	--kingster-article-heading-color: var(--sdb-color-title, #364048);
	--kingster-article-h2-size: min(var(--sdb-editorial-title-lg, clamp(1.52rem, 1.22rem + 1.05vw, 2.05rem)), 1.8rem);
	--kingster-article-h3-size: var(--sdb-editorial-title-md, clamp(1.18rem, 1.04rem + 0.58vw, 1.42rem));
	--kingster-article-h4-size: var(--sdb-editorial-title-sm, clamp(1.02rem, 0.92rem + 0.38vw, 1.18rem));
}

/* Frontend: base de leitura do corpo da noticia. */
body.sdb-kingster-child.single-post .kingster-single-article-content {
	font-family: var(--sdb-font-body, Archivo, Arial, sans-serif);
	font-size: var(--kingster-article-body-size);
	line-height: var(--kingster-article-body-line-height);
	color: var(--kingster-article-body-color);
}

body.sdb-kingster-child.single-post .kingster-single-article-content > *:first-child {
	margin-top: 0;
}

body.sdb-kingster-child.single-post .kingster-single-article-content > *:last-child {
	margin-bottom: 0;
}

body.sdb-kingster-child.single-post .kingster-single-article-content p {
	margin-bottom: 1.45em;
}

/* Gutenberg: replica a tipografia do frontend sem reduzir a largura do canvas. */
.editor-styles-wrapper .wp-block-paragraph,
.editor-styles-wrapper :is(ul, ol).wp-block-list {
	font-family: var(--sdb-font-body, Archivo, Arial, sans-serif);
	line-height: var(--kingster-article-body-line-height);
}

.editor-styles-wrapper .wp-block-paragraph:not([class*="-font-size"]),
.editor-styles-wrapper :is(ul, ol).wp-block-list:not([class*="-font-size"]) {
	font-size: var(--kingster-article-body-size);
}

.editor-styles-wrapper .wp-block-paragraph:not(.has-text-color),
.editor-styles-wrapper :is(ul, ol).wp-block-list:not(.has-text-color) {
	color: var(--kingster-article-body-color);
}

.editor-styles-wrapper .wp-block-paragraph {
	margin-bottom: 1.45em;
}

/* Hierarquia H2/H3/H4: declaracao unica para frontend e editor. */
body.sdb-kingster-child.single-post .kingster-single-article-content > :is(h2, h3, h4),
body.sdb-kingster-child.single-post .kingster-single-article-content :is(h2, h3, h4).wp-block-heading,
.editor-styles-wrapper :is(h2, h3, h4).wp-block-heading {
	font-family: var(--sdb-font-heading, "Neo Sans", Arial, sans-serif);
	color: var(--kingster-article-heading-color);
	text-wrap: balance;
}

body.sdb-kingster-child.single-post .kingster-single-article-content > h2,
body.sdb-kingster-child.single-post .kingster-single-article-content h2.wp-block-heading,
.editor-styles-wrapper h2.wp-block-heading {
	margin-top: 2.25rem;
	margin-bottom: 0.8rem;
	font-size: var(--kingster-article-h2-size);
	font-weight: var(--sdb-font-weight-semibold, 600);
	line-height: var(--sdb-line-height-h2, 1.3);
	letter-spacing: var(--sdb-letter-spacing-h2, -0.015em);
}

body.sdb-kingster-child.single-post .kingster-single-article-content > h3,
body.sdb-kingster-child.single-post .kingster-single-article-content h3.wp-block-heading,
.editor-styles-wrapper h3.wp-block-heading {
	margin-top: 1.9rem;
	margin-bottom: 0.65rem;
	font-size: var(--kingster-article-h3-size);
	font-weight: var(--sdb-font-weight-semibold, 600);
	line-height: var(--sdb-line-height-h3, 1.35);
	letter-spacing: var(--sdb-letter-spacing-h3, -0.01em);
}

body.sdb-kingster-child.single-post .kingster-single-article-content > h4,
body.sdb-kingster-child.single-post .kingster-single-article-content h4.wp-block-heading,
.editor-styles-wrapper h4.wp-block-heading {
	margin-top: 1.65rem;
	margin-bottom: 0.55rem;
	font-size: var(--kingster-article-h4-size);
	font-weight: var(--sdb-font-weight-medium, 500);
	line-height: var(--sdb-line-height-h4, 1.35);
	letter-spacing: var(--sdb-letter-spacing-h4, 0);
}

body.sdb-kingster-child.single-post .kingster-single-article-content > :is(h2, h3, h4):first-child {
	margin-top: 0;
}

/* Lead editorial oficial do SDB, quando o bloco usa a classe sdb-lead. */
body.sdb-kingster-child.single-post .kingster-single-article-content p.sdb-lead,
.editor-styles-wrapper p.wp-block-paragraph.sdb-lead {
	font-family: var(--sdb-font-body, Archivo, Arial, sans-serif) !important;
	font-size: var(--sdb-type-body-lg-size, 1.125rem) !important;
	font-weight: var(--sdb-font-weight-lead, 500);
	line-height: 1.55;
	color: var(--sdb-color-text, #6b7785) !important;
}

@media (max-width: 767px) {
	body.sdb-kingster-child.single-post .kingster-single-article-content,
	.editor-styles-wrapper {
		--kingster-article-body-line-height: var(--sdb-line-height-body, 1.68);
	}

	body.sdb-kingster-child.single-post .kingster-single-article-content > h2,
	body.sdb-kingster-child.single-post .kingster-single-article-content h2.wp-block-heading,
	.editor-styles-wrapper h2.wp-block-heading {
		margin-top: 2rem;
	}

	body.sdb-kingster-child.single-post .kingster-single-article-content > h3,
	body.sdb-kingster-child.single-post .kingster-single-article-content h3.wp-block-heading,
	.editor-styles-wrapper h3.wp-block-heading {
		margin-top: 1.7rem;
	}

	body.sdb-kingster-child.single-post .kingster-single-article-content > h4,
	body.sdb-kingster-child.single-post .kingster-single-article-content h4.wp-block-heading,
	.editor-styles-wrapper h4.wp-block-heading {
		margin-top: 1.5rem;
	}
}
