/* Museu ODC 3.0.34 — alinhamento justificado consolidado.
 * Aplica justificativa ao conteúdo editorial e descritivo de todas as páginas,
 * preservando títulos, botões, menus, controles, formulários, tabelas e widgets.
 */

html body.odc334-textos-justificados {
  --odc334-reading: 76ch;
}

/* Conteúdo narrativo padrão do WordPress, Gutenberg, Tainacan e páginas ODC. */
html body.odc334-textos-justificados
:where(
  main,
  #primary,
  .site-main,
  .content-area,
  .entry-content,
  .page-content,
  .wp-block-post-content,
  .odc24-collection-introduction__content,
  .odc261-acervo-body,
  .odc16-curated-section__body,
  .odc16-biography__content,
  .odc23-accessible-reader__content,
  .odc18-educational-journey__content,
  .odc329-donation__intro,
  .odc329-donation__card,
  .odc333-support-editorial,
  .tainacan-item-metadata,
  .tainacan-item-section,
  .tainacan-item-section__metadata,
  .tainacan-item-section__metadata-value
)
:where(
  p,
  li,
  dd,
  blockquote,
  figcaption,
  .wp-block-paragraph,
  .wp-block-quote,
  .item-description,
  .metadata-type-textarea,
  .metadata-type-core_description,
  .tainacan-metadata-value,
  .odc24-justified-text,
  .odc16-home-card__text,
  .odc21-home-final-block__text,
  .odc321-celebration__text
) {
  text-align: justify !important;
  text-align-last: left !important;
  text-justify: inter-word !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: break-word !important;
  -webkit-hyphens: auto !important;
  hyphens: auto !important;
}

/* Blocos descritivos gerados por scripts que nem sempre usam <p>. */
html body.odc334-textos-justificados
:where(
  .odc16-curated-section__body,
  .odc16-biography__content,
  .odc24-justified-text,
  .metadata-type-textarea,
  .metadata-type-core_description,
  .tainacan-item-section__metadata-value,
  .item-description
) {
  text-align: justify !important;
  text-align-last: left !important;
  text-justify: inter-word !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: break-word !important;
  -webkit-hyphens: auto !important;
  hyphens: auto !important;
}

/* Mantém largura de leitura coerente sem esticar parágrafos em monitores grandes. */
html body.odc334-textos-justificados:not(.odc21-page-map)
:where(.entry-content, .page-content, .wp-block-post-content)
> :where(p, ul, ol, blockquote, dl) {
  width: min(100%, var(--odc334-reading)) !important;
  max-width: var(--odc334-reading) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Elementos de interface não devem ser justificados. */
html body.odc334-textos-justificados
:where(
  nav,
  .odc15-nav,
  .odc25-home-primary-nav,
  .odc327-cookie,
  .odc326-a11y,
  .odc326-a11y__panel,
  .odc18-journey-toolbar,
  .odc16-tools,
  .leaflet-control,
  .leaflet-popup,
  .wp-block-buttons,
  form,
  table
)
:where(p, li, dd, blockquote, figcaption, th, td, label, span) {
  text-align: left !important;
  text-align-last: left !important;
  text-justify: none !important;
  -webkit-hyphens: none !important;
  hyphens: none !important;
}

html body.odc334-textos-justificados
:where(button, .button, .wp-element-button, .wp-block-button__link, .odc15-nav__button, .odc25-home-primary-nav__button) {
  text-align: center !important;
  text-align-last: center !important;
  text-justify: none !important;
  -webkit-hyphens: none !important;
  hyphens: none !important;
}

/* Títulos seguem a hierarquia aprovada; não recebem justificativa. */
html body.odc334-textos-justificados
:where(h1, h2, h3, h4, h5, h6, .entry-title, .page-title) {
  text-justify: none !important;
  -webkit-hyphens: none !important;
  hyphens: none !important;
}

/* No celular, mantém a justificativa, mas reduz os vazios entre palavras. */
@media (max-width: 680px) {
  html body.odc334-textos-justificados
  :where(.entry-content, .page-content, .wp-block-post-content, .odc24-collection-introduction__content)
  :where(p, li, dd, blockquote, figcaption) {
    line-height: 1.62 !important;
    text-justify: inter-word !important;
    -webkit-hyphens: auto !important;
    hyphens: auto !important;
  }
}
