/* Componentes visuais dos artigos de FII.
   Reutiliza variáveis do tema em css/style.css.
   Inspirado no padrão estabelecido pelo artigo tgar11-balanco-2025. */

/* Container canônico do artigo. A regra cobre dois cenários:
   1) Template novo: <article class="article-container">
   2) Template antigo (sem class): <main class="main-content"><article>
   Sem o segundo seletor, artigos antigos ficavam com 100% da largura no
   desktop e desalinhados do header/footer (incidente 2026-05-18). */
.article-container,
main.main-content > article,
body > main > article {
  max-width: 1200px; /* alinhado ao .article-topbar (1280px) — menos 80px do padding lateral combinado */
  margin: 0 auto;
  /* padding-top dá respiro entre o cabeçalho fixo do site (app-header) e o
     primeiro elemento do artigo — geralmente a <figure class="article-cover">.
     padding-bottom pequeno: o bloco que vem depois (.rap-c-trailing dentro do
     article, ou .article-related fora) já tem seu próprio espaço — não dobrar. */
  padding: 24px 20px 12px;
  box-sizing: border-box;
  width: 100%;
}

/* Layout do envelope: garante footer no fim mesmo em artigos curtos.
   O template novo aplica isso inline; aqui cobrimos os 12 artigos antigos
   que tinham apenas <div class="page-wrapper"> sem display:flex.

   ATENÇÃO: article-fii.css NÃO é exclusivo de páginas de artigo. Hoje ele
   também hospeda as classes .article-topbar/.article-footer usadas pelo
   site-header.js — que é carregado em /fiis/ e potencialmente outras
   landings. Por isso, regras que mexem em .page-wrapper / main precisam
   ser escopadas para artigos via :has(> article), pra não vazar.
   (Incidente 2026-05-19: regra abaixo, sem :has(), zerou max-width do
   /fiis/ no desktop.) */
