/* =====================================================================
   charts_minimas.css — Gráficos de noches tropicales 2026
   Estilo sobrio (línea de 2607 incendios), no la línea "calor" del tracker
   de máximas. Paleta secuencial cálida (YlOrRd) sobre acumulados.
   ===================================================================== */

:root {
    --tropical-0:  #f7f7f7;   /* sin datos / sin noches */
    --tropical-1:  #fee5d9;   /* muy pocas */
    --tropical-2:  #fcbba1;
    --tropical-3:  #fc9272;
    --tropical-4:  #fb6a4a;
    --tropical-5:  #de2d26;
    --tropical-6:  #a50f15;   /* muchas */
    --tropical-borde-capital: #67000d;
    --texto:       #1a1a1a;
    --gris-mapa:   #e5e5e5;   /* fondo de las provincias */
    --gris-borde:  #ffffff;
    --fuente:      'Encode Sans', 'Helvetica Neue', Arial, sans-serif;
}

.embed-container { clear: left; }

/* ---- Bloques de título / fuente (comunes a todos los gráficos) ---- */
.container-title-minimas {
    font-family: var(--fuente);
    color: var(--texto);
    margin: 32px 0 12px;
    text-align: left;
}
.container-title-minimas h2 {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    margin: 4px 0 8px;
}
.container-title-minimas p {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.45;
    margin: 0;
    color: #333;
}
.container-title-minimas p.actualizado-minimas {
    font-size: 11px;
    color: #aaa;
    margin: 5px 0 0;
    line-height: 1.3;
}
.fuente-minimas {
    font-family: var(--fuente);
    font-size: 12px;
    color: #888;
    margin: 8px 0 40px;
    text-align: left;
}

/* [id^="contenedor-"] hereda text-align:left dentro del artículo */
[id^="contenedor-minimas-"] {
    font-family: var(--fuente);
    text-align: left;
}

/* =====================================================================
   BOTONES DE UMBRAL (>20 / >25 / >30 ºC)
   ===================================================================== */
.buttons-selector-umbral {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 0 0 14px;
}
.button-umbral {
    flex: 0 1 auto;
    min-width: 96px;
    padding: 7px 12px;
    border: 1px solid #d5d5d5;
    background: #ffffff;
    border-radius: 3px;
    font-family: var(--fuente);
    font-size: 13px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    line-height: 1.2;
    text-align: center;
}
.button-umbral:hover {
    border-color: #999;
    color: var(--texto);
}
.button-umbral .titulo-boton-umbral {
    display: block;
    font-size: 14px;
    font-weight: 600;
}
.button-umbral .subtitulo-boton-umbral {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #888;
    margin-top: 2px;
    letter-spacing: 0.01em;
}
.button-umbral.active {
    background: var(--tropical-5);
    color: #fff;
    border-color: var(--tropical-5);
}
.button-umbral.active .subtitulo-boton-umbral { color: rgba(255, 255, 255, 0.85); }

/* =====================================================================
   MAPA (círculos por estación, proyección composite de España)
   ===================================================================== */
/* Envoltorio exterior: apila leyenda + aviso + contenedor del mapa. */
#div-minimas-mapa-outer {
    display: flex;
    flex-direction: column;
    width: 100%;
    position: relative;
}
/* Contenedor directo del SVG. En móvil se convierte en scroll horizontal
   (el JS dibuja el SVG al doble de ancho para que quepa la geografía). */
#contenedor-minimas-mapa {
    width: 100%;
    position: relative;
}
/* IMPORTANTE: el ancho del SVG lo fija el JS (px). No forzar width:100% aquí
   o se anularía el 2x del móvil y no habría nada que deslizar. */
