/*
 * Folha do 2º turno (index.html, js/app-2t.js). Usa as classes e variáveis do css/style.css
 * (cartao, grade, secao, etiqueta, barra, stats...) e acrescenta só o que é do placar de
 * dois candidatos. Cores dos candidatos (Decisão 11): Lula vermelho, Flávio amarelo —
 * o amarelo NUNCA é tinta de texto sobre fundo claro; cor só em preenchimento, os rótulos
 * em texto normal (contraste >= 4.5:1). Tema escuro usa os tons claros equivalentes.
 */
:root {
  --st-lula: #b3261e;        /* vermelho Lula */
  --st-lula-claro: #f3d3d0;  /* trilho / fundo suave */
  --st-flavio: #c77d00;      /* âmbar Flávio: legível como preenchimento; texto continua na cor do tema */
  --st-flavio-claro: #f7e8c8;
  --st-neutro: #cfd6de;
}
@media (prefers-color-scheme: dark) {
  :root {
    --st-lula: #ef9a94;
    --st-lula-claro: #4a1f1c;
    --st-flavio: #e3b341;
    --st-flavio-claro: #4a3a14;
    --st-neutro: #334154;
  }
}
[data-tema="escuro"] {
  --st-lula: #ef9a94;
  --st-lula-claro: #4a1f1c;
  --st-flavio: #e3b341;
  --st-flavio-claro: #4a3a14;
  --st-neutro: #334154;
}

/* ------ botão de troca de turno, no cabeçalho ------ */
.botao--troca { white-space: nowrap; }

/* ------ placar: três âmbitos, dois candidatos cada ------ */
.st-placares { display: grid; gap: 16px; }
@media (min-width: 900px) { .st-placares { grid-template-columns: repeat(3, 1fr); } }

.st-ambito { display: flex; flex-direction: column; gap: 12px; }

.st-kand {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px 12px;
  align-items: center;
}
.st-kand__foto {
  position: relative;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  background: var(--st-lula-claro);
  font-weight: 700; font-size: 15px;
}
/* A foto cobre o círculo inteiro (por cima das iniciais, que só aparecem sem foto ou
   enquanto carrega). object-position no topo: o rosto fica no terço superior do 3x4. */
.st-kand__foto img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
}
.st-kand--flavio .st-kand__foto { background: var(--st-flavio-claro); }
.st-kand__quem { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.st-kand__nome { font-weight: 700; font-size: 1.05em; }
.st-kand__partido { color: var(--tinta-fraca, #5b6b7c); font-size: .85em; }
.st-kand__numeros { text-align: right; }
.st-kand__pct { font-weight: 800; font-size: 1.6em; line-height: 1; font-variant-numeric: tabular-nums; }
.st-kand__votos { display: block; font-size: .8em; color: var(--tinta-fraca, #5b6b7c); }
.st-kand__barra { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--st-lula-claro); overflow: hidden; }
.st-kand--flavio .st-kand__barra { background: var(--st-flavio-claro); }
.st-kand__barra i { display: block; height: 100%; background: var(--serie); transition: clip-path .9s var(--curva); }
.st-kand__barra i { clip-path: inset(0 calc((1 - var(--p, 0)) * 100%) 0 0 round 0 4px 4px 0); }
.st-kand__antes { grid-column: 1 / -1; color: var(--tinta-fraca, #5b6b7c); font-size: .85em; }
.st-kand__1t { display: block; font-size: .78em; color: var(--tinta-fraca, #5b6b7c); }

/* selo de estado do âmbito (eleito / matematicamente definido) */
.st-ambito__selo { display: flex; flex-wrap: wrap; gap: 6px; }
.st-ambito__nota { color: var(--tinta-fraca, #5b6b7c); font-size: .85em; margin: 0 0 4px; }

/* diferença */
.st-diferenca {
  border-top: 1px solid var(--trilho, #e3e8ee);
  padding-top: 10px; font-size: .95em;
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.st-diferenca strong { font-variant-numeric: tabular-nums; }

/* ------ comparação 1º -> 2º turno ------ */
.st-comp { overflow-x: auto; }
.st-comp table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.st-comp th, .st-comp td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--trilho, #e3e8ee); white-space: nowrap; }
.st-comp th:first-child, .st-comp td:first-child { text-align: left; }
.st-comp thead th { font-size: .8em; text-transform: uppercase; letter-spacing: .04em; color: var(--tinta-fraca, #5b6b7c); }
.st-comp .st-comp__lula strong { color: inherit; }
.st-comp .ponto-lula, .st-comp .ponto-flavio { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }
.st-comp .ponto-lula { background: var(--st-lula); }
.st-comp .ponto-flavio { background: var(--st-flavio); }
.st-comp .delta { color: var(--tinta-fraca, #5b6b7c); font-size: .9em; }

/* ------ participação: brancos, nulos, abstenção ------ */
.st-part { display: grid; gap: 10px; }
.st-part__linha { display: grid; grid-template-columns: minmax(110px, auto) 1fr auto; gap: 10px; align-items: center; }
.st-part__linha .barra { height: 6px; }
.st-part__valor { font-variant-numeric: tabular-nums; }
.st-part__nota { color: var(--tinta-fraca, #5b6b7c); font-size: .85em; }

/* ------ tabela da região ------ */
.st-regiao__corpo { overflow-x: auto; }
.st-regiao table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.st-regiao th, .st-regiao td { padding: 8px 10px; border-bottom: 1px solid var(--trilho, #e3e8ee); white-space: nowrap; }
.st-regiao td { text-align: right; } /* células numéricas terminam onde os cabeçalhos terminam */
.st-regiao th { text-align: right; font-size: .8em; text-transform: uppercase; letter-spacing: .04em; color: var(--tinta-fraca, #5b6b7c); }
.st-regiao th:first-child, .st-regiao td:first-child { text-align: left; }
.st-regiao th:nth-child(2), .st-regiao td:nth-child(2) { text-align: left; } /* LÍDER alinha com o nome do candidato */
.st-regiao .st-regiao__lider { font-weight: 700; }
.st-regiao .ponto-lula, .st-regiao .ponto-flavio { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.st-regiao .ponto-lula { background: var(--st-lula); }
.st-regiao .ponto-flavio { background: var(--st-flavio); }
.st-regiao tr.st-regiao__destaque { background: var(--lilas-suave, rgba(0, 77, 126, .06)); }
/* células numéricas: votos e % empilhados, terminando na borda direita (igual ao header) */
.st-regiao .st-regiao__num { display: inline-block; text-align: right; }
.st-regiao .st-regiao__num .delta { display: block; }
.st-regiao td.st-regiao__empate, .st-regiao td.st-regiao__espera { color: var(--tinta-fraca, #5b6b7c); }

/* ------ mapa: contêiner antes do módulo do T-6 ------ */
.st-mapa__espera { color: var(--tinta-fraca, #5b6b7c); padding: 24px 0; text-align: center; }
