:root {
  --bg: #0e1014;
  --bg2: #151821;
  --bg3: #1d212d;
  --ink: #eef0f6;
  --ink2: #a7adbf;
  --line: #2a2f3f;
  --acc: #ff4d5e;
  --acc2: #ffb020;
  --ok: #3ddc97;
  --no: #ff4d5e;
  --pp: #1f8fff;
  --psoe: #ff2e3e;
  --vox: #63be21;
  --sumar: #e1529e;
  --junts: #00c3b2;
  --erc: #ffc232;
  --pnv: #1a9e54;
  --bildu: #b5cf00;
  --bng: #7db4e8;
  --cc: #ffd700;
  --podemos: #6b2f8f;
  --mixto: #8a90a3;
  --r: 14px;
  font-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: var(--acc2); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 22px; }

/* ─── cabecera ─── */
.top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14,16,20,.82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: .5px; color: var(--ink); text-decoration: none; }
.brand b { color: var(--acc); }
.top nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a {
  color: var(--ink2); text-decoration: none; font-size: .9rem;
  padding: 6px 11px; border-radius: 999px; transition: .2s;
  white-space: nowrap;
}
.top nav a:hover, .top nav a.on { color: var(--ink); background: var(--bg3); }
#progress { position: absolute; left: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, var(--acc), var(--acc2)); width: 0; transition: width .1s linear; }

/* ─── héroe ─── */
.hero { position: relative; padding: 92px 0 70px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -40%;
  background:
    radial-gradient(600px 400px at 20% 30%, rgba(255,77,94,.16), transparent 60%),
    radial-gradient(700px 500px at 80% 20%, rgba(255,176,32,.10), transparent 60%),
    radial-gradient(500px 500px at 60% 90%, rgba(31,143,255,.10), transparent 60%);
  animation: drift 18s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes drift { to { transform: translate(4%, -3%) scale(1.06); } }
.kicker {
  display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--acc2); border: 1px solid var(--acc2);
  padding: 4px 12px; border-radius: 999px; margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(2rem, 5.4vw, 3.7rem); line-height: 1.08; font-weight: 800;
  letter-spacing: -.02em; max-width: 21ch; position: relative;
}
.hero h1 .hl { color: var(--acc); }
.hero .sub { margin-top: 18px; color: var(--ink2); font-size: 1.12rem; max-width: 62ch; position: relative; }
.meta { margin-top: 16px; color: var(--ink2); font-size: .85rem; display: flex; gap: 14px; flex-wrap: wrap; }

/* ─── contadores ─── */
.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 46px 0 8px; }
.counter {
  background: linear-gradient(160deg, var(--bg2), var(--bg3));
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px 18px; position: relative; overflow: hidden;
  transition: transform .25s, border-color .25s;
}
.counter:hover { transform: translateY(-4px); border-color: var(--acc); }
.counter .num { font-size: 2.1rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--acc2); }
.counter.red .num { color: var(--acc); }
.counter .lbl { color: var(--ink2); font-size: .88rem; margin-top: 4px; }

/* ─── secciones ─── */
section.blk { padding: 74px 0 30px; }
section.blk h2 {
  font-size: clamp(1.5rem, 3.2vw, 2.2rem); font-weight: 800; letter-spacing: -.01em;
  margin-bottom: 10px; max-width: 30ch;
}
section.blk h2 .n { color: var(--acc); font-variant-numeric: tabular-nums; margin-right: 10px; }
section.blk .lead { color: var(--ink2); max-width: 70ch; margin-bottom: 30px; }
.prose { max-width: 72ch; color: var(--ink2); }
.prose p { margin-bottom: 14px; }
.prose strong { color: var(--ink); }
.prose blockquote {
  border-left: 3px solid var(--acc); padding: 6px 0 6px 18px; margin: 20px 0;
  color: var(--ink); font-style: italic;
}

