@font-face {
  font-family: "Archivo";
  src: url(fuentes/archivo.woff2) format("woff2-variations");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --fondo: #EEF1F5;
  --papel: #F8F9FB;
  --tinta: #17202E;
  --gris: #5B6576;
  --linea: #D3D9E2;
  --der: #1C4FD6;
  --proy: #F0A202;
  --proy-linea: #C97F00;
  --izq: #D8344F;
  --junts: #139C8E;
  --otros: #B8C0CC;
  --h23j: #9AA3B2;
  --cab: #17202E;
  --cab-texto: #F8F9FB;
  --zona: .06;
  --ancho: 1080px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0E141E;
    --papel: #0E141E;
    --tinta: #E6EAF0;
    --gris: #97A2B3;
    --linea: #263142;
    --der: #5D88FF;
    --proy: #F5B12A;
    --proy-linea: #F5B12A;
    --izq: #FF5A73;
    --junts: #22BFAE;
    --otros: #6C7889;
    --h23j: #6F7B8E;
    --cab: #060A10;
    --zona: .12;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--fondo);
  color: var(--tinta);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

/* Cabecera ------------------------------------------------------------ */
.cabecera {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem max(1rem, calc((100vw - var(--ancho)) / 2)) .8rem;
  background: var(--cab);
  color: var(--cab-texto);
}

.marca {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  font-stretch: 75%;
  letter-spacing: -.01em;
}

.escrutado { margin: 0; font-size: .95rem; color: #B9C2D0; }
.escrutado span { color: var(--cab-texto); font-weight: 700; font-size: 1.15rem; }

.progreso {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: #2A3547;
}
.progreso div {
  height: 100%;
  width: 0;
  background: var(--proy);
  transition: width .8s ease;
}

main, .pie {
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 0 1rem;
}

/* Hero ---------------------------------------------------------------- */
.hero {
  display: grid;
  gap: 1rem 2.5rem;
  padding: 1.5rem 0 2rem;
  align-items: end;
}

.cifra { display: flex; flex-direction: column; }

.numero {
  font-size: clamp(8rem, 42vw, 17rem);
  font-weight: 900;
  font-stretch: 62%;
  line-height: .78;
  letter-spacing: -.03em;
  color: var(--der);
  margin-left: -.04em;
}

.unidad {
  margin-top: .9rem;
  font-size: clamp(1.35rem, 5vw, 1.9rem);
  font-weight: 800;
  font-stretch: 75%;
  line-height: 1.1;
  max-width: 18ch;
}
.unidad .nombre-der { white-space: nowrap; }

.sentencia {
  margin: 0 0 1.25rem;
  font-size: clamp(2.2rem, 9vw, 3.6rem);
  font-weight: 800;
  font-stretch: 70%;
  line-height: .95;
}
.sentencia.suma { color: var(--der); }
.sentencia.no-suma { color: var(--izq); }
.sentencia:has(+ .aviso:not([hidden])) { margin-bottom: .4rem; }
.aviso { margin: 0 0 1.1rem; font-size: 1rem; font-weight: 600; }

.aviso-previa { display: none; margin: 0; max-width: 40ch; color: var(--gris); }
.previa .aviso-previa { display: block; }
.previa .datos, .previa .aviso { display: none; }
.previa.antes .unidad-der { display: none; }
.previa:not(.antes) .cifra { display: none; }
.previa .numero { font-size: clamp(5rem, 24vw, 13rem); letter-spacing: -.02em; }
.previa .sentencia { color: var(--tinta); }

.datos {
  display: grid;
  grid-template-columns: repeat(2, auto);
  justify-content: start;
  gap: .75rem 2.5rem;
  margin: 0;
}
.datos div { display: flex; flex-direction: column-reverse; }
.datos dt { font-size: .85rem; color: var(--gris); }
.datos dd {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  font-stretch: 75%;
  line-height: 1.1;
}

/* Bloques ------------------------------------------------------------- */
.bloque {
  padding: 1.5rem 0 1.75rem;
  border-top: 2px solid var(--tinta);
}

.titular {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  margin-bottom: .75rem;
}

h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  font-stretch: 75%;
  line-height: 1.1;
}

.leyenda {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .85rem;
  color: var(--gris);
}
.leyenda li { display: flex; align-items: center; gap: .4rem; }
.leyenda i { display: inline-block; width: 18px; height: 0; border-top: 3px solid; }
.l-obs { border-color: var(--der) !important; }
.l-proy { border-color: var(--proy-linea) !important; border-top-style: dashed !important; }
.l-banda { height: 10px !important; border: 0 !important; background: var(--proy); opacity: .3; }
.l-esp { border-color: var(--der) !important; border-top-style: dotted !important; opacity: .55; }
.l-23j { border-color: var(--h23j) !important; border-top-width: 2px !important; }

.curva { position: relative; touch-action: pan-y; }
.curva svg { display: block; width: 100%; height: auto; overflow: visible; }

.eje text { fill: var(--gris); font-size: 12px; }
.eje line { stroke: var(--linea); }
.mayoria-linea { stroke: var(--tinta); stroke-width: 1.5; }
.mayoria-texto { fill: var(--tinta); font-size: 12px; font-weight: 700; }
.zona-mayoria { fill: var(--der); opacity: var(--zona); }
.banda { fill: var(--proy); opacity: .22; }
.s-23j { fill: none; stroke: var(--h23j); stroke-width: 2; }
.s-esp { fill: none; stroke: var(--der); stroke-width: 2; stroke-dasharray: 1 5; stroke-linecap: round; opacity: .6; }
.s-obs { fill: none; stroke: var(--der); stroke-width: 3; stroke-linejoin: round; }
.s-proy { fill: none; stroke: var(--proy-linea); stroke-width: 2.5; stroke-dasharray: 7 5; }
.p-obs { fill: var(--der); stroke: var(--fondo); stroke-width: 2; }
.p-fin { fill: var(--proy); stroke: var(--tinta); stroke-width: 2; }
.t-fin { fill: var(--tinta); font-size: 22px; font-weight: 800; font-stretch: 70%; }
.t-serie { font-size: 12px; fill: var(--gris); }
.cruz { stroke: var(--tinta); stroke-width: 1; opacity: .35; }