.page-wrapper:has(article) {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page-wrapper:has(article) > main {
  flex: 1;
}
/* Override do style.css global: `.page-wrapper .main-content { max-width:1000px }`
   estreitaria artigos antigos pra 1000px enquanto os novos rodam em 1200px
   (que não têm <main> intermediário). E muitos artigos antigos ainda têm um
   <style> inline com `.main-content { max-width: 800px }` herdado de um
   layout legado. Aqui forçamos o main em página de artigo a ser
   transparente — quem define a largura é o .article-container interno.
   :has(> article) garante que isso só aplica em páginas que de fato têm
   um <article> dentro do main (artigos), e não em landings/hubs que
   também carregam este CSS por causa do shell injetado. */
.page-wrapper > main.main-content:has(> article) {
  max-width: none !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent;
}

/* Todo conteúdo (texto e blocos visuais) usa a largura total do container,
   alinhado em duas linhas verticais únicas (borda esquerda e borda direita).
   Pra compensar a coluna larga em texto corrido, mantemos line-height confortável. */
.article-content > p,
.article-content > h2,
.article-content > h3,
.article-content > h4,
.article-content > ul,
.article-content > ol,
.article-content > blockquote,
.article-header h1,
.article-header .subtitle,
.article-header .article-meta {
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}
.article-content > p,
.article-content > ul,
.article-content > ol,
.article-content > blockquote {
  line-height: 1.65;
}

/* Mobile */
@media (max-width: 720px) {
  .article-container {
    padding: 16px 12px 32px;
  }
  .article-content h2 { margin: 24px 0 12px; font-size: 1.3rem; line-height: 1.3; }
  .article-content h3 { font-size: 1.1rem; line-height: 1.3; }
  .article-content p,
  .article-content li { font-size: 0.95rem; line-height: 1.6; }
  .article-content blockquote { font-size: 0.95rem; }
  .article-content figcaption { font-size: 0.8rem; }
  .article-header h1 { font-size: 1.55rem; line-height: 1.25; }
  .article-header .subtitle { font-size: 0.98rem; line-height: 1.45; }
  .article-header .article-meta { font-size: 0.78rem; flex-wrap: wrap; gap: 8px; }
  /* Continue Lendo: padding-right pra deixar o último card visível ao final do scroll */
  .article-related { padding: 18px 12px 22px; }
  .article-related-scroll {
    grid-auto-columns: 260px;
    padding-right: 16px;
    scroll-padding-inline-end: 16px;
  }
  /* Stats grid: nunca deixar valor estourar a célula */
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .stat-item { padding: 14px 12px; }
  .stat-item .value {
    font-size: 1.05rem;
    line-height: 1.25;
    word-break: break-word;
  }
  .stat-item .label { font-size: 0.72rem; }
  .stat-box { padding: 18px 14px; }
  .stat-number { font-size: 1.8rem; }
  .stat-label { font-size: 0.82rem; }
  /* Callouts mais compactos */
  .callout { padding: 14px; margin: 18px 0; }
  .callout h3 { font-size: 1rem; }
  /* Disclaimer/details */
  .disclaimer { padding: 14px; font-size: 0.85rem; }
  /* Tabela: padding menor + scroll horizontal default em mobile */
  .article-table { font-size: 0.88rem; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .article-table thead th,
  .article-table tbody td { padding: 10px 12px; }
  .article-table thead th { font-size: 0.78rem; white-space: nowrap; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .article-related-scroll { grid-auto-columns: 230px; padding-right: 12px; }
  .article-header h1 { font-size: 1.4rem; }
  .article-header .subtitle { font-size: 0.92rem; }
}
@media (max-width: 400px) {
  .article-container { padding: 12px 10px 28px; }
}

/* Capa do artigo: aparece ANTES do título */
.article-cover {
  margin: 0 0 28px;
  border-radius: 12px;
  overflow: hidden;
  max-height: 700px;
  background: #0d1117; /* fundo neutro caso a imagem não preencha (verticais com object-fit contain) */
  display: flex;
  justify-content: center;
  align-items: center;
}
.article-cover img {
  width: auto;
  max-width: 100%;
  max-height: 700px;
  height: auto;
  display: block;
  object-fit: contain;
}
@media (max-width: 720px) {
  /* Em mobile a capa vira full-bleed (negativa o padding lateral do container) */
  .article-cover {
    margin: 0 -12px 20px;
    border-radius: 0;
  }
}
@media (max-width: 400px) {
  .article-cover { margin: 0 -10px 18px; }
}

.article-header {
  margin-bottom: 32px;
}

.article-header h1 {
  font-size: 2rem;
  margin: 16px 0;
  line-height: 1.3;
  color: var(--text-primary);
}

.article-header .subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.45;
  max-width: 920px; /* limita a largura pra subtítulo não virar resumão */
}

.article-meta {
  display: flex;
  gap: 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-wrap: wrap;
  margin-top: 16px;
}

.article-content {
  line-height: 1.8;
  color: var(--text-secondary);
}

.article-content h2 {
  color: var(--text-primary);
  margin: 40px 0 20px;
  font-size: 1.5rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 8px;
}

.article-content h3 {
  color: var(--text-primary);
  margin: 28px 0 12px;
  font-size: 1.2rem;
}

.article-content p {
  margin-bottom: 16px;
}

.article-content ul,
.article-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.article-content li {
  margin-bottom: 8px;
}

.article-content strong {
  color: var(--text-primary);
}

/* Destaques semânticos usados inline */
.text-bullish { color: var(--bullish); }
.text-bearish { color: var(--bearish); }
.text-neutral { color: var(--neutral); }
.text-accent { color: var(--primary-light); }

/* Grid de métricas grandes — fotografia rápida */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.stat-item {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.stat-item .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-light);
}

.stat-item .value.bearish { color: var(--bearish); }
.stat-item .value.bullish { color: var(--bullish); }
.stat-item .value.neutral { color: var(--neutral); }

.stat-item .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Garante empilhamento vertical mesmo quando os filhos são <span> (inline por
   padrão) — sem isso label/value/subtitle saem todos na mesma linha. */
.stat-item .label,
.stat-item .value,
.stat-item .subtitle {
  display: block;
}

.stat-item .subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.3;
}

