/* Archivo, de Omnibus-Type, bajo SIL Open Font License 1.1 (assets/fuentes/OFL.txt).
   Se sirve desde este mismo dominio: la web no hace ni una petición a terceros. */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url('fuentes/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: 62% 125%;
  font-display: swap;
  src: url('fuentes/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-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ═══════════════════════════════════════════════════════════════════════
   PARLA, A LA COLA
   Paleta: near-black neutro (chroma 0) + tres colores con papel semántico.
   rojo = lo que le falta a Parla · azul = Parla, y la ciudad que se elige en
   el titular · verde = donde Parla tiene más
   Validada para daltonismo y contraste antes de escribirse.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  /* Tema claro por defecto: la web se lee de día y se comparte en capturas.
     Los mismos papeles semánticos en oscuro más abajo. */
  --bg:        #ffffff;
  --surface:   #f7f7f7;
  --surface-2: #ededed;
  --line:      #dfdfdf;
  --line-alta: #bebebe;

  --ink:    #161616;
  --ink-2:  #525252;
  --ink-3:  #717171;

  --loss:      #c02719;
  --loss-deep: #ac0700;
  --loss-veil: rgba(192, 39, 25, .09);
  --ref:       #1a67c2;
  --ref-deep:  #0f4a91;
  --gain:      #1d7635;
  --gain-ink:  #17652c;

  --sombra: 0 1px 2px rgba(22, 22, 22, .05), 0 8px 24px -12px rgba(22, 22, 22, .12);
  --velo: rgba(255, 255, 255, .92);
  --aura-ref: rgba(26, 103, 194, .07);
  --aura-loss: rgba(192, 39, 25, .07);

  --fuente: 'Archivo', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --env:     42rem;
  --gutter:  clamp(1.25rem, 5vw, 2.25rem);
  --banda:   clamp(3.5rem, 11vw, 7rem);

  --z-sticky: 10;
  --z-saltar: 50;

  --sal: cubic-bezier(.16, 1, .3, 1);
  --sal-corta: cubic-bezier(.22, 1, .36, 1);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0f0f0f;
    --surface:   #171717;
    --surface-2: #212121;
    --line:      #2e2e2e;
    --line-alta: #454545;

    --ink:    #f2f2f2;
    --ink-2:  #b4b4b4;
    --ink-3:  #8d8d8d;

    --loss:      #f4604d;
    --loss-deep: #8d2418;
    --loss-veil: rgba(244, 96, 77, .13);
    --ref:       #5ea0f5;
    --ref-deep:  #12447f;
    --gain:      #3faa63;
    --gain-ink:  #6fcd8c;

    --sombra: none;
    --velo: rgba(15, 15, 15, .90);
    --aura-ref: rgba(94, 160, 245, .10);
    --aura-loss: rgba(244, 96, 77, .10);
  }
}

/* ── Base ─────────────────────────────────────────────────────────────── */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--fuente);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.62;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 { color: var(--ink); text-wrap: balance; margin: 0; }
p { margin: 0; text-wrap: pretty; }
b, strong { color: var(--ink); font-weight: 700; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }

a { color: var(--ink); text-decoration-color: var(--line-alta); text-underline-offset: .22em; }
a:hover { text-decoration-color: var(--ref); }

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