#svg-minimas-mapa {
    display: block;
}
.provincia-fondo-minimas {
    fill: var(--gris-mapa);
    stroke: var(--gris-borde);
    stroke-width: 0.5px;
}
.borde-composite-minimas {
    fill: none;
    stroke: #b0b0b0;
    stroke-width: 0.6px;
}
.circulo-estacion-minimas {
    stroke: #ffffff;
    stroke-width: 0.6px;
    fill-opacity: 0.9;
    transition: stroke-width 0.15s;
}
.circulo-estacion-minimas.capital {
    stroke: var(--tropical-borde-capital);
    stroke-width: 1.2px;
}
.circulo-estacion-minimas:hover {
    stroke: #000;
    stroke-width: 1.5px;
    fill-opacity: 1;
}
.circulo-estacion-minimas.cero {
    fill: #d5d5d5;
    stroke: #bbbbbb;
}

/* Aviso móvil para deslizar (cuando el mapa se expande al doble). Oculto en
   escritorio, visible solo en móvil. */
.text-slide-mobile-minimas {
    display: none;
    font-family: var(--fuente);
    font-size: 12px;
    color: #888;
    margin: 0 0 8px;
    text-align: center;
}
@media (max-width: 600px) {
    #contenedor-minimas-mapa {
        overflow-x: scroll;
        overflow-y: hidden;
    }
    #contenedor-minimas-mapa::-webkit-scrollbar {
        width: 0;
        height: 0;
        background: transparent;
    }
    .text-slide-mobile-minimas { display: block; }
}

/* =====================================================================
   LEYENDA (compartida por mapa y heatmap)
   ===================================================================== */
.legend-minimas {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 12px;
    font-family: var(--fuente);
    font-size: 11px;
    color: #555;
    margin: 0 0 12px;
}
.legend-minimas .legend-title {
    font-size: 11px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-right: 6px;
}
.legend-minimas .legend-scale {
    display: flex;
    align-items: center;
    gap: 0;
}
.legend-minimas .legend-swatch {
    width: 22px;
    height: 12px;
    display: inline-block;
}
.legend-minimas .legend-tick {
    font-size: 10px;
    color: #666;
    margin: 0 2px;
}
.legend-minimas .legend-note {
    font-size: 11px;
    color: #999;
    font-style: italic;
    margin-left: 8px;
}

/* Puntos de referencia dentro de la leyenda del mapa (capital vs extra) */
.legend-minimas .legend-punto {
    display: inline-block;
    background: var(--tropical-5);
    margin: 0 4px 0 0;
    vertical-align: middle;
}
.legend-minimas .legend-punto.capital {
    width: 16px;
    height: 16px;
    border-radius: 8px;
    border: 1.2px solid var(--tropical-borde-capital);
}
.legend-minimas .legend-punto.extra {
    width: 6px;
    height: 6px;
    border-radius: 3px;
}

/* =====================================================================
   HEATMAP (climate-stripes por capital y año)
   ===================================================================== */
#contenedor-minimas-heatmap {
    font-family: var(--fuente);
}
/* Rejilla de SVGs (uno por región): columna que se reparte en 2 columnas al
   llegar a max-height. Mismo truco que el heatmap del tracker de máximas. */
#contenedor-minimas-heatmap-grid {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    max-height: 750px;
    gap: 0 24px;
}
@media (max-width: 600px) {
    #contenedor-minimas-heatmap-grid { max-height: 6000px; }
}
.heatmap-minimas-svg { display: block; }
.heatmap-minimas-svg text {
    font-size: 12px;
    font-family: var(--fuente);
}
.heatmap-celda-minimas {
    stroke: none;
    cursor: pointer;
}
.heatmap-celda-minimas.cero {
    fill: #f7f7f7;
}
.heatmap-grupo-label {
    font-size: 14px;
    font-weight: 700;
    fill: var(--texto);
}
/* Etiquetas del eje Y (provincias): mismo tono discreto que el tracker. */
.eje-minimas-heatmap text { fill: #333; }
.eje-minimas-heatmap path.domain { display: none; }

/* =====================================================================
   FICHAS DE RÉCORDS (noche más cálida batida en el año)
   ===================================================================== */
/* container-type habilita las @container queries: el nº de columnas se decide
   por el ancho del CONTENEDOR del embed, no del viewport. */
#contenedor-minimas-records {
    font-family: var(--fuente);
    container-type: inline-size;
}
/* Rejilla: 2 columnas por defecto (móvil), 4 desde 600, 6 desde 900.
   Con grid + 1fr todas las fichas tienen el mismo ancho y misma altura por
   fila (align stretch). */
