/* ==========================================================================
   Página interna do post

   Estrutura (ref. zionsoftwarehouse.com.br/blog):
   título → autor, tempo de leitura e data (entre linhas) → banner → conteúdo
   com índice. Tipografia do Figma "Blog - Página interna" (node 13935:3015):
   título Optima Medium 80/1.15 (35 no mobile), meta Gotham 17/1.5 (14),
   lead Optima Medium 42/1.4 (28), texto Gotham 17/1.5 (14),
   intertítulos Optima Regular 32/1.4 (24).
   ========================================================================== */

.post-page {
  --post-gutter: 24px;
  --post-section: 40px;
  padding-bottom: 80px;
  color: var(--corte-blue);
}

/* --------------------------------------------------------------------------
   Cabeçalho: título + meta
   -------------------------------------------------------------------------- */

.post-header {
  max-width: 1440px;
  margin: 0 auto;
  padding: 40px var(--post-gutter) 0;
}

/* Título: Optima Medium / 1.15 com text-box-trim (cap → alphabetic) */
.post-header__title {
  max-width: 1100px;
  margin-top: -0.1234em;
  margin-bottom: -0.3375em;
  font-family: var(--corte-font-optima);
  font-size: 35px;
  font-weight: 500;
  line-height: 1.15;
}

@supports (text-box: trim-both cap alphabetic) {
  .post-header__title {
    margin-top: 0;
    margin-bottom: 0;
    text-box: trim-both cap alphabetic;
  }
}

.post-header__meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 40px;
  padding: 20px 0;
  border-top: 1px solid var(--corte-gray-350);
  border-bottom: 1px solid var(--corte-gray-350);
  font-family: var(--corte-font-gotham);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

.post-header__author {
  text-transform: uppercase;
}

.post-header__info {
  color: #6a6a6a;
}

/* --------------------------------------------------------------------------
   Banner (16:9, mesma proporção em todas as telas)
   -------------------------------------------------------------------------- */

.post-cover {
  max-width: 1440px;
  margin: 40px auto 0;
}

.post-cover__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background-color: #d9d9d9;
}

/* --------------------------------------------------------------------------
   Corpo: artigo + índice
   -------------------------------------------------------------------------- */

.post-body {
  max-width: 1440px;
  margin: var(--post-section) auto 0;
  padding: 0 var(--post-gutter);
}

.post-article__lead {
  margin-bottom: var(--post-section);
  font-family: var(--corte-font-optima);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.4;
}

/* Índice */
.post-toc__title {
  padding-bottom: 14.92px;
  border-bottom: 1px solid var(--corte-gray-350);
  font-family: var(--corte-font-optima);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.4;
}

.post-toc__list {
  display: flex;
  flex-direction: column;
  gap: 12.459px;
  margin-top: 23.28px;
}

.post-toc__link {
  position: relative;
  display: block;
  padding: 2.25px 0 2.25px 14px;
  font-family: var(--corte-font-gotham);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

.post-toc__link::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background-color: #d9d9d9;
  transition: background-color 300ms var(--corte-ease);
}

.post-toc__link:hover::before,
.post-toc__link.is-active::before {
  background-color: var(--corte-blue);
}

/* Mobile/tablet: índice em caixa, logo após o lead */
.post-toc--inline {
  margin-bottom: var(--post-section);
  padding: 24px;
  background-color: var(--corte-gray-400);
}

.post-toc--aside {
  display: none;
}

/* --------------------------------------------------------------------------
   Conteúdo do editor
   Os seletores usam :where() (especificidade baixa) e valem em qualquer
   nível — inclusive dentro de <article>, <section>, <div> ou blocos HTML —,
   então estilos próprios do post sobrescrevem sem precisar de !important.
   -------------------------------------------------------------------------- */

.post-content {
  --flow: 1.5em;
  --heading-space: var(--post-section);
  font-family: var(--corte-font-gotham);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  overflow-wrap: break-word;
}

/* Blocos de texto: uma linha em branco entre eles (como no Figma) */
.post-content :where(p, ul, ol, dl, blockquote, pre, figure, table, details, iframe, video, .table-responsive, .wp-block-table, .wp-block-embed) {
  margin-top: 0;
  margin-bottom: var(--flow);
}

/* Intertítulos */
.post-content :where(h2, h3, h4) {
  font-family: var(--corte-font-optima);
  font-weight: 400;
  line-height: 1.4;
  scroll-margin-top: 100px;
}

.post-content :where(h2) {
  margin: var(--heading-space) 0 16px;
  font-size: 24px;
}

.post-content :where(h3) {
  margin: 28px 0 10px;
  font-size: 20px;
}

.post-content :where(h4) {
  margin: 24px 0 8px;
  font-size: 17px;
}

/* Primeiro e último elementos não empurram o conteúdo */
.post-content > :first-child,
.post-content > :first-child > :first-child {
  margin-top: 0;
}

.post-content > :last-child,
.post-content > :last-child > :last-child {
  margin-bottom: 0;
}

/* Listas */
.post-content :where(ul, ol) {
  padding-left: 1.25em;
}

.post-content :where(ul) {
  list-style: disc;
}

.post-content :where(ol) {
  list-style: decimal;
}

.post-content :where(li) {
  margin-bottom: 0.5em;
}

.post-content :where(li:last-child) {
  margin-bottom: 0;
}

.post-content :where(li > ul, li > ol) {
  margin-top: 0.5em;
  margin-bottom: 0;
}

/* Texto */
.post-content :where(a) {
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 300ms var(--corte-ease);
}

.post-content :where(a:hover) {
  color: var(--corte-beige);
}

.post-content :where(strong, b) {
  font-weight: 500;
}

