   SECTION HEADER
   ============================================================ */
.section-header {
  display: flex; align-items: flex-end;
  justify-content: space-between; gap: 12px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 14px; margin-bottom: 28px;
  flex-wrap: wrap;
}
.section-title {
  font-family: var(--font-head);
  font-size: 1.35rem; font-weight: 700;
}
.section-desc { font-size: .82rem; color: var(--muted); margin-top: 3px; }
.view-all-link {
  font-size: .82rem; font-weight: 600; color: var(--accent);
  white-space: nowrap; display: flex; align-items: center; gap: 3px;
  transition: gap .2s;
}
.view-all-link:hover { gap: 7px; }
.view-all-link::after { content: '→'; }

/* ============================================================
   FEATURED POSTS SECTION
   ============================================================ */
.featured-section { padding: 52px 0; }

/* ============================================================
   POST CARDS GRID
   ============================================================ */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

.post-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .28s ease, box-shadow .28s ease;
  display: flex; flex-direction: column;
}
.post-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }

.post-card-thumb {
  overflow: hidden; position: relative;
  background: var(--border);
}
.post-card-thumb img {
  width: 100%; height: 185px;
  object-fit: cover;
  transition: transform .45s ease;
  display: block;
}
.post-card:hover .post-card-thumb img { transform: scale(1.06); }

/* When thumbnails are hidden */
.post-card-thumb.no-thumb {
  height: 185px;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  display: flex; align-items: center; justify-content: center;
  color: #93c5fd; font-size: 2rem;
}

