/* =========================================================
   POST CONTENT (WordPress) — .article-content
   Objetivo:
   - Tipografia editorial consistente
   - Cobrir elementos comuns do WP/Gutenberg
   - Evitar conflitos/duplicações (tudo centralizado aqui)
   ========================================================= */

.article-content {
  font-size: 1.25rem;
  line-height: 1.85;
  color: #334155; /* slate-700 */
}

/* Espaçamento base */
.article-content > * {
  max-width: 100%;
}

.article-content p {
  margin: 0 0 1.75rem;
}

/* Links (editorial) */
.article-content a {
  font-weight: 800;
  color: var(--brand-primary);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* Ênfase */
.article-content strong,
.article-content b {
  color: #0f172a;
  font-weight: 700;
}
.article-content em {
  font-style: italic;
}

/* Headings — cobre WP comum (h1..h6) */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
  color: #0f172a;
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin: 2.75rem 0 1.25rem;
}

/* h1 (raro dentro do conteúdo, mas aparece em imports) */
.article-content h1 {
  font-size: 2rem;
  font-weight: 900;
}

/* h2 com “assinatura” do Portal */
.article-content h2 {
  font-size: 1.75rem;
  font-weight: 800;
  border-left: 8px solid var(--brand-secondary);
  padding-left: 0.75rem;
}

/* h3 */
.article-content h3 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2.25rem 0 1rem;
  border-left: 4px solid var(--brand-secondary);
  padding-left: 0.75rem;
  color: #1e293b; /* slate-800 */
}

/* h4 */
.article-content h4 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1.75rem 0 0.75rem;
  color: #334155; /* slate-700 */
}

/* h5/h6 — compactos */
.article-content h5 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
}
.article-content h6 {
  font-size: 0.98rem;
  font-weight: 700;
  margin: 1.25rem 0 0.5rem;
  opacity: 0.9;
}

/* Neutraliza cores inline do editor dentro dos headings */
.article-content h1 span,
.article-content h2 span,
.article-content h3 span,
.article-content h4 span,
.article-content h5 span,
.article-content h6 span {
  color: inherit !important;
}
.article-content h1 *,
.article-content h2 *,
.article-content h3 *,
.article-content h4 *,
.article-content h5 *,
.article-content h6 * {
  color: inherit !important;
}

/* Separador / HR */
.article-content hr,
.article-content .wp-block-separator {
  border: 0;
  height: 1px;
  background: #e2e8f0;
  margin: 2.5rem 0;
}

/* Listas (editorial) */
.article-content ul,
.article-content ol {
  margin: 1.75rem 0 2rem;
  padding-left: 1.25rem;
  color: #334155;
  line-height: 1.7;
  font-size: inherit;
}
.article-content li {
  font-size: inherit;
  line-height: 1.85;
}

/* UL com bullet moderno */
.article-content ul {
  list-style: none;
}
.article-content ul li {
  position: relative;
  padding-left: 1.75rem;
  margin-bottom: 0.75rem;
}
.article-content ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background-color: var(--brand-secondary);
}

/* OL com contador */
.article-content ol {
  counter-reset: pm-counter;
}
.article-content ol li {
  counter-increment: pm-counter;
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.75rem;
}
.article-content ol li::before {
  content: counter(pm-counter);
  position: absolute;
  left: 0;
  top: 0.7em;
  line-height: 1;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-secondary), white 75%);
  color: var(--brand-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Blockquote */
.article-content blockquote {
  margin: 2.25rem 0;
  padding: 1.25rem 1.25rem 1.25rem 1.5rem;
  border-left: 5px solid var(--brand-secondary);
  background: color-mix(in srgb, var(--brand-secondary), white 92%);
  border-radius: 0.75rem;
  color: #0f172a;
  box-shadow: 0 10px 25px -18px rgba(0, 0, 0, 0.25);
}
.article-content blockquote > :first-child {
  margin-top: 0;
}
.article-content blockquote > :last-child {
  margin-bottom: 0;
}
.article-content blockquote p {
  margin: 0.75rem 0;
  font-size: 1.25rem;
  line-height: 1.85;
  color: #0f172a;
}
.article-content blockquote p:first-child {
  font-weight: 600;
}
.article-content blockquote cite {
  display: block;
  margin-top: 0.75rem;
  font-style: normal;
  font-weight: 700;
  color: var(--brand-secondary);
  font-size: 0.95rem;
}

/* Code inline */
.article-content code {
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    monospace;
  font-size: 0.95em;
  background: #f1f5f9;
  padding: 0.15em 0.35em;
  border-radius: 0.4rem;
  color: #0f172a;
}

.article-content pre {
  background: transparent;
  padding: 0.75rem 0 0;
  border: 0;
  border-top: 1px solid #e2e8f0;
  border-radius: 0;
  font-size: 0.85rem;
  color: #64748b;
  margin: 3rem 0 0;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* =========================
   Tables (WP) — tabelas soltas no conteúdo (.article-content)
   Card + radius + sombra + scroll-x, mantendo colunas alinhadas
   ========================= */

.article-content table {
  /* card */
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px -10px rgba(0, 0, 0, 0.15);
  background-clip: padding-box;

  /* spacing */
  margin: 2.5rem 0 4rem;

  /* ✅ scroll-x real */
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;

  /* ✅ faz o browser calcular colunas uma vez só (thead + tbody juntos) */
  border-collapse: separate;
  border-spacing: 0;

  /* ✅ garante que possa “crescer” e gerar overflow quando necessário */
  width: max-content;
  min-width: 100%;

  /* ✅ evita variação do cálculo em alguns browsers */
  table-layout: auto;
}

/* mantém grupos nativos (importante p/ alinhar thead/tbody) */
.article-content table thead {
  background: color-mix(in srgb, var(--brand-secondary), white 90%);
}
.article-content table thead {
  display: table-header-group;
}
.article-content table tbody {
  display: table-row-group;
}
.article-content table tfoot {
  display: table-footer-group;
}

.article-content table tbody {
  display: table-row-group;
}
.article-content table tfoot {
  display: table-footer-group;
}

/* células */
.article-content table th,
.article-content table td {
  padding: 0.75rem 1rem;
  text-align: left;
  vertical-align: top;

  /* ✅ faz both th/td respeitarem o mesmo modelo e gerarem overflow */
  white-space: nowrap;
}

/* header */
.article-content table th {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--brand-secondary);
  border-bottom: 1px solid #e2e8f0;
}

/* body */
.article-content table td {
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

/* zebra */
.article-content table tbody tr:nth-child(even) {
  background: #f8fafc;
}

@media (hover: hover) {
  .article-content table tbody tr:hover {
    background: color-mix(in srgb, var(--brand-secondary), white 92%);
  }
}

/* cantos arredondados */
.article-content table thead tr:first-child th:first-child {
  border-top-left-radius: 0.75rem;
}
.article-content table thead tr:first-child th:last-child {
  border-top-right-radius: 0.75rem;
}
.article-content table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 0.75rem;
}
.article-content table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 0.75rem;
}

