/* Congreso Abierto: "public record" design system.
   Serif headlines (Source Serif 4) over an official sans (Public Sans), ruled sections instead of
   cards, ink-blue institutional accent, one red signal colour. See DESIGN.md. */

:root {
  /* surfaces */
  --bg: oklch(0.993 0.002 255);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.967 0.006 255);
  --surface-3: oklch(0.935 0.009 255);
  /* ink */
  --text: oklch(0.22 0.025 258);
  --ink-2: oklch(0.36 0.02 258);
  --muted: oklch(0.47 0.018 258);
  --border: oklch(0.885 0.008 255);
  --rule: oklch(0.22 0.025 258);
  /* roles */
  --accent: oklch(0.44 0.135 256);
  --accent-hover: oklch(0.36 0.13 256);
  --accent-soft: oklch(0.95 0.022 256);
  --signal: oklch(0.54 0.2 27);
  --good: oklch(0.49 0.12 152);
  --bad: oklch(0.52 0.19 27);
  --warn: oklch(0.52 0.12 68);
  --focus: oklch(0.55 0.17 256);
  /* type */
  --serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font: var(--sans);
  --step--1: .8125rem;
  --step-0: 1rem;
  --step-1: 1.1875rem;
  --step-2: 1.4375rem;
  --step-3: 1.8125rem;
  --step-4: clamp(2rem, 1.35rem + 2.2vw, 2.875rem);
  --measure: 68ch;
  --radius: 3px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --z-sticky: 20;
  --z-overlay: 40;
  /* chart roles (validated: dataviz validator, both modes) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --mark-muted: #c9ccd1;
  --seq-low: #cde2fb;
  --seq-high: #0d366b;
  /* bloc slots 1–6 + 'others' (validated; paired with a marker shape per bloc) */
  --bloc-0: #2a78d6; --bloc-1: #eb6834; --bloc-2: #1baf7a; --bloc-3: #eda100; --bloc-4: #e87ba4; --bloc-5: #008300;
  --bloc-other: #4a3aa7;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.175 0.012 258);
    --surface: oklch(0.205 0.013 258);
    --surface-2: oklch(0.24 0.014 258);
    --surface-3: oklch(0.29 0.016 258);
    --text: oklch(0.94 0.006 255);
    --ink-2: oklch(0.84 0.01 255);
    --muted: oklch(0.73 0.014 255);
    --border: oklch(0.33 0.015 258);
    --rule: oklch(0.86 0.01 255);
    --accent: oklch(0.78 0.1 250);
    --accent-hover: oklch(0.86 0.08 250);
    --accent-soft: oklch(0.29 0.045 256);
    --signal: oklch(0.68 0.17 27);
    --good: oklch(0.74 0.13 152);
    --bad: oklch(0.72 0.15 25);
    --warn: oklch(0.8 0.12 75);
    --focus: oklch(0.75 0.12 250);
    --series-1: #3987e5;
    --series-2: #d95926;
    --mark-muted: #4a4f58;
    --seq-low: #22303f;
    --seq-high: #86b6ef;
    --bloc-0: #3987e5; --bloc-1: #d95926; --bloc-2: #199e70; --bloc-3: #c98500; --bloc-4: #d55181; --bloc-5: #008300;
    --bloc-other: #9085e9;
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 4rem; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--step-0)/1.55 var(--sans);
  font-kerning: normal; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-decoration: none; text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--accent-soft); }

h1, h2, h3, h4 { margin: 0 0 .5rem; color: var(--text); text-wrap: balance; }
h1, h2 { font-family: var(--serif); font-optical-sizing: auto; }
h1 { font-size: var(--step-4); line-height: 1.08; font-weight: 700; letter-spacing: -.018em; }
h2 { font-size: var(--step-2); line-height: 1.2; font-weight: 650; letter-spacing: -.008em; }
h3 { font-family: var(--sans); font-size: var(--step-0); line-height: 1.3; font-weight: 700; }
h1 a, h2 a, h3 a { color: inherit; }
h2 .small, h3 .small, h1 .small { font-family: var(--sans); font-weight: 400; letter-spacing: 0; }
p { margin: 0 0 .75rem; }
b, strong { font-weight: 650; }
code { font-size: .9em; background: var(--surface-2); padding: .05em .3em; border-radius: var(--radius); }
.muted { color: var(--muted); }
.small { font-size: var(--step--1); line-height: 1.5; }
.nowrap { white-space: nowrap; }
.num-inline { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -3rem; background: var(--text); color: var(--bg); padding: .5rem .8rem; z-index: var(--z-overlay); font-weight: 600; }
.skip-link:focus { top: .5rem; color: var(--bg); text-decoration: none; }

/* ------------------------------------------------------------ masthead */
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