.post-card-body {
  padding: 18px; flex: 1;
  display: flex; flex-direction: column; gap: 8px;
}
.post-card-cat {
  font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--accent);
}
.post-card-title {
  font-family: var(--font-head);
  font-size: 1rem; font-weight: 700; line-height: 1.38;
  display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card-title a { transition: color .18s; }
.post-card-title a:hover { color: var(--accent); }
.post-card-excerpt {
  font-size: .84rem; color: var(--muted); line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  flex: 1;
}
.post-card-footer {
  margin-top: auto; padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.read-more-link {
  font-size: .8rem; font-weight: 600; color: var(--accent);
  transition: gap .18s; display: flex; align-items: center; gap: 3px;
}
.read-more-link:hover { gap: 7px; }
.read-more-link::after { content: '→'; }

/* ============================================================
   CATEGORY BROWSER SECTION
   ============================================================ */
.category-section {
  background: var(--white);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 52px 0;
}
.cat-tabs {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 28px;
}
.cat-tab {
  background: #f1f5f9; border: 1px solid var(--border);
  border-radius: 99px; padding: 7px 18px;
  font-size: .82rem; font-weight: 500; color: var(--muted);
  transition: all .18s;
}
.cat-tab:hover { border-color: var(--accent); color: var(--accent); }
.cat-tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Posts inside category section */
#cat-grid { min-height: 100px; transition: opacity .25s; }
#cat-grid.is-loading { opacity: .4; pointer-events: none; }

.browse-all-btn {
  display: block; width: fit-content; margin: 32px auto 0;
  background: var(--text); color: #fff;
  padding: 13px 36px; border-radius: 99px;
  font-weight: 600; font-size: .9rem; letter-spacing: .02em;
  transition: background .18s, transform .18s;
}
.browse-all-btn:hover { background: var(--accent); transform: translateY(-2px); }

/* ============================================================
   SINGLE POST
   ============================================================ */
.single-post-wrap { padding: 52px 0; }
.single-post-inner { max-width: 760px; margin-inline: auto; }

.single-post-cats { margin-bottom: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.single-post-cats a {
  display: inline-block; background: #eff6ff; color: var(--accent);
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; padding: 4px 12px; border-radius: 99px;
  transition: background .18s;
}
.single-post-cats a:hover { background: var(--accent); color: #fff; }

.single-post-title {
  font-family: var(--font-head);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.22; margin-bottom: 14px;
}

.single-post-subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 12px;
}

.single-post-meta {
  font-size: .84rem; color: var(--muted); margin-bottom: 28px;
}

.single-featured-img {
  width: 100%; aspect-ratio: 16/9;
  object-fit: cover; border-radius: var(--radius-lg);
  margin-bottom: 36px;
}

.single-post-content { font-size: 1.02rem; line-height: 1.82; }
.single-post-content > * + * { margin-top: 1.2em; }
.single-post-content h2 { font-family: var(--font-head); font-size: 1.55rem; margin-top: 2em; }
.single-post-content h3 { font-family: var(--font-head); font-size: 1.2rem; margin-top: 1.6em; }
.single-post-content ul, .single-post-content ol { padding-left: 1.5em; }
.single-post-content ul { list-style: disc; }
.single-post-content ol { list-style: decimal; }
.single-post-content li { margin-bottom: .4em; }
.single-post-content img { border-radius: var(--radius); margin-block: 1.5em; }
.single-post-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.single-post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px; background: #eff6ff;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic; color: var(--muted);
}

/* Tables */
.single-post-content table {
  width: 100%; border-collapse: collapse;
  font-size: .9rem; margin-block: 1.5em;
}
.single-post-content th, .single-post-content td {
  border: 1px solid var(--border);
  padding: 10px 14px; text-align: left;
}
.single-post-content th {
  background: #f1f5f9; font-weight: 600; font-size: .82rem;
  text-transform: uppercase; letter-spacing: .04em;
}
.single-post-content tr:nth-child(even) td { background: #fafafa; }

/* ============================================================
   AUTHOR BOX
   ============================================================ */
.author-box {
  max-width: 760px; margin: 48px auto 0;
  display: flex; gap: 20px; align-items: flex-start;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
}
.author-avatar-link { flex-shrink: 0; }
.author-avatar-img {
  width: 72px !important; height: 72px !important;
  border-radius: 50%; object-fit: cover;
  display: block;
}
.author-info { min-width: 0; }
.author-name {
  display: block; font-weight: 700; font-size: 1rem;
  color: var(--text); margin-bottom: 8px;
  transition: color .18s;
}
.author-name:hover { color: var(--accent); }
.author-bio {
  font-size: .88rem; color: var(--muted);
  line-height: 1.65;
}

/* ============================================================
   RELATED POSTS
   ============================================================ */
.related-posts {
  max-width: 760px; margin: 56px auto 0;
}
.related-posts-title {
  font-size: 1.25rem; font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
}
.related-posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.related-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform .25s ease, box-shadow .25s ease;
}
.related-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

/* Image: tall, ~65% of card */
.related-card-thumb {
  overflow: hidden;
  background: #e2e8f0;
  flex-shrink: 0;
}
.related-card-thumb img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
  transition: transform .45s ease;
}
.related-card:hover .related-card-thumb img { transform: scale(1.04); }
.related-card-thumb--empty {
  height: 260px;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
}

/* Body: title bold + date */
.related-card-body {
  padding: 20px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.related-card-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color .18s;
}
.related-card:hover .related-card-title { color: var(--accent); }
.related-card-date {
  font-size: .82rem;
  color: var(--muted);
}

/* Mobile: stack vertically, full width */
@media (max-width: 640px) {
  .related-posts-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .related-card-thumb img,
  .related-card-thumb--empty { height: 200px; }
}

/* ============================================================
   ARCHIVE / SEARCH / PAGE
   ============================================================ */
.archive-wrap { padding: 52px 0; }
.archive-header { margin-bottom: 36px; }
.archive-eyebrow {
  display: inline-block; background: #eff6ff; color: var(--accent);
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; padding: 4px 12px; border-radius: 99px;
  margin-bottom: 10px;
}
.archive-title { font-family: var(--font-head); font-size: clamp(1.5rem, 4vw, 2rem); }
.archive-desc { color: var(--muted); font-size: .9rem; margin-top: 8px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex; justify-content: center;
  align-items: center; flex-wrap: wrap;
  gap: 6px; padding: 40px 0 0;
}
.pagination .page-numbers {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px;
  font-size: .88rem; font-weight: 500;
  border: 1px solid var(--border);
  background: var(--white); color: var(--text);
  transition: all .18s;
}
.pagination .page-numbers:hover,
.pagination .current {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.pagination .prev.page-numbers,
.pagination .next.page-numbers { width: auto; padding-inline: 14px; }

/* ============================================================
   404
   ============================================================ */
.error-404-wrap { text-align: center; padding: 100px 20px; }
.error-code {
  font-family: var(--font-head); font-size: 8rem; font-weight: 700;
  color: var(--border); line-height: 1;
}
.error-title { font-family: var(--font-head); font-size: 1.8rem; margin-bottom: 12px; }
.error-desc { color: var(--muted); margin-bottom: 28px; }
.btn-primary {
  display: inline-block; background: var(--accent); color: #fff;
  padding: 13px 36px; border-radius: 99px;
  font-weight: 600; font-size: .9rem;
  transition: background .18s, transform .18s;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-2px); }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer { background: var(--footer-bg) !important; color: var(--footer-text) !important; }
.footer-main { padding: 48px 0 32px; }

.footer-brand-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}
.footer-brand-center .site-logo {
  color: var(--footer-logo-color);
  font-size: 1.6rem;
}
.footer-brand-center p {
  font-size: .88rem;
  color: var(--footer-desc-color);
  max-width: 420px;
  line-height: 1.6;
}