/* Stat box solo (destaque forte) */
.stat-box {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  margin: 24px 0;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
}

.stat-number.bearish { color: var(--bearish); }
.stat-number.bullish { color: var(--bullish); }
.stat-number.neutral { color: var(--neutral); }

.stat-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 8px;
}

/* Tabela de dados em artigos (ex: comparativos, listas de inquilinos, projeções) */
.article-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 24px 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  font-size: 0.95rem;
  line-height: 1.45;
}

.article-table thead th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.article-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: top;
}

.article-table tbody tr:last-child td {
  border-bottom: none;
}

.article-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

.article-table tbody tr:hover td {
  background: rgba(45, 138, 110, 0.08);
}

/* Primeira coluna costuma ser rótulo — leve destaque */
.article-table tbody td:first-child {
  font-weight: 500;
  color: var(--text-primary);
}

/* Números alinhados à direita ficam mais fáceis de comparar — opt-in via classe */
.article-table td.num,
.article-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Permite scroll horizontal em telas pequenas sem quebrar layout */
.article-content .article-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 24px 0;
}

.article-content .article-table-wrap .article-table {
  margin: 0;
}

/* Callouts coloridos — contexto, alerta, insight */
.callout {
  background: linear-gradient(135deg, rgba(240, 193, 75, 0.1) 0%, rgba(13, 17, 23, 0.95) 100%);
  border: 1px solid rgba(240, 193, 75, 0.3);
  border-radius: 12px;
  padding: 20px;
  margin: 24px 0;
}

.callout.positive {
  background: linear-gradient(135deg, rgba(63, 185, 80, 0.15) 0%, rgba(13, 17, 23, 0.95) 100%);
  border-color: rgba(63, 185, 80, 0.3);
}

.callout.danger {
  background: linear-gradient(135deg, rgba(248, 81, 73, 0.1) 0%, rgba(13, 17, 23, 0.95) 100%);
  border-color: rgba(248, 81, 73, 0.3);
}

.callout h3 {
  margin: 0 0 12px 0;
  color: var(--text-primary);
}

.callout p:last-child {
  margin-bottom: 0;
}

/* Tabelas comparativas */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  background: var(--bg-tertiary);
  border-radius: 12px;
  overflow: hidden;
}

.comparison-table th,
.comparison-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.comparison-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

.comparison-table tr:last-child td { border-bottom: none; }
.comparison-table td:first-child { font-weight: 600; color: var(--text-primary); }
.comparison-table td.center { text-align: center; }
.comparison-table td.bullish { color: var(--bullish); font-weight: 600; }
.comparison-table td.bearish { color: var(--bearish); font-weight: 600; }

/* Faixa de preços / cenário de entrada */
.price-action-box {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
}

.price-action-box h4 {
  margin: 0 0 16px 0;
  color: var(--text-primary);
}

.price-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  margin-bottom: 8px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.price-row .price {
  font-size: 1.2rem;
  font-weight: 700;
  min-width: 80px;
}

.price-row .price.bullish { color: var(--bullish); }
.price-row .price.neutral { color: var(--neutral); }
.price-row .price.bearish { color: var(--bearish); }

.price-row .action {
  flex: 1;
  font-size: 0.95rem;
}

.price-row .action strong {
  color: var(--text-primary);
}

/* Badges de categoria no topo */
.nivel-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  /* margem direita pra separar entre si na mesma linha + margem inferior
     pra dar respiro quando quebram em múltiplas linhas no mobile */
  margin: 0 6px 8px 0;
}

.nivel-badge.urgente {
  background: rgba(248, 81, 73, 0.15);
  color: var(--bearish);
}

.nivel-badge.estrategia {
  background: rgba(63, 185, 80, 0.15);
  color: var(--bullish);
}

.nivel-badge.atualizado {
  background: rgba(88, 166, 255, 0.15);
  color: #58a6ff;
}

.nivel-badge.novato {
  background: rgba(240, 193, 75, 0.15);
  color: var(--neutral);
}

/* capa do artigo precisa ancorar o badge de relevância (overlay) */
.article-cover { position: relative; }

