/* ==========================================================================
   Intendentes PY 2026 — editorial data-journalism system
   ========================================================================== */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 900;
  font-stretch: 100%;
  font-display: swap;
  src: url("fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 900;
  font-stretch: 100%;
  font-display: swap;
  src: url("fonts/archivo-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #ffffff;
  --ground: #f5f5f2;
  --ink: #0c0c0d;
  --ink-2: #55585f;
  --ink-3: #6b6e75;
  --rule: #e6e6e2;
  --rule-2: #cdcecb;

  --anr: #ff0000;
  --plra: #002bc7;
  --yocreo: #ffa760;
  --otros: #9aa0a6;

  --wrap: 1180px;
  --gap: clamp(1.25rem, 4vw, 3rem);

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul { list-style: none; padding: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }

::selection { background: var(--ink); color: var(--paper); }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 3px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 50;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ------------------------------------------------------------------ masthead */

.masthead {
  border-bottom: 1px solid var(--rule-2);
  padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(1.5rem, 4vw, 2.5rem);
}

.masthead-title {
  font-weight: 900;
  font-size: clamp(2.6rem, 8vw, 5.5rem);
  line-height: 0.92;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.masthead-title span { color: var(--anr); }

.lede {
  margin-top: clamp(1rem, 3vw, 1.75rem);
  max-width: 46ch;
  font-size: clamp(1.15rem, 2.2vw, 1.6rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: pretty;
}
.lede b { font-weight: 800; }

.provenance {
  margin-top: clamp(1.25rem, 3vw, 2rem);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-3);
}
.provenance a { text-underline-offset: 3px; }

/* ------------------------------------------------------------------ sections */

.section { padding: 4.5rem 0; }
.section + .section { border-top: 1px solid var(--rule); }
@media (max-width: 900px) { .section { padding: 3rem 0; } }

.section-head { max-width: 62ch; margin-bottom: clamp(1.75rem, 5vw, 3rem); }

.section h2 {
  font-weight: 800;
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.section-note {
  margin-top: 0.75rem;
  font-size: 1rem;
  color: var(--ink-2);
  max-width: 58ch;
}

.section-head-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem 2rem;
  flex-wrap: wrap;
  margin-bottom: clamp(1.75rem, 5vw, 3rem);
}
.section-head-bar .section-head { margin-bottom: 0; }

.viewswitch {
  display: inline-flex;
  border: 1px solid var(--rule-2);
  border-radius: 9px;
  overflow: hidden;
  flex: none;
}
.viewswitch button {
  border: 0;
  background: var(--paper);
  padding: 0.5rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.viewswitch button + button { border-left: 1px solid var(--rule-2); }
.viewswitch button:hover { background: var(--ground); }
.viewswitch button.is-on { background: var(--ink); color: var(--paper); }

.legend-toggle { position: relative; padding-top: 0.3rem; }
.legend-toggle button {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.legend-toggle button:hover { color: var(--anr); }

/* Bounded party list: overlays the page without resizing .map-side. */
.legend-dropdown {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(60vh, 460px);
  overflow: auto;
  display: grid;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  background: var(--paper);
  border: 1px solid var(--rule-2);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
  scrollbar-color: var(--rule-2) transparent;
  scrollbar-width: thin;
}
.legend-dropdown::-webkit-scrollbar { width: 10px; }
.legend-dropdown::-webkit-scrollbar-track { background: transparent; }
.legend-dropdown::-webkit-scrollbar-thumb {
  background: var(--rule-2);
  border: 3px solid var(--paper);
  border-radius: 999px;
}

/* ---------------------------------------------------------------------- map */

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

.map-stage {
  position: relative;
  height: clamp(420px, 66vh, 760px);
  min-width: 0;
}

#map { display: block; width: 100%; height: 100%; }

.district {
  stroke: #ffffff;
  stroke-width: 0.75;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: opacity 0.18s ease, stroke 0.18s ease;
}
.district:hover { stroke: var(--ink); stroke-width: 1.4; }
.district.is-selected { stroke: var(--ink); stroke-width: 1.8; }

#map.is-dimmed .district { opacity: 0.13; }
#map.is-dimmed .district.is-active { opacity: 1; }

.map-tooltip,
.chart-tip {
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.35;
  max-width: 16rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}
.map-tooltip { position: absolute; z-index: 6; transform: translate(-50%, calc(-100% - 12px)); }
.chart-tip { position: fixed; z-index: 40; transform: translate(-50%, calc(-100% - 14px)); }
.map-tooltip b,
.chart-tip b { font-weight: 700; }
.map-tooltip span,
.chart-tip span { display: block; color: rgba(255, 255, 255, 0.72); }
.map-tooltip .tip-sub,
.chart-tip .tip-sub {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-top: 0.1rem;
}
.map-tooltip .tip-cand,
.chart-tip .tip-cand { color: #fff; font-weight: 700; margin-top: 0.2rem; }

.map-zoom {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule-2);
  border-radius: 9px;
  overflow: hidden;
}
.map-zoom button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--paper);
  border: 0;
  cursor: pointer;
  transition: background 0.15s ease;
}
.map-zoom button:hover { background: var(--ground); }
.map-zoom svg { width: 15px; height: 15px; }

/* --------------------------------------------------------------- map sidebar */

.map-side { display: grid; gap: clamp(1.25rem, 3vw, 1.75rem); }

.search { position: relative; }

.search-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.5rem;
}

#search-input {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-2);
  border-radius: 9px;
  padding: 0.65rem 0.8rem;
  transition: border-color 0.15s ease;
}
#search-input::placeholder { color: var(--ink-3); }
#search-input:hover { border-color: var(--ink-3); }

.search-results {
  position: absolute;
  z-index: 8;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--paper);
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.14);
  overflow: hidden;
}
.search-results li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
  font-size: 0.9rem;
}
.search-results li[aria-selected="true"],
.search-results li:hover { background: var(--ground); }
.search-results li b { font-weight: 600; }
.search-results li span { color: var(--ink-3); font-size: 0.82rem; }

