/*
 * US4 (REQ-037/REQ-038): troca de tag de títulos sem mudança visual (CON-014, NFR-010).
 *
 * Cada classe "seo-de-<tag>" marca um elemento cuja tag mudou e devolve a ele os estilos que a tag ANTIGA recebia
 * do Bootstrap 5.3.6 (reboot) ou do navegador. Especificidade (0,0,2): vence as regras por elemento do Bootstrap
 * (h1..h6, p, que são 0,0,1) e perde para qualquer regra com classe (f-48, fw-bold, mb-0, tipografia do Elementor),
 * exatamente como a tag antiga. Nos widgets do Elementor a classe fica no wrapper do widget.
 */

/* Era h2 (Bootstrap: h2 + reboot de h1..h6) */
html body :where(.seo-de-h2:not(.elementor-widget)),
html body :where(.seo-de-h2 .elementor-heading-title) {
  margin-top: 0;
  margin-bottom: .5rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--bs-heading-color);
  font-size: calc(1.325rem + .9vw);
}
@media (min-width: 1200px) {
  html body :where(.seo-de-h2:not(.elementor-widget)),
  html body :where(.seo-de-h2 .elementor-heading-title) {
    font-size: 2rem;
  }
}

/* Era h4 (bloco de título do editor de posts) */
html body :where(.seo-de-h4) {
  margin-top: 0;
  margin-bottom: .5rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--bs-heading-color);
  font-size: calc(1.275rem + .3vw);
}
@media (min-width: 1200px) {
  html body :where(.seo-de-h4) {
    font-size: 1.5rem;
  }
}

/* Era h5 */
html body :where(.seo-de-h5) {
  margin-top: 0;
  margin-bottom: .5rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--bs-heading-color);
  font-size: 1.25rem;
}

/* Era span: herda tudo do pai e é inline */
html body :where(.seo-de-span) {
  display: inline;
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
}

/* Era b: inline e "bolder" */
html body :where(.seo-de-b) {
  display: inline;
  margin: 0;
  font-size: inherit;
  font-weight: bolder;
  line-height: inherit;
  color: inherit;
}

/* Era p (Bootstrap: margin-bottom 1rem) */
html body :where(.seo-de-p) {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: inherit;
}

/*
 * Home (CON-016): um único H1 visível em todos os tamanhos. O widget com o título inteiro passa a aparecer
 * também no desktop e no tablet, quebrando a linha onde ficavam os dois widgets antigos (agora ocultos).
 * line-height = tamanho da fonte + gap do container (desktop 20px, tablet 10px); a margem negativa
 * anula o meio-entrelinha extra, deixando cada linha na posição exata do widget antigo.
 */
@media (min-width: 768px) {
  .elementor-1793 .elementor-element.elementor-element-3b76fddd .elementor-heading-title {
    line-height: 68px;
    margin: -10px 0;
  }
}
@media (min-width: 768px) and (max-width: 1024px) {
  .elementor-1793 .elementor-element.elementor-element-3b76fddd .elementor-heading-title {
    line-height: 46px;
    /* -4px embaixo: a 2ª linha antiga era um span inline, com caixa de linha de 37px (1px a mais) */
    margin: -5px 0 -4px;
  }
}
@media (max-width: 767px) {
  .seo-quebra-desktop {
    display: none;
  }
  /* No celular o título era um span (inline): o espaçamento das linhas vinha da linha do container (27px), não dos 24px do H1 */
  .elementor-1793 .elementor-element.elementor-element-3b76fddd .elementor-heading-title {
    display: inline;
  }
}

/* Fase 1 (L1, AC-062): texto do H1 só para leitores de tela e buscadores, sem ocupar espaço.
   Mesma definição do .visually-hidden do Bootstrap 5.3.6, com nome próprio para não depender do CDN. */
.seo-oculto {
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  position: absolute !important;
}

/* Era h3: títulos dos posts no widget de listagem do arquivo do Blog (template 1285) */
html body :where(.seo-de-h3 .elementor-post__title) {
  margin-top: 0;
  margin-bottom: .5rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--bs-heading-color);
  font-size: calc(1.3rem + .6vw);
}
@media (min-width: 1200px) {
  html body :where(.seo-de-h3 .elementor-post__title) {
    font-size: 1.75rem;
  }
}

/* Fase 2 (L6b, REQ-020): "Relações com o Mercado" era <a> dentro de <button>. O <a> passou a ser o botão;
   aqui ele recebe o que o <button> ganhava do navegador e do Bootstrap (reboot) e o <a> não. */
html body :where(a.seo-de-button) {
  display: inline-block;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  text-transform: none;
}