/* Imagens / Figuras */
.article-content figure {
  max-width: 100%;
  margin: 2rem auto;
}

.article-content figcaption,
.article-content .wp-caption-text {
  margin-top: 0.65rem;
  font-size: 0.9rem;
  color: #64748b;
  text-align: center;
  line-height: 1.4;
}

/* Imagem solta dentro do conteúdo (não mexe nas figuras “pm-figure”) */
.article-content img:not(.pm-figure img):not(figure img) {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2rem auto;
  border-radius: 0.75rem;
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.08),
    0 4px 6px -2px rgba(0, 0, 0, 0.06);
}

/* Alinhamentos clássicos do WP (conteúdo legado) */
.article-content .alignleft {
  float: left;
  margin: 0.5rem 1.25rem 1rem 0;
  max-width: 50%;
}
.article-content .alignright {
  float: right;
  margin: 0.5rem 0 1rem 1.25rem;
  max-width: 50%;
}
.article-content .aligncenter {
  display: block;
  margin: 2rem auto;
}
@media (max-width: 640px) {
  .article-content .alignleft,
  .article-content .alignright {
    float: none;
    max-width: 100%;
    margin: 1.5rem auto;
  }
}

/* Embeds (Gutenberg + iframes soltos) */
.article-content .wp-block-embed__wrapper,
.article-content .wp-embed-aspect-16-9 .wp-block-embed__wrapper,
.article-content .wp-block-embed-youtube .wp-block-embed__wrapper {
  aspect-ratio: 16 / 9;
  width: 100%;
}

/* YouTube/Vimeo */
.article-content iframe[src*="youtube.com"],
.article-content iframe[src*="youtu.be"],
.article-content iframe[src*="youtube-nocookie.com"],
.article-content iframe[src*="player.vimeo.com"] {
  display: block;
  width: 100% !important;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto !important;
  border: 0;
}

/* Correto: encadeia os :not() NO iframe (sem espaços) */
.article-content
  iframe:not([src*="youtube.com"]):not([src*="youtu.be"]):not(
    [src*="youtube-nocookie.com"]
  ):not([src*="player.vimeo.com"]) {
  width: 100%;
  max-width: 100%;
  min-height: 350px;
  border: 0;
}
@media (max-width: 640px) {
  .article-content
    iframe:not([src*="youtube.com"]):not([src*="player.vimeo.com"]) {
    min-height: 280px;
  }
}
.article-content p > iframe {
  margin: 1.75rem 0;
}

/* Blocks do Gutenberg que costumam “estourar” */
.article-content .wp-block-image,
.article-content .wp-block-embed,
.article-content .wp-block-video,
.article-content .wp-block-gallery,
.article-content .wp-block-table {
  max-width: 100%;
}