.district-card {
  border-top: 1px solid var(--rule-2);
  padding-top: 1.25rem;
  min-height: 8rem;
}
.card-dpto {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.card-name {
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin-top: 0.15rem;
  color: var(--ink-2);
  text-wrap: balance;
}
.card-winner {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
}
.card-winner-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.card-winner-name {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin-top: 0.15rem;
  text-wrap: balance;
}
.card-party {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
}
.card-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--c, var(--ink-3));
  flex: none;
}
.card-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  margin-top: 1.1rem;
}
.card-facts div { display: grid; gap: 0.1rem; }
.card-facts dt {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.card-facts dd { font-size: 1.05rem; font-weight: 700; }
.card-hint { color: var(--ink-2); font-size: 0.92rem; }

/* ------------------------------------------------------------------- legend */

.legend { display: grid; gap: 0.85rem; }

.legend-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
}
.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--c, var(--ink-3));
  flex: none;
}
.legend-text { display: grid; gap: 0.05rem; min-width: 0; }
.legend-short { font-size: 0.92rem; font-weight: 800; letter-spacing: -0.01em; }
.legend-full { font-size: 0.8rem; color: var(--ink-2); }
.legend-figures {
  display: grid;
  justify-items: end;
  line-height: 1.05;
}
.legend-figures b {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}
.legend-figures span { font-size: 0.8rem; color: var(--ink-3); font-weight: 600; }

.legend--compact .legend-figures b { font-size: 1.15rem; }
.legend--compact .legend-full { display: none; }

.legend--inline {
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 1.1rem;
}
.legend--inline .legend-row {
  grid-template-columns: auto auto;
  gap: 0.45rem;
}
.legend--inline .legend-swatch { width: 11px; height: 11px; }
.legend--inline .legend-short { font-size: 0.76rem; font-weight: 700; }
.legend--inline .legend-full,
.legend--inline .legend-figures { display: none; }

/* ------------------------------------------------------------------- waffle */

.waffle {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14px, 1fr));
  gap: 3px;
  max-width: 720px;
}
.waffle-cell {
  aspect-ratio: 1 / 1;
  border-radius: 2px;
  background: var(--c, var(--ink-3));
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  transition-delay: calc(var(--i) * 2ms);
}
.waffle.is-in .waffle-cell { opacity: 1; transform: none; }
.waffle-cell.is-active { outline: 2px solid var(--ink); outline-offset: 1px; }

