*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); font: var(--step-0)/1.62 var(--font-body);
  font-optical-sizing: auto; -webkit-text-size-adjust: 100%; }
body { margin: 0; }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
p, li { max-width: var(--measure); }

h1, h2, h3, .brand-name { font-family: var(--font-display); color: var(--text); letter-spacing: -.01em; }
h1 { font-size: var(--step-4); line-height: 1.08; font-weight: 800; margin: var(--space-5) 0 var(--space-3); max-width: 24ch; }
h2 { font-size: var(--step-2); line-height: 1.2; font-weight: 700; margin: var(--space-5) 0 var(--space-3); }
h3 { font-size: var(--step-1); line-height: 1.25; font-weight: 700; margin: 0 0 var(--space-2); }
.lead { font-size: var(--step-1); line-height: 1.45; color: var(--muted); }
.muted { color: var(--muted); }
small, .small { font-size: var(--step--1); }

/* ---- header: blue band + red rule (the flag's lower stripe) ---- */
.site-header { background: var(--header-bg); color: var(--header-text); border-bottom: 6px solid var(--rule); }
.site-header-inner { max-width: var(--max-width); margin: 0 auto; padding: var(--space-3);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--header-text); }
.brand img { width: 2.6rem; height: 2.6rem; display: block; box-shadow: 0 0 0 1px rgb(255 255 255 / .35); }
.brand-name { color: var(--header-text); font-size: 1.45rem; font-weight: 800; line-height: 1; }
.brand-tag { display: block; font-family: var(--font-body); font-size: var(--step--1); color: var(--header-muted); font-weight: 400; margin-top: .25rem; letter-spacing: 0; }
.site-header nav ul { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; list-style: none; margin: 0; padding: 0; }
.site-header nav a { color: var(--header-text); text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: .98rem; padding: .2rem 0; border-bottom: 2px solid transparent; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { border-bottom-color: var(--header-text); }

main { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space-3) var(--space-5); }
section { margin-bottom: var(--space-4); }

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.site-footer-inner { max-width: var(--max-width); margin: 0 auto; padding: var(--space-4) var(--space-3);
  display: grid; gap: var(--space-2); color: var(--muted); font-size: var(--step--1); }
.site-footer .themes a { margin-right: var(--space-3); }
.disclaimer { color: var(--text); }

/* ---- hero: the latest vote with its tally ---- */
.hero { padding: var(--space-5) 0 var(--space-4); border-bottom: 1px solid var(--border); }
.hero-kicker { font-family: var(--font-display); color: var(--muted); font-size: var(--step-0); margin: 0; }
.hero h1 { margin-top: var(--space-2); max-width: 30ch; font-size: clamp(1.9rem, 3.6vw, var(--step-4)); }
.hero h1 a { color: inherit; text-decoration: none; }
.hero h1 a:hover { text-decoration: underline; text-decoration-color: var(--rule); }
.hero .tally { height: 2.25rem; margin: var(--space-4) 0 var(--space-2); }
.hero-figures { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); font-family: var(--font-display); }
.hero-figures b { font-size: var(--step-3); font-weight: 800; display: block; line-height: 1; font-variant-numeric: tabular-nums; }
.fig-yes b { color: var(--yes); } .fig-no b { color: var(--no); } .fig-abs b { color: var(--abstain); }
.facts { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); color: var(--muted); margin: var(--space-4) 0 0; padding: 0; list-style: none; }
.facts strong { color: var(--text); font-family: var(--font-display); font-variant-numeric: tabular-nums; }

/* ---- the signature: tally band ---- */
.tally { display: flex; width: 100%; height: .55rem; background: var(--track); overflow: hidden; }
.tally > span { display: block; height: 100%; }
.tally .t-yes { background: var(--yes); } .tally .t-no { background: var(--no); } .tally .t-abs { background: var(--abstain); }
.tally-cell { min-width: 9rem; }
.tally-cell small { display: block; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: .2rem; }