.masthead { background: var(--surface); border-top: 4px solid var(--signal); }
.masthead .dateline {
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  font-size: var(--step--1); color: var(--muted); padding: .55rem 0 0;
}
.masthead .dateline a { color: var(--muted); }
.masthead .dateline a:hover { color: var(--text); }
.masthead .dateline .fresh { display: inline-flex; align-items: center; gap: .4rem; }
.masthead .dateline .fresh::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--good); }
.masthead .dateline .fresh.stale::before { background: var(--warn); }
.masthead .title-row { display: flex; align-items: end; justify-content: space-between; gap: 1rem 2rem; padding: .6rem 0 .9rem; flex-wrap: wrap; }
.wordmark { display: inline-flex; align-items: center; gap: .7rem; color: var(--text); }
.wordmark:hover { text-decoration: none; color: var(--text); }
.wordmark .seal { flex: none; width: 34px; height: 34px; }
.wordmark .name { font: 700 clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem)/1 var(--serif); letter-spacing: -.02em; }
.wordmark .tag { display: block; font: 400 var(--step--1)/1.4 var(--sans); color: var(--muted); letter-spacing: 0; margin-top: .3rem; }
.site-search { display: flex; flex: 0 1 340px; min-width: 0; }
.site-search input[type=search] { flex: 1 1 auto; border-radius: var(--radius) 0 0 var(--radius); border-right: 0; }
.site-search button { border-radius: 0 var(--radius) var(--radius) 0; }