/* -------------------------------------------------------------------- donut */

.donut-layout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  margin-top: clamp(2.5rem, 6vw, 4rem);
}
.donut { position: relative; width: clamp(200px, 26vw, 300px); flex: none; }
.donut svg { display: block; width: 100%; height: auto; overflow: visible; }
.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}
.donut-center b {
  font-size: clamp(2.5rem, 6vw, 3.6rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
}
.donut-center span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.donut-seg { transition: opacity 0.2s ease; }
.donut.is-hovering .donut-seg { opacity: 0.35; }
.donut.is-hovering .donut-seg.is-active { opacity: 1; }

/* --------------------------------------------------------------------- bars */

.bars-head {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: baseline;
  gap: 16px;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule-2);
  margin-bottom: 0.9rem;
}
.bars-head-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.bars { display: grid; gap: 7px; }

.bar-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}
.bar-name {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  min-width: 0;
}
.bar-name span { color: var(--ink-3); font-size: 0.75rem; font-weight: 600; flex: none; }

.bar-track {
  height: 20px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--ground);
}
.bar-fill {
  display: flex;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.7s var(--ease);
  transition-delay: calc(var(--i) * 28ms);
}
.bars.is-in .bar-fill { transform: scaleX(1); }
.bar-seg { height: 100%; transition: filter 0.15s ease; }
.bar-seg:hover { filter: brightness(1.1); }
.bar-row.is-active .bar-name { color: var(--ink); }

/* ------------------------------------------------------------------- votes */

.votebars { display: grid; gap: 1rem; max-width: 840px; }
.votebar {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
}
.votebar-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}
.votebar-swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--c); flex: none; }
.votebar-track { height: 22px; border-radius: 3px; background: var(--ground); overflow: hidden; }
.votebar-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--c);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.8s var(--ease);
  transition-delay: calc(var(--i) * 90ms);
}
.votebars.is-in .votebar-fill { transform: scaleX(var(--w, 0)); }
.votebar-figure { text-align: right; line-height: 1.1; font-variant-numeric: tabular-nums; }
.votebar-figure b { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.02em; }
.votebar-figure span { display: block; font-size: 0.76rem; color: var(--ink-3); font-weight: 600; }

.votes-total {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--ink-2);
  max-width: 62ch;
}

/* ------------------------------------------------------------------- footer */

.footer {
  border-top: 1px solid var(--rule-2);
  padding: clamp(2.5rem, 6vw, 4rem) 0;
  background: var(--ground);
}
.footer-inner {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
}
.footer-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.6rem;
}
.footer-col p { font-size: 0.85rem; color: var(--ink-2); max-width: 40ch; }
.footer-col p + p { margin-top: 0.5rem; }
.footer-col a { text-underline-offset: 3px; }

/* ------------------------------------------------------------------ reveal */

[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
[data-reveal].is-in { opacity: 1; transform: none; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .map-layout { grid-template-columns: 1fr; }
  .map-stage { height: clamp(340px, 52vh, 560px); }
  .map-side { grid-template-columns: 1fr; }
  .donut-layout { grid-template-columns: 1fr; gap: 2rem; }
  .footer-inner { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .bars-head { grid-template-columns: 1fr; gap: 0.6rem; }
  .bars-head .legend--inline { grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); grid-auto-columns: auto; gap: 0.4rem 1rem; }
  .bar-row { grid-template-columns: 1fr; gap: 5px; }
  .bar-name { font-size: 0.82rem; }
  .bar-track { height: 16px; }
  .votebar { grid-template-columns: 1fr auto; gap: 0.5rem 1rem; }
  .votebar-track { grid-column: 1 / -1; height: 18px; }
  .waffle { grid-template-columns: repeat(auto-fill, minmax(12px, 1fr)); }
  .viewswitch { width: 100%; }
  .viewswitch button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  [data-reveal],
  .waffle-cell { opacity: 1; transform: none; }
  .bars .bar-fill { transform: none; }
  .votebars .votebar-fill { transform: scaleX(var(--w, 0)); }
}

/* --------------------------------------------------- asunción 2021 -> 2026 */

.asun-source {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.8rem;
  color: var(--ink-3);
  max-width: 78ch;
}

/* tabs */

.asuntabs { margin-top: 0.25rem; }

.asuntabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--rule-2);
  margin-bottom: clamp(1.5rem, 4vw, 2.25rem);
}
.asuntab {
  border: 1px solid var(--rule-2);
  background: var(--paper);
  border-radius: 9px;
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.asuntab:hover { background: var(--ground); }
.asuntab.is-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.asuntab-panel[hidden] { display: none; }
.asuntab-panel:focus-visible { outline-offset: 6px; }

/* shared block bits */

.asun-block { margin-top: clamp(1.5rem, 4vw, 2.25rem); }
.asun-block:first-child { margin-top: 0; }
.asun-subhead {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.9rem;
}
.asun-note {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--ink-3);
  max-width: 72ch;
}
.asun-cap {
  margin-top: 0.85rem;
  font-size: 0.78rem;
  color: var(--ink-3);
  max-width: 72ch;
}

