/*
 * Property Engine — camada final de tipografia configurável.
 *
 * Esta folha é carregada por último. Cada declaração depende de um token
 * `--pty-user-*`; quando o token não existe, a declaração fica inválida e o
 * desenho curado da página permanece intacto. Quando existe, a configuração
 * feita em Sistema > Aparência > Tipografia vence os tamanhos/ritmos fixos das
 * composições internas. Escopos de página e de faixa redefinem os mesmos
 * tokens e, pela cascata, continuam tendo precedência sobre o global.
 */

/* Corpo global. */
body.pty-body {
	font-family: var(--pty-user-font-body) !important;
	font-size: var(--pty-user-font-base) !important;
	font-weight: var(--pty-user-body-weight) !important;
	line-height: var(--pty-user-body-line-height) !important;
	letter-spacing: var(--pty-user-body-letter-spacing) !important;
}

/*
 * O valor local de uma página precisa ser LIDO dentro do próprio escopo.
 * Declarar a variável no wrapper não altera uma propriedade que foi resolvida
 * no body; esta regra fecha exatamente a lacuna que fazia `ap_body_px` gravar
 * corretamente e não mudar nada no site.
 */
body.pty-body :is(.pty-hp, .pty-pa, .pty-lp, .pty-lc, .pty-dsc, .pty-cp, .pty-fav, .pty-fp, .pty-ap, .pty-ct, .pty-bl, .pty-pc, .pty-pd) {
	font-family: var(--pty-user-font-body) !important;
	font-size: var(--pty-user-font-base) !important;
	font-weight: var(--pty-user-body-weight) !important;
	line-height: var(--pty-user-body-line-height) !important;
	letter-spacing: var(--pty-user-body-letter-spacing) !important;
}

/* Texto de leitura. Interface curta (badges, botões, menus) preserva seu
 * próprio ritmo; parágrafos/listas recebem o controle global de leitura. */
body.pty-body :is(
	p:not([class*="eyebrow"]):not([class*="kicker"]):not([class*="ticket"]):not(.pty-error-404__code),
	li, dd, dt, blockquote, figcaption, address
) {
	font-weight: var(--pty-user-body-weight) !important;
	line-height: var(--pty-user-body-line-height) !important;
	letter-spacing: var(--pty-user-body-letter-spacing) !important;
}

/* Títulos semânticos. As variáveis locais de página/faixa são herdadas pelo
 * próprio heading, portanto uma personalização individual continua vencendo. */
body.pty-body :is(h1, h2, h3, h4, h5, h6) {
	font-family: var(--pty-user-font-heading) !important;
	font-weight: var(--pty-user-heading-weight) !important;
	line-height: var(--pty-user-heading-line-height) !important;
	letter-spacing: var(--pty-user-heading-letter-spacing) !important;
}

/* O valor configurado é o teto no desktop. Em telas estreitas o tamanho pode
 * encolher para impedir estouro horizontal e títulos de uma palavra por linha. */
/* A escala de TÍTULO da faixa também modifica o teto fluido (vw): alterar
 * apenas o valor em px não funcionaria no celular quando o teto prevalece.
 * Sem escolha por faixa o multiplicador vale 1 e mantém o desenho anterior. */
body.pty-body h1 { font-size: min(var(--pty-user-font-h1), max(1.5rem, calc(8vw * var(--pty-band-title-scale, 1)))) !important; }
body.pty-body h2 { font-size: min(var(--pty-user-font-h2), max(1.25rem, calc(6vw * var(--pty-band-title-scale, 1)))) !important; }
body.pty-body h3 { font-size: min(var(--pty-user-font-h3), max(1.1rem, calc(5vw * var(--pty-band-title-scale, 1)))) !important; }

/* Alguns títulos visuais do tema não são necessariamente h1–h6 em todas as
 * composições. Eles recebem família/peso/ritmo, mas não um tamanho artificial:
 * a escala específica da composição continua preservada. */
body.pty-body :is(.pty-ap-title, .pty-hp-title, .pty-ed-section-title, .pty-pc-title) {
	font-family: var(--pty-user-font-heading) !important;
	font-weight: var(--pty-user-heading-weight) !important;
	line-height: var(--pty-user-heading-line-height) !important;
	letter-spacing: var(--pty-user-heading-letter-spacing) !important;
}