.post-content :where(blockquote) {
  padding-left: 24px;
  border-left: 2px solid var(--corte-blue);
  font-family: var(--corte-font-optima);
  font-size: 24px;
  line-height: 1.4;
}

.post-content :where(hr) {
  margin: var(--heading-space) 0;
  border-top: 1px solid var(--corte-gray-350);
}

/* Mídia */
.post-content :where(figure) {
  margin-left: 0;
  margin-right: 0;
}

.post-content :where(img, video) {
  width: 100%;
  height: auto;
}

.post-content :where(figcaption) {
  margin-top: 8px;
  color: #6a6a6a;
  font-size: 14px;
  line-height: 1.5;
}

/* Tabelas: rolagem horizontal quando não cabem */
.post-content :where(.table-responsive, .wp-block-table) {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.post-content :where(table) {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.5;
}

.post-content :where(.table-responsive, .wp-block-table) :where(table) {
  min-width: 560px;
  margin-bottom: 0;
}

.post-content :where(th, td) {
  padding: 12px 14px;
  border: 1px solid #d9d9d9;
  text-align: left;
  vertical-align: top;
}

.post-content :where(th) {
  background-color: #f5f5f5;
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Compartilhar
   -------------------------------------------------------------------------- */

.post-share {
  position: relative;
  margin-top: var(--post-section);
}

/* Figma: leading "normal" da Gotham = 17px (14px) e 20px (17px) */
.post-share__label {
  font-family: var(--corte-font-gotham);
  font-size: 14px;
  font-weight: 400;
  line-height: 17px;
}

.post-share__list {
  display: flex;
  gap: 5.98px;
  margin-top: 12px;
}

.post-share__button {
  display: flex;
  width: 31.415px;
  height: 32.157px;
  align-items: center;
  justify-content: center;
  border: 0.749px solid var(--corte-blue);
  border-radius: 31.79px;
  transition: background-color 300ms var(--corte-ease), border-color 300ms var(--corte-ease);
}

.post-share__button:hover,
.post-share__button.is-copied {
  border-color: var(--corte-beige);
  background-color: var(--corte-beige);
}

.post-share__button img {
  width: 17.96px;
  height: 18.7px;
}

.post-share__feedback {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  font-family: var(--corte-font-gotham);
  font-size: 12px;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Artigos relacionados
   -------------------------------------------------------------------------- */

.post-related {
  margin-top: 39px;
  padding: 40px var(--post-gutter) 0;
  border-top: 1px solid var(--corte-gray-350);
}

.post-related__title {
  font-family: var(--corte-font-optima);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.4;
}

.post-related__grid {
  margin-top: 40px;
}

/* No mobile o Figma mostra 3 cards */
@media (max-width: 767.98px) {
  .post-related__grid .blog-card:nth-child(n + 4) {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Tablet
   -------------------------------------------------------------------------- */

@media (min-width: 768px) {
  .post-page {
    --post-gutter: 50px;
  }

  .post-header {
    padding-top: 80px;
  }

  .post-header__title {
    font-size: 56px;
  }

  .post-header__meta {
    flex-direction: row;
    flex-wrap: wrap;
    column-gap: 60px;
    row-gap: 8px;
    padding: 24px 0;
  }

  .post-cover {
    padding: 0 var(--post-gutter);
  }
}

/* --------------------------------------------------------------------------
   Desktop
   -------------------------------------------------------------------------- */

@media (min-width: 1024px) {
  .post-page {
    --post-gutter: 60px;
    --post-section: 60px;
    padding-bottom: 95.39px;
  }

  .post-header {
    padding-top: 110.29px;
  }

  .post-header__title {
    font-size: 80px;
  }

  .post-header__meta {
    font-size: 17px;
  }

  .post-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 297px;
    align-items: start;
    column-gap: 95.36px;
  }

  .post-article__lead {
    max-width: 832px;
    font-size: 42px;
  }

  .post-toc--inline {
    display: none;
  }

  .post-toc--aside {
    position: sticky;
    top: 140px;
    display: block;
  }

  .admin-bar .post-toc--aside {
    top: 172px;
  }

  .post-toc__title {
    font-size: 32px;
  }

  .post-toc__link {
    font-size: 17px;
  }

  .post-content {
    font-size: 17px;
  }

  .post-content :where(h2, h3, h4) {
    max-width: 832px;
    scroll-margin-top: 140px;
  }

  .post-content :where(h2) {
    margin-bottom: 20px;
    font-size: 32px;
  }

  .post-content :where(h3) {
    margin: 36px 0 12px;
    font-size: 24px;
  }

  .post-content :where(h4) {
    margin: 28px 0 10px;
    font-size: 20px;
  }

  .post-content :where(table) {
    font-size: 15px;
  }

  .post-share {
    display: flex;
    max-width: 856px;
    align-items: center;
    justify-content: space-between;
    padding-top: 30px;
    border-top: 1px solid var(--corte-gray-350);
  }

  .post-share__label {
    font-size: 17px;
    line-height: 20px;
  }

  .post-share__list {
    gap: 8px;
    margin-top: 0;
  }

  .post-share__button {
    width: 41.95px;
    height: 42.94px;
    border-width: 1px;
    border-radius: 42.45px;
  }

  .post-share__button img {
    width: 23.98px;
    height: 24.96px;
  }

  .post-share__feedback {
    right: 0;
    left: auto;
  }

  .post-related {
    max-width: 1440px;
    margin: 165.88px auto 0;
    padding: 0 var(--post-gutter);
    border-top: 0;
  }

  .post-related__title {
    padding-bottom: 19px;
    border-bottom: 1px solid var(--corte-gray-350);
    font-size: 40px;
  }

  .post-related__grid {
    margin-top: 60px;
  }
}

@media (min-width: 1280px) {
  .post-page {
    --post-gutter: 90px;
  }
}