/* KPI cards */

.asun-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
}
.asun-kpi { background: var(--paper); padding: 1.1rem 1.15rem 1.2rem; }
.asun-kpi-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  line-height: 1.3;
}
.asun-kpi-value {
  margin-top: 0.45rem;
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.02;
}
.asun-kpi-value.is-anr { color: var(--anr); }
.asun-kpi-value.is-ja { color: var(--plra); }
.asun-kpi-sub { margin-top: 0.5rem; font-size: 0.82rem; color: var(--ink-2); }

/* grouped forces bars */

.asun-fuerzas { display: grid; gap: 0.85rem; max-width: 760px; }
.asun-fuerza {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}
.asun-fuerza-name { font-weight: 800; font-size: 0.9rem; letter-spacing: -0.01em; }
.asun-fuerza-plot { display: grid; gap: 4px; }
.asun-fbar {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) 4.2rem;
  gap: 0.5rem;
  align-items: center;
}
.asun-fbar-tag { font-size: 0.72rem; font-weight: 600; color: var(--ink-3); }
.asun-fbar-track { height: 16px; background: var(--ground); border-radius: 3px; overflow: hidden; }
.asun-fbar-fill { display: block; height: 100%; border-radius: 3px; }
.asun-fbar-val { font-size: 0.8rem; font-weight: 700; text-align: right; }
.asun-fbar.is-na { opacity: 0.5; }

.asun-stat { margin-top: 1.5rem; font-size: 0.98rem; font-weight: 600; }
.asun-stat b { font-weight: 800; }

/* qué pasó list */

.asun-ql { margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.asun-ql-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.7rem;
}
.asun-ql ul { display: grid; gap: 0.5rem; max-width: 62ch; }
.asun-ql li {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 0.75rem;
  font-size: 0.9rem;
}
.asun-ql li b { font-weight: 700; }
.asun-ql li span { color: var(--ink-2); }

/* zone diverging bars */

.asun-zonebars { display: grid; gap: 0.9rem; max-width: 780px; }
.asun-zonebar {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}
.asun-zonebar-name { font-weight: 700; font-size: 0.82rem; line-height: 1.2; }
.asun-zonebar-plot { display: grid; gap: 5px; }
.asun-dbar {
  display: grid;
  /* Tag | track | value: the value column fits "−18,6 puntos" without clipping. */
  grid-template-columns: 3.6rem minmax(0, 1fr) 6.4rem;
  gap: 0.5rem;
  align-items: center;
}
.asun-dbar--pct .asun-dbar-val { color: var(--ink-2); }
.asun-dbar-tag { font-size: 0.72rem; font-weight: 600; color: var(--ink-3); }
.asun-dbar-track { position: relative; height: 14px; background: var(--ground); border-radius: 3px; }
.asun-dbar-zero {
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: 50%;
  width: 1px;
  background: var(--rule-2);
}
.asun-dbar-fill { position: absolute; top: 0; bottom: 0; border-radius: 2px; }
.asun-dbar-val { font-size: 0.8rem; font-weight: 700; text-align: right; white-space: nowrap; }

/* zone filter (sits below the chart) */
.asun-zfilter-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: clamp(1.25rem, 3vw, 1.75rem);
}
.asun-zfilter-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.asun-zfilter {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-2);
  border-radius: 9px;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.asun-zfilter:hover { border-color: var(--ink-3); }

