/* MAQUETA «Así ha evolucionado la estimación de voto, ola a ola» (D3, gráfico de líneas).
   Iframe para el CMS de El Confidencial. Mismo sistema que el gráfico de barras de la ola 3
   (Figma Margaret-2026: body caja normal 662 px; botones del calle a calle).
   Escritorio a partir de 560 px de ancho; por debajo, móvil (misma escala y nunca menos de 12 px). */
@font-face{font-family:"Confi Sans";font-weight:400;font-style:normal;font-display:swap;src:url(fonts/ConfiSans-400-Regular.woff2) format("woff2")}
@font-face{font-family:"Confi Sans";font-weight:500;font-style:normal;font-display:swap;src:url(fonts/ConfiSans-500-Medium.woff2) format("woff2")}
@font-face{font-family:"Confi Sans";font-weight:700;font-style:normal;font-display:swap;src:url(fonts/ConfiSans-700-Bold.woff2) format("woff2")}

:root{
  --texto:#121212;
  --texto-2:#737373;
  --borde:#BFC7CE;
  --blanco:#FFFFFF;
  --ambar:#CC7A4B;
  --fuente:"Confi Sans",Roboto,Arial,sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--blanco)}
body{color:var(--texto);font-family:var(--fuente);font-size:15px;container-type:inline-size}
button:focus-visible{outline:2px solid var(--ambar);outline-offset:2px}

.graf{position:relative;padding:10px 0 14px;display:flex;flex-direction:column;gap:24px;font-variant-numeric:tabular-nums}

