/* ============================================================
   post-content.css
   Tipografia e blocos de conteudo para artigos do blog/suporte.
   Vale para TODOS os posts (.post-body) — nao so um artigo.
   ============================================================ */

:root {
  /* Largura padrao de leitura: bem mais larga que o antigo 1200px */
  --post-max: 1360px;
  --post-aside: 320px;

  --post-ink: #23272f;
  --post-ink-soft: #4b5563;
  --post-line: #e6e8ee;
  --post-radius: 14px;
}

/* ---------- LAYOUT ---------- */
.post-shell {
  width: 100%;
  max-width: var(--post-max);
  margin: 0 auto;
  padding: 0 1.1rem;
}

.content-with-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--post-aside);
  gap: 2rem;
  align-items: start;
  margin-bottom: 3.5rem;
}

@media (max-width: 1080px) {
  .content-with-sidebar { grid-template-columns: minmax(0, 1fr); }
}

/* Telas grandes: aproveita o espaco em vez de deixar margem morta dos lados */
@media (min-width: 1500px) {
  :root { --post-max: 1580px; --post-aside: 340px; }
  .content-with-sidebar { gap: 2.5rem; }
}
@media (min-width: 1800px) {
  :root { --post-max: 1760px; --post-aside: 360px; }
}

@media (max-width: 640px) {
  .post-shell { padding: 0 .75rem; }
  .content-with-sidebar { gap: 1.25rem; }
}

.post-content {
  min-width: 0;             /* impede que tabela/codigo estoure o grid */
  background: var(--card, #fff);
  padding: 2.4rem 2.6rem 2rem;
  border-radius: var(--post-radius);
  box-shadow: 0 4px 24px rgba(16, 24, 40, .07);
}

@media (max-width: 900px) { .post-content { padding: 1.6rem 1.4rem 1.4rem; } }
@media (max-width: 480px) { .post-content { padding: 1.15rem .95rem 1.2rem; border-radius: 10px; } }

/* ---------- TIPOGRAFIA DO CONTEUDO ---------- */
.post-body {
  font-size: clamp(1.02rem, .35vw + .96rem, 1.12rem);
  line-height: 1.75;
  color: var(--post-ink);
  overflow-wrap: break-word;
  word-break: break-word;
}

.post-body > *:first-child { margin-top: 0 !important; }

.post-body p {
  margin: 0 0 1.05em;
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
  font-family: 'Sora', 'Manrope', system-ui, sans-serif;
  color: #111827;
  line-height: 1.25;
  font-weight: 700;
  margin: 2.2rem 0 .85rem;
  scroll-margin-top: calc(var(--header-height, 70px) + 14px);
}

.post-body h1 { font-size: clamp(1.5rem, 3.2vw, 2rem); }
.post-body h2 { font-size: clamp(1.32rem, 2.6vw, 1.65rem); }
.post-body h3 { font-size: clamp(1.12rem, 2.1vw, 1.28rem); }
.post-body h4 { font-size: 1.05rem; }

.post-body h2 {
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--post-line);
}

