/* Brasil Descoberto — páginas institucionais (metodologia, correções, privacidade, quem faz, independência).
 *
 * Ordem de carga: /design/tokens.css, /css/fontes.css, /css/componentes.css (classes bd- sem o @import do
 * Google Fonts) e por último este arquivo. Aqui ficam só o layout destas páginas e pequenos ajustes de
 * componente; as classes bd- em si vêm de componentes.css, que é gerado a partir do design system.
 */

/* ---------- Tema escuro automático ----------
   design/tokens.css só aplica o escuro com [data-theme="dark"]. Aqui ele vale também pela preferência
   do aparelho, a menos que a página force data-theme="light". Valores copiados de design/tokens.css
   ([data-theme="dark"]), iguais aos do index.html: manter em sincronia. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:#0d1322; --surface:#151d31; --line:#263049; --ink:#e8ecf5; --muted:#9ba6bf;
    --tinta:#8eaaff; --on-tinta:#0d1322; --marca-texto:#ffd83a; --on-marca-texto:#121c3d;
    --atencao:#ff8f5e; --atencao-fundo:#3a1f14; --verificado:#4fd1bf; --verificado-fundo:#12302c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font: var(--text-body); background: var(--paper); color: var(--ink); overflow-wrap: break-word; }
a { color: var(--tinta); text-underline-offset: 2px; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--tinta); outline-offset: 2px; border-radius: 2px; }
img { max-width: 100%; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 var(--space-4); }
.muted { color: var(--muted); }
.small { font: var(--text-small); }
.pular { position: absolute; left: var(--space-4); top: -100px; background: var(--surface); color: var(--tinta); padding: var(--space-2) var(--space-4); border: 1px solid var(--tinta); border-radius: var(--radius-md); z-index: 10; }
.pular:focus { top: var(--space-2); }

/* ---------- Ajustes de componente (as classes bd- vêm de /css/componentes.css) ---------- */
.bd-btn { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.bd-alerta .bd-tag { align-self: flex-start; }

/* ---------- Cabeçalho ---------- */
header.topo { border-bottom: 1px solid var(--line); background: var(--surface); }
header.topo .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; padding-top: var(--space-3); padding-bottom: var(--space-3); }
header.topo .inicio { font-weight: 600; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
header.topo .inicio:hover { text-decoration: underline; }

/* ---------- Abertura da página ---------- */
.abertura { padding: var(--space-12) 0 var(--space-6); display: flex; flex-direction: column; gap: var(--space-3); }
.abertura .rotulo { font: var(--text-label); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0; }
.abertura h1 { font: var(--text-title); letter-spacing: -.01em; font-size: clamp(28px, 6vw, 32px); line-height: 1.12; margin: 0; }
.abertura .resumo { font-size: 18px; line-height: 28px; margin: 0; }
.atualizada { font: var(--text-small); color: var(--muted); margin: 0; }

/* ---------- Sumário ---------- */
nav.sumario { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-6); margin-bottom: var(--space-8); }
nav.sumario h2 { font: var(--text-label); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--space-2); }
nav.sumario ol { margin: 0; padding-left: var(--space-6); display: grid; gap: var(--space-1); }
nav.sumario a { display: inline-block; padding: 6px 0; }

/* ---------- Texto corrido ---------- */
.texto section { margin: 0 0 var(--space-8); scroll-margin-top: var(--space-4); }
.texto h2 { font: var(--text-heading); margin: 0 0 var(--space-3); }
.texto h3 { font: var(--text-body-strong); margin: var(--space-6) 0 var(--space-2); }
.texto p, .texto ul, .texto ol { margin: 0 0 var(--space-3); }
.texto ul, .texto ol { padding-left: var(--space-6); }
.texto li + li { margin-top: var(--space-2); }
.texto code { font-family: var(--font-mono); font-size: 14px; background: var(--line); color: var(--ink); padding: 1px 4px; border-radius: var(--radius-sm); overflow-wrap: anywhere; }
.texto a.externo::after { content: " ↗"; }

