/* ============================================================
   BLOG / PAGE CONTENT SANDBOX
   Protege a estrutura do site contra HTML colado no editor.
   Aplicado ao wrapper .post-content (que envolve the_content()).
   ============================================================ */

/* ── CONTAINER PRINCIPAL ─────────────────────────────────────── */
.post-content {
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  overflow: hidden;          /* impede que qualquer filho estoure a caixa */
}

/* ── TIPOGRAFIA INTERNA ──────────────────────────────────────── */
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  font-family: var(--font-headings);
  color: var(--verde-escuro);
  line-height: 1.4;
  margin-top: 1.6em;
  margin-bottom: 0.6em;
}
.post-content h1 { font-size: clamp(26px, 4vw, 36px); }
.post-content h2 { font-size: clamp(22px, 3vw, 30px); }
.post-content h3 { font-size: clamp(19px, 2.5vw, 24px); }
.post-content h4 { font-size: 18px; }
.post-content h5 { font-size: 16px; }
.post-content h6 { font-size: 14px; }

.post-content p {
  margin-bottom: 1.2em;
  font-size: inherit;
  line-height: inherit;
}

.post-content a {
  color: var(--verde-claro);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--transition);
}
.post-content a:hover {
  color: var(--verde-escuro);
}

.post-content strong, .post-content b {
  font-weight: 700;
  color: var(--verde-escuro);
}

/* ── LISTAS (restaurar bullets/números) ──────────────────────── */
.post-content ul,
.post-content ol {
  padding-left: 1.8em;
  margin-bottom: 1.2em;
}
.post-content ul { list-style: disc; }
.post-content ol { list-style: decimal; }
.post-content ul ul { list-style: circle; }
.post-content ol ol { list-style: lower-alpha; }
.post-content li {
  margin-bottom: 0.4em;
  line-height: 1.8;
}
.post-content li > ul,
.post-content li > ol {
  margin-top: 0.4em;
  margin-bottom: 0;
}


/* ── IMAGENS DENTRO DO CONTEÚDO ──────────────────────────────── */
.post-content img {
  max-width: 100% !important;
  height: auto;
  border-radius: var(--radius);
}

/* Imagens WP com alinhamento */
.post-content .aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.post-content .alignleft {
  float: left;
  margin-right: var(--sp-3);
  margin-bottom: var(--sp-2);
  max-width: 50%;
}
.post-content .alignright {
  float: right;
  margin-left: var(--sp-3);
  margin-bottom: var(--sp-2);
  max-width: 50%;
}

/* ── FIGURAS / CAPTIONS WP ───────────────────────────────────── */
.post-content figure {
  max-width: 100% !important;
  margin: var(--sp-3) 0;
}
.post-content figure img {
  margin: 0;
}
.post-content figcaption,
.post-content .wp-caption-text {
  font-size: 13px;
  color: #888;
  text-align: center;
  margin-top: var(--sp-1);
  font-style: italic;
}

/* ── TABELAS ─────────────────────────────────────────────────── */
.post-content table {
  width: 100% !important;
  max-width: 100% !important;
  border-collapse: collapse;
  margin: var(--sp-3) 0;
  font-size: 15px;
  overflow-x: auto;
  display: block;
}
.post-content thead {
  background: var(--verde-escuro);
  color: var(--branco);
}
.post-content th,
.post-content td {
  padding: 10px 14px;
  border: 1px solid var(--cinza-claro);
  text-align: left;
  vertical-align: top;
}
.post-content tbody tr:nth-child(even) {
  background: var(--off-white);
}

/* ── BLOCKQUOTES ─────────────────────────────────────────────── */
.post-content blockquote {
  border-left: 4px solid var(--verde-claro);
  background: var(--off-white);
  padding: var(--sp-3) var(--sp-4);
  margin: var(--sp-4) 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  font-size: 17px;
  color: var(--verde-escuro);
}
.post-content blockquote p:last-child {
  margin-bottom: 0;
}