.post-body strong, .post-body b { font-weight: 700; color: #111827; }
.post-body em, .post-body i { font-style: italic; }

.post-body a {
  color: var(--accent, #7b5cff);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}
.post-body a:hover { opacity: .8; }

.post-body hr {
  border: 0;
  border-top: 1px solid var(--post-line);
  margin: 2rem 0;
}

/* ---------- LISTAS ---------- */
.post-body ul,
.post-body ol {
  margin: 0 0 1.2em;
  padding-left: 1.4em;
}
.post-body ul { list-style: disc; }
.post-body ol { list-style: decimal; }
.post-body ul ul, .post-body ol ol, .post-body ul ol, .post-body ol ul {
  margin-top: .4em;
  margin-bottom: .4em;
}
.post-body li {
  margin-bottom: .55em;
  padding-left: .15em;
}
.post-body li::marker { color: var(--accent, #7b5cff); font-weight: 700; }

.post-body blockquote {
  margin: 1.4rem 0;
  padding: .9rem 1.1rem;
  border-left: 4px solid var(--accent, #7b5cff);
  background: #f6f5ff;
  border-radius: 0 10px 10px 0;
  color: var(--post-ink-soft);
}

/* ---------- MIDIA ---------- */
.post-body img {
  display: block;
  max-width: 100%;
  width: auto;          /* nunca esticar foto pequena/retrato */
  height: auto;
  margin: 1.3rem auto;
  border-radius: 12px;
  border: 1px solid var(--post-line);
  background: #fff;
}

/* imagens verticais (passo a passo de fiacao) nao podem virar posters gigantes */
.post-body .img-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: center;   /* sem isso o flex estica a foto e distorce */
  margin: 1.4rem 0;
}
.post-body .img-row img { margin: 0; max-height: 460px; }

.post-body figure { margin: 1.4rem 0; }
.post-body figcaption {
  font-size: .88rem;
  color: var(--post-ink-soft);
  text-align: center;
  margin-top: .5rem;
}

/* Video / iframe responsivo por proporcao (sem min-height fixo, bom no mobile) */
.post-body .video-wrap,
.post-body .embed-responsive {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1.3rem 0;
  border-radius: 12px;
  overflow: hidden;
  background: #0f1115;
  box-shadow: 0 4px 18px rgba(16, 24, 40, .12);
}
.post-body .video-wrap.is-vertical { aspect-ratio: 9 / 16; max-width: 340px; margin-inline: auto; }
.post-body .video-wrap > iframe,
.post-body .video-wrap > video,
.post-body .embed-responsive > iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 12px;
}
.post-body .video-wrap:empty { display: none; }

.post-body video {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

/* Grade de videos (ex.: modelo PP x modelo JY) */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
  margin: 1.3rem 0 1.8rem;
}
.video-grid .video-card {
  background: #fff;
  border: 1px solid var(--post-line);
  border-radius: 14px;
  padding: .9rem;
  box-shadow: 0 3px 14px rgba(16, 24, 40, .06);
}
.video-grid .video-card > h3,
.video-grid .video-card > .video-card-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 .7rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
}
.video-grid .video-card .video-wrap { margin: 0; }

/* ---------- TABELAS (scroll no mobile) ---------- */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.3rem 0;
  border-radius: 12px;
  border: 1px solid var(--post-line);
}
.post-body table {
  border-collapse: collapse;
  width: 100%;
  min-width: 480px;
  background: #fff;
  font-size: .97rem;
}
.table-scroll > table { margin: 0; border: 0; }
.post-body th,
.post-body td {
  border: 1px solid var(--post-line);
  padding: .7rem .8rem;
  text-align: left;
  vertical-align: top;
}
.post-body thead th { background: #f4f5f9; font-weight: 700; }

.post-body pre,
.post-body code {
  background: #f4f5f9;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .92em;
}
.post-body code { padding: .15em .4em; }
.post-body pre { padding: .9rem 1rem; overflow-x: auto; display: block; }
.post-body pre code { background: none; padding: 0; }

/* estilos inline vindos do editor nao vazam pra pagina */
.post-body style { display: none !important; }

/* ============================================================
   BLOCOS SEMANTICOS (usaveis em qualquer post pelo editor)
   ============================================================ */

/* Caixa de introducao / boas-vindas */
.post-body .intro-box {
  background: linear-gradient(135deg, #f5f3ff 0%, #eef2ff 100%);
  border: 1px solid #ddd6fe;
  border-left: 5px solid var(--accent, #7b5cff);
  border-radius: var(--post-radius);
  padding: 1.4rem 1.5rem .4rem;
  margin: 0 0 1.6rem;
}
.post-body .intro-box h2 {
  border: 0;
  margin-top: 0;
  padding-bottom: 0;
  font-size: clamp(1.25rem, 2.4vw, 1.5rem);
}

/* Aviso / atencao */
.post-body .alert-box {
  background: #fffaf0;
  border: 1px solid #fcd9a4;
  border-left: 5px solid #f59e0b;
  border-radius: var(--post-radius);
  padding: 1.25rem 1.4rem;
  margin: 1.6rem 0;
}
.post-body .alert-box > strong:first-child {
  display: block;
  font-size: 1.05rem;
  margin-bottom: .7rem;
  color: #92400e;
}
.post-body .alert-box ul,
.post-body .alert-box ol { margin-bottom: 0; }

/* Perigo / nao faca isso */
.post-body .danger-box {
  background: #fff5f5;
  border: 1px solid #fecaca;
  border-left: 5px solid #ef4444;
  border-radius: var(--post-radius);
  padding: 1.25rem 1.4rem;
  margin: 1.6rem 0;
  color: #7f1d1d;
}
.post-body .danger-box strong { color: #b91c1c; }
.post-body .danger-box > *:last-child { margin-bottom: 0; }

/* Dica */
.post-body .tip-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 5px solid #16a34a;
  border-radius: var(--post-radius);
  padding: 1.1rem 1.3rem;
  margin: 1.4rem 0;
}
.post-body .tip-box > *:last-child { margin-bottom: 0; }

/* Titulo de secao */
.post-body .section-title {
  font-family: 'Sora', 'Manrope', system-ui, sans-serif;
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  font-weight: 700;
  color: #111827;
  margin: 2.4rem 0 1rem;
  padding-bottom: .55rem;
  border-bottom: 2px solid var(--post-line);
  line-height: 1.3;
  scroll-margin-top: calc(var(--header-height, 70px) + 14px);
}
/* quando o editor usou .section-title como wrapper de outros blocos */
.post-body .section-title:has(> div),
.post-body .section-title:has(> table),
.post-body .section-title:has(> p) {
  border-bottom: 0;
  padding-bottom: 0;
  font-size: inherit;
  font-weight: 400;
  margin: 0;
}

/* ---------- SECAO DE ERROS ---------- */
.post-body .errors-section { margin: 2rem 0; }

.post-body .error-card {
  background: #fff;
  border: 1px solid var(--post-line);
  border-radius: var(--post-radius);
  padding: 1.3rem 1.4rem;
  margin: 1.1rem 0;
  box-shadow: 0 3px 14px rgba(16, 24, 40, .06);
  scroll-margin-top: calc(var(--header-height, 70px) + 14px);
}
.post-body .error-card:empty { display: none; }
.post-body .error-card > h3 {
  margin: .55rem 0 .6rem;
  font-size: clamp(1.08rem, 2.2vw, 1.25rem);
}
.post-body .error-card > *:last-child { margin-bottom: 0; }

.post-body .error-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: #ef4444;
  color: #fff;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .3rem .7rem;
  border-radius: 999px;
  line-height: 1.4;
}
.post-body .error-badge:empty { display: none; }
.post-body .error-badge.orange { background: #f59e0b; }
.post-body .error-badge.blue   { background: #3b82f6; }
.post-body .error-badge.green  { background: #16a34a; }
.post-body .error-badge.purple { background: var(--accent, #7b5cff); }

/* sintoma (o que o cliente ve) */
.post-body .symptom {
  color: var(--post-ink-soft);
  margin-bottom: .9rem;
}

/* Passos de solucao */
.post-body .fix-steps {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 1rem 1.15rem;
  margin: 1rem 0 0;
}
.post-body .fix-steps > strong:first-child,
.post-body .fix-steps .fix-title {
  display: block;
  color: #15803d;
  font-weight: 800;
  margin-bottom: .6rem;
  font-size: 1rem;
}
.post-body .fix-steps ol,
.post-body .fix-steps ul { margin-bottom: 0; padding-left: 1.3em; }
.post-body .fix-steps li::marker { color: #16a34a; }
.post-body .fix-steps > *:last-child { margin-bottom: 0; }

/* ---------- SUMARIO / INDICE ---------- */
.post-toc {
  background: #f8f9fc;
  border: 1px solid var(--post-line);
  border-radius: var(--post-radius);
  padding: 1rem 1.2rem;
  margin: 0 0 1.8rem;
}
.post-toc > summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 1.02rem;
  color: #111827;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .55rem;
}
.post-toc > summary::-webkit-details-marker { display: none; }
.post-toc > summary::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  margin-left: auto;
  font-size: .8rem;
  color: var(--post-ink-soft);
  transition: transform .2s;
}
.post-toc[open] > summary::after { transform: rotate(180deg); }
.post-toc ol {
  list-style: none;
  margin: .9rem 0 0;
  padding: 0;
  display: grid;
  gap: .1rem;
}
.post-toc li { margin: 0; }
.post-toc li.lvl-3 { padding-left: 1rem; }
.post-toc a {
  display: block;
  padding: .42rem .5rem;
  border-radius: 8px;
  color: #374151;
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  border-left: 3px solid transparent;
}
.post-toc a:hover {
  background: #fff;
  border-left-color: var(--accent, #7b5cff);
  color: var(--accent, #7b5cff);
}

/* ---------- CTA DE SUPORTE ---------- */
.post-body .support-box {
  margin: 2.2rem 0 .5rem;
  padding: 1.5rem;
  border-radius: var(--post-radius);
  background: linear-gradient(135deg, #111827 0%, #312e81 100%);
  color: #fff;
  text-align: center;
}
.post-body .support-box p { color: #e5e7eb; }
.post-body .support-box strong { color: #fff; }
.post-body .support-box > *:last-child { margin-bottom: 0; }
.post-body .support-box a {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: #22c55e;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  padding: .8rem 1.5rem;
  border-radius: 999px;
  font-size: 1.05rem;
  margin-top: .3rem;
}
.post-body .support-box a:hover { background: #16a34a; opacity: 1; }

/* ---------- SIDEBAR ---------- */
aside.sidebar {
  position: sticky;
  top: calc(var(--header-height, 70px) + 1.2rem);
  align-self: start;          /* sem isso o sticky nao gruda no grid */
  min-width: 0;
  background: var(--card, #fff);
  padding: 1.4rem;
  border-radius: var(--post-radius);
  box-shadow: 0 4px 24px rgba(16, 24, 40, .07);
}
@media (max-width: 1080px) {
  aside.sidebar { position: static; }
}

@media print {
  aside.sidebar, .post-toc, #commentsWrap, .btn--back { display: none !important; }
  .post-content { box-shadow: none; padding: 0; }
}
