/**
 * Shared layout shell — header, posts, categories, home bands.
 * Critical path still inlines shell vars + header in head.html; this file
 * covers post grid, sidebar, and list shells so templates stay thin.
 */

/* Comments form is in the article flow; hide broken unstyled flash until comments.css loads */
.modalcomments .comentscloseBtn {
  display: none;
}

/* Related footer thumbs: force aspect so late layout does not shift */
.relatedfooter .block-media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--dica-surface-soft, #ececf0);
}
.relatedfooter .block-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---- Shell (also in critical CSS; restate for non-critical pages) ---- */
.dica-shell,
.main-container {
  width: 100%;
  max-width: var(--dica-shell, 1200px);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--dica-gutter, 24px);
  padding-right: var(--dica-gutter, 24px);
  box-sizing: border-box;
}

/* Posts (destaques bar above) sit tighter under the header */
body.is-single .main-container,
.main-container.is-post {
  padding-top: 0;
  padding-bottom: 10px;
  margin-top: 6px;
}

/* Category / author archive shells clear the fixed header */
body.is-term .main-container,
body.is-section .main-container,
.main-container.is-archive {
  padding-top: 10px;
  padding-bottom: 40px;
  margin-top: 68px;
}

/* ---- Post page grid (article + optional "Leia também") ---- */
.page {
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  column-gap: 27px;
  align-items: start;
  float: none;
}

body.no-sidebar .page,
.page.is-full {
  grid-template-columns: minmax(0, 1fr);
}

.page .article {
  float: none;
  width: auto;
  max-width: none;
  min-width: 0;
  /* Horizontal inset from .main-container gutters */
  padding: 10px 0 0;
}

.category-sidebar {
  float: none;
  width: 320px;
  max-width: 320px;
  background-color: var(--dica-surface);
  padding: 0;
  height: fit-content;
  position: sticky;
  top: 100px;
  align-self: start;
}

body.no-sidebar .category-sidebar {
  display: none;
}

/* ---- Title / subheading (stable first paint metrics) ---- */
h1.single-title {
  color: var(--dica-ink, #101010);
  font-weight: 700;
  font-size: 210%;
  letter-spacing: -1px;
  word-spacing: 1px;
  margin: 0 0 10px;
  line-height: 1.1;
}

.article-subheading {
  color: var(--dica-muted, #848484);
  line-height: 1.2em;
  font-weight: 600;
  margin: 0;
  padding-bottom: 8px;
}

/* ---- Leia também sidebar cards ---- */
.siderelated ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.siderelated ul li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 15px 0;
  border-bottom: 1px solid var(--dica-border, #d4d2d2);
}

.siderelated .blocoimagem {
  flex: 0 0 auto;
  width: 150px;
  padding: 0 10px 0 0;
  box-sizing: content-box;
}

.siderelated .blocoimagem a {
  display: block;
  width: 150px;
  height: 92px;
  overflow: hidden;
  border-radius: 4px;
  background-color: var(--dica-surface-soft, #ececf0);
}

.siderelated .imagemcover,
.siderelated img.imagemcover {
  display: block;
  width: 150px;
  height: 92px;
  max-width: none;
  object-fit: cover;
  margin: 0;
  border-radius: 4px;
  background-color: var(--dica-surface-soft, #ececf0);
}

.siderelated .blocoimagem img {
  width: 150px;
  height: 92px;
  max-width: none;
  object-fit: cover;
}

.siderelated .bloco-conteudo {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  max-width: none;
  max-height: none;
  overflow: visible;
  margin: 0;
  border-radius: 0;
}

.siderelated .titulo-bloco {
  display: block;
  line-height: 1.35;
  font-weight: 600;
  margin: 0;
  color: var(--dica-ink, #101010);
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: manual;
}

.siderelated .titulo-bloco a {
  color: inherit;
  text-decoration: none;
}

.siderelated p {
  font-size: 20px;
  padding: 0 0 10px;
  border-bottom: 5px solid var(--dica-brand, #fc0);
  font-weight: 700;
  display: inline-block;
  margin: 0;
}

/* ---- Related posts footer strip ---- */
.relatedfooter {
  max-width: var(--dica-shell, 1200px);
  margin: 0 auto;
  padding: 20px var(--dica-gutter, 24px);
  box-sizing: border-box;
}

.relatedfooter-title {
  margin: 0 0 16px;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--dica-ink, #101010);
  line-height: 1.25;
}

.relatedfooter-title a {
  color: inherit;
  text-decoration: none;
}

.relatedfooter-title a:hover {
  color: var(--dica-action, #2f5da8);
}

.relatedfooter--tools .relatedfooter-title {
  padding-bottom: 8px;
  border-bottom: 3px solid var(--dica-brand, #ffcc00);
  display: inline-block;
  margin-bottom: 18px;
}

/* ---- Tool pages: tighter chrome on mobile (drop zone higher) ---- */
@media (max-width: 720px) {
  body.is-tool h1.single-title {
    font-size: 1.35rem;
    letter-spacing: -0.5px;
    margin: 0 0 6px;
    line-height: 1.15;
  }

  body.is-tool .article-subheading {
    font-size: 0.88rem;
    line-height: 1.35;
    padding-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  body.is-tool .breadcrumb {
    margin-bottom: 8px;
    font-size: 0.8rem;
  }

  body.is-tool .post-info {
    margin-bottom: 8px;
  }

  body.is-tool .post-info span {
    font-size: 0.75rem;
  }

  /* First intro paragraph after meta — keep short on small screens */
  body.is-tool .post-content > p:first-of-type {
    font-size: 0.9rem;
    line-height: 1.45;
    margin-bottom: 12px;
  }

  body.is-tool .itool-privacy,
  body.is-tool .cimg-privacy,
  body.is-tool .itool-hint[data-qa-mobile-note] {
    margin-bottom: 10px;
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  body.is-tool .itool-privacy-full {
    display: none;
  }

  body.is-tool .itool-privacy-short {
    display: inline;
  }
}

/* ---- Home shells (width only; card chrome stays in list.html) ---- */
.ff-home,
.ff-featured {
  max-width: var(--dica-shell, 1200px);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--dica-gutter, 24px);
  padding-right: var(--dica-gutter, 24px);
  box-sizing: border-box;
}

.ff-home {
  padding-top: 20px;
  padding-bottom: 40px;
  margin-top: 34px;
}

.ff-featured {
  margin-top: 26px;
  padding-top: 0;
  padding-bottom: 0;
}

/* ---- Tool pages: slightly tighter title block ---- */
body.is-tool h1.single-title {
  font-size: 190%;
}

body.is-tool .article-subheading {
  font-size: 0.98rem;
  line-height: 1.35;
}

/* ---- Responsive ---- */
@media screen and (max-width: 890px) {
  body.is-single .main-container,
  .main-container.is-post {
    margin-top: 6px;
    padding-left: 16px;
    padding-right: 16px;
  }

  body.is-term .main-container,
  body.is-section .main-container,
  .main-container.is-archive {
    margin-top: 68px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .page {
    display: block;
  }

  .page .article {
    width: 100%;
  }

  .category-sidebar {
    width: 100%;
    max-width: 100%;
    position: static;
    margin-top: 20px;
  }
}
