/* ==========================================================================
   Base — reset, tipografia e grid.
   Depende de tokens.css. Nenhuma cor literal abaixo desta linha.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* A barra é sticky com 68px: sem isto a âncora para atrás dela. */
  scroll-padding-top: calc(68px + var(--e-2));
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: var(--fs-corpo);
  font-weight: var(--wght-body);
  line-height: var(--lh-corpo, 1.6);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* --- Títulos ---------------------------------------------------------- */

h1, h2, h3, h4 {
  margin: 0 0 var(--e-2);
  font-weight: var(--wght-title);
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); line-height: .98; letter-spacing: -.05em; font-weight: 400; }
h2 { font-size: var(--fs-h2); line-height: 1.04; letter-spacing: -.04em; font-weight: 400; }
h3 { font-size: var(--fs-h3); line-height: 1.30; }
h4 { font-size: var(--fs-lead); line-height: 1.35; }

.display {
  font-size: var(--fs-display);
  line-height: 1.05;
  letter-spacing: -.02em;
  font-weight: var(--wght-title);
  margin: 0 0 var(--e-3);
  text-wrap: balance;
}

/* O eixo óptico do Newsreader foi cortado do carregamento: custava 73,7 KB no
   romano e 82,6 KB no itálico, e a geometria medida é idêntica sem ele. A
   compensação óptica do tema escuro segue viva, via --wght-title. */

/* --- Texto ------------------------------------------------------------ */

p { margin: 0 0 var(--e-3); max-width: var(--largura-leitura); }

.lead {
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--text-2);
  max-width: 60ch;
}

.legenda { font-size: var(--fs-legenda); line-height: 1.45; color: var(--text-2); }

/* Rótulo técnico. Nunca passa de ~5% do texto da página. */
.micro {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  line-height: 1.3;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* Nomenclatura binomial — Newsreader tem itálico verdadeiro. */
.taxon { font-style: italic; }

strong, b { font-weight: 650; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}
a:hover { text-decoration-thickness: 2px; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

hr { border: 0; border-top: 1px solid var(--line); margin: var(--e-5) 0; }

blockquote {
  margin: var(--e-4) 0;
  padding-left: var(--e-3);
  border-left: 2px solid var(--track);
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--text);
}
blockquote p:last-child { margin-bottom: 0; }

ul, ol { margin: 0 0 var(--e-3); padding-left: 1.35em; max-width: var(--largura-leitura); }
li { margin-bottom: var(--e-1); }
li::marker { color: var(--accent); }

img, picture, video, svg { max-width: 100%; height: auto; display: block; }

code, kbd, samp { font-family: var(--font-mono); font-size: .9em; }

/* --- Tabela. Sempre <table> real: imagem de tabela não é extraível
       por mecanismos de IA e falha em leitor de tela. ------------------- */

/* tabindex="0" no HTML torna o container focável; sem ele o conteúdo à
   direita é inalcançável por teclado no Chrome. */
.tabela-wrap { overflow-x: auto; margin: var(--e-4) 0; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.tabela-wrap:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;
  font-family: var(--font-sans);
  font-size: var(--fs-ui);
}
caption { text-align: left; padding-bottom: var(--e-1); color: var(--text-2); font-size: var(--fs-legenda); }
/* Regua informativa, nao decorativa: numa tabela de comparacao e a linha
   que emparelha a alegacao com a evidencia. Com --line (1,26:1 no campo
   claro) cinco linhas empilhadas leem como um bloco unico de prosa. */
th, td { padding: var(--e-2); text-align: left; border-bottom: 1px solid var(--line-strong); vertical-align: top; }
th { font-weight: 600; background: var(--surface-2); }

/* --- Layout ----------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--largura-max);
  margin-inline: auto;
  padding-inline: var(--e-3);
}
@media (min-width: 768px)  { .wrap { padding-inline: var(--e-5); } }
@media (min-width: 1100px) { .wrap { padding-inline: var(--e-6); } }

.leitura { max-width: var(--largura-leitura); }

.secao { padding-block: var(--e-7); }
@media (min-width: 768px) { .secao { padding-block: clamp(96px, 9vw, 160px); } }

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--e-3);
}
@media (max-width: 767px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* --- Utilitários ------------------------------------------------------ */

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.pular-para-conteudo {
  position: absolute; left: var(--e-2); top: -100vh;
  z-index: 100;
  padding: var(--e-2) var(--e-3);
  background: var(--surface); color: var(--text);
  border: 2px solid var(--focus); border-radius: var(--raio);
  font-family: var(--font-sans); font-size: var(--fs-ui);
}
.pular-para-conteudo:focus { top: var(--e-2); }

.stack > * + * { margin-top: var(--e-3); }
.centro { margin-inline: auto; }