/* winner grids */

.asun-winners {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 2.75rem);
}
.asun-winner-h { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.015em; margin-bottom: 0.35rem; }
.asun-grid-zona {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0.9rem 0 0.45rem;
}
.asun-cells { display: flex; flex-wrap: wrap; gap: 3px; }
.asun-cell {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* tables */

.asun-tablewrap {
  margin-top: clamp(1.5rem, 4vw, 2.25rem);
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: var(--rule-2) transparent;
  scrollbar-width: thin;
}
.asun-tablewrap::-webkit-scrollbar { height: 10px; }
.asun-tablewrap::-webkit-scrollbar-track { background: transparent; }
.asun-tablewrap::-webkit-scrollbar-thumb {
  background: var(--rule-2);
  border: 3px solid var(--paper);
  border-radius: 999px;
}
.asun-table { border-collapse: collapse; width: 100%; min-width: 680px; font-size: 0.82rem; }
.asun-table th,
.asun-table td {
  padding: 0.5rem 0.7rem;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--rule);
}
.asun-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ground);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.asun-table .is-text { text-align: left; }
.asun-table th.is-sortable { cursor: pointer; user-select: none; }
.asun-table th.is-sortable:hover { color: var(--ink); }
.asun-table th.is-active { color: var(--ink); }
.asun-table th.is-active::after { content: " \25BE"; font-size: 0.7em; }
.asun-table tbody tr:last-child td { border-bottom: 0; }
.asun-table tbody tr:hover td { background: var(--ground); }
.asun-table tr.is-flip td { background: rgba(12, 12, 13, 0.045); }
.asun-table tr.is-flip:hover td { background: rgba(12, 12, 13, 0.08); }
.asun-table tr.is-flip td:first-child { box-shadow: inset 3px 0 0 var(--ink); }

.asun-flip-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
  vertical-align: middle;
}
.asun-w { font-weight: 800; }
.asun-w--anr { color: var(--anr); }
.asun-w--ja { color: var(--plra); }

/* locales map */

.asun-map { margin-top: 0.25rem; }
.asun-map svg {
  display: block;
  width: 100%;
  height: auto;
  background: var(--ground);
  border: 1px solid var(--rule);
  border-radius: 10px;
}
.asun-dot { stroke: #fff; stroke-width: 0.8; cursor: pointer; transition: stroke 0.12s ease; }
.asun-dot:hover { stroke: var(--ink); stroke-width: 1.6; }
.asun-map-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  margin-top: 0.85rem;
  font-size: 0.78rem;
  color: var(--ink-2);
}
.asun-lg { display: inline-flex; align-items: center; gap: 0.4rem; }
.asun-dotkey { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }

/* correlation heatmap */

.asun-heat {
  margin-top: 0.25rem;
  overflow-x: auto;
  scrollbar-color: var(--rule-2) transparent;
  scrollbar-width: thin;
}
.asun-heat::-webkit-scrollbar { height: 10px; }
.asun-heat::-webkit-scrollbar-track { background: transparent; }
.asun-heat::-webkit-scrollbar-thumb {
  background: var(--rule-2);
  border: 3px solid var(--paper);
  border-radius: 999px;
}
.asun-heat-table { border-collapse: separate; border-spacing: 3px; }
.asun-heat-th { font-size: 0.62rem; }
.asun-heat-ch,
.asun-heat-corner {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 0.35rem 0.3rem;
  text-align: center;
}
.asun-heat-rh {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-2);
  text-align: right;
  padding-right: 0.6rem;
  white-space: nowrap;
}
.asun-heat-cell {
  width: 62px;
  height: 44px;
  text-align: center;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--ground);
}
.asun-heat-cell.asun-heat-diag { color: var(--ink-3); }

/* scatter plots */