.fichas-records-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
@container (min-width: 600px) {
    .fichas-records-grid { grid-template-columns: repeat(4, 1fr); }
}
@container (min-width: 900px) {
    .fichas-records-grid { grid-template-columns: repeat(6, 1fr); }
}
.ficha-record {
    min-height: 138px;        /* misma altura mínima para todas */
    box-sizing: border-box;
    border: 1px solid #e5e5e5;
    padding: 9px 11px 10px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.ficha-record-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px;
}
.ficha-record-prov {
    font-size: 14px;
    font-weight: 700;
    color: var(--texto);
    text-transform: uppercase;
    letter-spacing: 0.01em;
    line-height: 1.15;
}
.ficha-record-fecha {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    white-space: nowrap;
}
.ficha-record-estacion {
    font-size: 11px;
    color: #a5a5a5;
    line-height: 1.2;
    margin-bottom: 5px;
    min-height: 26px;        /* reserva 2 líneas: iguala fichas con nombre corto y largo */
}
.ficha-record-valor {
    font-size: 27px;
    font-weight: 700;
    line-height: 1;
    margin: 0 0 5px;
    font-variant-numeric: tabular-nums;
}
.ficha-record-tipo {
    font-size: 12px;
    color: var(--texto);
    line-height: 1.3;
}
.ficha-record-tipo .tipo-lbl { font-weight: 700; }
.ficha-record-serie {
    font-size: 11px;
    color: #999;
    line-height: 1.3;
}
.ficha-record-anterior {
    font-size: 11px;
    color: #999;
    margin-top: 1px;
}
.boton-ver-todos-records {
    display: inline-block;
    margin: 14px 0 0;
    cursor: pointer;
    font-family: var(--fuente);
    font-size: 13px;
    font-weight: 600;
    color: var(--tropical-5);
    background: none;
    border: none;
    padding: 6px 0;
}
.boton-ver-todos-records:hover { text-decoration: underline; }

/* =====================================================================
   TOOLTIP (único, compartido entre mapa y heatmap)
   ===================================================================== */
#tooltip-minimas {
    position: absolute;
    visibility: hidden;
    pointer-events: none;
    z-index: 999;
    background: #ffffff;
    border: 1px solid #ccc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
    padding: 8px 10px;
    font-family: var(--fuente);
    font-size: 12px;
    line-height: 1.4;
    color: var(--texto);
    max-width: 260px;
    border-radius: 2px;
}
#tooltip-minimas .tt-title {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 2px;
}
#tooltip-minimas .tt-prov {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 6px;
}
#tooltip-minimas table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}
#tooltip-minimas th,
#tooltip-minimas td {
    padding: 3px 5px;
    font-size: 12px;
    text-align: left;
}
#tooltip-minimas th {
    font-weight: 600;
    color: #555;
    border-bottom: 1px solid #eee;
}
#tooltip-minimas td.num {
    text-align: right;
    font-weight: 700;
    color: var(--texto);
    font-variant-numeric: tabular-nums;
}
#tooltip-minimas .tt-highlighted td.num {
    color: var(--tropical-6);
}
#tooltip-minimas .tt-nota {
    display: block;
    font-size: 10px;
    color: #999;
    font-style: italic;
    margin-top: 5px;
    padding-top: 4px;
    border-top: 1px solid #eee;
}