/* Citações de gestores */
.quote-box {
  background: var(--bg-tertiary);
  border-left: 4px solid var(--primary-light);
  padding: 20px;
  margin: 24px 0;
  font-style: italic;
}

.quote-box .author {
  font-style: normal;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Veredicto final */
.verdict-box {
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.1) 0%, rgba(13, 17, 23, 0.95) 100%);
  border: 2px solid rgba(88, 166, 255, 0.4);
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
}

.verdict-box h3 {
  margin: 0 0 16px 0;
  color: #58a6ff;
}

/* Disclaimer padrão */
.disclaimer {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin-top: 40px;
}

.disclaimer h4 {
  margin-bottom: 8px;
  color: var(--neutral);
}

@media (max-width: 600px) {
  .article-header h1 { font-size: 1.5rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .comparison-table th,
  .comparison-table td { padding: 8px 6px; font-size: 0.85rem; }
  .price-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .price-row .price { min-width: auto; }
}

html, body, .page-wrapper { overflow-x: hidden; }

/* Defensiva contra estouro horizontal em mobile:
   URLs/códigos/inputs longos podem expandir o container além da viewport.
   `min-width: 0` quebra o assumido `min-width: auto` do flex item, e
   `overflow-wrap: anywhere` autoriza quebrar palavras que não cabem.
   NÃO incluir .article-container aqui: ele precisa manter max-width:1200px
   pra ficar alinhado com header/footer no desktop (incidente 2026-05-18 —
   .article-container caía pra 100% da viewport e o artigo grudava nas bordas). */
.article-content,
.article-header,
.article-content > * {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-wrap: break-word;
}
.article-content code,
.article-content pre,
.article-content a {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.article-content pre {
  overflow-x: auto;
  max-width: 100%;
}
/* Tabelas em mobile precisam de scroll horizontal próprio, não estourar viewport */
.article-content table,
.article-content .comparison-table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

/* ── Topbar padrão dos artigos (injetada via js/article-layout.js) ── */
/* Usa position: fixed porque `overflow-x: hidden` em html/body/.page-wrapper
   quebra position: sticky nos descendentes.
   Altura controlada por --topbar-h e --tabbar-h pra manter consistência. */
:root {
  --topbar-h: 56px;
  --tabbar-h: 68px;
}
@media (max-width: 600px) {
  :root {
    --topbar-h: 52px;
    --tabbar-h: 64px;
  }
}

.article-topbar-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--topbar-h);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  /* backdrop-filter removido: topbar fixo sobre fundo opaco (#161b22) → blur
     invisível, mas re-rasterizado a cada frame ao rolar o artigo (jank mobile). */
}

/* Compensa a altura do topbar fixo para o conteúdo não ficar por baixo. */
body[data-ticker] .page-wrapper,
body.article-page .page-wrapper,
body.has-fixed-topbar .page-wrapper,
body.has-fixed-topbar > main,
body.has-fixed-topbar > .main-content {
  padding-top: var(--topbar-h);
}

/* Quando há tab-bar de "Modo de visualização" abaixo do topbar,
   o padding precisa cobrir os dois elementos fixos. */
body.has-view-modes .page-wrapper,
body.has-view-modes > main,
body.has-view-modes > .main-content {
  padding-top: calc(var(--topbar-h) + var(--tabbar-h));
}

.article-topbar {
  max-width: 1200px; /* alinhado ao .article-container e ao .article-footer-inner — coluna única do site */
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  position: relative;
}

.article-topbar .topbar-back,
.article-topbar .topbar-search-btn,
.article-topbar .topbar-menu-btn {
  width: 36px;
  height: 36px;
}

/* Search no header: circular, mesma cor de borda do sininho (rap-notif-btn).
   Posicionado ANTES dos demais ícones de ação (sininho + avatar). */
.article-topbar .topbar-search-btn {
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  transition: background 0.15s, border-color 0.15s;
}
.article-topbar .topbar-search-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.22);
}
.article-topbar .topbar-search-btn svg { width: 18px; height: 18px; }
.article-topbar .topbar-logo svg { width: 32px; height: 32px; }

.topbar-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s;
}