/* ─── tarjetas de gráfico ─── */
.chart {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 22px; margin: 26px 0;
}
.chart h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
.chart .hint { color: var(--ink2); font-size: .82rem; margin-bottom: 16px; }
.chart svg { display: block; width: 100%; height: auto; }

/* ─── controles ─── */
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 18px 0; }
.seg { display: inline-flex; background: var(--bg3); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button {
  border: 0; background: none; color: var(--ink2); font: inherit; font-size: .85rem;
  padding: 7px 15px; border-radius: 999px; cursor: pointer; transition: .18s;
}
.seg button.on { background: var(--acc); color: #fff; font-weight: 700; }
.seg.alt button.on { background: var(--acc2); color: #161616; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 1px solid var(--line); background: var(--bg3); color: var(--ink2);
  font-size: .8rem; padding: 5px 12px; border-radius: 999px; cursor: pointer; transition: .18s;
}
.chip:hover { border-color: var(--ink2); }
.chip.on { background: var(--ink); color: #111; border-color: var(--ink); font-weight: 700; }
.search {
  flex: 1 1 220px; display: flex; align-items: center; gap: 8px;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 999px; padding: 0 16px;
}
.search input {
  flex: 1; background: none; border: 0; outline: 0; color: var(--ink);
  font: inherit; font-size: .92rem; height: 40px;
}
select.ctl {
  background: var(--bg3); color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 14px; font: inherit; font-size: .85rem; cursor: pointer;
}
input[type=range].ctl { accent-color: var(--acc); }

/* ─── tooltip ─── */
#tip {
  position: fixed; z-index: 90; pointer-events: none; opacity: 0;
  background: #0a0c10f2; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 13px; font-size: .82rem; max-width: 290px; line-height: 1.45;
  transition: opacity .12s; box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
#tip b { color: var(--acc2); }
#tip .t { color: var(--ink2); font-size: .76rem; }

/* ─── leyendas ─── */
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: .8rem; color: var(--ink2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

/* ─── lista diputados (vista tabla) ─── */
.dip-list { display: grid; gap: 8px; margin-top: 16px; }
.dip-row {
  display: grid; grid-template-columns: 30px 1fr auto auto; gap: 12px; align-items: center;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; cursor: pointer; transition: .18s;
}
.dip-row:hover { border-color: var(--acc2); transform: translateX(4px); }
.dip-row .bars { height: 8px; border-radius: 4px; background: var(--line); position: relative; overflow: hidden; grid-column: 1 / -1; }
.dip-row .bars i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--acc2); }
.dip-row .nm { font-weight: 600; font-size: .92rem; }
.dip-row .cr { color: var(--ink2); font-size: .78rem; }
.dip-row .vw { font-weight: 800; color: var(--acc2); font-variant-numeric: tabular-nums; }
.dip-row .vt { font-size: .72rem; padding: 3px 9px; border-radius: 999px; font-weight: 700; }
.vt.si { background: rgba(61,220,151,.16); color: var(--ok); }
.vt.no { background: rgba(255,77,94,.16); color: var(--no); }

/* ─── modal ficha ─── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(8,9,12,.7); backdrop-filter: blur(6px);
  z-index: 80; display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 18px;
  max-width: 560px; width: 100%; max-height: 86vh; overflow: auto; padding: 28px;
  animation: pop .25s ease;
}
@keyframes pop { from { transform: scale(.94) translateY(10px); opacity: 0; } }
.modal .x { float: right; background: var(--bg3); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 1rem; }
.modal h3 { font-size: 1.3rem; margin-bottom: 2px; padding-right: 40px; }
.modal .sub2 { color: var(--ink2); font-size: .88rem; margin-bottom: 18px; }
.fact { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.fact b { color: var(--acc2); }
.modal .det { margin-top: 14px; font-size: .82rem; color: var(--ink2); background: var(--bg3); border-radius: 10px; padding: 12px; white-space: pre-line; }
.modal .note { margin-top: 10px; font-size: .78rem; color: var(--acc2); }
.modal a.pdf { display: inline-block; margin-top: 16px; font-size: .85rem; }

/* ─── hemiciclo ─── */
.hemi-votes { display: flex; gap: 26px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.hv { text-align: center; }
.hv .n { font-size: 2.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.hv.si .n { color: var(--ok); }
.hv.no .n { color: var(--no); }
.hv .l { color: var(--ink2); font-size: .85rem; }

/* ─── timeline fondos ─── */
.tl { position: relative; margin: 26px 0; padding-left: 26px; }
.tl::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--acc), var(--acc2)); }
.tl-item { position: relative; padding: 0 0 26px 18px; opacity: .35; transform: translateX(12px); transition: .5s; }
.tl-item.vis { opacity: 1; transform: none; }
.tl-item::before {
  content: ""; position: absolute; left: -24px; top: 7px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--bg); border: 3px solid var(--acc2);
}
.tl-item .y { font-weight: 800; color: var(--acc2); font-size: 1.05rem; }
.tl-item h4 { margin: 2px 0 6px; font-size: 1rem; }
.tl-item p { color: var(--ink2); font-size: .9rem; max-width: 68ch; }