.vacio { fill: var(--gris); font-size: 15px; }

.globo {
  position: absolute;
  top: 0;
  pointer-events: none;
  padding: .45rem .6rem;
  background: var(--tinta);
  color: var(--fondo);
  font-size: .85rem;
  line-height: 1.35;
  border-radius: 4px;
  white-space: nowrap;
  transform: translateX(-50%);
}
.globo b { font-weight: 700; }
.globo[hidden] { display: none; }


/* Participación ------------------------------------------------------ */
.participacion {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem 2rem;
  margin: .9rem 0 0;
  padding: 0;
  list-style: none;
}
.participacion li { display: flex; flex-direction: column; }
.p-valor { font-size: 2.4rem; font-weight: 800; font-stretch: 70%; line-height: 1; }
.p-cuando { font-size: .9rem; color: var(--gris); }
.p-delta { margin-top: .3rem; font-size: .9rem; font-weight: 600; }
.participacion .pendiente .p-cuando { font-size: 1rem; padding: .35rem 0; border-top: 2px dotted var(--linea); }

/* Hemiciclo ----------------------------------------------------------- */
.botones { display: flex; gap: .5rem; }
.franja { display: block; width: 100%; height: 34px; }
.franja rect { shape-rendering: crispEdges; }
.marca-franja { position: relative; height: 1.2rem; margin-top: 2px; }
.marca-franja span {
  position: absolute; left: calc(174 / 350 * 100%); transform: translateX(-50%);
  font-size: .8rem; font-weight: 700;
}
.marca-franja span::before {
  content: ""; position: absolute; left: 50%; bottom: 100%; height: 42px; border-left: 2px solid var(--tinta);
}
.hemiciclo[hidden], .franja[hidden], .marca-franja[hidden] { display: none; }
.hemiciclo { display: block; width: 100%; max-width: 720px; margin: 0 auto; }
.hemiciclo circle { transition: fill .12s linear; }
.hemiciclo .marca176 { stroke: var(--tinta); stroke-width: 1.5; }
.hemiciclo .texto176 { fill: var(--tinta); font-size: 11px; font-weight: 700; }

.bloques {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem 1.5rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}
.bloques li { border-left: 4px solid var(--c); padding-left: .6rem; }
.bloques .nombre { display: block; font-size: .85rem; color: var(--gris); }
.bloques .n { font-size: 2rem; font-weight: 800; font-stretch: 70%; line-height: 1.05; }
.bloques .antes { font-size: .85rem; color: var(--gris); margin-left: .35rem; }

.boton {
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  padding: .35rem .9rem;
  color: var(--tinta);
  background: transparent;
  border: 2px solid var(--tinta);
  border-radius: 999px;
  cursor: pointer;
}
.boton:hover { background: var(--tinta); color: var(--fondo); }
.boton:focus-visible { outline: 3px solid var(--proy); outline-offset: 2px; }

/* Método ------------------------------------------------------------- */
.entrada {
  margin: .6rem 0 1.25rem;
  max-width: 30ch;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 700;
  font-stretch: 80%;
  line-height: 1.15;
}
.metodo-cuerpo { display: grid; gap: 1.5rem 3rem; }
.metodo .texto p { max-width: 62ch; margin: 0 0 .8rem; }
.fuentes { font-size: .85rem; color: var(--gris); }
.fuentes a { color: inherit; }
.historico { margin: 0; }
.historico figcaption { font-size: .85rem; color: var(--gris); margin-bottom: .6rem; }
.historico ul { margin: 0; padding: 0; list-style: none; }
.historico li {
  display: grid;
  grid-template-columns: 4.5rem 1fr 2.6rem;
  grid-template-areas: "n b v" ". d d";
  align-items: center;
  gap: 0 .6rem;
  padding: .45rem 0;
  border-bottom: 1px solid var(--linea);
}
.h-nombre { grid-area: n; font-weight: 600; font-size: .9rem; }
.h-barra { grid-area: b; height: 10px; }
.h-barra i { display: block; height: 100%; background: var(--der); border-radius: 0 4px 4px 0; }
.h-n { grid-area: v; text-align: right; font-weight: 800; font-stretch: 75%; font-size: 1.25rem; }
.h-detalle { grid-area: d; font-size: .8rem; color: var(--gris); }

/* Tabla y pie --------------------------------------------------------- */

.pie { padding-top: 1rem; padding-bottom: 2.5rem; font-size: .85rem; color: var(--gris); }
.pie p { max-width: 70ch; margin: 0 0 .5rem; }
.firma { margin-top: 1.25rem !important; font-weight: 600; color: var(--tinta); }
.firma a { color: inherit; }

@media (min-width: 760px) {
  .marca { font-size: 1.6rem; }
  .hero { grid-template-columns: auto 1fr; padding: 2.5rem 0 3rem; }
  .numero { font-size: clamp(12rem, 24vw, 19rem); }
  .bloques { grid-template-columns: repeat(4, 1fr); }
  .datos { grid-template-columns: repeat(4, auto); }
  .participacion { grid-template-columns: repeat(3, 1fr); }
  .metodo-cuerpo { grid-template-columns: 1.4fr 1fr; align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
  .progreso div, .hemiciclo circle { transition: none; }
}