/* Cartão neutro (bloco de destaque, exemplo, modelo de texto) */
.cartao { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-6); margin: 0 0 var(--space-4); }
.cartao > :last-child { margin-bottom: 0; }
.cartao h3:first-child { margin-top: 0; }

/* Citação de modelo de texto */
blockquote.modelo { margin: 0 0 var(--space-4); padding: var(--space-4) var(--space-6); border-left: 4px solid var(--tinta); background: var(--surface); border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
blockquote.modelo > :last-child { margin-bottom: 0; }

/* Contas passo a passo */
ol.contas { list-style: none; padding: 0; margin: 0 0 var(--space-3); display: grid; gap: var(--space-2); }
ol.contas li { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: var(--space-1) var(--space-3); align-items: baseline; padding-bottom: var(--space-2); border-bottom: 1px solid var(--line); }
ol.contas li:last-child { border-bottom: 0; padding-bottom: 0; }
ol.contas .bd-num { text-align: right; }
@media (max-width: 480px) {
  ol.contas li { grid-template-columns: 1fr; }
  ol.contas .bd-num { text-align: left; }
}

/* Tabela simples (salário mínimo, versões) */
.tabela { overflow-x: auto; margin: 0 0 var(--space-4); }
.tabela table { width: 100%; border-collapse: collapse; font: var(--text-small); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.tabela th, .tabela td { text-align: left; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); vertical-align: top; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela th { font: var(--text-label); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tabela td.r, .tabela th.r { text-align: right; }
@media (max-width: 560px) {
  .tabela.empilha thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tabela.empilha table, .tabela.empilha tbody, .tabela.empilha tr, .tabela.empilha td { display: block; width: 100%; }
  .tabela.empilha tr { padding: var(--space-3) var(--space-3); border-bottom: 1px solid var(--line); }
  .tabela.empilha tr:last-child { border-bottom: 0; }
  .tabela.empilha td { border: 0; padding: 2px 0; text-align: left; }
  .tabela.empilha td[data-rotulo]::before { content: attr(data-rotulo) ": "; color: var(--muted); }
}

/* Lista de compromissos / lista "nunca" */
ul.marcada { list-style: none; padding: 0; }
ul.marcada li { position: relative; padding-left: var(--space-6); }
ul.marcada li::before { content: ""; position: absolute; left: 4px; top: 10px; width: 10px; height: 4px; background: var(--tinta); border-radius: 2px; }

/* Registro (correções, respostas) */
.registro { display: grid; gap: var(--space-3); margin: 0 0 var(--space-4); padding: 0; list-style: none; }
.registro li { margin: 0; }
.registro .cartao { margin: 0; }
.registro h3 { margin: 0 0 var(--space-2); }
.vazio { color: var(--muted); }

/* Contato em destaque */
.contato { font-weight: 600; overflow-wrap: anywhere; }

/* ---------- Rodapé ---------- */
footer.rodape { border-top: 1px solid var(--line); margin-top: var(--space-12); padding: var(--space-8) 0 var(--space-12); color: var(--muted); background: var(--surface); }
footer.rodape .wrap { display: flex; flex-direction: column; gap: var(--space-4); }
footer.rodape p { margin: 0; font: var(--text-small); }
footer.rodape nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 var(--space-4); }
footer.rodape nav a { display: inline-flex; align-items: center; min-height: 44px; font: var(--text-small); font-weight: 600; }
footer.rodape nav a[aria-current="page"] { color: var(--ink); text-decoration: none; }

@media print {
  header.topo, footer.rodape nav, nav.sumario, .pular { display: none; }
  body { background: #fff; color: #000; }
}

/* Só para leitores de tela */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Resposta publicada: mantém as quebras de linha do texto enviado */
.texto-resposta { white-space: pre-line; }