.asun-scatter { margin-top: 0.25rem; }
.asun-scatter svg { display: block; width: 100%; height: auto; max-width: 760px; }
.asun-bubble { fill-opacity: 0.7; stroke: #fff; stroke-width: 1; }
.asun-trend {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.4;
  stroke-dasharray: 5 4;
  opacity: 0.7;
}
.asun-zero { stroke: var(--ink-3); stroke-dasharray: 4 3; }
.asun-axis-label { font-size: 11px; fill: var(--ink-3); }
.asun-axis-title { font-size: 11px; font-weight: 700; fill: var(--ink-2); letter-spacing: 0.04em; }

/* asunción responsive */

@media (max-width: 900px) {
  .asun-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .asun-winners { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .asun-kpis { grid-template-columns: 1fr; }
  .asun-zonebar { grid-template-columns: 1fr; gap: 5px; }
  .asun-fuerza { grid-template-columns: 62px minmax(0, 1fr); gap: 0.65rem; }
  .asun-ql li { grid-template-columns: 1fr; gap: 0.1rem; }
  .asun-ql li span { padding-left: 0; }
  .asun-cell { width: 20px; height: 20px; }
  .asun-heat-cell { width: 48px; height: 38px; font-size: 0.66rem; }
  .asun-dbar { grid-template-columns: 3.2rem minmax(0, 1fr) 5.6rem; }
}

/* ------------------------------------- asunción filtros, mapas y resultado */

.asun-filterchip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  /* Rendered at the end of the section: it never displaces the chart above. */
  margin: 1.5rem 0 0;
}
.asun-filterchip[hidden] { display: none; }
.asun-filterchip-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-2);
}
.asun-filterchip-btn {
  border: 1px solid var(--rule-2);
  background: var(--paper);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.asun-filterchip-btn:hover { background: var(--ground); border-color: var(--ink-3); }

/* 2026 result card */

.asun-result-winner { font-size: 1rem; font-weight: 700; line-height: 1.5; }
.asun-result-winner b { font-weight: 900; }
.asun-result-name { font-weight: 800; }
.asun-result-party { color: var(--ink-2); }
.asun-result-votes { color: var(--ink-3); font-weight: 600; }
.asun-result-cands { display: grid; gap: 0.55rem; margin-top: 1rem; max-width: 640px; }
.asun-rcand {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  column-gap: 0.6rem;
  row-gap: 0.1rem;
  align-items: center;
  font-size: 0.82rem;
}
.asun-rcand-sw {
  grid-row: 1 / span 2;
  grid-column: 1;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.18);
}
.asun-rcand-name { grid-row: 1; grid-column: 2; font-weight: 700; }
.asun-rcand-party { grid-row: 2; grid-column: 2; color: var(--ink-3); font-size: 0.76rem; }
.asun-rcand-votes { grid-row: 1; grid-column: 3; text-align: right; font-weight: 600; }
.asun-rcand-pct { grid-row: 2; grid-column: 3; text-align: right; font-weight: 800; }

/* barrio choropleth maps */

.asun-winner-col svg { display: block; width: 100%; height: auto; }
.asun-poly {
  stroke: rgba(0, 0, 0, 0.14);
  stroke-width: 0.6;
  cursor: pointer;
  transition: stroke 0.12s ease, stroke-width 0.12s ease, opacity 0.2s ease;
}
.asun-poly:hover { stroke: var(--ink); stroke-width: 1.4; }
.asun-poly.is-selected { stroke: var(--ink); stroke-width: 2.4; }
.asun-poly.is-dim { opacity: 0.16; }
.asun-poly.is-dim:hover { opacity: 0.55; }
.asun-base {
  fill: rgba(12, 12, 13, 0.035);
  stroke: var(--rule-2);
  stroke-width: 0.5;
  pointer-events: none;
}
.asun-district {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 0.9;
  pointer-events: none;
}
.asun-map-note[hidden] { display: none; }

.asun-dot.is-selected { stroke: var(--ink); stroke-width: 2.2; }
.asun-map-legend .asun-dotkey { border: 1px solid rgba(0, 0, 0, 0.12); }

/* interactive selections */

.asun-zonebar.is-clickable { cursor: pointer; border-radius: 6px; }
.asun-zonebar.is-clickable:hover { background: var(--ground); }
.asun-zonebar.is-selected { background: var(--ground); box-shadow: inset 3px 0 0 var(--ink); }
.asun-zonebar.is-selected .asun-zonebar-name { color: var(--ink); }

.asun-table tr.is-clickable { cursor: pointer; }
.asun-table tbody tr.is-selected td { background: rgba(0, 43, 199, 0.12); }
.asun-table tbody tr.is-selected:hover td { background: rgba(0, 43, 199, 0.16); }