/* ─── art 47 ─── */
.art47 {
  background: linear-gradient(150deg, rgba(255,77,94,.12), rgba(255,176,32,.07));
  border: 1px solid rgba(255,77,94,.35); border-radius: var(--r);
  padding: 34px; margin: 30px 0; font-size: 1.1rem;
}
.art47 p { max-width: 70ch; }
.art47 .art { font-style: italic; color: var(--ink); }

/* ─── fuentes ─── */
.sources { font-size: .82rem; color: var(--ink2); }
.sources li { margin-bottom: 7px; }
.disclaimer {
  background: rgba(255,176,32,.07); border: 1px solid rgba(255,176,32,.3);
  border-radius: var(--r); padding: 18px 20px; font-size: .85rem; color: var(--ink2);
  margin: 24px 0;
}
.disclaimer b { color: var(--acc2); }

/* ─── portada ─── */
.cover-hero { padding: 100px 0 60px; position: relative; overflow: hidden; }
.cover-hero h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.04; }
.cover-hero h1 b { color: var(--acc); }
.cover-hero .sub { color: var(--ink2); font-size: 1.15rem; margin-top: 16px; max-width: 56ch; }
.grid-news { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 20px; margin: 36px 0 60px; }
.card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 18px;
  overflow: hidden; text-decoration: none; color: var(--ink);
  transition: transform .25s, border-color .25s, box-shadow .25s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-6px); border-color: var(--acc); box-shadow: 0 18px 44px rgba(255,77,94,.12); }
.card .viz { height: 170px; position: relative; background: var(--bg3); overflow: hidden; }
.card .viz svg { width: 100%; height: 100%; }
.card .body { padding: 20px 22px 24px; flex: 1; display: flex; flex-direction: column; }
.card .tag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--acc2); margin-bottom: 8px; }
.card h3 { font-size: 1.25rem; font-weight: 800; line-height: 1.25; margin-bottom: 8px; }
.card p { color: var(--ink2); font-size: .92rem; flex: 1; }
.card .go { margin-top: 16px; font-size: .85rem; font-weight: 700; color: var(--acc); }
.card.soon { opacity: .55; pointer-events: none; }
.card.soon .viz { display: flex; align-items: center; justify-content: center; color: var(--ink2); font-size: 2rem; }

footer { border-top: 1px solid var(--line); padding: 34px 0 50px; color: var(--ink2); font-size: .82rem; margin-top: 60px; }

.reveal { opacity: 0; transform: translateY(26px); transition: opacity .6s, transform .6s; }
.reveal.vis { opacity: 1; transform: none; }

@media (max-width: 720px) {
  .top nav { display: none; }
  .chart { padding: 14px; }
  .counters { grid-template-columns: repeat(2, 1fr); }
}