.env {
  width: 100%;
  max-width: var(--env);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.saltar {
  position: fixed; top: .6rem; left: .6rem; z-index: var(--z-saltar);
  padding: .55rem .9rem; border-radius: 4px;
  background: var(--ink); color: var(--bg);
  font-size: .8rem; font-weight: 700; text-decoration: none;
  transform: translateY(-160%);
  transition: transform .2s var(--sal-corta);
}
.saltar:focus-visible { transform: none; }

.oculto {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

.sin-js {
  margin: 0; padding: 1rem var(--gutter);
  background: var(--loss-deep); color: var(--ink);
  font-size: .9375rem;
}
.sin-js code { background: rgba(0, 0, 0, .18); }

/* Escalas tipográficas —————————————————————————————————————————————— */

.display {
  font-weight: 800;
  font-stretch: 80%;
  letter-spacing: -.035em;
  line-height: .9;
  text-transform: uppercase;
}

/* ── La marca: la cola de la ballena y el nombre ─────────────────────────
   La cola de la escultura del Parque de la Ballena, en dos tonos, como al
   sol: la cara iluminada más clara que la que queda en sombra. En oscuro se
   invierten para que la luz siga siendo lo más claro. */

:root {
  --ballena-sombra: var(--ink);
  --ballena-luz: color-mix(in srgb, var(--ink) 50%, var(--bg));
}
@media (prefers-color-scheme: dark) {
  :root {
    --ballena-sombra: color-mix(in srgb, var(--ink) 50%, var(--bg));
    --ballena-luz: var(--ink);
  }
}
.ballena__sombra { fill: var(--ballena-sombra); }
.ballena__luz { fill: var(--ballena-luz); }

.marca {
  display: inline-flex; align-items: center; gap: .65rem;
  margin-bottom: clamp(1.4rem, 5vw, 2.2rem);
  font-size: .8125rem; font-weight: 800; font-stretch: 85%;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
}
.marca:hover span { text-decoration: underline; text-underline-offset: .25em; }
.marca__ballena { display: block; width: 2.6rem; height: auto; flex: none; }

/* ── Portada ──────────────────────────────────────────────────────────── */

.portada {
  position: relative;
  padding-block: clamp(1.75rem, 6vh, 3.5rem) clamp(2rem, 6vh, 3.5rem);
  min-height: 100svh;
  display: flex; align-items: center;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(120% 70% at 50% 0%, var(--aura-ref), transparent 62%),
    var(--bg);
}

/* La cola de la ballena, entera y muy clara, saliendo del borde inferior de
   la portada, que hace de suelo. No compite con el texto. */
/* Solo en horizontal: la lista de ciudades tiene que poder salir por abajo. */
.portada { overflow-x: clip; overflow-y: visible; }
.portada:has(.t3--abierto) { z-index: 20; }
.portada > .env { position: relative; z-index: 1; }
.portada__ballena {
  position: absolute; right: 3%; bottom: -1px;
  width: min(92%, 46rem); height: auto;
  pointer-events: none;
  --ballena-sombra: color-mix(in srgb, var(--ink) 8%, var(--bg));
  --ballena-luz: color-mix(in srgb, var(--ink) 4%, var(--bg));
}
@media (prefers-color-scheme: dark) {
  .portada__ballena {
    --ballena-sombra: color-mix(in srgb, var(--ink) 5%, var(--bg));
    --ballena-luz: color-mix(in srgb, var(--ink) 10%, var(--bg));
  }
}

/* El selector es una palabra más de la frase: mismo tipo, mismo peso y
   una marca clara de que se puede tocar. */
.selector {
  position: relative;
  display: inline-block;
  color: var(--ref);
  padding-right: .66em;
  cursor: pointer;
}
.selector__eco {
  border-bottom: .085em solid currentColor;
  padding-bottom: .04em;
  transition: background .18s var(--sal-corta);
}
.selector::after {
  content: '';
  position: absolute; right: .1em; bottom: .3em;
  width: .3em; height: .3em;
  border-right: .08em solid currentColor;
  border-bottom: .08em solid currentColor;
  transform: rotate(45deg);
  transition: transform .2s var(--sal-corta);
}
.selector:hover .selector__eco { background: var(--aura-ref); }
.selector:hover::after { transform: rotate(45deg) translate(.05em, .05em); }
#sel-municipio {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
  font: inherit;
}
.selector:focus-within .selector__eco {
  outline: 3px solid var(--ref);
  outline-offset: 4px;
  border-radius: 2px;
}

.portada__titulo {
  font-weight: 800; font-stretch: 78%;
  letter-spacing: -.035em; line-height: .92;
  text-transform: uppercase;
  display: grid;
  gap: .06em;
}
/* Parla, el sujeto, arriba y en tinta. */
.portada__titulo .t1 {
  font-size: clamp(1.95rem, 10.2vw, 3.5rem);
  line-height: 1.08;
  color: var(--ink);
}
.portada__titulo .t2 {
  font-size: clamp(1.3rem, 6.4vw, 2.25rem);
  font-weight: 500; font-stretch: 92%; letter-spacing: -.012em;
  color: var(--ink-3);
}
/* La ciudad con la que se compara es la palabra grande y la que se toca:
   en azul, con su subrayado. No tan grande como para que «Pozuelo de
   Alarcón» no quepa en un móvil; el aire de abajo es para el subrayado. */
.portada__titulo .t3 {
  font-size: clamp(2.6rem, 15vw, 4.75rem);
  line-height: 1.02;
  padding-bottom: .1em;
  color: var(--ref);
}
.portada__titulo .t3[data-largo='1'] { font-size: clamp(2.3rem, 11.5vw, 4.75rem); }
/* En línea y no en bloque: si el nombre ocupa dos líneas («Torrejón de
   Ardoz»), la flecha va detrás de la última palabra y no colgando a la
   derecha de la primera. */
/* El desplegable invisible cubre toda la línea del nombre, y no solo el texto:
   un elemento en línea partido en dos renglones no tiene un rectángulo claro,
   y la flecha, girada, quedaba fuera en algunos navegadores. */
.portada__titulo .t3 { position: relative; }
.portada__titulo .t3 .selector { display: inline; padding-right: 0; position: static; }
.portada__titulo .t3 #sel-municipio { inset: 0; width: 100%; height: 100%; }
/* El cierre de la pregunta, pegado al nombre y fuera del subrayado. */
.selector__q { color: var(--ink); }
.portada__titulo .t3 .selector::after {
  position: static; display: inline-block;
  margin-left: .22em; vertical-align: .32em;
}
.portada__titulo .t3 .selector:hover::after { transform: rotate(45deg) translate(.05em, .05em); }

.portada__golpe {
  margin-top: clamp(1rem, 3.5vw, 1.4rem);
  max-width: 30rem;
  font-size: clamp(.9375rem, 3.6vw, 1.0625rem);
  line-height: 1.45;
  color: var(--ink-2);
}
.portada__golpe b {
  color: var(--loss);
  font-weight: 800;
}

/* marcador de la portada: remata la frase del titular */
.marcador {
  margin-top: clamp(1.3rem, 4.5vw, 2rem);
  padding-top: clamp(1rem, 3.5vw, 1.5rem);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: 'p p' 'n u' 'r r' 'l l' 'k k';
  column-gap: clamp(.8rem, 3vw, 1.2rem);
  align-items: center;
}
.marcador__pre {
  grid-area: p;
  margin-bottom: .25rem;
  font-size: clamp(1.3rem, 6.4vw, 2.25rem);
  font-weight: 500; font-stretch: 92%;
  letter-spacing: -.012em; line-height: 1;
  text-transform: uppercase;
  color: var(--ink-3);
}
.marcador__n {
  grid-area: n;
  font-weight: 800; font-stretch: 76%;
  font-size: clamp(3.2rem, 19vw, 5rem);
  line-height: .78; letter-spacing: -.045em;
  color: var(--loss);
}
.marcador__u {
  grid-area: u;
  font-size: clamp(.9375rem, 3.6vw, 1.125rem);
  font-weight: 600; line-height: 1.22;
  color: var(--ink);
  text-wrap: balance;
}
.marcador__u span { display: block; color: var(--ink-3); font-weight: 400; }
/* Donde Parla tiene más, justo debajo: en verde y más discreto que la cifra. */
.marcador__gana {
  display: block; margin-top: .35rem;
  color: var(--gain-ink); font-weight: 600;
  text-decoration: none;
}
.marcador__gana:empty { display: none; }
.marcador__gana:hover { text-decoration: underline; }
.marcador__rejilla { grid-area: r; margin-top: 1rem; }
.marcador__rejilla .tira { margin-top: 0; }
/* La leyenda de la tira: lo que hay y lo que falta. */
.marcador__ley {
  grid-area: l;
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem;
  margin-top: .7rem;
  font-size: .75rem; color: var(--ink-3);
}
.ley { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.ley--hay { background: var(--ink); }
.ley--hueco { margin-left: .5rem; }
/* La tira de un área en los resúmenes de la portada. */
.tira--resumen { margin-top: .6rem; max-width: 34rem; }

.portada__pie {
  margin-top: 1rem;
  font-size: .8125rem; line-height: 1.5;
  color: var(--ink-3);
  max-width: 30rem;
}

.bajar {
  display: inline-flex; align-items: center; gap: .6rem;
  margin-top: clamp(1.5rem, 5vw, 2.25rem);
  color: var(--ink-3);
  font-size: .8125rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none;
}
.bajar:hover { color: var(--ink); }
.bajar svg { animation: flota 2.6s ease-in-out infinite; }
@keyframes flota { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

/* ── Bloques ──────────────────────────────────────────────────────────── */

.bloque { padding-block: var(--banda); }
.bloque + .bloque { border-top: 1px solid var(--line); }

.bloque__h {
  font-weight: 800; font-stretch: 80%;
  font-size: clamp(1.75rem, 8vw, 2.75rem);
  line-height: .96; letter-spacing: -.03em;
  text-transform: uppercase;
}
.bloque__intro {
  max-width: 34rem;
  margin-top: 1.1rem;
  font-size: 1rem;
}

/* ── Notas bajo un gráfico ─────────────────────────────────────────── */

.renta__nota {
  margin-top: 1.5rem;
  max-width: 32rem;
  font-size: .9375rem;
  color: var(--ink-2);
}

/* El suelo que hay que repartir, en el punto de partida. */
.tamano { margin-top: clamp(1.5rem, 5vw, 2rem); }
.tamano__txt {
  max-width: 32rem;
  font-size: .9375rem; line-height: 1.5;
  color: var(--ink-2);
}

/* Las filas del dinero: la media de referencia, Parla y la ciudad elegida, cada una con
   su barra proporcional a la mayor. Los papeles, los del resto de la web: tu
   ciudad en gris, Parla en azul, y la media más clara que las dos. */
.mun { list-style: none; margin: 1.1rem 0 0; padding: 0; }
.mun__fila {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 38%);
  align-items: center;
  column-gap: .9rem;
  padding-block: .4rem;
  border-top: 1px solid var(--line);
}
.mun__fila:last-child { border-bottom: 1px solid var(--line); }
.mun__q { font-size: .875rem; color: var(--ink-3); min-width: 0; }
.mun__v {
  font-size: .9375rem; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.mun__barra { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.mun__barra i { display: block; height: 100%; border-radius: 4px; background: var(--line-alta); }
.mun__fila[data-quien='referencia'] .mun__q { color: var(--ref); font-weight: 700; }
.mun__fila[data-quien='referencia'] .mun__barra i { background: var(--ref); }
.mun__fila[data-quien='aqui'] .mun__q { color: var(--ink); font-weight: 700; }
.mun__fila[data-quien='aqui'] .mun__barra i { background: var(--ink-3); }

/* ── El dinero: flujos anuales, saldo de deuda y contexto vecinal ──────── */

.bloque--dinero { background: var(--surface); }

.dinero {
  display: grid;
  gap: clamp(2.25rem, 8vw, 3.25rem);
  margin-top: clamp(2rem, 7vw, 2.75rem);
}
@media (min-width: 58rem) {
  .dinero { grid-template-columns: 1fr 1fr; column-gap: clamp(2.5rem, 5vw, 4rem); }
  /* Paro, renta, pobreza y PIB: dos por fila, y la barra baja a su propia
     línea bajo el nombre y la cifra. */
  .dinero--contexto { grid-template-columns: repeat(2, 1fr); column-gap: clamp(1.75rem, 3vw, 2.5rem); }
  .dinero--contexto .mun__fila { grid-template-columns: minmax(0, 1fr) auto; row-gap: .35rem; }
  .dinero--contexto .mun__barra { grid-column: 1 / -1; }
}
.bloque--dinero .bloque__h3 + .dinero { margin-top: clamp(1.25rem, 4vw, 1.75rem); }

.plata__h {
  font-weight: 800; font-stretch: 84%;
  font-size: clamp(1.1rem, 4.5vw, 1.3rem);
  line-height: 1.12; letter-spacing: -.02em;
  color: var(--ink);
}
.plata__pie {
  margin-top: .3rem;
  font-size: .8125rem;
  color: var(--ink-3);
}
/* Dentro de la sección las barras van pegadas a su título. */

/* Gasto e inversión en euros al año: la frase que se comparte. */
.plata__titular {
  margin-top: .9rem;
  font-size: clamp(1.125rem, 4.6vw, 1.375rem);
  font-weight: 700; font-stretch: 88%;
  line-height: 1.2; letter-spacing: -.015em;
  color: var(--ink);
  text-wrap: balance;
}
.plata__titular .cifra {
  font-weight: 800; font-stretch: 80%;
  color: var(--loss);
  white-space: nowrap;
}
.plata .compartir { margin-top: 1.25rem; }
/* Los dos botones de una ficha (cartel y vista previa) juntos, con el mismo aire. */
.plata .seccion__botones { margin-top: 1.25rem; }
.plata .seccion__botones .compartir { margin-top: 0; }
.plata .renta__nota { margin-top: 1.1rem; }

/* El saldo queda separado de los flujos anuales, a todo el ancho. */
.plata--saldo {
  grid-column: 1 / -1;
  padding-top: clamp(1.5rem, 5vw, 2rem);
  border-top: 1px solid var(--line-alta);
}
.plata--saldo .plata__titular .cifra { color: var(--ref); white-space: normal; }
.plata--saldo .mun { max-width: 34rem; }
.plata--saldo .renta__nota { max-width: 65ch; }
@media (max-width: 35rem) {
  .plata--saldo .mun__fila { grid-template-columns: minmax(0, 1fr) auto; row-gap: .35rem; }
  .plata--saldo .mun__barra { grid-column: 1 / -1; }
}

.dinero__cierre {
  max-width: 34rem;
  margin-top: clamp(2.25rem, 8vw, 3rem);
  padding-top: clamp(1.25rem, 5vw, 1.75rem);
  border-top: 2px solid var(--ink);
  font-size: 1rem;
  color: var(--ink);
}

/* ── Botón de compartir ───────────────────────────────────────────────── */

.compartir {
  display: inline-flex; align-items: center; gap: .45rem;
  margin-top: 1rem;
  padding: .5rem .85rem;
  border: 1px solid var(--line-alta); border-radius: 999px;
  background: var(--bg); color: var(--ink);
  font: inherit; font-size: .8125rem; font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
}
.compartir:hover { border-color: var(--ink); background: var(--surface); }
.compartir:focus-visible { outline: 2px solid var(--ref); outline-offset: 2px; }
.compartir__ico { display: inline-flex; width: 15px; height: 15px; color: var(--ref); }
.compartir__ico svg { width: 100%; height: 100%; }

/* El cartel del total: el hueco va en rojo, que es su color. */
.compartir--general .compartir__ico { color: var(--loss); }
.portada__cartel { grid-area: k; justify-self: start; margin-top: 1.4rem; }

/* ── Elegir el cartel ─────────────────────────────────────────────────── */

.fondos {
  width: min(92vw, 34rem);
  padding: clamp(1.25rem, 5vw, 1.75rem);
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); color: var(--ink);
  box-shadow: var(--sombra);
}
.fondos::backdrop { background: rgba(22, 22, 22, .45); }
.fondos__h {
  font-weight: 800; font-stretch: 84%; font-size: 1.35rem;
  letter-spacing: -.02em; text-transform: uppercase;
}
.fondos__p { margin-top: .5rem; font-size: .875rem; color: var(--ink-2); }

.cifra { margin-top: 1.1rem; }
.cifra__rot {
  display: block;
  font-size: .6875rem; font-weight: 800;
  letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3);
}
.cifra__seg {
  display: inline-flex; margin-top: .5rem;
  border: 1px solid var(--line-alta); border-radius: 999px;
  overflow: hidden;
}
.cifra__op {
  padding: .45rem .9rem;
  border: 0; background: var(--bg); color: var(--ink-2);
  font: inherit; font-size: .8125rem; cursor: pointer;
}
.cifra__op + .cifra__op { border-left: 1px solid var(--line-alta); }
.cifra__op[data-activo='1'] { background: var(--ink); color: var(--bg); }
.cifra__op:focus-visible { outline: 2px solid var(--ref); outline-offset: 2px; }

.fondos__fila {
  display: grid; grid-template-columns: 1fr 1fr; gap: .9rem;
  margin-top: 1.25rem;
}
.fondo {
  display: block; padding: .4rem;
  border: 2px solid var(--line); border-radius: 10px;
  background: var(--bg); font: inherit; color: inherit;
  cursor: pointer; text-align: left;
}
.fondo:hover { border-color: var(--ink-3); }
.fondo[data-activo='1'] { border-color: var(--ref); }
.fondo:focus-visible { outline: 2px solid var(--ref); outline-offset: 2px; }
.fondo img {
  display: block; width: 100%; aspect-ratio: 210 / 297;
  object-fit: cover; border-radius: 6px;
}
.fondo__n {
  display: block; margin-top: .45rem;
  font-size: .8125rem; font-weight: 700;
}
.fondos__x {
  margin-top: 1.1rem; padding: .5rem .9rem;
  border: 1px solid var(--line-alta); border-radius: 999px;
  background: var(--bg); color: var(--ink-2);
  font: inherit; font-size: .8125rem; cursor: pointer;
}

/* ── El cartel A4 ─────────────────────────────────────────────────────────
   No se ve nunca en pantalla, pero sus estilos viven fuera de @media print:
   antes de imprimir hay que medirlo para ajustar el titular al ancho, y para
   medir hay que poder pintarlo. Colores literales y no tokens del tema: un
   cartel impreso desde el tema oscuro tiene que salir igual.
   La composición sale de un cartel de asociación de vecinos: titular enorme
   con alternancia de negro y rojo, fila de cajas con filete rojo, y banda
   oscura al pie con el cuadro blanco —que aquí es el QR—. */

.cartel { display: none; }

/* estado de medición: pintado pero fuera de la pantalla */
.cartel.midiendo {
  display: block;
  position: fixed; left: -100vw; top: 0;
  pointer-events: none;
}

.cartel--afiche {
  position: relative;
  box-sizing: border-box;
  width: 210mm; height: 297mm;
  background: #f3f1ec; color: #161616;
  font-family: var(--fuente);
  overflow: hidden;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}

.kfondo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.kcapa {
  position: absolute; left: 0; right: 0; top: 0;
  padding: 11mm 11mm 0;
  display: flex; flex-direction: column;
}

.kpre {
  font-size: 10.5pt; font-weight: 800;
  letter-spacing: .17em; text-transform: uppercase; color: #3d3a36;
}

/* El titular ocupa la mayor parte del cartel. El cuerpo lo fija ajustarTitular(). */
.ktit {
  margin-top: 6mm;
  font-weight: 800; font-stretch: 62%;
  /* .92 y no .8: con el interlineado apretado la cola de la Q y las tildes de
     las mayúsculas pisan el renglón de al lado. Medido letra a letra sobre los
     siete municipios, el par que más sitio pide (una tilde bajo una letra) gasta
     0,89 em, así que ahí va el suelo. */
  font-size: 116pt; line-height: .92;
  letter-spacing: -.035em; text-transform: uppercase;
  white-space: nowrap;
}
.ktit span { display: block; }
.ktit__n { font-size: 1.35em; line-height: .86; color: #161616; white-space: normal; }
.ktit__q { color: #c02719; white-space: normal; }
/* El «%» de la cifra: en línea con el número, a menos cuerpo y sobre su línea base (cartel.js, `partir`). */
.ktit .ktit__sig { display: inline; font-size: .6em; white-space: nowrap; }
/* Dos ciudades frente a frente, cada una con su cifra (cartel.js, `dos`). */
.ktit__dos { display: grid; grid-template-columns: 1fr 1fr; column-gap: 7mm; align-items: end; margin: .04em 0 .06em; }
.ktit__col { min-width: 0; }
.ktit__n--rojo { color: #c02719; }
/* Una línea corta bajo el nombre de la ciudad o pegada a su cifra (cartel.js, `nota` y `pie`). */
.ktit__h {
  font-size: .3em; line-height: 1.02; letter-spacing: -.015em; white-space: normal;
  color: #161616;
}
.ktit__h--nota { margin: -.02em 0 .14em; }
.ktit__h--pie { margin: .12em 0 0; }
.ktit__m { color: #161616; }
/* Quién: «A Parla le faltan», en tinta y a menos de la mitad del cuerpo, para
   que la cifra siga siendo lo primero que se ve. */
.ktit__a {
  font-size: .42em; line-height: 1; letter-spacing: -.015em; white-space: normal;
  color: #161616; margin-bottom: .1em;
}
/* Contra qué: una frase corta, en redonda, bajo el titular. */
.ksub {
  margin-top: 5mm; max-width: 175mm;
  font-size: 16pt; font-weight: 600; line-height: 1.22;
  color: #161616;
}
.cartel[data-fondo='barrio'] .ksub { color: #161616; }

/* La marca en la banda: la cola de la ballena, en dos tonos claros sobre el
   oscuro, y el nombre al lado. */
.kbanda__marca { display: flex; align-items: center; gap: 3.5mm; }
.kbanda__marca .marca__ballena { width: 17mm; height: auto; flex: none; }
.kbanda__marca .ballena__sombra { fill: #8f8a83; }
.kbanda__marca .ballena__luz { fill: #ffffff; }

/* fila de cajas con filete rojo */
.kcajas {
  list-style: none; margin: 8mm 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 2.5mm;
  max-width: 175mm;
}
.kcaja {
  padding: 2.4mm 3.2mm;
  border: 1pt solid #c02719;
  background: #f3f1ec;
  font-size: 11pt; font-weight: 800; line-height: 1.12;
  text-transform: uppercase; color: #161616;
}
/* lo que le falta al hospital: la caja en hueco, con su nombre */
.kcaja--hueco {
  border-style: dashed; background: transparent;
  color: #c02719;
}
/* Sobre la foto, la caja en hueco cae a veces en un edificio rojo y el rojo se pierde: lleva el mismo velo claro. */
.cartel[data-fondo='barrio'] .kcaja--hueco { background: rgba(243, 241, 236, .92); }
.kcaja__ico { display: inline-flex; flex: none; width: 4mm; height: 4mm; }
.kcaja__ico svg { display: block; width: 100%; height: 100%; }
.kcaja b {
  display: block; margin-bottom: .8mm;
  font-size: 8pt; letter-spacing: .12em; color: #c02719;
  text-decoration: none;
}
.kcaja--ref b { color: #161616; }

/* El cartel general: cada área con su caja de nombre y cifra, y debajo su fila
   de huecos. El lado del hueco lo pone el propio cartel en --ku,
   para que la fila del área que más tiene quepa entera. */
.kareas { list-style: none; margin: 7mm 0 0; padding: 0; --ku: 6mm; }
.karea + .karea { margin-top: 3mm; }
.karea__cab { display: flex; align-items: baseline; gap: 2.2mm; }
.karea__ico {
  display: inline-flex; flex: none; align-self: center;
  width: 4.6mm; height: 4.6mm; color: #c02719;
}
.karea__ico svg { display: block; width: 100%; height: 100%; }
.karea__q {
  font-size: 11pt; font-weight: 800; line-height: 1.1;
  letter-spacing: .11em; text-transform: uppercase; color: #c02719;
}
.karea__n {
  font-size: 15pt; font-weight: 800; line-height: 1;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: #161616;
}

/* Sobre la foto las filas caen en los edificios y el rojo se pierde: se apoyan
   en un velo claro. En papel el velo es el propio papel, así que no se ve. */
.cartel[data-fondo='barrio'] .kareas {
  padding: 4mm 4mm 4.5mm;
  background: rgba(243, 241, 236, .9);
}
/* Con la caja de la fuente debajo, las filas se juntan un poco para que el bloque no llegue a la banda. */
.cartel[data-fondo='barrio'] .karea + .karea { margin-top: 2mm; }

/* la tira de unidades: un hueco por equipamiento que falta */
.krejilla {
  display: flex; flex-wrap: wrap; gap: 1.4mm;
  margin-top: 1.6mm; max-width: 178mm;
}
.ku {
  flex: none; display: block; width: var(--ku); height: var(--ku);
}
.ku svg { display: block; width: 100%; height: 100%; }

/* banda oscura al pie */
.kbanda {
  position: absolute; left: 0; right: 0; bottom: 0; height: 58mm;
  display: flex; align-items: center; gap: 7mm;
  padding: 0 11mm;
  background: #191714; color: #ffffff;
}
.kqr { flex: 0 0 auto; width: 32mm; height: 32mm; padding: 2mm; background: #ffffff; }
.kqr svg { display: block; width: 100%; height: 100%; }
.kbanda__txt { flex: 1 1 auto; min-width: 0; }
.kbanda__h {
  font-size: 21pt; font-weight: 800; font-stretch: 74%;
  line-height: .96; letter-spacing: -.01em; text-transform: uppercase;
}
.kbanda__raya { display: block; width: 16mm; height: 1.2mm; margin: 3mm 0 2.5mm; background: #ffffff; }
.kbanda__url { font-size: 9pt; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }

@media print {
  @page { size: A4 portrait; margin: 0; }
  html[data-cartel] body > *:not(#cartel) { display: none !important; }
  html[data-cartel] #cartel { display: block !important; }
}

/* ── Cómo se hace la cuenta ───────────────────────────────────────────── */

.lee {
  display: block;
  margin-top: clamp(1.5rem, 5vw, 2rem);
  padding: clamp(1rem, 4vw, 1.35rem);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.lee__rot {
  font-size: .6875rem; font-weight: 800;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--ref);
}

.lee__tabla {
  margin-top: .9rem;
  font-variant-numeric: tabular-nums;
}
.lee__fila {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  column-gap: clamp(.7rem, 3vw, 1.25rem);
  align-items: baseline;
  padding-block: .4rem;
  border-top: 1px solid var(--line);
}
.lee__fila--cab {
  border-top: 0;
  padding-bottom: .25rem;
}
.lee__fila--cab .lee__v {
  font-size: .6875rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3);
}
.lee__fila--cab .lee__v:last-child { color: var(--ref); }

.lee__et {
  font-size: .8125rem; line-height: 1.3;
  color: var(--ink-3);
  min-width: 0;
}
.lee__v {
  font-size: .9375rem; font-weight: 700;
  color: var(--ink);
  text-align: right;
  min-width: 3.9rem;
  white-space: nowrap;
}

.lee__fila--clave { border-top-width: 2px; border-top-color: var(--line-alta); }
.lee__fila--clave .lee__et { color: var(--ink-2); font-weight: 600; }
.lee__fila--clave .lee__v { font-size: 1.0625rem; font-stretch: 88%; letter-spacing: -.015em; }

.lee__txt {
  margin-top: 1rem;
  padding-top: .9rem;
  border-top: 1px solid var(--line);
  font-size: .9375rem; line-height: 1.55;
  color: var(--ink-2);
}
.lee__txt b { color: var(--ink); font-weight: 700; }
.lee__dif { color: var(--loss) !important; }

/* ── El recuento ──────────────────────────────────────────────────────── */

.ico { display: block; width: 1.375rem; height: 1.375rem; flex: none; }
.ico svg { display: block; width: 100%; height: 100%; }

.recuento { margin-top: clamp(1.75rem, 6vw, 2.5rem); }

.area + .area { margin-top: 1.75rem; }

.area__cab {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--ink);
}
.area__q {
  font-size: .75rem; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink);
}
.area__n {
  font-size: 1.0625rem; font-weight: 800; font-stretch: 84%;
  letter-spacing: -.02em;
  color: var(--loss);
  font-variant-numeric: tabular-nums;
}
.area--sobra .area__n { color: var(--gain); }
.area__n--aprox { cursor: help; text-decoration: underline dotted; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.area--extra .area__cab { border-bottom-color: var(--line-alta); }
.area--extra .area__q { color: var(--ink-3); }

.area__filas { display: block; }

.rec { border-bottom: 1px solid var(--line); scroll-margin-top: 5rem; }
.rec__h { margin: 0; font: inherit; }

.rec__a {
  display: grid;
  grid-template-columns: 1.375rem 1fr auto 1rem;
  align-items: center;
  column-gap: .75rem;
  min-height: 2.75rem;
  padding: .7rem .25rem;
  color: inherit; text-decoration: none;
  transition: background .16s var(--sal-corta);
}
/* Las filas que no se abren (enlaces al dinero, empates) reservan la misma
   columna del chevron, para que su cifra caiga bajo las demás. */
a.rec__a::after, div.rec__a::after { content: ''; grid-column: 4; width: 1rem; }
button.rec__a {
  width: 100%; margin: 0; border: 0; background: none;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
button.rec__a:focus-visible { outline: 2px solid var(--ref); outline-offset: -2px; }
.rec__a:hover { background: var(--surface); }
a.rec__a:hover .rec__q, button.rec__a:hover .rec__q { color: var(--loss); }
div.rec__a:hover { background: none; }

/* El chevron: un trazo que mira a la derecha y gira hacia abajo al abrir. */
.rec__v {
  justify-self: end;
  width: .5rem; height: .5rem; margin-right: .25rem;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: rotate(-45deg);
  transition: transform .2s var(--sal-corta);
}
.rec[data-abierta="1"] .rec__v { transform: rotate(45deg); }
.rec[data-abierta="1"] > .rec__h .rec__a { background: var(--surface); }
.rec[data-abierta="1"] > .rec__h .rec__q { font-weight: 800; }
.rec__sub { display: block; margin-top: .15rem; font-size: .8125rem; font-weight: 400; color: var(--ink-3); }

.area__nota { margin: .6rem 0 .25rem; font-size: .8125rem; line-height: 1.55; color: var(--ink-3); max-width: 36rem; }

.rec__ico { color: var(--ink-3); }
.rec__q {
  font-size: .9375rem; font-weight: 600; line-height: 1.3;
  color: var(--ink);
  transition: color .16s var(--sal-corta);
}
.rec__n {
  font-size: 1.125rem; font-weight: 800; font-stretch: 80%;
  letter-spacing: -.025em;
  color: var(--loss);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rec--aparte .rec__n { color: var(--ink-3); }
.rec--sobra .rec__n { color: var(--gain); }
.rec--sobra .rec__ico { color: var(--gain); }
.rec--sobra a.rec__a:hover .rec__q, .rec--sobra button.rec__a:hover .rec__q { color: var(--gain); }

/* La columna del recuento: lo que le falta a Parla. */
.rec__columnas {
  display: flex; justify-content: flex-end;
  margin-bottom: .4rem;
  font-size: .6875rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--loss);
}

.recuento__pie {
  margin-top: 1.5rem;
  font-size: .875rem; line-height: 1.6;
  color: var(--ink-3);
  max-width: 32rem;
}
.recuento__pie b { color: var(--loss); }
.recuento__pie b.gana { color: var(--gain-ink); }

/* ── Estructura de edad ───────────────────────────────────────────────── */

.bloque__h3 {
  margin-top: clamp(2.75rem, 9vw, 4rem);
  font-size: clamp(1.25rem, 5.5vw, 1.625rem);
  font-weight: 700; font-stretch: 88%;
  letter-spacing: -.02em; line-height: 1.15;
}

.edades { margin-top: clamp(1.5rem, 5vw, 2rem); }

.edades__ley {
  font-size: .75rem; color: var(--ink-3);
  margin-bottom: .9rem;
  max-width: 24rem;
}

.edades__grafico { display: grid; gap: 1.1rem; }

.edad { display: grid; gap: .4rem; }
.edad__q { font-size: .8125rem; font-weight: 700; color: var(--ink); }

/* ── Indicador ────────────────────────────────────────────────────────── */

.ind {
  padding-block: clamp(2.5rem, 9vw, 3.75rem);
  border-top: 1px solid var(--line);
}
.ind:first-child { border-top: 0; }
/* La ficha desplegada bajo su línea del recuento: a todo el ancho de la fila. */
.rec > .ind { padding-block: .5rem 1.5rem; border-top: 0; scroll-margin-top: 5rem; }
.rec > .ind[hidden] { display: none; }
.ind__acciones { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: 1.25rem; }

.ind__titular {
  margin-top: .85rem;
  font-size: clamp(1.375rem, 6vw, 1.875rem);
  font-weight: 700; font-stretch: 88%;
  line-height: 1.1; letter-spacing: -.022em;
  color: var(--ink);
  text-wrap: balance;
}
.ind__titular .cifra {
  font-size: 1.62em;
  font-weight: 800; font-stretch: 76%;
  letter-spacing: -.045em;
  color: var(--loss);
  padding-inline: .04em;
}
.ind--sobra .ind__titular .cifra { color: var(--gain-ink); }
/* «No tiene ninguna»: la palabra en rojo, sin el cuerpo de una cifra. */
.ind__titular .cifra--palabra { font-size: 1em; font-stretch: 88%; letter-spacing: -.022em; }
.ind__titular .resto { color: var(--ink-3); font-weight: 600; }

/* tira de unidades */
.tira {
  margin-top: 1.4rem;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.u {
  position: relative;
  width: 15px; height: 15px; border-radius: 3px;
  background: var(--ink);
  flex: none;
}
/* El hueco: lo que debería estar y no está. Un borde discontinuo de CSS
   reparte los trazos como le parece y corta las esquinas, así que se dibuja
   con una máscara: la curva de cada esquina entera y un trazo largo centrado
   en cada lado, igual a cualquier tamaño. El color lo pone el fondo, así que
   sigue al tema claro y oscuro. */
:root {
  --hueco: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 15' fill='none' stroke='%23000' stroke-width='1.5'><path d='M.75 4.25V3.75a3 3 0 0 1 3-3H4.25M10.75 .75h0.5a3 3 0 0 1 3 3V4.25M14.25 10.75v0.5a3 3 0 0 1-3 3H10.75M4.25 14.25H3.75a3 3 0 0 1-3-3V10.75M5.5 .75H9.5M14.25 5.5V9.5M9.5 14.25H5.5M.75 9.5V5.5'/></svg>");
}
.u--hueco,
.u--hueco-parte::after,
.nombre.nombre--hueco .nombre__m,
.ley--hueco {
  border-radius: 0;
  background: var(--loss);
  -webkit-mask: var(--hueco) center / 100% 100% no-repeat;
  mask: var(--hueco) center / 100% 100% no-repeat;
}
.u--hueco {
  opacity: 0; transform: scale(.55);
  transition: opacity .3s var(--sal-corta), transform .42s var(--sal);
  transition-delay: var(--retraso, 0ms);
}
.ind.visto .u--hueco,
.marcador.visto .u--hueco { opacity: 1; transform: none; }
/* La parte de un hueco: el contorno entero en gris y, encima, en rojo solo
   el trozo que falta. */
.u--hueco-parte { background: var(--line-alta); }
.u--hueco-parte::after {
  content: ''; position: absolute; inset: 0;
  clip-path: inset(0 calc(100% - var(--parte, 50%)) 0 0);
}

.tira--densa { gap: 5px; }
.tira--densa .u { width: 12px; height: 12px; border-radius: 2px; }
.tira--microscopica { gap: 4px; }
.tira--microscopica .u { width: 9px; height: 9px; border-radius: 2px; }

/* tasas */
.tasas {
  margin-top: 1.5rem;
  display: grid; gap: .55rem;
}
.tasa { display: grid; grid-template-columns: 5.5rem 1fr auto; align-items: center; gap: .7rem; }
.tasa__quien { font-size: .8125rem; font-weight: 700; color: var(--ink-2); }
.tasa__pista { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.tasa__pista i {
  display: block; height: 100%; border-radius: 3px;
  background: var(--ink-3);
  transform: scaleX(var(--v, 0)); transform-origin: left;
  transition: transform .7s var(--sal) .1s;
}
.tasa[data-quien='referencia'] .tasa__pista i { background: var(--ref); }
.tasa__valor { font-size: .8125rem; font-weight: 700; color: var(--ink); min-width: 2.6rem; text-align: right; }
.tasas__llano {
  margin-top: .55rem;
  font-size: .875rem; line-height: 1.5;
  color: var(--ink-2);
}
.tasas__pie { font-size: .75rem; color: var(--ink-3); margin-top: .35rem; }
/* La leyenda de las barras: dice de qué son los dos números. */
.tasas__ley {
  margin-bottom: .55rem;
  font-size: .75rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  line-height: 1.35; color: var(--ink-3);
}

.tasas__base {
  margin-bottom: .35rem;
  padding: .5rem .7rem;
  border: 1px solid var(--line); border-radius: 6px;
  font-size: .75rem; line-height: 1.5; color: var(--ink-3);
}
.tasas__base b { color: var(--ref); font-weight: 700; }

/* nombres */
.nombres-bloque { margin-top: 1.5rem; }
.nombres__rot {
  font-size: .6875rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .3rem;
}
.nombres__rot--cae { color: var(--loss); }
.nombres { display: grid; gap: .08rem; }
.nombre {
  display: grid; grid-template-columns: 16px 1fr auto; align-items: center; gap: .65rem;
  padding-block: .42rem;
  font-size: .9375rem;
  border-bottom: 1px solid var(--surface-2);
}
.nombre:last-child { border-bottom: 0; }
.nombre__m {
  width: 9px; height: 9px; border-radius: 2px;
  background: var(--ink-3);
  justify-self: center;
}
.nombre__t { color: var(--ink-2); }
.nombre__p { font-size: .75rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.nombres__rot--falta { color: var(--loss); }
.nombres__rot--sobra { color: var(--gain-ink); }
.nombres-bloque .nombres__rot:not(:first-child) { margin-top: 1.2rem; }
.nombre .nombre__m { background: var(--ink); }
.nombre.nombre--hueco .nombre__m { width: 11px; height: 11px; }
.nombre--hueco .nombre__t { color: var(--loss); font-weight: 600; }
.nombre--hueco.nombre--nombrado .nombre__t { color: var(--ink); font-weight: 400; }
.nombre.nombre--parte .nombre__m { background: var(--line-alta); }
.nombre--parte .nombre__p { color: var(--loss); }
.nombre--otra .nombre__m { background: var(--ink-3); }
.nombre--sobra .nombre__m { background: var(--gain); }
.nombre--sobra .nombre__t { color: var(--ink); }

details.plegable > summary {
  list-style: none; cursor: pointer;
  margin-top: 1.1rem; padding: .55rem .85rem;
  border: 1px solid var(--line); border-radius: 7px;
  font-size: .8125rem; font-weight: 700; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: .5rem;
  transition: border-color .2s var(--sal-corta), color .2s var(--sal-corta);
}
details.plegable > summary::-webkit-details-marker { display: none; }
details.plegable > summary::after {
  content: ''; width: 6px; height: 6px;
  border-right: 1.4px solid currentColor; border-bottom: 1.4px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform .25s var(--sal-corta);
}
details.plegable[open] > summary::after { transform: rotate(225deg) translate(-1px, -1px); }
details.plegable > summary:hover { border-color: var(--line-alta); color: var(--ink); }
details.plegable[open] > summary { margin-bottom: .2rem; }

/* pies del indicador */
.ind__nota {
  margin-top: 1.4rem;
  max-width: 33rem;
  font-size: .9375rem;
  color: var(--ink-2);
}
.ind__fuente {
  margin-top: .85rem;
  font-size: .75rem; line-height: 1.5;
  color: var(--ink-3);
}
.ind__fuente a { color: var(--ink-3); }
.ind__fuente a:hover { color: var(--ink-2); }

.cautela {
  margin-top: 1.5rem;
  max-width: 33rem;
  font-size: .8125rem; line-height: 1.6;
  color: var(--ink-3);
}

/* ── Donde Parla tiene más ─────────────────────────────────────────────── */

.area--sobra .ind__titular .resto { color: var(--ink-3); }

/* ── Método ───────────────────────────────────────────────────────────── */

.metodo__cuerpo { margin-top: clamp(1.75rem, 6vw, 2.5rem); max-width: 34rem; }
.metodo__cuerpo h3 {
  margin-top: 2.5rem; margin-bottom: .7rem;
  font-size: 1.125rem; font-weight: 700; font-stretch: 92%;
  letter-spacing: -.012em; line-height: 1.25;
  color: var(--ink);
}
.metodo__cuerpo h3::before {
  content: ''; display: block;
  width: 1.75rem; height: 2px; margin-bottom: .7rem;
  background: var(--ref);
}
.metodo__cuerpo h3:first-child { margin-top: 0; }
.metodo__cuerpo p + p { margin-top: .85rem; }

.formula {
  margin-block: 1.1rem !important;
  padding: .9rem 1rem;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface);
  font-size: .8125rem; line-height: 1.9;
  color: var(--ink-3);
}
.formula span { color: var(--ink); font-weight: 600; }

.pendientes { margin-top: .85rem; display: grid; gap: .1rem; }
.pendientes li {
  padding-block: .45rem;
  border-bottom: 1px solid var(--surface-2);
  font-size: .9375rem; color: var(--ink-3);
}
.pendientes li::before { content: '·  '; color: var(--line-alta); }

.fuentes { margin-top: .85rem; display: grid; gap: .55rem; }
.fuentes li { font-size: .8125rem; line-height: 1.5; color: var(--ink-3); }
.fuentes a { color: var(--ink-2); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em;
  color: var(--ink-2);
  background: var(--surface-2);
  padding: .1em .35em; border-radius: 3px;
}

/* ── Pie ──────────────────────────────────────────────────────────────── */

.pie {
  padding-block: clamp(3.5rem, 11vw, 6rem);
  border-top: 1px solid var(--line);
  background:
    radial-gradient(110% 80% at 50% 100%, var(--aura-loss), transparent 60%),
    var(--bg);
}
.pie__frase {
  font-size: clamp(1.5rem, 7vw, 2.25rem);
  font-weight: 800; font-stretch: 82%;
  line-height: 1.06; letter-spacing: -.028em;
  text-transform: uppercase;
  color: var(--ink);
}
.pie__meta { margin-top: 1.5rem; font-size: .8125rem; color: var(--ink-3); max-width: 26rem; }

/* ── Salir en coche: el resumen que manda a infraestructura.html ──────── */

.salir__filas { margin-top: 1.5rem; max-width: 34rem; }
/* El tren, debajo del coche y separado de su fuente. */
.salir__tren { margin-top: clamp(1.75rem, 6vw, 2.5rem); }
.espera__h { margin-top: clamp(1.5rem, 5vw, 2rem); font-size: .8125rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.espera__filas { margin-top: .6rem; }
.salir__pie { margin-top: .7rem; max-width: 34rem; font-size: .8125rem; color: var(--ink-3); }
.salir__pie a { color: var(--ink-3); }
.salir__ir {
  display: inline-flex; align-items: center; gap: .6rem;
  margin-top: 1.5rem;
  color: var(--ref);
  font-size: .8125rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none;
}
.salir__ir:hover { color: var(--ref-deep); }
.salir__ir svg { transition: transform .2s var(--sal-corta); }
.salir__ir:hover svg { transform: translateX(3px); }

/* El atajo de la portada a infraestructura.html: relleno en el azul de
   Parla y algo más grande que el del cartel, para que no se pierda. */
.portada__cartel { display: flex; flex-wrap: wrap; align-items: center; gap: 0 .6rem; }
.compartir--salir {
  padding: .7rem 1.15rem;
  border-color: var(--ref);
  background: var(--ref); color: var(--bg);
  font-size: .9375rem; font-weight: 800;
  text-decoration: none;
}
.compartir--salir:hover { border-color: var(--ref-deep); background: var(--ref-deep); }
.compartir--salir .compartir__icono { flex: none; margin-left: -.2rem; }
.compartir--salir .compartir__flecha { transition: transform .2s var(--sal-corta); }
.compartir--salir:hover .compartir__flecha { transform: translateX(3px); }

/* El resumen de la vivienda: por cada 100 vecinos nuevos, los hogares
   que serían (con borde) y las viviendas que se hicieron (llenas). */
.hogm-pareja { display: grid; gap: 1.75rem; margin-top: 1.5rem; max-width: 40rem; }
@media (min-width: 40rem) { .hogm-pareja { grid-template-columns: 1fr 1fr; } }
.hogm__nombre { font-weight: 800; font-stretch: 80%; font-size: 1.15rem; text-transform: uppercase; color: var(--ink); }
.hogm__v { margin-top: .2rem; font-weight: 800; font-stretch: 80%; font-size: 3rem; line-height: 1; letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.hogm__que { margin-top: .3rem; font-size: .875rem; line-height: 1.4; color: var(--ink-2); max-width: 20rem; }
.hogm[data-quien='referencia'] .hogm__nombre, .hogm[data-quien='referencia'] .hogm__v { color: var(--ref); }
.hogm__fila { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; max-width: 16rem; margin-top: .8rem; }
.hogm__u { display: block; width: 100%; height: auto; overflow: visible; }
.hogm__borde { fill: none; stroke: var(--ink-3); stroke-width: 1.4; }
.hogm__lleno { fill: var(--ink-3); }
.hogm[data-quien='referencia'] .hogm__borde { stroke: var(--ref); }
.hogm[data-quien='referencia'] .hogm__lleno { fill: var(--ref); }
/* En el móvil, las dos ciudades en dos columnas; con subgrid, nombre, cifra, texto y rejilla a la misma altura. */
@media (max-width: 39.99rem) {
  .hogm-pareja { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: .875rem; row-gap: 0; }
  .hogm-pareja .hogm { display: grid; align-content: start; grid-row: span 4; }
  .hogm__nombre { font-size: clamp(1.05rem, 5vw, 1.25rem); line-height: 1.05; align-self: end; }
  .hogm__v { font-size: clamp(2.25rem, 10.5vw, 3rem); }
  .hogm__que { font-size: .8125rem; }
  .hogm__fila { gap: 2px; max-width: none; margin-top: .7rem; align-self: start; }
  .hogm__borde { stroke-width: 1.8; }
}
@supports (grid-template-rows: subgrid) {
  @media (max-width: 39.99rem) { .hogm-pareja .hogm { grid-template-rows: subgrid; } }
}

/* ── Pantallas anchas ─────────────────────────────────────────────────── */

@media (min-width: 62rem) {
  /* La portada se abre en dos: el grito a la izquierda, el recuento a la derecha */
  .portada > .env {
    max-width: 64rem;
    display: grid;
    align-content: center;
    column-gap: clamp(2.5rem, 6vw, 5rem);
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    grid-template-areas:
      'marca    marca'
      'titulo   marcador'
      'ayuda    marcador'
      'pie      marcador'
      'bajar    marcador';
  }
  .portada .marca  { grid-area: marca; justify-self: start; }
  .portada__ballena { right: 3vw; width: min(52vw, 50rem); }
  .portada__titulo { grid-area: titulo; }
  .portada__golpe  { grid-area: ayuda; }
  .portada__pie    { grid-area: pie; }
  .bajar           { grid-area: bajar; }
  .marcador {
    grid-area: marcador;
    align-self: center;
    margin-top: 0;
    padding-top: 0;
    padding-left: clamp(2rem, 4vw, 3rem);
    border-top: 0;
    border-left: 1px solid var(--line);
  }
  .portada__titulo .t1 { font-size: 3.5rem; }
  .portada__titulo .t2 { font-size: 2.25rem; }
  .portada__titulo .t3 { font-size: 4.75rem; }
  /* Los nombres largos tampoco caben en escritorio a ese cuerpo: la columna
     del titular es la mitad de la página. */
  .portada__titulo .t3[data-largo='1'] { font-size: 3.6rem; }
  .marcador__pre { font-size: 2.25rem; }
  .marcador__n { font-size: 4.5rem; }
}

@media (min-width: 46rem) {
  :root { --env: 46rem; }
  body { font-size: 1.125rem; }
  .u { width: 17px; height: 17px; }
  .tira--densa .u { width: 14px; height: 14px; }
  .tira--microscopica .u { width: 11px; height: 11px; }
  .rec__a { column-gap: 1rem; padding-block: .8rem; }
  .rec__n { font-size: 1.25rem; }
  .nombres--dos { grid-template-columns: 1fr 1fr; column-gap: 2rem; }
  .unidades { grid-template-columns: 1fr; }
}

/* ── El índice (assets/indice.js) ─────────────────────────────────────────
   Dos formas del mismo índice. Con sitio en el margen izquierdo, una lista
   fija ahí (html[data-indice='lateral']). Sin sitio, una barra abajo que
   dice dónde se está y abre una hoja con todo (html[data-indice='barra']).
   Las dos salen al dejar atrás la portada. */

[data-indice], [data-indice-sub] { scroll-margin-top: 1.25rem; }
[data-indice]:focus, [data-indice-sub]:focus { outline: none; }

.indice__h {
  font-size: .6875rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3);
}
.indice__lista, .indice__subs, .indice__paginas { list-style: none; margin: 0; padding: 0; }
.indice__a {
  display: grid; grid-template-columns: 1.6rem 1fr auto; align-items: baseline;
  gap: .15rem .3rem;
  padding: .42rem .5rem .42rem .75rem;
  border-left: 2px solid var(--line);
  color: var(--ink-2);
  text-decoration: none;
  line-height: 1.25;
  transition: color .2s, border-color .2s;
}
.indice__a:hover { color: var(--ink); border-left-color: var(--line-alta); }
.indice__a[aria-current] { color: var(--ink); font-weight: 700; border-left-color: var(--ref); }
.indice__n { font-size: .6875rem; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.indice__a[aria-current] .indice__n { color: var(--ref); }
.indice__dato {
  font-size: .75rem; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
.indice__dato[data-tono='loss'] { color: var(--loss); }
.indice__dato[data-tono='gain'] { color: var(--gain-ink, var(--gain)); }
.indice__subs { padding: .1rem 0 .35rem; border-left: 2px solid var(--line); }
.indice__sub {
  display: block;
  padding: .26rem .5rem .26rem 2.35rem;
  font-size: .8125rem; line-height: 1.25;
  color: var(--ink-3);
  text-decoration: none;
}
.indice__sub:hover { color: var(--ink); }
.indice__sub[aria-current] { color: var(--ink); font-weight: 700; }
.indice__h--paginas { margin-top: 1.25rem; }
.indice__paginas { margin-top: .4rem; }
.indice__pagina {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem 0;
  color: var(--ref); font-weight: 700; line-height: 1.25;
  text-decoration: none;
}
.indice__pagina:hover { color: var(--ref-deep); }
.indice__pagina svg { flex: none; transition: transform .2s var(--sal-corta); }
.indice__pagina:hover svg { transform: translateX(3px); }

/* El lateral: solo se despliegan los apartados de la sección en la que se
   está, para que la lista no crezca con la página. */
.indice {
  position: fixed; z-index: var(--z-sticky);
  top: 50%; left: clamp(1rem, 2vw, 2rem);
  width: 13rem; max-height: calc(100vh - 6rem);
  overflow-y: auto; overscroll-behavior: contain;
  font-size: .875rem;
  opacity: 0; visibility: hidden;
  transform: translate(-.5rem, -50%);
  transition: opacity .3s var(--sal), transform .3s var(--sal), visibility 0s .3s;
  scrollbar-width: none;
}
.indice .indice__h:first-child { padding-left: .75rem; margin-bottom: .5rem; }
.indice .indice__subs { display: none; }
.indice .indice__item--abierto .indice__subs { display: block; }
.indice .indice__h--paginas, .indice .indice__paginas { padding-left: .75rem; }
html[data-indice='lateral'] .indice[data-visible='1'] {
  opacity: 1; visibility: visible;
  transform: translate(0, -50%);
  transition: opacity .3s var(--sal), transform .3s var(--sal), visibility 0s;
}

/* La barra de abajo: dónde se está y cuánto queda; toda ella abre la hoja. */
.indice-barra {
  position: fixed; z-index: var(--z-sticky);
  left: 50%; bottom: max(.75rem, env(safe-area-inset-bottom));
  width: min(100% - 1.5rem, 26rem);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .7rem;
  padding: .7rem .8rem .7rem 1rem;
  border: 1px solid var(--line-alta); border-radius: 14px;
  background: var(--velo);
  backdrop-filter: blur(12px);
  box-shadow: var(--sombra), 0 10px 30px -14px rgba(22, 22, 22, .35);
  color: var(--ink);
  font: inherit; text-align: left;
  cursor: pointer;
  overflow: hidden;
  transform: translate(-50%, calc(100% + 1.5rem));
  transition: transform .45s var(--sal);
}
html[data-indice='barra'] .indice-barra[data-visible='1'] { transform: translate(-50%, 0); }
.indice-barra:focus-visible { outline: 2px solid var(--ref); outline-offset: 2px; }
.indice-barra__progreso { position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--line); }
.indice-barra__progreso i {
  position: absolute; inset: 0;
  background: var(--ref);
  transform-origin: left; transform: scaleX(var(--progreso, 0));
}
.indice-barra__n { font-size: .75rem; font-weight: 800; color: var(--ref); font-variant-numeric: tabular-nums; }
.indice-barra__actual {
  min-width: 0;
  font-size: .9375rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.indice-barra__abre {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem;
  border-radius: 10px;
  background: var(--ref); color: var(--bg);
}
/* que la barra no tape el final de la página */
html[data-indice='barra'] .pie { padding-bottom: calc(clamp(3.5rem, 11vw, 6rem) + 4.5rem); }

/* La hoja: sube desde abajo, con todas las secciones y sus apartados. */
.indice-hoja {
  position: fixed;
  inset: auto 0 0 0;
  width: min(100%, 34rem); max-width: none;
  max-height: min(85dvh, 44rem);
  margin: 0 auto;
  padding: 0;
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: var(--bg); color: var(--ink);
  box-shadow: var(--sombra);
  overflow: hidden;
}
.indice-hoja[open] { display: flex; flex-direction: column; animation: indice-sube .35s var(--sal); }
.indice-hoja::backdrop { background: rgba(22, 22, 22, .45); }
@keyframes indice-sube { from { transform: translateY(100%); } to { transform: none; } }
.indice-hoja__cab {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1rem .6rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.indice-hoja__h {
  font-weight: 800; font-stretch: 84%; font-size: 1.35rem;
  letter-spacing: -.02em; text-transform: uppercase;
}
.indice-hoja__cerrar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem;
  border: 1px solid var(--line-alta); border-radius: 999px;
  background: var(--bg); color: var(--ink);
  cursor: pointer;
}
.indice-hoja__cerrar:focus-visible { outline: 2px solid var(--ref); outline-offset: 2px; }
.indice-hoja__cuerpo {
  overflow-y: auto; overscroll-behavior: contain;
  padding: .75rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
}
.indice-hoja .indice__a { padding-block: .7rem; font-size: 1rem; }
.indice-hoja .indice__sub { padding-block: .45rem; font-size: .9375rem; }
.indice-hoja .indice__pagina { padding-block: .6rem; font-size: 1rem; }

@media print {
  .indice, .indice-barra, .indice-hoja { display: none !important; }
}

/* Hacia dónde es mejor (assets/sentido.js): una línea bajo el título del dato. */
.sentido {
  display: flex; align-items: center; gap: .35rem;
  margin: .5rem 0 .25rem;
  font-size: .8125rem; font-weight: 700; line-height: 1.2; letter-spacing: 0; text-transform: none;
  color: var(--ink-2);
}
.sentido__f {
  flex: none; width: .8rem; height: .8rem;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* Sanidad y educación: el enlace de cada indicador a su apartado del recuento. */
.hay__ir { display: inline-block; margin-top: .55rem; font-size: .8125rem; font-weight: 700; color: var(--ref); }
.hay__ir:hover { color: var(--ref-deep); }

/* Los botones del final de una sección: el cartel y el enlace. */
.seccion__botones { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.seccion__botones:empty { display: none; }

/* La fecha de la revisión, al pie de cada página. */
.pie__fecha { margin-top: .5rem; }

/* ── Al pulsar ────────────────────────────────────────────────────────
   Los botones ceden un poco al pulsarlos, como uno de verdad. Va con
   «scale» y no con «transform», para no pisar las flechas que se mueven. */

.compartir, .tp__min, .fondo, details.plegable > summary {
  transition-property: scale, background, border-color, color;
  transition-duration: .14s; transition-timing-function: var(--sal-corta);
}
.compartir:active, .tp__min:active, .fondo:active, details.plegable > summary:active { scale: .965; }
.fondo:hover { translate: 0 -2px; }
.fondo { transition-property: scale, translate, border-color; }

/* ── Movimiento reducido ──────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    transition-delay: 0ms !important;
  }
  .u--hueco { opacity: 1; transform: none; }
  .tasa__pista i { transform: scaleX(var(--v, 0)); }
  .indice-hoja[open] { animation: none; }
}

/* ── La cadena: copiar el enlace a una métrica (assets/indice.js) ───── */
.cadena {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.75rem; height: 1.75rem; margin: -.25rem 0 0 .3rem;
  vertical-align: middle;
  padding: 0; border: 0; border-radius: .375rem;
  background: none; color: var(--ink-3);
  opacity: .5; cursor: pointer;
  transition: opacity .15s, background-color .15s;
}
.cadena svg { width: 1rem; height: 1rem; }
.cadena:hover, .cadena:focus-visible, .cadena--ok { opacity: 1; }
.cadena:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.cadena:focus-visible { outline: 2px solid var(--ref); outline-offset: 1px; }
.cadena--ok { color: var(--ref); }
.cadena--ok::after {
  content: 'Copiado';
  /* Encima y hacia la izquierda: al final de una línea no se sale de la pantalla. */
  position: absolute; right: 0; bottom: 100%;
  margin-bottom: .25rem; padding: .15rem .4rem; border-radius: .25rem;
  font-size: .75rem; font-weight: 700; font-stretch: 100%; line-height: 1.2;
  letter-spacing: 0; text-transform: none; white-space: nowrap;
  color: var(--bg); background: var(--ink);
  pointer-events: none;
}
/* Quien llega por el enlace ve el título con aire encima. */
:is(.bloque__h3, .plata__h, .espera__h, .hecho__h, .plata, .ind, .hecho, .rango)[id] { scroll-margin-top: 1.5rem; }
@media print { .cadena { display: none; } }

/* ── El selector de ciudad, propio (assets/selector.js) ───────────────────
   El select del navegador se queda debajo, sin clics, como estado. Encima,
   un botón transparente que cubre toda la línea del nombre y la flecha, y
   la lista, en el mismo tipo que el resto de la web. */
.selector--propio #sel-municipio { pointer-events: none; visibility: hidden; }
.portada__titulo .t3 { position: relative; }
.selector__boton {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%;
  margin: 0; padding: 0; border: 0;
  background: transparent; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.selector__boton:focus-visible { outline: 3px solid var(--ref); outline-offset: 4px; border-radius: 4px; }
.selector__boton:hover ~ .selector .selector__eco,
.t3:has(.selector__boton:hover) .selector__eco { background: var(--aura-ref); }
.t3--abierto .selector::after { transform: rotate(225deg) translate(-.12em, -.12em); }

.ciudades {
  position: absolute; z-index: 30;
  top: calc(100% + .5rem); left: 0;
  width: min(24rem, calc(100vw - 2 * var(--gutter)));
  max-height: min(26rem, 70vh); overflow-y: auto;
  margin: 0; padding: .35rem;
  list-style: none;
  border: 1px solid var(--line-alta); border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 2px 4px rgba(22, 22, 22, .06), 0 18px 40px -12px rgba(22, 22, 22, .28);
  font-size: 1rem; text-transform: none; letter-spacing: 0; line-height: 1.2;
  color: var(--ink);
}
.ciudades:focus { outline: none; }
.ciudad {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: .7rem .8rem;
  border-radius: 8px;
  font-size: 1.0625rem; font-weight: 600; font-stretch: 100%;
  cursor: pointer;
}
.ciudad--activa { background: var(--surface-2); }
.ciudad[aria-selected='true'] { color: var(--ref); }
.ciudad[aria-selected='true'] .ciudad__n::after { content: ' ·  ahora'; font-weight: 400; color: var(--ink-3); font-size: .875rem; }
.ciudad__d {
  flex: none;
  font-weight: 800; font-stretch: 80%; font-size: 1.125rem;
  color: var(--loss); font-variant-numeric: tabular-nums;
}
@media (prefers-color-scheme: dark) {
  .ciudades { box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7); }
}

/* Cautelas y fuentes largas: tres líneas y un «Ver más» (assets/plegar.js). */
.plegado { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ver-mas {
  display: block; margin-top: .35rem; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: .8125rem; font-weight: 700; color: var(--ink-2);
  text-decoration: underline; text-decoration-color: var(--line-alta); text-underline-offset: .22em;
}
.ver-mas:hover { color: var(--ink); }