/* ---- tables ---- */
table.data { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .97rem; font-variant-numeric: tabular-nums; border-top: 2px solid var(--text); }
table.data th, table.data td { text-align: left; padding: .6rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { font-family: var(--font-display); font-weight: 600; font-size: .9rem; color: var(--muted); }
table.data tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.table-wrap { overflow-x: auto; }
details summary { cursor: pointer; }

/* ---- badges ---- */
.badge { display: inline-block; padding: .05em .55em; border: 1px solid currentColor; border-radius: var(--radius); font-size: .85em; white-space: nowrap; text-decoration: none; font-family: var(--font-display); font-weight: 600; }
.opt-yes { color: var(--yes); } .opt-no { color: var(--no); } .opt-abstain { color: var(--abstain); }
.opt-dispensado, .opt-no_vota, .opt-pareo, .opt-absent_inferred { color: var(--other); border-style: dashed; }
.lean-left { color: var(--left); } .lean-right { color: var(--right); }
.lean-center, .lean-none { color: var(--center); } .lean-transversal { color: var(--transversal); }
.party { color: var(--text); border-color: var(--border); }
.source { white-space: nowrap; }

/* ---- forms ---- */
form.filters { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: end;
  padding: var(--space-3) 0; margin: var(--space-3) 0 var(--space-4); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
form.filters label { display: flex; flex-direction: column; font-size: var(--step--1); color: var(--muted); gap: .2rem; font-family: var(--font-display); }
input, select, button { font: inherit; font-size: .95rem; padding: .4rem .55rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
button { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); cursor: pointer; font-family: var(--font-display); font-weight: 700; }
button:hover { filter: brightness(1.1); }

/* ---- highlights: left rule in brand blue, no card kit ---- */
.highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: var(--space-4); }
.highlight { border-left: 4px solid var(--accent); padding: 0 0 0 var(--space-3); }
.empty { padding: var(--space-3) 0; color: var(--muted); font-style: italic; }

ul.inline { display: flex; flex-wrap: wrap; gap: var(--space-3); list-style: none; padding: 0; }
ul.columns { columns: 3 14rem; padding-left: 1.1rem; }
ul.plain { list-style: none; padding: 0; }
ul.plain li { padding: .25rem 0; }
.pager { display: flex; justify-content: space-between; align-items: center; margin: var(--space-3) 0; font-family: var(--font-display); }
.pager .disabled { color: var(--muted); opacity: .5; }

/* ---- gauges: half dial ---- */
.gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: var(--space-4); }
.gauge { display: flex; flex-direction: column; gap: var(--space-2); padding-top: var(--space-3); border-top: 2px solid var(--text); }
.gauge-wrap { width: 11rem; height: 5.5rem; overflow: hidden; }
.gauge-dial { width: 11rem; height: 11rem; border-radius: 50%; position: relative;
  background: conic-gradient(from 270deg, var(--accent) 0 var(--deg), var(--track) var(--deg) 180deg, transparent 180deg); }
.gauge-dial::after { content: ""; position: absolute; inset: 1.4rem; border-radius: 50%; background: var(--bg); }
.gauge-value { position: absolute; z-index: 1; left: 0; right: 0; top: 2.7rem; text-align: center; font-family: var(--font-display); font-size: var(--step-2); font-weight: 800; font-variant-numeric: tabular-nums; }
.gauge-title { font-family: var(--font-display); font-weight: 700; font-size: var(--step-1); display: block; }
.gauge-empty .gauge-dial { background: conic-gradient(from 270deg, var(--track) 0 180deg, transparent 180deg); }

/* ---- brand kit page ---- */
.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--space-3); }
.swatch { border: 1px solid var(--border); background: var(--surface); }
.swatch div { height: 5rem; }
.swatch p { margin: 0; padding: var(--space-2); font-size: var(--step--1); }
.specimen-display { font-family: var(--font-display); font-weight: 800; font-size: var(--step-4); line-height: 1.05; margin: 0; }
.specimen-body { font-family: var(--font-body); font-size: var(--step-1); }
.logo-row { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; }
.logo-row .on-blue { background: var(--republica); padding: var(--space-3); }

@media (max-width: 40rem) {
  h1 { font-size: var(--step-3); }
  .site-header nav ul { gap: .25rem .9rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.opt-other { color: var(--other); border-style: dashed; }

/* Party capsule: the one fully rounded shape in the system, so parties read at a glance. */
.party-pill { display: inline-block; background: var(--pill-bg); color: var(--pill-text); border-radius: 999px;
  padding: .08em .6em; font-family: var(--font-display); font-weight: 700; font-size: .72em; line-height: 1.5;
  vertical-align: .12em; white-space: nowrap; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
ul.facts-list li { padding: .35rem 0; border-bottom: 1px solid var(--border); max-width: var(--measure); }
ul.facts-list li:last-child { border-bottom: 0; }
ul.facts-list b { font-family: var(--font-display); font-weight: 700; }