/* Align wide/full (se aparecerem dentro do container) */
.article-content .alignwide,
.article-content .alignfull {
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

/* Recomendadas (pm-relmod) — neutraliza heranças do conteúdo */
.article-content .pm-relmod a {
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
}
.article-content .pm-relmod a:hover {
  text-decoration: none;
}
.article-content .pm-relmod img.pm-relmod-thumb {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  display: block !important;
  margin: 0 !important;
}
.article-content .pm-relmod .pm-relmod-thumbwrap {
  width: 4rem;
  height: 4rem;
}

/* Mini popup - seta sutil (mobile-first) */
#floatingNews .pm-arrow {
  animation: pmArrowNudge 1.6s ease-in-out infinite;
}

@keyframes pmArrowNudge {
  0%,
  100% {
    transform: translateX(0);
    opacity: 0.85;
  }
  50% {
    transform: translateX(4px);
    opacity: 1;
  }
}

/* Respeita usuários que preferem menos movimento */
@media (prefers-reduced-motion: reduce) {
  #floatingNews .pm-arrow {
    animation: none;
  }
}
#floatingNews .pm-dot {
  animation: pmDotPulse 1.4s ease-in-out infinite;
}

@keyframes pmDotPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.55;
  }
  50% {
    transform: scale(1.35);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  #floatingNews .pm-dot {
    animation: none;
  }
}

/* Figure moderno (substitui a antiga featured image visualmente) */
.pm-figure {
  max-width: 100%;
  margin: 0 auto 2.5rem;
  border-radius: 1rem; /* equivalente ao rounded-2xl */
  overflow: hidden;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1); /* shadow-xl */
  background: #fff;
}

.pm-figure img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* Legenda */
.pm-figure figcaption {
  padding: 0.75rem 1rem 0.9rem;
  font-size: 0.875rem;
  color: #64748b;
  text-align: center;
  line-height: 1.4;
  background: #fff;
}

/* ====== Player leve do YouTube – Portal Mie ====== */

.pm-youtube-lite-wrapper {
  margin: 20px 0;
}

/* Mantém 16:9 sempre (evita layout shift) */
.pm-youtube-lite {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
  border-radius: 16px; /* mais “card moderno” */
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(2, 6, 23, 0.14); /* slate-ish suave */
  border: 1px solid rgba(148, 163, 184, 0.18); /* slate-400 bem leve */
}

/* Thumbnail */
.pm-youtube-lite-thumb {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: brightness(0.88);
  transform: scale(1.01);
  transition:
    transform 0.35s ease,
    filter 0.35s ease;
}

/* Overlay bem sutil pra dar contraste no play */
.pm-youtube-lite::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(0, 0, 0, 0.08) 0%,
    rgba(0, 0, 0, 0.35) 70%,
    rgba(0, 0, 0, 0.5) 100%
  );
  pointer-events: none;
}

/* Botão play */
.pm-youtube-lite-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 0;
  outline: 0;
  width: 74px;
  height: 54px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72); /* slate-900-ish */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.25);
  transition:
    transform 0.2s ease,
    background 0.2s ease;
}

.pm-youtube-lite-play-icon {
  display: inline-block;
  margin-left: 3px;
  font-size: 26px;
  line-height: 1;
  color: #fff;
}

/* Hover */
.pm-youtube-lite:hover .pm-youtube-lite-thumb {
  filter: brightness(1);
  transform: scale(1.04);
}

.pm-youtube-lite:hover .pm-youtube-lite-play {
  background: rgba(15, 23, 42, 0.85);
  transform: translate(-50%, -50%) scale(1.03);
}

/* Acessibilidade: foco visível */
.pm-youtube-lite-play:focus-visible {
  outline: 2px solid rgba(244, 63, 94, 0.65); /* rose-500-ish */
  outline-offset: 3px;
}

/* Quando o iframe carregar, só ajusta visual (não mexe no ratio) */
.pm-youtube-lite--loaded {
  cursor: default;
}

/*
Audio Player styles
 */
.pm-audio-range {
  height: 18px;
}

.pm-audio-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
}

.pm-audio-range::-webkit-slider-thumb {
  height: 12px;
  width: 12px;
  margin-top: -4px;
}

.pm-audio-play {
  line-height: 0;
}

/* Playlist: equalizerzinho leve (sem GIF) */
/* Playlist: equalizerzinho leve (sem GIF) */
.pm-eq {
  width: 18px;
  height: 14px;
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
}
.pm-eq span {
  display: block;
  width: 3px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.9;
}

/* aparece SOMENTE quando a playlist está tocando + item atual */
.pm-playlist .pm-eq {
  display: none;
}

.pm-playlist.is-playing .pm-pl-item[aria-current="true"] .pm-eq {
  display: inline-flex;
}

.pm-playlist.is-playing .pm-pl-item[aria-current="true"] .pm-eq span {
  animation: pmEq 0.9s infinite ease-in-out;
}
.pm-playlist.is-playing
  .pm-pl-item[aria-current="true"]
  .pm-eq
  span:nth-child(2) {
  animation-delay: 0.12s;
}
.pm-playlist.is-playing
  .pm-pl-item[aria-current="true"]
  .pm-eq
  span:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes pmEq {
  0%,
  100% {
    height: 5px;
    opacity: 0.6;
  }
  50% {
    height: 14px;
    opacity: 1;
  }
}