/* Banda de maqueta: fuera cuando los cinco datos sean reales */
.aviso{margin:0;padding:8px 10px;border:1px solid #fe422b;border-radius:2px;background:#fff4f2;color:#b3281a;font-size:13px;line-height:1.3;font-weight:500}
.aviso strong{font-weight:700}

.g-cab{display:flex;flex-direction:column;gap:12px}
.g-tit{margin:0;font-size:22px;line-height:1.2;font-weight:700;text-wrap:balance}
.g-desc{margin:0;font-size:18px;line-height:1.4}
.g-grafico{display:flex;flex-direction:column;gap:12px}

/* Botones: como los del calle a calle de la renta (dos columnas a todo el ancho, activo en negro) */
.botones{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
.botones button{font:500 15px/1.3 var(--fuente);height:40px;padding:0 8px;border:1px solid var(--borde);border-radius:2px;background:var(--blanco);color:var(--texto);cursor:pointer;transition:border-color .15s}
.botones button:hover:not([aria-pressed="true"]){border-color:var(--texto-2)}
.botones button[aria-pressed="true"]{background:var(--texto);border-color:var(--texto);color:var(--blanco);cursor:default}

/* Leyenda: aquí son los partidos (en el de barras eran las olas). Pasar por encima aísla su línea; un clic la fija */
.leyenda{display:flex;flex-wrap:wrap;gap:6px 16px;font-size:15px;line-height:1.4}
.leyenda span{display:inline-flex;align-items:center;gap:6px;cursor:pointer;transition:opacity .15s}
.leyenda i{display:block;width:12px;height:12px;flex:none}
.leyenda span.apagado{opacity:.3}

/* Gráfico */
.lienzo{position:relative}
.lienzo svg{display:block;width:100%;height:auto;overflow:visible}
.lienzo text{font-family:var(--fuente);fill:var(--texto)}
.base{stroke:var(--texto);stroke-width:1}
.grp{transition:opacity .15s}
.grp.apagado{opacity:.18}
.linea{fill:none;stroke-width:2.5;stroke-linejoin:round;stroke-linecap:round}
/* Tramo 23-J -> 1a ola: discontinuo, porque une un resultado oficial con una encuesta y median tres anos */
.linea.puente{stroke-width:1.2;stroke-dasharray:4 4;stroke-linecap:butt}
.toque{fill:none;stroke:transparent;stroke-width:16;stroke-linejoin:round;stroke-linecap:round;cursor:pointer}
.punto{stroke:var(--blanco);stroke-width:1.4;pointer-events:none}
.guia{stroke:var(--texto-2);stroke-width:1;stroke-dasharray:2 3;pointer-events:none}
.cabo{stroke-width:1;opacity:.55;pointer-events:none}
/* Anotación de un suceso, con el formato del observatorio de escaños por provincias */
.suceso{pointer-events:none}
.suceso-eje{stroke:var(--texto);stroke-width:1;opacity:.3;pointer-events:none}
.suceso-flecha{fill:none;stroke:var(--texto);stroke-width:1}
.lienzo text.suceso-txt{font-size:12.5px;font-weight:400;fill:var(--texto)}
.ygrid{stroke:var(--borde);stroke-width:1;stroke-dasharray:2 3}
.lienzo text.ytick{font-size:12px;fill:var(--texto-2)}
.lienzo text.xtick{font-size:12px;fill:var(--texto-2)}
/* La ola inventada lleva clase .falsa en el eje, pero sin color propio: el aviso va en la banda de arriba */
/* Rótulo al final de cada línea: nombre del partido y su última cifra */
/* El rótulo va en negro: el punto de la línea ya da el color, y los tonos claros
   (BNG, Junts, CC) no se leían escritos en su propio color sobre blanco */
.fin{font-size:12px;font-weight:700;fill:var(--texto);pointer-events:none}
.fin .num{font-weight:500}

/* Ficha */
.tip{position:absolute;z-index:5;pointer-events:none;width:max-content;min-width:176px;background:var(--blanco);border:1px solid var(--borde);border-radius:2px;padding:7px 9px}
.tip[hidden]{display:none}
.tp-head{display:flex;align-items:center;gap:6px;height:20px;padding-bottom:5px;margin-bottom:4px;border-bottom:1px solid var(--borde);box-sizing:content-box}
.tp-sq{display:block;flex:none;width:8px;height:8px}
.tp-title{font-size:14px;font-weight:700;line-height:20px}
/* Tres columnas (etiqueta · dato · variación) que se ajustan a su contenido; la etiqueta absorbe el espacio sobrante */
.tp-tabla{display:grid;grid-template-columns:1fr auto auto;column-gap:10px;font-size:13px}
.tp-row{display:contents}
.tp-etq{display:flex;align-items:center;height:22px;white-space:nowrap;font-weight:400;color:var(--texto-2)}
.tp-row.cur .tp-etq{color:var(--texto)}
.tp-val{height:22px;font-weight:700;display:flex;align-items:center;justify-content:flex-end}
.tp-d{height:22px;display:flex;align-items:center;justify-content:flex-start;font-size:13px;color:var(--texto-2)}
.tp-tri{display:inline-block;width:0;height:0;margin-right:4px;border-left:4px solid transparent;border-right:4px solid transparent}
.tp-tri.dn{border-top:7px solid #fe422b}
.tp-tri.up{border-bottom:7px solid #2f9e44}

/* Nota y fuente */
.g-pieblock{display:flex;flex-direction:column;gap:12px}
.g-nota{margin:0;font-size:13px;line-height:1.3;color:var(--texto-2);font-style:italic;text-align:right}
.g-pie{margin:0;font-size:13px;line-height:1.3;color:var(--texto-2);text-align:right}
.g-pie strong{font-weight:700;color:var(--texto)}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* Móvil: 4 px de margen lateral, botones de 48 px */
@container (max-width:559px){
  .graf{padding:10px 4px 14px;gap:16px}
  .botones button{height:48px}
  .g-desc{font-size:16px}
  .leyenda{font-size:14px;gap:6px 12px}
  .linea{stroke-width:2}
  .lienzo text.ytick,.lienzo text.xtick{font-size:12px}
  .fin{font-size:12px}
}
@container (max-width:419px){
  .botones button{font-size:14px;padding:0 4px}
  .leyenda{font-size:13px}
}
@container (max-width:379px){
  .botones button{font-size:13px}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important}}
