/* ---------- Fontes (self-hosted, OFL) ---------- */
@font-face {
  font-family: "Sofia Sans";
  src: url("fonts/sofia-sans-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 1 1000; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Sofia Sans";
  src: url("fonts/sofia-sans-latin-ext-wght-normal.woff2") format("woff2-variations");
  font-weight: 1 1000; font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Sofia Sans Extra Condensed";
  src: url("fonts/sofia-sans-extra-condensed-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 1 1000; font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --branco: #ffffff;
  --tinta: #000000;
  --tinta-2: #555b65;
  --linha: #dadde2;
  --superficie: #f2f3f5;
  --vazio: #e4e6ea;
  --foco: #1f4fd1;

  /* Vermelho = candidato do PT; verde = o outro (pedido do cliente). */
  --vermelho-1: #f6c6c8; --vermelho-2: #e7666e; --vermelho-3: #c8102e; --vermelho-texto: #c8102e;
  /* (nome da variável ficou 'amarelo', mas a cor do outro candidato agora é verde) */
  --amarelo-1: #c7e8d2;  --amarelo-2: #4fb874;  --amarelo-3: #00843d;  --amarelo-texto: #00843d;

  --corpo: "Sofia Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --estreita: "Sofia Sans Extra Condensed", "Sofia Sans", "Arial Narrow", sans-serif;
  --largura: 1160px;
  --margem: 16px;
}
@media (min-width: 720px) { :root { --margem: 28px; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--branco); color: var(--tinta);
  font: 400 17px/1.5 var(--corpo); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 3px; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

main, .topo, .rodape, .ad--topo, .ad--rodape { max-width: var(--largura); margin-left: auto; margin-right: auto; padding-left: var(--margem); padding-right: var(--margem); }

/* ---------- Topo ---------- */
.topo { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--linha); }
.logo { font-weight: 850; font-size: 20px; letter-spacing: -0.01em; text-decoration: none; }
.status { margin: 0; font-size: 14px; color: var(--tinta-2); display: flex; align-items: center; gap: 8px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tinta-2); flex: none; }
.status.ao-vivo::before { background: #d6001c; animation: pulso 2s ease-in-out infinite; }
@keyframes pulso { 50% { opacity: .3; } }

/* ---------- Anúncios ---------- */
.ad { margin-top: 16px; margin-bottom: 16px; }
.ad::before { content: "Publicidade"; display: block; font-size: 12px; color: var(--tinta-2); margin-bottom: 4px; }
.ad-unidade { display: flex; align-items: center; justify-content: center; background: var(--superficie); text-decoration: none; }
.ad--topo .ad-unidade, .ad--rodape .ad-unidade { min-height: 100px; max-width: 970px; margin: 0 auto; }
@media (min-width: 720px) { .ad--topo .ad-unidade, .ad--rodape .ad-unidade { min-height: 90px; } }
.ad--lateral .ad-unidade { min-height: 250px; max-width: 336px; margin: 0 auto; }
@media (min-width: 960px) { .ad--lateral .ad-unidade { margin: 0; } }
.ad--topo::before, .ad--rodape::before { text-align: center; }
.ad picture { display: flex; justify-content: center; width: 100%; }
/* A arte sempre cabe no espaço: encolhe proporcionalmente, nunca corta nem estica */
.ad img { display: block; max-width: 100%; height: auto; object-fit: contain; }
.ad--topo img, .ad--rodape img { max-height: 160px; }
.ad--lateral img { max-height: 420px; }
@media (max-width: 719px) { .ad--topo img, .ad--rodape img { max-height: 200px; } .ad--lateral img { max-height: 360px; } }
.ad-texto { padding: 18px 20px; text-align: center; }
.ad-texto strong { display: block; font-size: 19px; font-weight: 800; }
.ad-texto span { display: block; color: var(--tinta-2); font-size: 15px; }
.ad-texto em { display: inline-block; margin-top: 10px; font-style: normal; font-weight: 750; font-size: 15px; text-decoration: underline; }
.ad-vazio { padding: 18px 20px; text-align: center; color: var(--tinta-2); font-size: 15px; }
.ad-vazio strong { display: block; color: var(--tinta); font-weight: 750; }

/* ---------- Disputa (hero) ---------- */
.disputa { padding: 20px 0 8px; }
.cartola { margin: 0 0 6px; font-size: 15px; font-weight: 700; color: var(--tinta-2); }
h1 { margin: 0; font-weight: 820; font-size: clamp(30px, 5.4vw, 54px); line-height: 1.04; letter-spacing: -0.02em; max-width: 21ch; text-wrap: balance; }
.linha-fina { margin: 10px 0 0; font-size: clamp(17px, 2vw, 20px); color: var(--tinta-2); max-width: 60ch; }

.corrida { margin-top: 28px; }
.corrida-nomes { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.lado { min-width: 0; }
.lado--dir { text-align: right; }
.lado-nome { font-weight: 780; font-size: clamp(17px, 2.2vw, 22px); line-height: 1.15; }
.lado-partido { font-weight: 500; color: var(--tinta-2); }
.lado-pct { font-family: var(--estreita); font-weight: 780; font-size: clamp(62px, 15vw, 128px); line-height: .82; letter-spacing: -0.01em; margin: 8px 0 6px; }
.lado-pct small { font-size: .48em; letter-spacing: 0; }
.lado-votos { font-size: 15px; color: var(--tinta-2); }
.lado-selo { display: inline-block; margin-top: 6px; font-size: 14px; font-weight: 800; padding: 2px 8px; color: var(--branco); }

.barra { position: relative; display: flex; height: 22px; margin-top: 16px; background: var(--vazio); }
@media (min-width: 720px) { .barra { height: 30px; } }
.barra > span:not(.barra-meta) { height: 100%; transition: flex-basis .9s cubic-bezier(.2,.7,.2,1); }
.barra-a { flex: 0 0 0; } .barra-b { flex: 0 0 0; margin-left: auto; }
.barra-meta { position: absolute; left: 50%; top: -8px; bottom: -8px; width: 2px; margin-left: -1px; background: var(--tinta); }
.barra-meta span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 13px; font-weight: 700; padding-bottom: 2px; white-space: nowrap; }

.apuradas { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.apuradas-trilho { flex: 0 0 96px; height: 6px; background: var(--vazio); }
.apuradas-trilho span { display: block; height: 100%; width: 0; background: var(--tinta); transition: width .9s ease; }
.apuradas p { margin: 0; font-size: 15px; color: var(--tinta-2); }
.apuradas strong { color: var(--tinta); }

.compartilhar { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; font-weight: 750; font-size: 16px; padding: 10px 16px; background: var(--tinta); color: #fff; text-decoration: none; border-radius: 999px; }
.compartilhar:hover { background: #333; }

/* ---------- Mapa + detalhe ---------- */
.mapa-e-detalhe { display: grid; gap: 28px; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--linha); }
@media (min-width: 960px) { .mapa-e-detalhe { grid-template-columns: minmax(0, 7fr) minmax(320px, 5fr); gap: 40px; align-items: start; } }
.secao-titulo { margin: 0 0 12px; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }

.mapa { margin: 0; position: relative; }
.mapa-svg svg { display: block; width: 100%; height: auto; overflow: visible; }
.mapa-svg path[data-uf] { stroke: var(--branco); stroke-width: 1px; vector-effect: non-scaling-stroke; stroke-linejoin: round; cursor: pointer; transition: fill .6s ease; }
.mapa-svg path[data-uf]:hover { stroke: var(--tinta); stroke-width: 1.5px; }
.mapa-svg path[data-uf]:focus-visible { outline: none; stroke: var(--foco); stroke-width: 3px; }
.mapa-svg path.contorno { fill: none; stroke: var(--tinta); stroke-width: 2.5px; vector-effect: non-scaling-stroke; pointer-events: none; }
.mapa-svg .rotulos { pointer-events: none; }
.mapa-svg .rot text { text-anchor: middle; paint-order: stroke fill; stroke-linejoin: round; }
.mapa-svg .r-pct { font-family: var(--estreita); font-weight: 800; }
.mapa-svg .r-vot { font-family: var(--estreita); font-weight: 600; }
.mapa-svg .r-uf { font-family: var(--corpo); font-weight: 750; }
.mapa-svg .fora { pointer-events: auto; cursor: pointer; }
.mapa-svg .fora rect.fora-ativo { stroke: var(--tinta); stroke-width: 2.5px; vector-effect: non-scaling-stroke; }
.mapa-svg .fora:hover rect { stroke: var(--tinta); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.mapa-svg .fio { stroke: var(--tinta); }
.mapa-svg .fio-halo { stroke: var(--branco); opacity: .8; }
.mapa-svg .fio-ponto { fill: var(--tinta); stroke: var(--branco); stroke-width: 1px; vector-effect: non-scaling-stroke; }

.tooltip { position: absolute; z-index: 5; pointer-events: none; background: var(--branco); border: 1px solid var(--tinta); padding: 8px 10px; font-size: 14px; line-height: 1.35; min-width: 170px; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.tooltip strong { display: block; font-size: 15px; }
.tooltip .t-linha { display: flex; justify-content: space-between; gap: 12px; }
.tooltip .t-votos { color: var(--tinta-2); font-size: 13px; margin-bottom: 2px; }
.tooltip .t-apurado { color: var(--tinta-2); margin-top: 2px; border-top: 1px solid var(--linha); padding-top: 4px; }

.legenda { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 15px; color: var(--tinta-2); }
.legenda-linha { display: flex; align-items: center; gap: 8px; }
.legenda-linha b { color: var(--tinta); font-weight: 750; }
.legenda-cor { width: 14px; height: 14px; flex: none; }
.legenda-nota { flex-basis: 100%; font-size: 14px; }

.botao-exterior { margin-top: 12px; background: none; border: 1px solid var(--tinta); padding: 7px 14px; font-weight: 700; font-size: 15px; cursor: pointer; border-radius: 999px; }
.botao-exterior[aria-pressed="true"] { background: var(--tinta); color: var(--branco); }

.coluna { display: grid; gap: 24px; align-content: start; }
.detalhe { background: var(--superficie); padding: 20px; }
@media (min-width: 960px) { .detalhe { padding: 24px; } }
.detalhe-cabeca { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.detalhe select { appearance: none; -webkit-appearance: none; background: transparent; border: 0; padding: 0 26px 0 0; font-size: 26px; font-weight: 820; letter-spacing: -0.01em; cursor: pointer; max-width: 100%;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 8px top 55%, right 2px top 55%; background-size: 6px 6px; background-repeat: no-repeat; }
.link { background: none; border: 0; padding: 0; font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.detalhe-apurado { margin: 4px 0 16px; color: var(--tinta-2); font-size: 15px; }

.detalhe-cands { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.d-cand { display: grid; grid-template-columns: 1fr auto; row-gap: 4px; }
.d-nome { font-weight: 760; }
.d-nome small { font-weight: 500; color: var(--tinta-2); font-size: 15px; }
.d-pct { font-family: var(--estreita); font-weight: 760; font-size: 30px; line-height: 1; text-align: right; }
.d-trilho { grid-column: 1 / -1; height: 8px; background: rgba(0,0,0,.07); }
.d-trilho span { display: block; height: 100%; transition: width .8s ease; }
.d-votos { grid-column: 1 / -1; font-size: 14px; color: var(--tinta-2); }

.virada { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--linha); font-size: 16px; line-height: 1.5; }
.virada strong { font-weight: 780; }

.comparecimento { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--linha); }
.comparecimento div { min-width: 0; }
.comparecimento dt { font-size: 14px; color: var(--tinta-2); }
.comparecimento dd { margin: 0; font-weight: 760; font-size: 18px; }
.comparecimento dd small { display: block; font-weight: 500; color: var(--tinta-2); font-size: 14px; }

.cidades { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--linha); }
.cidades label { display: block; font-weight: 750; margin-bottom: 6px; }
.cidades input { width: 100%; padding: 10px 12px; border: 1px solid #b9bec7; background: var(--branco); font-size: 16px; }
.cidades ul { list-style: none; margin: 8px 0 0; padding: 0; }
.cidades li button { width: 100%; display: flex; justify-content: space-between; gap: 12px; background: none; border: 0; border-bottom: 1px solid var(--linha); padding: 9px 2px; cursor: pointer; text-align: left; font-size: 15px; }
.cidades li button:hover span:first-child { text-decoration: underline; }

/* ---------- Tabela ---------- */
.tabela-estados { margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--linha); }
.tabela-rolagem { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { padding: 10px 8px; text-align: right; border-bottom: 1px solid var(--linha); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; padding-left: 0; white-space: normal; }
th:last-child, td:last-child { padding-right: 0; }
th { font-weight: 700; font-size: 14px; color: var(--tinta-2); border-bottom-color: var(--tinta); vertical-align: bottom; }
th button { all: unset; cursor: pointer; }
th button:focus-visible { outline: 3px solid var(--foco); }
th[aria-sort] button::after { content: " ↓"; }
th[aria-sort="ascending"] button::after { content: " ↑"; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--superficie); }
td.vence { font-weight: 800; }
td small { display: block; font-weight: 500; font-size: 13px; color: var(--tinta-2); }
td.vence::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; background: var(--cor); vertical-align: 0; }
.uf-sigla { display: none; }
@media (max-width: 480px) { .uf-nome { display: none; } .uf-sigla { display: inline; font-weight: 700; } table { font-size: 15px; } th, td { padding: 9px 5px; } }

/* ---------- Rodapé ---------- */
.rodape { margin-top: 40px; padding-top: 18px; padding-bottom: 40px; border-top: 1px solid var(--linha); color: var(--tinta-2); font-size: 14px; }
.rodape p { margin: 0 0 8px; max-width: 80ch; }
.rodape .credito { font-size: 12px; opacity: .75; }
.fonte { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; font-size: 14px; color: var(--tinta-2); }
.fonte svg { flex: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