.footer-bottom {
  border-top: 1px solid var(--footer-border);
  padding: 20px 0;
}
.footer-bottom-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.footer-copy { font-size: .8rem; color: var(--footer-copy-color, var(--footer-text)); }
.footer-legal { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-legal a { font-size: .8rem; transition: color .18s; color: var(--footer-link-color); }
.footer-legal a:hover { color: var(--footer-link-hover); }

/* ============================================================
   WIDGETS / SIDEBAR
   ============================================================ */
.widget { margin-bottom: 28px; }
.widget-title {
  font-family: var(--font-head); font-size: 1rem; font-weight: 700;
  border-bottom: 2px solid var(--border); padding-bottom: 10px; margin-bottom: 14px;
}

/* ============================================================
   SCROLL ANIMATIONS
   ============================================================ */
.anim-fade-up {
  opacity: 0; transform: translateY(20px);
  transition: opacity .4s ease, transform .4s ease;
}
.anim-fade-up.is-visible { opacity: 1; transform: translateY(0); }

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Tablet landscape (≤ 1024px) */
@media (max-width: 1024px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Tablet portrait (≤ 900px) – hero stacks */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-main-link img { height: 300px; }
  .hero-main-no-thumb { min-height: 260px; }
  .hero-secondary { flex-direction: row; flex-wrap: wrap; }
  .hero-sub-card { flex: 1 1 calc(50% - 7px); min-width: 200px; }
}

/* Mobile (≤ 640px) */
@media (max-width: 640px) {
  :root { --gap: 16px; }

  /* Nav: hide desktop, show hamburger */
  .primary-nav { display: none; }
  .hamburger { display: flex; }

  /* Hero */
  .hero-section { padding: 20px 0 28px; }
  .hero-main-link img { height: 240px; }
  .hero-main-overlay h2 { font-size: 1.15rem; }
  .hero-secondary { flex-direction: column; }
  .hero-sub-card { flex: unset; }
  .hero-sub-card img { width: 80px; height: 60px; }

  /* Posts grid → single column */
  .posts-grid { grid-template-columns: 1fr; }
  .post-card-thumb img { height: 180px; }

  /* Featured section spacing */
  .featured-section { padding: 32px 0; }
  .category-section { padding: 32px 0; }

  /* Single post */
  .single-post-wrap { padding: 28px 0; }

  /* Author box */
  .author-box { flex-direction: column; align-items: center; text-align: center; }

  /* Footer */
  .footer-bottom-inner { flex-direction: column; text-align: center; }
  .footer-legal { justify-content: center; }

  /* Archive */
  .archive-wrap { padding: 28px 0; }
}

/* Small mobile (≤ 400px) */
@media (max-width: 400px) {
  .hero-main-link img { height: 200px; }
  .section-title { font-size: 1.1rem; }
  .hero-sub-card img { display: none; }
}

/* ============================================================
   PERFORMANCE — PageSpeed optimizations
   ============================================================ */

/* content-visibility: auto — navegador pula renderização de
   seções fora da viewport, melhora TBT e FCP */
.category-section,
.related-posts,
.author-box,
.footer-main {
  content-visibility: auto;
  contain-intrinsic-size: 0 400px;
}

/* Evita layout shift (CLS) nas imagens — sempre ocupa espaço */
img {
  max-width: 100%;
  height: auto;
  display: block;
}
.post-card-thumb img,
.related-card-thumb img,
.hero-main-link img,
.single-featured-img {
  aspect-ratio: attr(width) / attr(height);
}

/* Reduz paint area — only animate transform/opacity (GPU layers) */
.post-card,
.related-card,
.hero-sub-card {
  will-change: transform;
}
/* Remove will-change após hover para liberar memória GPU */
.post-card:not(:hover),
.related-card:not(:hover),
.hero-sub-card:not(:hover) {
  will-change: auto;
}

/* Desabilita animações para usuários que preferem menos movimento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  .anim-fade-up { opacity: 1 !important; transform: none !important; }
}

/* Fonte system-ui como fallback antes do Montserrat carregar
   (evita FOUT / layout shift de fonte) */
body {
  font-family: 'Montserrat', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