.topbar-back:hover { background: rgba(255, 255, 255, 0.10); }

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.topbar-logo {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
}

.topbar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}

.topbar-brand-text strong {
  font-size: 1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--neutral) 100%); /* branco → amarelo (padronizado com .app-name da home) */
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.2px;
}

.topbar-brand-text small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.topbar-search-btn,
.topbar-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  flex-shrink: 0;
}

.topbar-search-btn:hover,
.topbar-menu-btn:hover { background: rgba(255, 255, 255, 0.10); }

.topbar-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px;
  min-width: 220px;
  display: none;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  z-index: 30;
}

.topbar-menu.open { display: flex; }

.topbar-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: background 0.15s;
}

.topbar-menu-item:hover { background: rgba(255, 255, 255, 0.06); }

.topbar-menu-item.is-active {
  background: rgba(34, 211, 238, 0.10);
  color: var(--primary-light, #22d3ee);
  font-weight: 600;
}

.topbar-menu-icon {
  font-size: 1.1rem;
  width: 22px;
  display: inline-flex;
  justify-content: center;
}

/* ── CTA pra página do FII (injetada via JS) ──
   Largura alinhada ao .article-container (1200px com 20px de padding lateral)
   pra ficar na mesma linha vertical do conteúdo do artigo.
   width:100% é obrigatório: o JS injeta esse <section> como irmão do
   <article.article-container> dentro do .page-wrapper, que é
   display:flex; flex-direction:column. Em flex column, `margin: ... auto`
   no cross-axis absorve o espaço livre e o item fica com largura intrínseca
   (~1071px no desktop, ficando desalinhado do .article-content acima e do
   .article-related abaixo). width:100% força o stretch até o max-width. */
.article-cta-fii {
  max-width: 1200px;
  width: 100%;
  margin: 32px auto;
  padding: 0 20px;
  box-sizing: border-box;
}

.article-cta-fii-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.15) 0%, rgba(13, 17, 23, 0.95) 100%);
  border: 2px solid rgba(88, 166, 255, 0.3);
  border-radius: 16px;
  padding: 28px;
  flex-wrap: wrap;
}

.article-cta-fii-text {
  flex: 1;
  min-width: 240px;
}

.article-cta-fii-text h3 {
  margin: 0 0 8px 0;
  font-size: 1.3rem;
  color: var(--text-primary);
}

.article-cta-fii-text h3 strong {
  color: #58a6ff;
}

.article-cta-fii-text p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

.article-cta-fii-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  background: #58a6ff;
  color: #0d1117;
  font-weight: 700;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: transform 0.15s, box-shadow 0.15s;
}

/* Override do `a:hover { color: var(--secondary) }` global de style.css:76 —
   o botão é um <a> e estava ficando com texto colorido no hover. */
.article-cta-fii-btn:hover,
.article-cta-fii-btn:focus {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(88, 166, 255, 0.4);
  color: #0d1117;
}

/* ── Carrossel de artigos relacionados ── */
.article-related {
  /* Bloco edge-to-edge igual ao footer — background full-width via box-shadow
     trick. Sem gap pro conteúdo acima nem pro footer abaixo. */
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 20px 24px;
  background: var(--bg-secondary);
  box-shadow: 0 0 0 100vmax var(--bg-secondary);
  clip-path: inset(0 -100vmax);
  position: relative;
}
.article-related + .article-footer,
.article-related + #site-footer {
  margin-top: 0; /* footer vem colado depois do "Continue lendo" pra reduzir o gap */
}

.article-related h3 {
  font-size: 1.2rem;
  margin: 0 0 16px 0;
  color: var(--text-primary);
}

.article-related-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 280px;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}

.article-related-scroll::-webkit-scrollbar { height: 6px; }
.article-related-scroll::-webkit-scrollbar-track { background: transparent; }
.article-related-scroll::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.article-related-card {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  min-height: 130px;
  transition: border-color 0.15s, transform 0.15s;
}

.article-related-card:hover {
  border-color: #58a6ff;
  transform: translateY(-2px);
}

.article-related-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.article-related-title {
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--text-primary);
  font-weight: 600;
}

