/*
 * Na Mira da Mídia — Correções de matérias e páginas (v1.4.5)
 * Carregado após style.css. Não altera a home, cabeçalho ou rodapé.
 * Seletores de linha-fina incluem padrões frequentes de temas WordPress,
 * mas ficam restritos ao cabeçalho do conteúdo singular.
 */

/* Evita que itens de grid/flex imponham largura maior que a coluna. */
body.single-post .article-page,
body.single-post .article-wrap,
body.single-post .article-header,
body.single-post .article-layout,
body.single-post .article-content-wrap,
body.single-post .article-content,
body.single-post .article-sidebar,
body.single-post .article-hero,
body.single-post .article-latest,
body.page .page-standard,
body.page .page-standard article,
body.page .page-standard .article-content {
  min-width: 0;
}
body.single-post .article-layout {
  grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
  gap: clamp(30px, 4vw, 56px);
  max-width: 1150px;
}
@media (min-width: 821px) and (max-width: 1050px) {
  body.single-post .article-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 290px);
    gap: 42px;
  }
}

/* Manchetes menores e sem hífens automáticos no desktop e no celular.
   Em títulos, break-word atua somente se uma palavra inteira for maior
   que o espaço disponível, evitando overflow sem separar palavras normais. */
body.single-post h1.article-title,
body.page h1.page-title {
  font-weight: 800;
  line-height: 1.24;
  letter-spacing: -.025em;
  -webkit-hyphens: none !important;
  -ms-hyphens: none !important;
  hyphens: none !important;
  word-break: normal !important;
  overflow-wrap: break-word !important;
  word-wrap: break-word !important;
}
body.single-post h1.article-title {
  font-size: clamp(27px, 2.8vw, 38px);
}
body.page h1.page-title {
  font-size: clamp(27px, 2.7vw, 37px);
}

/* Oculta o subtítulo/excerpt debaixo do título, sem apagar o resumo do WP
   nem tocar no texto da matéria. Funciona com classes comuns de outros temas. */
:is(body.single-post, body.page) :is(
  .article-header, .entry-header, .post-header, .page-header, .single-header,
  .post-heading, .entry-heading
) :is(
  .article-subtitle, .post-subtitle, .entry-subtitle, .page-subtitle,
  .subtitle, .sub-title, .linha-fina, .line-fine, .article-summary,
  .post-summary, .entry-summary, .page-summary, .post-excerpt,
  .entry-excerpt, .article-excerpt, .excerpt, .summary, .dek, .deck,
  .standfirst, .lead, .lead-text
) {
  display: none !important;
}
/* Alguns temas usam simplesmente um parágrafo logo após o H1 no header.
   Esta regra NÃO alcança o primeiro parágrafo da matéria (entry-content). */
:is(body.single-post, body.page) :is(
  .article-header, .entry-header, .post-header, .page-header, .single-header
) > h1 + p:not(.article-meta):not(.entry-meta):not(.post-meta):not(.byline):not(.author):not(.date) {
  display: none !important;
}

/* Mídias, tabelas e textos compridos não podem empurrar a tela lateralmente. */
:is(body.single-post, body.page) :is(.article-content, .entry-content) {
  max-width: 100%;
  overflow-wrap: break-word;
}
:is(body.single-post, body.page) :is(.article-content, .entry-content) :is(
  img, video, iframe, embed, object, canvas, svg
) {
  max-width: 100%;
}
:is(body.single-post, body.page) :is(.article-content, .entry-content) :is(
  figure, .wp-block-image, .wp-block-gallery, .wp-block-columns,
  .wp-block-group, .wp-block-cover, .wp-block-media-text
) {
  min-width: 0;
  max-width: 100%;
}
:is(body.single-post, body.page) :is(.article-content, .entry-content) :is(
  pre, .wp-block-preformatted, .wp-block-code
) {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
:is(body.single-post, body.page) :is(.article-content, .entry-content) :is(
  .wp-block-table, .table-responsive
) {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
:is(body.single-post, body.page) :is(.article-content, .entry-content) table {
  max-width: 100%;
}
:is(body.single-post, body.page) :is(.article-content, .entry-content) > table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 820px) {
  /* clip não cria outro container de rolagem e preserva elementos sticky. */
  html:has(body.single-post),
  html:has(body.page),
  body.single-post,
  body.page {
    max-width: 100%;
    overflow-x: clip;
  }
  body.single-post .article-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    width: min(calc(100% - 28px), var(--nmm-shell));
    max-width: 100%;
  }
  body.single-post .article-header,
  body.single-post .article-image-wrap,
  body.page .page-standard > .site-shell {
    max-width: 100%;
  }
  body.single-post h1.article-title {
    font-size: clamp(24px, 3.25vw, 28px);
    line-height: 1.25;
  }
  body.page h1.page-title {
    font-size: clamp(24px, 3.2vw, 28px);
    line-height: 1.25;
  }
  :is(body.single-post, body.page) :is(.article-content, .entry-content) :is(
    p, li, h2, h3, h4, blockquote, figcaption
  ) {
    overflow-wrap: anywhere;
    white-space: normal;
  }
  body.single-post .article-share-row,
  body.single-post .article-meta {
    flex-wrap: wrap;
    min-width: 0;
  }
  :is(body.single-post, body.page) :is(.article-content, .entry-content) :is(
    .wp-block-columns, .wp-block-media-text
  ) {
    min-width: 0;
    max-width: 100%;
  }
  :is(body.single-post, body.page) :is(.article-content, .entry-content) .wp-block-column {
    min-width: 0;
  }
}

@media (max-width: 560px) {
  body.single-post h1.article-title {
    font-size: clamp(21px, 5.6vw, 23px);
    line-height: 1.28;
    letter-spacing: -.015em;
    margin-bottom: 14px;
  }
  body.page h1.page-title {
    font-size: clamp(21px, 5.6vw, 23px);
    line-height: 1.28;
  }
  body.single-post .article-content,
  body.page .page-standard .article-content {
    font-size: 17px;
    line-height: 1.7;
  }
  body.single-post .article-content h2,
  body.page .page-standard .article-content h2 {
    font-size: 25px;
    line-height: 1.2;
  }
}

/* Primeiro parágrafo em itálico no corpo da matéria: linha-fina editorial
   inserida pelo próprio redator depois da foto. Mantém o texto visível,
   apenas menor que os parágrafos normais. Não afeta parágrafos comuns. */
body.single-post .article-content > p:first-of-type:is(
  :has(em), :has(i), [style*="italic"], :has([style*="italic"]),
  .has-large-font-size, .has-x-large-font-size
) {
  font-size: 16px !important;
  line-height: 1.55 !important;
}
/* Ignora tamanhos inseridos diretamente em spans/em dentro do subtítulo. */
body.single-post .article-content > p:first-of-type:is(
  :has(em), :has(i), [style*="italic"], :has([style*="italic"]),
  .has-large-font-size, .has-x-large-font-size
) * {
  font-size: inherit !important;
  line-height: inherit !important;
}
@media (max-width: 560px) {
  body.single-post .article-content > p:first-of-type:is(
    :has(em), :has(i), [style*="italic"], :has([style*="italic"]),
    .has-large-font-size, .has-x-large-font-size
  ) {
    font-size: 14px !important;
    line-height: 1.55 !important;
  }
}
