/* Stats for Nerds. Reaproveita as variáveis de style.css. */
:root {
  --seq0: #dbe7f7; --seq1: #123a80;      /* presença: azul, do claro ao escuro */
  --warm0: #fbe3d6; --warm1: #b23a1d;    /* abstenção: laranja/vermelho */
  --pt-cheio: #1f5fbf; --pt-vazio: #d4d2ca;
  --pt-cheio-q: #1f5fbf;
}
:root[data-theme="dark"] {
  --seq0: #35558c; --seq1: #c4daff;
  --warm0: #7d4a3b; --warm1: #ffae94;
  --pt-cheio: #6a9df0; --pt-vazio: #3a3e45;
}

main.nerds { max-width: 980px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
a.voltar { color: var(--accent); text-decoration: none; text-transform: none; letter-spacing: 0; }
a.voltar:hover { text-decoration: underline; }
h2.secao { font-size: 22px; margin: 36px 0 2px; }
.card h2 { font-size: 20px; }
.card > h3 { font-size: 17px; margin-bottom: 8px; }
#carregando { margin-top: 24px; }

.duas { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-items: start; }
@media (max-width: 760px) { .duas { grid-template-columns: 1fr; } }

/* Panorama */
.hero { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: center; }
.hero-donut { position: relative; width: 200px; height: 200px; }
.hero-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-centro { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-centro strong { font-size: 34px; letter-spacing: -0.02em; line-height: 1; }
.donut-centro span { font-size: 13px; color: var(--muted); }
.hero-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 12px; margin: 0; }
.hero-nums dt { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.hero-nums dd { margin: 2px 0 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.quente, .hero-nums dd.quente { color: var(--warm1); }
@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; justify-items: center; }
  .hero-nums { grid-template-columns: repeat(2, 1fr); width: 100%; }
  .hero-nums dd { font-size: 22px; }
}

/* Botões segmentados */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; padding: 3px; margin: 10px 0 8px; background: var(--bg); }
.seg button { width: auto; padding: 7px 16px; border-radius: 99px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Mapa e dispersão */
.mapa-wrap { position: relative; width: 100%; max-width: 640px; margin: 0 auto; }
#disp-cv, #mapa-cv { display: block; width: 100%; touch-action: pan-y; }
.dica {
  position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, calc(-100% - 12px));
  background: var(--ink); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: 13px; line-height: 1.35; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.dica b { display: block; }
.escala { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); max-width: 640px; margin: 4px auto 0; }
.escala i { flex: 1; height: 8px; border-radius: 4px; }
#mapa-leg { text-align: center; margin-top: 6px; }

/* Fatos curiosos */
.fatos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.fato { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.fato strong { display: block; font-size: 30px; letter-spacing: -0.02em; line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums; }
.fato span { display: block; margin-top: 4px; font-size: 14px; color: var(--muted); }
@media (max-width: 760px) { .fatos { grid-template-columns: 1fr; } }

/* Rankings */
ol.rank { list-style: none; margin: 0; padding: 0; }
ol.rank li {
  position: relative; display: grid; grid-template-columns: 22px 1fr auto; gap: 0 8px; align-items: center;
  padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px;
}
ol.rank li:first-child { border-top: 0; }
ol.rank .n { color: var(--muted); font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
ol.rank b { font-weight: 600; display: block; overflow-wrap: anywhere; }
ol.rank small { color: var(--muted); font-size: 12px; display: block; overflow-wrap: anywhere; }
ol.rank .val { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
ol.rank .val small { font-weight: 400; }
ol.rank .barra { grid-column: 2 / 4; height: 5px; border-radius: 3px; background: var(--line); margin-top: 5px; overflow: hidden; }
ol.rank .barra i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
ol.rank.quente .barra i, ol.rank.barras .barra i { background: var(--warm1); }
ol.rank.quente .val { color: var(--warm1); }
ol.rank.barras li { padding: 4px 0; font-size: 13px; }
ol.rank.barras li.mesmo b { color: var(--accent); }

/* Cartão de seção com matriz de pontos */
.secao-card .eyebrow { margin-bottom: 2px; }
.secao-card h3 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.secao-card .sub { color: var(--muted); font-size: 13px; margin: 2px 0 10px; overflow-wrap: anywhere; }
.secao-card .total { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.secao-card .total small { font-size: 14px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.secao-card .total.quente { color: var(--warm1); }
.matriz { display: block; width: 100%; height: auto; margin-top: 10px; }
.matriz .c { fill: var(--pt-cheio); }
.matriz .v { fill: var(--pt-vazio); }
.pt { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: -1px; margin: 0 2px 0 6px; }
.pt.cheio { background: var(--pt-cheio); margin-left: 0; }
.pt.vazio { background: var(--pt-vazio); }

/* Tile map */
.tiles { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 10px 0 6px; }
.tile { aspect-ratio: 1; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; line-height: 1.15; cursor: default; }
.tile small { font-weight: 500; font-size: 11px; }
.tile:hover, .tile:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
@media (max-width: 420px) { .tile { font-size: 12px; } .tile small { font-size: 10px; } }

/* Histograma (SVG) */
#hist svg { width: 100%; height: auto; display: block; }
#hist text { fill: var(--muted); font: 11px system-ui, sans-serif; }
#hist .bar { fill: var(--accent); }
#hist .bar:hover { fill: var(--ink); }
#hist .eixo { stroke: var(--line); }
#hist .media { stroke: var(--warm1); stroke-width: 1.5; stroke-dasharray: 4 3; }
#hist text.dest { fill: var(--warm1); font-weight: 600; }

@media (prefers-reduced-motion: no-preference) {
  .hero-donut circle.val { transition: stroke-dasharray 1s ease; }
}

/* Acessos ao site por estado */
ol.rank.acessos .barra i { background: var(--accent); }
ol.rank.acessos li.extra b { color: var(--muted); font-weight: 500; }
ol.rank.acessos li.extra .barra i { background: var(--muted); opacity: .5; }