/* ── CÓDIGO ──────────────────────────────────────────────────── */
.post-content code {
  background: var(--off-white);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'Courier New', Courier, monospace;
  color: var(--verde-escuro);
}
.post-content pre {
  background: #2d2d2d;
  color: #f8f8f2;
  padding: var(--sp-3);
  border-radius: var(--radius);
  overflow-x: auto;
  margin: var(--sp-3) 0;
  font-size: 14px;
  line-height: 1.6;
}
.post-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* ── SEPARADORES ─────────────────────────────────────────────── */
.post-content hr {
  border: none;
  border-top: 2px solid var(--off-white);
  margin: var(--sp-5) 0;
}

/* ── IFRAMES / EMBEDS (YouTube, etc.) ────────────────────────── */
.post-content iframe {
  max-width: 100% !important;
  border-radius: var(--radius);
  margin: var(--sp-3) 0;
}
/* Wrapper responsivo para vídeos embed */
.post-content .wp-block-embed,
.post-content .wp-block-embed__wrapper {
  position: relative;
  max-width: 100%;
  overflow: hidden;
}
.post-content .wp-block-embed__wrapper iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
}

/* ── DIVS E ELEMENTOS GENÉRICOS — PROTEÇÃO CONTRA INLINE STYLES ── */
.post-content * {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.post-content div,
.post-content section,
.post-content article,
.post-content p {
  max-width: 100% !important;
}

/* ── ELEMENTOS COM WIDTH/HEIGHT/POSITION INLINE — OVERRIDE ─────── */
.post-content [style*="width"] {
  max-width: 100% !important;
}
.post-content [style*="min-width"] {
  min-width: 0 !important;
}
.post-content [style*="position: fixed"],
.post-content [style*="position:fixed"],
.post-content [style*="position: absolute"],
.post-content [style*="position:absolute"] {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
}
.post-content [style*="z-index"] {
  z-index: auto !important;
}

/* ── LIMPAR FLOATS ───────────────────────────────────────────── */
.post-content::after {
  content: '';
  display: table;
  clear: both;
}

/* ── GUTENBERG BLOCKS (WP) ───────────────────────────────────── */
.post-content .wp-block-image {
  max-width: 100%;
  margin: var(--sp-3) 0;
}
.post-content .wp-block-image img {
  border-radius: var(--radius);
}
.post-content .wp-block-gallery {
  max-width: 100%;
  margin: var(--sp-3) 0;
}
.post-content .wp-block-columns {
  max-width: 100%;
}
.post-content .wp-block-separator {
  border-top: 2px solid var(--off-white);
  margin: var(--sp-5) 0;
}
.post-content .wp-block-quote {
  border-left: 4px solid var(--verde-claro);
  background: var(--off-white);
  padding: var(--sp-3) var(--sp-4);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.post-content .wp-block-cover {
  max-width: 100% !important;
  border-radius: var(--radius);
  overflow: hidden;
}
.post-content .has-background {
  padding: var(--sp-3);
  border-radius: var(--radius);
}

/* ── FONTES / TAMANHOS INLINE — NORMALIZAR ───────────────────── */
.post-content [style*="font-size"] {
  font-size: inherit !important;
}
.post-content [style*="font-family"] {
  font-family: inherit !important;
}
.post-content [style*="color"]:not(a):not(strong):not(b) {
  color: inherit !important;
}
.post-content [style*="background-color"] {
  background-color: transparent !important;
}
/* Exceções para blocos WP legítimos */
.post-content .has-background[style*="background-color"] {
  background-color: revert !important;
}
.post-content .wp-block-quote[style*="color"],
.post-content .wp-block-cover[style*="color"],
.post-content .wp-block-button[style*="color"],
.post-content .wp-block-button[style*="background-color"] {
  color: revert !important;
  background-color: revert !important;
}

/* ── ESPAÇAMENTO ENTRE PARÁGRAFOS E BLOCOS ───────────────────── */
.post-content > *:first-child {
  margin-top: 0;
}
.post-content > *:last-child {
  margin-bottom: 0;
}

/* ── RESPONSIVIDADE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .post-content .alignleft,
  .post-content .alignright {
    float: none;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
  
  .post-content table {
    font-size: 13px;
  }
  .post-content th,
  .post-content td {
    padding: 8px 10px;
  }
}

@media (max-width: 480px) {
  .post-content blockquote {
    padding: var(--sp-2) var(--sp-3);
    font-size: 15px;
  }
}