.sections {
  position: sticky; top: 0; z-index: var(--z-sticky);
  background: color-mix(in oklab, var(--surface) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-top: 1px solid var(--border); border-bottom: 2px solid var(--rule);
}
.sections nav { display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.sections nav::-webkit-scrollbar { display: none; }
.sections a {
  flex: none; color: var(--ink-2); font-weight: 600; font-size: .9375rem; padding: .7rem .8rem .6rem;
  border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.sections a:first-child { padding-left: 0; }
.sections a:hover { color: var(--text); text-decoration: none; border-bottom-color: var(--border); }
.sections a.active, .sections a[aria-current="page"] { color: var(--text); border-bottom-color: var(--signal); }
.sections a:first-child.active, .sections a:first-child:hover { border-bottom-color: var(--signal); }
.sections .sep { flex: none; width: 1px; background: var(--border); margin: .6rem .4rem; }

main.wrap { padding-top: 2rem; padding-bottom: 4rem; }

/* --------------------------------------------------------- page header */
.kicker { font-size: var(--step--1); font-weight: 600; color: var(--muted); margin-bottom: .5rem; }
.kicker a { color: var(--accent); }
.kicker .sep { margin: 0 .35rem; color: var(--border); }
.page-head { padding-bottom: .75rem; margin-bottom: .5rem; }
.page-head h1 { max-width: 30ch; }
.page-head .lead { margin-top: .75rem; margin-bottom: 0; }
.page-head .meta { margin-top: .9rem; display: flex; flex-wrap: wrap; gap: .4rem .5rem; align-items: center; }
.lead {
  font-family: var(--serif); font-size: var(--step-1); line-height: 1.5; color: var(--ink-2);
  max-width: var(--measure); text-wrap: pretty; font-weight: 400;
}
.lead b { font-weight: 650; color: var(--text); }

/* -------------------------------------------------------------- layout */
.grid { display: grid; gap: 2rem 2.5rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 1.25rem 1.5rem; }
.section { margin-top: 2.5rem; }
h3.section, .card .section { margin-top: 1.5rem; }

/* A "card" is a ruled section of the page, not a floating box. */
.card { border-top: 2px solid var(--rule); padding-top: .85rem; min-width: 0; background: none; color: inherit; display: block; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card > h2 { margin-bottom: .6rem; }
a.card { color: inherit; transition: border-color .15s var(--ease); }
a.card:hover { text-decoration: none; border-top-color: var(--accent); }
a.card:hover h2 { color: var(--accent); }
.card > p:last-child, .card > .small:last-child { margin-bottom: 0; }
details.card > summary { cursor: pointer; font-weight: 600; }

/* Front-page style: main column + rail separated by a hairline. */
.front { display: grid; gap: 2rem 2.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) {
  .front { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .front > .rail { border-left: 1px solid var(--border); padding-left: 2.5rem; }
}
.rail > * + * { margin-top: 2.25rem; }

/* Figures: a chart or diagram with a caption and source line. */
figure { margin: 0; }
figcaption, .caption { font-size: var(--step--1); color: var(--muted); line-height: 1.5; margin-top: .5rem; max-width: var(--measure); }
.source-line { font-size: .75rem; color: var(--muted); margin-top: .4rem; }

/* --------------------------------------------------- key figures strip */
.figures {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  border-top: 2px solid var(--rule); border-bottom: 1px solid var(--border);
}
.figures > .stat, .figures > .card.stat { border: 0; padding: .9rem 1rem 1rem; }
.figures > .stat + .stat { box-shadow: inset 1px 0 0 var(--border); }
.figures > .stat:first-child { padding-left: 0; }
.stat .num { font: 650 var(--step-3)/1.05 var(--serif); font-variant-numeric: lining-nums tabular-nums; letter-spacing: -.01em; color: var(--text); }
.stat .lbl { color: var(--muted); font-size: var(--step--1); margin-top: .35rem; line-height: 1.4; max-width: 28ch; }
.grid > .stat, .grid > .card.stat { border-top: 1px solid var(--border); padding-top: .75rem; }
@media (max-width: 520px) {
  .figures { grid-template-columns: 1fr 1fr; }
  .figures > .stat:nth-child(odd) { padding-left: 0; box-shadow: none; }
  .figures > .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
}
/* Stacked figure list (front page rail). */
.factlist { list-style: none; margin: 0; padding: 0; }
.factlist li { display: grid; grid-template-columns: 5.5rem 1fr; gap: .9rem; align-items: baseline; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.factlist .n { font: 650 1.5rem/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; text-align: right; }
.factlist .l { font-size: .9375rem; color: var(--ink-2); line-height: 1.35; }

/* ---------------------------------------------------------------- lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: .7rem 0; border-bottom: 1px solid var(--border); }
.list li:first-child { padding-top: .2rem; }
.list li:last-child { border-bottom: 0; }
.list.small li { padding: .5rem 0; }
.list li > a:first-child { font-weight: 600; }
.list .meta, .list .small.muted { margin-top: .2rem; }
ol.numbered { list-style: none; counter-reset: n; margin: 0; padding: 0; }
ol.numbered > li { counter-increment: n; position: relative; padding-left: 2rem; }
ol.numbered > li::before { content: counter(n); position: absolute; left: 0; top: .7rem; font: 650 1rem/1.3 var(--serif); color: var(--muted); font-variant-numeric: tabular-nums; }
ol.numbered > li:first-child::before { top: .2rem; }

/* Headline list: the news-story rows used for votes and bills. */
.story { display: block; }
.story .hed { font: 600 1.0625rem/1.35 var(--serif); color: var(--text); text-wrap: pretty; }
a.hed:hover, .story a:hover .hed { color: var(--accent); }
.story .meta { font-size: var(--step--1); color: var(--muted); margin-top: .3rem; display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: center; }
.story .meta > * + *::before { content: none; }
.list li > a.hed { font-weight: 600; }

/* --------------------------------------------------------------- tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .9375rem; }
caption { text-align: left; font-size: var(--step--1); color: var(--muted); padding-bottom: .5rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
thead th { font-size: var(--step--1); color: var(--ink-2); font-weight: 700; border-bottom: 1px solid var(--rule); vertical-align: bottom; line-height: 1.3; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td.small { font-size: var(--step--1); }
.card > .table-scroll:first-child, .card > table:first-child { margin-top: -.25rem; }
.table-scroll > h2, .table-scroll > h3 { position: sticky; left: 0; }

/* ---------------------------------------------------------------- chips */
.chip {
  display: inline-flex; align-items: center; gap: .35rem; padding: .1rem .45rem; border-radius: var(--radius);
  font-size: .75rem; font-weight: 600; line-height: 1.5; background: var(--surface-2); color: var(--ink-2);
  white-space: nowrap; border: 1px solid transparent; vertical-align: .08em;
}
a.chip:hover { text-decoration: none; border-color: currentColor; }
.chip.ok { background: color-mix(in oklab, var(--good) 13%, var(--surface)); color: var(--good); }
.chip.bad { background: color-mix(in oklab, var(--bad) 11%, var(--surface)); color: var(--bad); }
.chip.warn { background: color-mix(in oklab, var(--warn) 14%, var(--surface)); color: var(--warn); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.live { background: var(--signal); color: #fff; }
/* Result stamp: the official outcome of a vote or bill. */
.stamp {
  display: inline-flex; align-items: center; gap: .35rem; font: 700 .75rem/1 var(--sans); letter-spacing: .02em;
  padding: .3rem .5rem; border: 1.5px solid currentColor; border-radius: var(--radius); white-space: nowrap; vertical-align: .1em;
}
.stamp.ok { color: var(--good); }
.stamp.bad { color: var(--bad); }
.stamp.neutral { color: var(--ink-2); }
.stamp.law { color: var(--surface); background: var(--good); border-color: var(--good); }
.dot { width: .65rem; height: .65rem; border-radius: 50%; display: inline-block; flex: none; vertical-align: baseline; }
.vote-opt { display: inline-block; min-width: 5.2rem; text-align: center; font: 700 .75rem/1 var(--sans); padding: .3rem .45rem; border-radius: var(--radius); color: #fff; }

/* ------------------------------------------------------------- tallies */
.tally { display: flex; height: 8px; background: var(--surface-3); border-radius: 1px; overflow: hidden; max-width: 260px; margin-top: .45rem; }
.tally span { display: block; height: 100%; }
.tally .y { background: var(--vote-yes); }
.tally .n { background: var(--vote-no); }
.tally .a { background: var(--vote-abst); }
.tally-nums { font-variant-numeric: tabular-nums; }
.tally-nums .y { color: var(--vote-yes-text); font-weight: 700; }
.tally-nums .n { color: var(--vote-no-text); font-weight: 700; }
:root { --vote-yes: #1f8a55; --vote-no: #e0533f; --vote-abst: #e6a700; --vote-yes-text: oklch(0.47 0.12 152); --vote-no-text: oklch(0.52 0.19 27); }
@media (prefers-color-scheme: dark) { :root { --vote-yes-text: oklch(0.74 0.13 152); --vote-no-text: oklch(0.72 0.15 25); } }

/* ------------------------------------------------------------ hemicycle */
.hemi svg { width: 100%; height: auto; display: block; }
.hemi circle { stroke: var(--bg); stroke-width: .35; transition: opacity .15s; }
.hemi a:hover circle, .hemi a:focus-visible circle { stroke: var(--text); stroke-width: .9; }
.hemi .total { font: 700 15px var(--serif); fill: var(--text); }
.hemi .sub { font: 5.5px var(--sans); fill: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: var(--step--1); margin-top: .6rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend a { color: var(--text); font-weight: 600; }

/* --------------------------------------------------------------- people */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 0 1.5rem; }
.person { display: flex; gap: .75rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--border); color: var(--text); min-width: 0; }
a.person:hover { text-decoration: none; }
a.person:hover .name { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
.avatar { width: 40px; height: 50px; border-radius: 2px; object-fit: cover; object-position: 50% 20%; background: var(--surface-3); flex: none; display: block; }
.avatar.lg { width: 136px; height: 170px; }
.person .name { font-weight: 600; font-size: .9375rem; line-height: 1.25; }
.person .small { margin-top: .1rem; }

/* ------------------------------------------------------------- pipeline */
.pipeline { display: flex; margin: 1rem 0 .5rem; overflow-x: auto; padding: 0 0 .25rem; counter-reset: st; }
.step { flex: 1 1 0; min-width: 104px; position: relative; text-align: left; font-size: var(--step--1); color: var(--muted); padding: 30px .75rem 0 0; line-height: 1.3; }
.step::before { content: ""; position: absolute; top: 10px; left: 0; right: 0; height: 2px; background: var(--border); }
.step:last-child::before { right: auto; width: 20px; }
.step .b { position: absolute; top: 2px; left: 0; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border); }
.step.reached { color: var(--text); }
.step.reached::before { background: var(--text); }
.step.reached .b { background: var(--text); border-color: var(--text); }
.step.current { font-weight: 700; }
.step.current .b { background: var(--signal); border-color: var(--signal); box-shadow: 0 0 0 4px color-mix(in oklab, var(--signal) 22%, transparent); }
.step.current::before { background: linear-gradient(90deg, var(--text) 18px, var(--border) 18px); }

/* ------------------------------------------------------------- timeline */
.timeline { margin: .5rem 0 0; padding: 0; }
.timeline .stage { font: 650 1.0625rem/1.3 var(--serif); margin: 1.25rem 0 .25rem; padding-top: .6rem; border-top: 1px solid var(--rule); }
.timeline .stage:first-child { margin-top: 0; }
.timeline .ev { display: grid; grid-template-columns: 6.2rem 1fr; gap: .75rem; padding: .4rem 0; font-size: .9375rem; border-bottom: 1px dotted var(--border); line-height: 1.45; }
.timeline .ev .d { color: var(--muted); font-size: var(--step--1); font-variant-numeric: tabular-nums; padding-top: .1rem; }
.timeline .ev .chip { margin-right: .3rem; }

/* ---------------------------------------------------------------- bars */
.bar { display: flex; height: 8px; border-radius: 1px; overflow: hidden; background: var(--surface-3); min-width: 80px; margin-top: .45rem; }
.bar > span { display: block; height: 100%; }

/* --------------------------------------------------------------- forms */
.filters { display: flex; flex-wrap: wrap; gap: .5rem .6rem; align-items: center; margin: 1.25rem 0; }
input[type=search], input[type=text], select {
  font: inherit; font-size: .9375rem; padding: .5rem .7rem; border: 1px solid color-mix(in oklab, var(--text) 30%, var(--surface));
  border-radius: var(--radius); background: var(--surface); color: var(--text); min-height: 2.75rem;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input[type=search]::placeholder { color: var(--muted); opacity: 1; }
input[type=search]:hover, select:hover { border-color: var(--text); }
input[type=search]:focus, select:focus { outline: 2px solid transparent; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent); }
.filters input[type=search] { flex: 1 1 260px; min-width: 0; }
label.check { display: inline-flex; gap: .4rem; align-items: center; font-size: .9375rem; cursor: pointer; }
label.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 2.75rem; padding: .45rem .9rem;
  border: 1px solid var(--text); border-radius: var(--radius); background: var(--surface); color: var(--text);
  font: 600 .9375rem/1.2 var(--sans); cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease);
}
.btn:hover { background: var(--text); color: var(--bg); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary, .btn.primary:hover { color: var(--bg); } }
.btn.quiet { border-color: var(--border); }
.btn.quiet:hover { border-color: var(--text); background: var(--surface-2); color: var(--text); }
.more { font-weight: 600; font-size: .9375rem; display: inline-block; margin-top: .75rem; }
.more::after { content: " →"; }
.pager { display: flex; gap: .75rem; align-items: center; justify-content: space-between; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.pager > :only-child, .pager > span:first-child { margin-left: auto; margin-right: auto; }

/* The comuna finder: the site's most important question. */
.finder { background: var(--surface-2); padding: 1.1rem 1.25rem 1.25rem; border-radius: var(--radius); margin-top: 1.5rem; }
.finder label { display: block; font: 650 var(--step-1)/1.3 var(--serif); margin-bottom: .6rem; }
.finder .row { display: flex; gap: .5rem; }
.finder input[type=search] { flex: 1 1 auto; min-width: 0; font-size: 1rem; min-height: 2.75rem; }
.finder .btn { min-height: 2.75rem; }
.finder .hint { font-size: var(--step--1); color: var(--muted); margin: .5rem 0 0; }

/* --------------------------------------------------------------- charts */
.chart { width: 100%; height: 300px; }
.chart.tall { height: 540px; }
@media (max-width: 640px) { .chart.tall { height: 440px; } }

/* ------------------------------------------------------ steps explainer */
.steps-explainer { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 0 2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.steps-explainer li { counter-increment: s; padding: 1rem 0 1rem 3.25rem; position: relative; border-top: 1px solid var(--border); line-height: 1.5; }
.steps-explainer li::before { content: counter(s); position: absolute; left: 0; top: .8rem; font: 700 2rem/1 var(--serif); color: var(--signal); font-variant-numeric: lining-nums; }
.steps-explainer .t { display: block; font: 650 var(--step-1)/1.3 var(--serif); margin-bottom: .2rem; }

/* ------------------------------------------------------------ analytics */
.legend-inline { display: inline-flex; align-items: center; gap: .35rem; margin-right: .9rem; font-size: var(--step--1); }
.swatch { width: .8rem; height: .8rem; border-radius: 2px; display: inline-block; }
.kpi-note { font-size: var(--step--1); color: var(--muted); }
.bloc-key { display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; }
.bloc-key svg { flex: none; }
.segmented { display: inline-flex; border: 1px solid var(--text); border-radius: var(--radius); overflow: hidden; }
.segmented a { padding: .45rem .8rem; color: var(--text); border-right: 1px solid var(--border); font-weight: 500; font-size: .9375rem; min-height: 2.4rem; display: inline-flex; align-items: center; }
.segmented a:last-child { border-right: 0; }
.segmented a.on { background: var(--text); color: var(--bg); font-weight: 650; }
.segmented a:hover { text-decoration: none; }
.segmented a:not(.on):hover { background: var(--surface-2); }
.dendro text { font: 12px var(--sans); fill: var(--text); }
.dendro .axis { stroke: var(--border); }

/* Hub index: numbered analysis entries. */
.index-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0 2.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.index-list > li { border-top: 2px solid var(--rule); padding: 1rem 0 1.5rem; }
.index-list h2 { margin-bottom: .4rem; }
.index-list p { color: var(--ink-2); max-width: 60ch; }
.index-list .links { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }

/* ------------------------------------------------------ sortable tables */
th .th-sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: .25rem; font: inherit; color: inherit; }
th .th-sort:hover { color: var(--accent); }
th .th-sort:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
th .arrow::after { content: "↕"; opacity: .35; font-size: .9em; }
th[aria-sort="ascending"] .arrow::after { content: "↑"; opacity: 1; color: var(--signal); }
th[aria-sort="descending"] .arrow::after { content: "↓"; opacity: 1; color: var(--signal); }
th.num .th-sort { flex-direction: row-reverse; }
table.sortable tbody tr:hover { background: var(--surface-2); }
.sticky-head thead th { position: sticky; top: 0; background: var(--bg); z-index: 1; }

/* -------------------------------------------------------------- notes */
.note { font-size: var(--step--1); color: var(--ink-2); background: var(--surface-2); padding: .75rem 1rem; border-radius: var(--radius); max-width: var(--measure); line-height: 1.5; }
.note b { color: var(--text); }
.fineprint { font-size: var(--step--1); color: var(--muted); max-width: var(--measure); line-height: 1.5; margin-top: .75rem; }

/* --------------------------------------------------------------- footer */
.colophon { border-top: 2px solid var(--rule); background: var(--surface); color: var(--ink-2); font-size: .875rem; padding: 2rem 0 2.5rem; margin-top: 2rem; }
.colophon .cols { display: grid; gap: 1.5rem 2.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.colophon .name { font: 700 1.35rem/1.1 var(--serif); color: var(--text); margin-bottom: .5rem; }
.colophon h3 { font-size: .875rem; margin-bottom: .4rem; }
.colophon ul { list-style: none; margin: 0; padding: 0; }
.colophon li { padding: .15rem 0; }
.colophon a { color: var(--ink-2); }
.colophon a:hover { color: var(--accent); }
.colophon .legal { margin-top: 1.75rem; padding-top: 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: var(--step--1); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 640px) {
  main.wrap { padding-top: 1.25rem; }
  .avatar.lg { width: 96px; height: 120px; }
  .hide-sm { display: none; }
  .masthead .dateline .long { display: none; }
  .masthead .title-row { padding-bottom: .75rem; }
  .site-search { flex: 1 1 100%; }
  .wordmark .seal { width: 28px; height: 28px; }
  .timeline .ev { grid-template-columns: 1fr; gap: 0; }
}

/* ---------------------------------------------------------------- motion */
@media (prefers-reduced-motion: no-preference) {
  .hemi circle { animation: seat-in .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 2ms); }
  @keyframes seat-in { from { opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media print {
  .sections, .site-search, .filters, .pager, .colophon .cols { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: inherit; }
}

/* Portrait placeholder (no photo, or the source blocked it). */
.avatar.ph, div.avatar {
  background: var(--surface-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 50'%3E%3Ccircle cx='20' cy='19' r='8' fill='%23a3aab6'/%3E%3Cpath d='M5 50c1-10 7-16 15-16s14 6 15 16z' fill='%23a3aab6'/%3E%3C/svg%3E") center bottom / 100% auto no-repeat;
}

/* Roll call: names flow in newspaper columns. */
.rollcall { list-style: none; margin: .25rem 0 0; padding: 0; columns: 15rem; column-gap: 2rem; font-size: var(--step--1); }
.rollcall li { break-inside: avoid; padding: .3rem 0; border-bottom: 1px solid var(--border); }

/* Profile header: portrait beside the name, like a byline card in print. */
.profile-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.5rem; align-items: end; }
.profile-head h1 { margin-bottom: .6rem; }
.profile-head .meta { margin-top: 0; }
.jump { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin-top: 1rem; font-size: .9375rem; font-weight: 600; }
.jump a { color: var(--ink-2); border-bottom: 1px solid var(--border); padding-bottom: .1rem; }
.jump a:hover { color: var(--accent); border-color: currentColor; text-decoration: none; }
@media (max-width: 560px) { .profile-head { gap: .35rem 1rem; align-items: start; } .profile-head .avatar.lg { grid-row: 1 / span 2; } .profile-head .avatar.lg { width: 76px; height: 95px; } .profile-head .jump { grid-column: 1 / -1; } .profile-head .who { display: contents; } .profile-head .kicker, .profile-head h1, .profile-head .meta { grid-column: 2; } .profile-head .meta { grid-column: 1 / -1; } }

/* Personal vote log: the vote on the left, the matter on the right. */
.votelog li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .75rem; align-items: start; }
.votelog .hed { font: 600 1rem/1.35 var(--serif); color: var(--text); }
.votelog .hed:hover { color: var(--accent); }
.vote-mark { display: inline-flex; align-items: center; gap: .4rem; font-size: var(--step--1); font-weight: 700; color: var(--text); padding-top: .15rem; }
.vote-mark i { width: .8rem; height: .8rem; border-radius: 2px; flex: none; }
@media (max-width: 520px) { .votelog li { grid-template-columns: 1fr; gap: .2rem; } }
.card .figures { border-top: 1px solid var(--border); margin-top: .5rem; }

/* Roster grouped by district. */
.districts { margin-top: .25rem; }
.district { padding: 1.1rem 0 .5rem; }
.district + .district { border-top: 1px solid var(--rule); }
.district h3 { font-size: 1.0625rem; margin-bottom: .25rem; }
.results-count { font-size: .9375rem; color: var(--ink-2); padding-bottom: .6rem; margin: 0; border-bottom: 2px solid var(--rule); }
.billlist li:first-child { padding-top: .8rem; }
.list li.empty { padding: 2rem 0; }
.htmx-request #results, #results.htmx-request { opacity: .55; transition: opacity .2s var(--ease); }

/* Weekly agenda. */
.session h3 { font: 650 var(--step-1)/1.25 var(--serif); margin-bottom: .15rem; }
.session .when { font-size: var(--step--1); font-weight: 600; margin-bottom: .75rem; }
.agenda-day { padding-top: 1.25rem; }
.agenda-day + .agenda-day { margin-top: .75rem; border-top: 1px solid var(--rule); }
.agenda-day h3 { margin-bottom: .5rem; }
.filters input.grow { flex: 1 1 100%; font-size: 1rem; min-height: 2.75rem; }
.story .hed { display: block; max-width: 78ch; }
.list.numbered > li, .list.small.numbered > li { padding-left: 2rem; }
.list.small.numbered > li::before { top: .5rem; font-size: .9375rem; }
.session.past h3, .session.past .when { color: var(--muted); }
details.agenda-day > summary { cursor: pointer; list-style: none; }
details.agenda-day > summary::-webkit-details-marker { display: none; }
details.agenda-day > summary h3 { display: inline; }
details.agenda-day > summary::after { content: "Mostrar"; margin-left: .6rem; font-size: var(--step--1); font-weight: 600; color: var(--accent); }
details.agenda-day[open] > summary::after { content: "Ocultar"; }
details.agenda-day[open] > summary { margin-bottom: .5rem; }
p.small.muted, p.small { max-width: var(--measure); }

/* Compact masthead on phones. */
@media (max-width: 640px) {
  .masthead .dateline > span:first-child { display: none; }
  .masthead .dateline { justify-content: flex-end; padding-top: .4rem; }
  .wordmark .tag { display: none; }
  .masthead .title-row { padding: .35rem 0 .7rem; }
  .site-search input[type=search], .site-search .btn { min-height: 2.75rem; }
  .sections nav { mask-image: linear-gradient(90deg, #000 85%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 2rem; }
  .sections a { padding-left: .6rem; padding-right: .6rem; font-size: .875rem; }
  h1 { letter-spacing: -.012em; }
  .front > .rail { border-top: 0; }
}
.page-head h1.long { font-size: clamp(1.5rem, 1.05rem + 1.9vw, 2.4rem); line-height: 1.14; max-width: 42ch; }
@media (min-width: 900px) { .grid.split-map { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); } }
.index-list .thumb { display: block; width: 100%; max-width: 280px; height: auto; margin: .25rem 0 .75rem; }
h2.section { border-top: 2px solid var(--rule); padding-top: .85rem; }
.card h2.section, .rail h2.section { border-top: 1px solid var(--border); }
.front > div > :first-child { margin-top: 0; }

/* Vote page reader tools. */
.spotlight { display: flex; gap: 1.25rem; align-items: center; padding: 1rem 1.25rem; background: var(--surface-2); border-radius: var(--radius); }
.vote-mark.big { font-size: 1rem; min-width: 7.5rem; }
.vote-mark.big i { width: 1.1rem; height: 1.1rem; }
.local-votes li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .75rem; align-items: baseline; }
.rollcall li.hl { background: color-mix(in oklab, var(--signal) 12%, var(--surface)); padding-left: .4rem; font-weight: 650; }
.rollcall abbr { text-decoration: none; cursor: help; }
.rollcall-group[hidden], .rollcall li[hidden] { display: none; }
.party-key { margin-top: .75rem; }
.party-key summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.party-key dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: .15rem 1.25rem; margin: .5rem 0 0; font-size: var(--step--1); }
.party-key dl div { display: flex; gap: .5rem; }
.party-key dt { font-weight: 700; min-width: 4.5rem; }
.party-key dd { margin: 0; color: var(--ink-2); }
.cite { display: flex; gap: 1rem; align-items: flex-start; background: var(--surface-2); padding: 1rem 1.25rem; border-radius: var(--radius); }
.cite p { margin: 0; font-size: .9375rem; line-height: 1.5; flex: 1; overflow-wrap: anywhere; max-width: 80ch; }
@media (max-width: 560px) { .cite { flex-direction: column; } .spotlight { flex-direction: column; align-items: flex-start; } }
.scroll-box { max-height: 75vh; overflow-y: auto; } @media (max-width: 640px) { .scroll-box { max-height: none; overflow-y: visible; } }
.note.defs { max-width: none; margin-bottom: 1rem; }
.note.defs summary { cursor: pointer; }
.note.defs dl { display: grid; grid-template-columns: minmax(9rem, max-content) minmax(0, 1fr); gap: .35rem 1rem; margin: .75rem 0 0; }
.note.defs dt { font-weight: 700; color: var(--text); }
.note.defs dd { margin: 0; max-width: 75ch; }
@media (max-width: 560px) { .note.defs dl { grid-template-columns: 1fr; } .note.defs dd { margin-bottom: .4rem; } }

/* Section nav: six entries; "Congreso" opens a panel. Phones get a single "Secciones" menu. */
.sections nav.primary { overflow: visible; align-items: stretch; }
.sections .aside { margin-left: auto; display: flex; }
.menu { position: relative; display: flex; }
.menu > summary {
  list-style: none; cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: .9375rem;
  padding: .7rem .8rem .6rem; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: .35rem;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: ""; width: .4rem; height: .4rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s var(--ease); }
.menu[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.menu > summary:hover, .menu[open] > summary { color: var(--text); border-bottom-color: var(--border); }
.menu.active > summary { color: var(--text); border-bottom-color: var(--signal); }
.menu-panel {
  position: absolute; top: calc(100% + 2px); left: 0; z-index: var(--z-overlay); min-width: 22rem;
  background: var(--surface); border: 1px solid var(--border); border-top: 2px solid var(--rule);
  box-shadow: 0 12px 32px rgba(15, 20, 35, .14); padding: .4rem 0;
}
.menu-panel a { display: block; padding: .6rem 1rem; border: 0; margin: 0; color: var(--text); font-weight: 650; white-space: normal; }
.menu-panel a span { display: block; font-weight: 400; font-size: var(--step--1); color: var(--muted); margin-top: .1rem; }
.menu-panel a:hover { background: var(--surface-2); text-decoration: none; color: var(--accent); }
.mobile-nav { display: none; }
@media (max-width: 760px) {
  .sections nav.primary { display: none; }
  .mobile-nav { display: block; }
  .mobile-nav > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .6rem; min-height: 2.9rem; font-weight: 700; }
  .mobile-nav > summary::-webkit-details-marker { display: none; }
  .burger, .burger::before, .burger::after { display: block; width: 18px; height: 2px; background: currentColor; position: relative; transition: transform .2s var(--ease), background .2s; }
  .burger::before, .burger::after { content: ""; position: absolute; left: 0; }
  .burger::before { top: -6px; } .burger::after { top: 6px; }
  .mobile-nav[open] .burger { background: transparent; }
  .mobile-nav[open] .burger::before { transform: translateY(6px) rotate(45deg); }
  .mobile-nav[open] .burger::after { transform: translateY(-6px) rotate(-45deg); }
  .mobile-panel { padding: .25rem 0 1rem; max-height: calc(100vh - 8rem); overflow-y: auto; }
  .mobile-panel a { display: flex; align-items: center; min-height: 2.9rem; border-top: 1px solid var(--border); color: var(--text); font-weight: 600; }
  .mobile-panel .group { margin: 1rem 0 .25rem; font-size: var(--step--1); color: var(--muted); font-weight: 700; }
}
.sections .menu-panel a, .sections .menu-panel a:first-child { padding: .6rem 1rem; border-bottom: 0; }
.sections .mobile-panel a, .sections .mobile-panel a:first-child { padding: .5rem 0; border-bottom: 0; margin: 0; }
.sections .aside a { padding-right: 0; }
.district[hidden], .person[hidden] { display: none; }
.to-top { position: fixed; right: 1rem; bottom: 1rem; z-index: var(--z-sticky); background: var(--surface); color: var(--text); border: 1px solid var(--text); border-radius: var(--radius); padding: .55rem .8rem; font-weight: 600; font-size: .875rem; box-shadow: 0 6px 18px rgba(15, 20, 35, .12); min-height: 2.75rem; display: inline-flex; align-items: center; }
.to-top:hover { background: var(--text); color: var(--bg); text-decoration: none; }
.to-top[hidden] { display: none; }

/* Touch targets: grow the hit area of small controls without changing their layout. */
th .th-sort { padding: .7rem 0; margin: -.7rem 0; }
a.chip { position: relative; }
a.chip::after { content: ""; position: absolute; inset: -10px -3px; }
.kicker a, .jump a, .masthead .dateline a, .legend a { padding-block: .6rem; margin-block: -.6rem; }
details.agenda-day > summary { padding: .55rem 0; }
.party-key summary, .note.defs summary, details > summary.small { padding-block: .6rem; }
.colophon .legal { max-width: 80ch; }
.colophon li a { display: inline-block; padding-block: .3rem; }
@media (forced-colors: active) {
  .stamp, .chip, .btn, .segmented a.on { border: 1px solid CanvasText; }
  .tally span, .bar span, .dot, .vote-mark i { forced-color-adjust: none; }
}
.note { margin-top: .75rem; margin-bottom: .75rem; }

/* PDF viewer modal (bill page). */
.doc-viewer {
  width: min(1120px, calc(100vw - 2rem)); height: calc(100dvh - 2rem); max-width: none; max-height: none;
  padding: 0; border: 0; border-top: 4px solid var(--signal); border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(10, 14, 25, .35);
  overflow: hidden;
}
.doc-viewer[open] { display: flex; flex-direction: column; }
.doc-viewer::backdrop { background: rgba(10, 14, 25, .6); }
html:has(.doc-viewer[open]) { overflow: hidden; }
.doc-viewer-bar { display: flex; gap: 1rem 1.5rem; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: .85rem 1.25rem; border-bottom: 1px solid var(--border); }
.doc-viewer-title { min-width: 0; flex: 1 1 320px; }
.doc-viewer-title h2 { font-size: var(--step-1); margin: 0; }
.doc-viewer-title p { margin: .15rem 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: none; }
.doc-viewer-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.doc-viewer-body { position: relative; flex: 1; min-height: 0; background: var(--surface-3); }
.doc-viewer-body iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--surface-3); }
.doc-viewer-status { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: .5rem; text-align: center; padding: 2rem; }
.doc-viewer-status p { margin: 0; }
.doc-viewer-status.failed [data-message] { font-weight: 650; }
.doc-viewer-status.failed .doc-viewer-spinner { display: none; }
.doc-viewer-spinner { width: 2rem; height: 2rem; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: no-preference) {
  .doc-viewer[open] { animation: viewer-in .22s var(--ease); }
  .doc-viewer[open]::backdrop { animation: backdrop-in .22s var(--ease); }
  @keyframes viewer-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }
  @keyframes backdrop-in { from { opacity: 0; } }
}
.date-field { display: inline-flex; align-items: center; gap: .4rem; font-size: .9375rem; color: var(--ink-2); }
.date-field input { font: inherit; padding: .45rem .6rem; border: 1px solid color-mix(in oklab, var(--text) 30%, var(--surface)); border-radius: var(--radius); background: var(--surface); color: var(--text); min-height: 2.75rem; }
.filter-chips { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; margin: -.5rem 0 1rem; font-size: .9375rem; }
.filter-chips .chip { font-size: .8125rem; padding: .25rem .55rem; }
.filter-chips a.remove { font-weight: 600; font-size: .875rem; }
.dup-group { border-top: 1px solid var(--border); padding-top: .75rem; } .dup-group h3 { font-size: .9375rem; }

/* Long-form text pages (privacy notice). */
.prose { max-width: 78ch; }
.prose h2 { margin-top: 2rem; padding-top: .75rem; border-top: 1px solid var(--border); }
.prose h2:first-child { margin-top: 0; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin: .35rem 0; }
.prose table { margin: .5rem 0 1rem; }

/* Source footnotes: {% cite %} markers and the page's "Fuentes" list (base.html). */
sup.ref { font-size: .7em; line-height: 0; vertical-align: super; margin-left: .1em; font-family: var(--sans); font-weight: 600; }
sup.ref a { color: var(--accent); text-decoration: none; padding: .35em .2em; margin: -.35em -.2em; }
sup.ref + sup.ref::before { content: ","; color: var(--muted); }
sup.ref a:hover, sup.ref a:focus-visible { text-decoration: underline; }
.references { border-top: 1px solid var(--rule); margin-top: 2.5rem; padding-top: 1rem; max-width: var(--measure); }
.references h2 { font-size: var(--step-0); margin: 0 0 .5rem; }
.references ol { margin: 0; padding-left: 1.6rem; font-size: var(--step--1); color: var(--ink-2); line-height: 1.5; }
.references li { margin: .35rem 0; padding: .15rem .35rem; border-radius: var(--radius); scroll-margin-top: 5rem; }
.references li:target { background: var(--accent-soft); color: var(--text); }
.references cite { font-style: italic; color: var(--text); }
.references .back { text-decoration: none; margin-right: .25rem; }
[id^="cite-"] { scroll-margin-top: 6rem; }