.article-related-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Footer padrão dos artigos ── */
.article-footer {
  margin-top: 0;
  margin-bottom: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.article-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 18px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: space-between;
}

.article-footer-brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.article-footer-brand svg { flex-shrink: 0; }
.article-footer-brand-text {
  display: flex; flex-direction: column; gap: 0;
  line-height: 1.25;
}

.article-footer-brand strong {
  font-size: 0.92rem;
  color: var(--text-primary);
  font-weight: 700;
}

.article-footer-brand span {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Lista de links removida no novo footer enxuto */
.article-footer-nav { display: none; }

.article-footer-note {
  flex-basis: 100%;
  border-top: 1px solid var(--border-color);
  padding-top: 6px;
  margin-top: 2px;
  margin-bottom: 0;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.35;
}

@media (max-width: 600px) {
  .article-topbar { padding: 10px 14px; gap: 8px; }
  .topbar-brand-text strong { font-size: 0.9rem; }
  .topbar-menu { right: 14px; left: 14px; min-width: auto; }
  .article-cta-fii-inner { flex-direction: column; align-items: flex-start; padding: 20px; }
  .article-cta-fii-btn { width: 100%; justify-content: center; }
  .article-related-scroll { grid-auto-columns: 240px; }

  /* Footer ENXUTO no mobile — uma linha + nota copyright bem apertada */
  .article-footer-inner { padding: 8px 14px calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
  .article-footer-brand { gap: 8px; }
  .article-footer-brand svg { width: 18px; height: 18px; }
  .article-footer-brand strong { font-size: 0.82rem; }
  .article-footer-brand span { font-size: 0.7rem; }
  .article-footer-note {
    font-size: 0.66rem;
    padding-top: 5px;
    margin-top: 0;
  }
}

/* ============================================================
   Widget de stats no topo do artigo (views/comments/shares).
   Injetado por js/article-stats.js entre .article-breadcrumb e o <h1>.
   ============================================================ */
.rap-article-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 8px 0 6px;
  margin: 6px 0 10px;
  font-size: 0.82rem;
  color: var(--text-muted, #8a94a3);
  letter-spacing: 0.01em;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.rap-article-stats[data-loaded="1"] { opacity: 1; }
.rap-article-stats .rap-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
/* Variante clicável: comments + shares — pula até o bloco correspondente */
.rap-article-stats .rap-stat--action {
  cursor: pointer;
  transition: color 0.15s ease, opacity 0.15s ease;
  border-radius: 4px;
}
.rap-article-stats .rap-stat--action:hover,
.rap-article-stats .rap-stat--action:focus-visible {
  color: var(--text, #e8edf3);
  outline: none;
}
.rap-article-stats .rap-stat--action:hover svg,
.rap-article-stats .rap-stat--action:focus-visible svg {
  opacity: 1;
}
.rap-article-stats .rap-stat svg {
  flex-shrink: 0;
  opacity: 0.72;
  transition: opacity 0.15s ease;
}
.rap-article-stats .rap-stat strong {
  color: var(--text, #e8edf3);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rap-article-stats .rap-stat-label {
  color: var(--text-muted, #8a94a3);
  font-weight: 400;
}
.rap-article-stats .rap-stat-sep {
  opacity: 0.38;
  font-size: 0.9rem;
  line-height: 1;
}
@media (max-width: 600px) {
  .rap-article-stats {
    gap: 6px 10px;
    padding: 6px 0 4px;
    margin: 4px 0 8px;
    font-size: 0.76rem;
  }
  .rap-article-stats .rap-stat-label { display: none; }
  .rap-article-stats .rap-stat-sep { opacity: 0.55; }
  .rap-article-stats .rap-stat svg { width: 14px; height: 14px; }
}

/* Vídeo embutido em artigo (YouTube) — padrão 16:9 responsivo */
.video-container { position: relative; width: 100%; padding-bottom: 56.25%; margin: 20px 0 24px; border-radius: 12px; overflow: hidden; background: var(--bg-tertiary, #0d1117); box-shadow: 0 10px 40px rgba(0,0,0,0.45); }
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
