/* Meio-Termo: reportagem interativa. Uma coluna de leitura, gráficos que saem um pouco dela. */
:root {
  --fundo: #fdfcfa;
  --texto: #1d1c1a;
  --suave: #67645e;
  --linha: #e3e0d9;
  --painel: #f5f3ee;
  --destaque: #1f5fbf;        /* quem mudou de declaração, e "você" */
  --destaque-fundo: #e8eefa;
  --c0: #d3cec3;              /* branca: escala ordinal de cinzas, sem tons de pele */
  --c1: #8c867a;              /* parda */
  --c2: #33312c;              /* preta */
  --c3: #b98a3e;              /* indígena (só no resultado) */
  --leitura: 640px;
  --largo: 880px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fundo: #151514; --texto: #ebe8e2; --suave: #a19d95; --linha: #2f2e2b; --painel: #1d1d1b;
    --destaque: #7aa7f0; --destaque-fundo: #1c2a40;
    --c0: #e4e0d6; --c1: #9b958a; --c2: #4b4943; --c3: #d1a457;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--fundo); color: var(--texto);
  font: 19px/1.65 "Newsreader", Georgia, serif;
  font-optical-sizing: auto;
}
a { color: inherit; text-decoration-color: var(--suave); text-underline-offset: 3px; }
a:hover { color: var(--destaque); text-decoration-color: currentColor; }
.ui, figcaption, .nota, .botao, .topo, .rodape, .grafico text, .legenda, details summary, table {
  font-family: "Public Sans", system-ui, sans-serif;
}

/* ---------- estrutura ---------- */
.topo {
  max-width: var(--largo); margin: 0 auto; padding: 18px 20px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  font-size: 14px; color: var(--suave); border-bottom: 1px solid var(--linha);
}
.topo a { text-decoration: none; }
.topo .nome { color: var(--texto); font-weight: 600; }
main { padding: 0 20px 80px; }
.coluna { max-width: var(--leitura); margin: 0 auto; }
.largo { max-width: var(--largo); margin: 0 auto; }

/* ---------- abertura ---------- */
.abertura { max-width: var(--leitura); margin: 0 auto; padding: 72px 0 24px; }
.chapeu { font: 600 14px/1.3 "Public Sans", sans-serif; color: var(--destaque); margin: 0 0 18px; }
h1 {
  font-weight: 500; font-size: clamp(44px, 8vw, 72px); line-height: 1.02;
  letter-spacing: -0.02em; margin: 0 0 22px;
}
.linha-fina { font-size: clamp(21px, 2.6vw, 25px); line-height: 1.45; color: var(--suave); margin: 0 0 28px; }
.credito { font: 14px/1.5 "Public Sans", sans-serif; color: var(--suave); margin: 0; }
.credito b { color: var(--texto); font-weight: 600; }

/* ---------- texto ---------- */
h2 {
  font-weight: 500; font-size: clamp(30px, 4.4vw, 38px); line-height: 1.15;
  letter-spacing: -0.01em; margin: 72px 0 18px;
}
p { margin: 0 0 20px; }
.grande { font-size: 1.12em; }
.marca { background: var(--destaque-fundo); color: var(--destaque); padding: 0 3px; border-radius: 2px; }
hr.pausa { border: 0; height: 1px; background: var(--linha); max-width: 120px; margin: 56px auto; }

/* ---------- gráficos ---------- */
figure { margin: 36px auto 40px; }
figcaption { font-size: 14px; line-height: 1.5; color: var(--suave); margin-top: 12px; }
figcaption b { color: var(--texto); font-weight: 600; }
.grafico { width: 100%; display: block; overflow: visible; }
.grafico text { font-size: 13px; fill: var(--suave); }
.grafico .forte { fill: var(--texto); font-weight: 600; }
.grafico .azul { fill: var(--destaque); font-weight: 600; }
.legenda { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--suave); margin: 0 0 12px; padding: 0; list-style: none; }
.legenda li { display: flex; align-items: center; gap: 7px; }
.legenda i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }

/* quadrinhos: 100 candidatos */
.cem { display: grid; grid-template-columns: repeat(20, 1fr); gap: 4px; max-width: 520px; }
.cem span { aspect-ratio: 1; border-radius: 2px; background: var(--linha); transition: background-color .5s ease; }
.visivel .cem span.mudou { background: var(--destaque); }
.cem span:nth-child(n) { transition-delay: calc(var(--i) * 12ms); }

/* barras empilhadas */
.barras { display: grid; gap: 14px; }
.barra-linha { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 14px; font: 15px/1.3 "Public Sans", sans-serif; }
.barra { display: flex; height: 34px; border-radius: 3px; overflow: hidden; background: var(--painel); }
.barra > div {
  width: 0; transition: width .9s cubic-bezier(.2,.7,.2,1);
  display: flex; align-items: center; padding-left: 8px; overflow: hidden; white-space: nowrap;
  font: 600 13px/1 "Public Sans", sans-serif;
}
.visivel .barra > div, .barra.ja > div { width: var(--w); }
.c0 { background: var(--c0); color: #1d1c1a; }
.c1 { background: var(--c1); color: #fff; }
.c2 { background: var(--c2); color: #fff; }
.c3 { background: var(--c3); color: #1d1c1a; }
.cx { background: var(--destaque); color: #fff; }
.cy { background: var(--linha); color: var(--suave); }

/* aparecer ao rolar */
.surge { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.surge.visivel { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .surge { opacity: 1; transform: none; transition: none; }
  .barra > div, .cem span { transition: none; }
}

/* ---------- experimente ---------- */
.experimente {
  max-width: var(--largo); margin: 72px auto; padding: 40px clamp(20px, 5vw, 56px);
  background: var(--painel); border-radius: 6px;
}
.experimente h2 { margin-top: 0; }
.experimente .intro { max-width: var(--leitura); }
.teste { display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: start; margin-top: 28px; }
.quadro {
  aspect-ratio: 1; width: 100%; border-radius: 4px; overflow: hidden; position: relative;
  background: var(--fundo); border: 1px dashed var(--c1); display: grid; place-items: center; cursor: pointer;
}
.quadro img, .quadro canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.quadro .vazio { font: 14px/1.45 "Public Sans", sans-serif; color: var(--texto); text-align: center; padding: 16px; }
.quadro .vazio svg { width: 44px; height: 44px; display: block; margin: 0 auto 10px; opacity: .6; }
.carregando {
  position: absolute; inset: 0; background: color-mix(in srgb, var(--fundo) 82%, transparent);
  display: grid; place-content: center; gap: 10px; text-align: center; padding: 16px;
  font: 14px/1.4 "Public Sans", sans-serif;
}
.progresso { width: 140px; height: 4px; background: var(--linha); border-radius: 2px; overflow: hidden; margin: 0 auto; }
.progresso div { height: 100%; width: 0; background: var(--destaque); transition: width .2s; }
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; width: 100%;
  background: var(--texto); color: var(--fundo); border: 0; border-radius: 4px; padding: 13px 18px;
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.botao:hover { opacity: .88; }
.botao:focus-within { outline: 2px solid var(--destaque); outline-offset: 2px; }
.botao input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.privado { font: 13px/1.45 "Public Sans", sans-serif; color: var(--suave); margin: 12px 0 0; }
.erro { font: 15px/1.45 "Public Sans", sans-serif; color: #a33a1c; margin: 12px 0 0; }
.espera p { color: var(--suave); }
.espera ol { margin: 0; padding-left: 22px; color: var(--suave); }
.espera li { margin-bottom: 8px; }
.resposta .frase { font-size: 23px; line-height: 1.4; margin: 0 0 18px; }
.resposta .frase b { font-weight: 600; }
.resposta .barra { height: 44px; }
.resposta .nota { font-size: 14px; color: var(--suave); line-height: 1.5; margin: 14px 0 0; }
.resposta .leitura { margin: 22px 0 0; }

/* ---------- detalhes ---------- */
details { border-top: 1px solid var(--linha); border-bottom: 1px solid var(--linha); margin: 48px 0; }
details summary { cursor: pointer; padding: 16px 0; font-size: 16px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
details summary::after { content: "+"; color: var(--suave); font-weight: 400; }
details[open] summary::after { content: "−"; }
details .dentro { padding-bottom: 20px; font-size: 17px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 8px 0 20px; }
th, td { text-align: left; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--linha); vertical-align: top; }
th { font-weight: 600; }
td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.links { font: 16px/1.6 "Public Sans", sans-serif; display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 28px 0 0; }
.rodape {
  max-width: var(--leitura); margin: 0 auto; padding: 28px 0 48px; border-top: 1px solid var(--linha);
  font-size: 14px; color: var(--suave);
}

@media (max-width: 700px) {
  body { font-size: 18px; }
  .rodape { margin: 0 20px; }
  .abertura { padding-top: 48px; }
  .teste { grid-template-columns: 1fr; }
  .quadro { max-width: 260px; }
  .barra-linha { grid-template-columns: 1fr; gap: 6px; }
  .cem { gap: 3px; }
  .experimente { margin-left: -20px; margin-right: -20px; border-radius: 0; }
}
