/* ===========================================================
   Riesgo de incendios forestales (AEMET) — estilos
   Convenciones tomadas del tracker de incendios de elDiario.es.
   Clases/IDs con prefijo "riesgo-incendios-" para no chocar en el CMS.
   =========================================================== */

:root {
    --riesgo-incendios-rojo: #D0021B;
    --riesgo-incendios-negro: #1a1a1a;
    --riesgo-incendios-texto: #1a1a1a;
    --riesgo-incendios-fuente: 'Encode Sans', 'Helvetica Neue', Arial, sans-serif;
}

/* --- Título / subtítulo / actualización (igual que incendios) --- */
.container-title-riesgo-incendios {
    font-family: var(--riesgo-incendios-fuente);
    color: var(--riesgo-incendios-texto);
    margin: 32px 0 12px;
    text-align: left;
}
.container-title-riesgo-incendios h2 {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    margin: 4px 0 8px;
}
.container-title-riesgo-incendios p {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.45;
    margin: 0;
    color: #333;
}
.container-title-riesgo-incendios p.actualizado-riesgo-incendios {
    font-size: 11px;
    color: #aaa;
    font-weight: 400;
    margin: 5px 0 0;
    line-height: 1.3;
}
.fuente-riesgo-incendios {
    font-family: var(--riesgo-incendios-fuente);
    font-size: 12px;
    color: #888;
    margin: 8px 0 40px;
    text-align: left;
}

/* --- Slider de días (línea + bolas, con el día de cada bola encima) --- */
.riesgo-incendios-pasos {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin: 12px 10px 6px;
    touch-action: none;   /* el arrastre táctil controla la barra, no hace scroll */
    user-select: none;
    cursor: ew-resize;
}
/* Línea gris a la altura de las bolas (que quedan abajo de cada columna). */
.riesgo-incendios-pasos::before {
    content: "";
    position: absolute;
    left: 12px; right: 12px; bottom: 5px;
    height: 2px;
    background: #d5d5d5;
    z-index: 0;
}
/* Cada día: columna con el label encima y la bola debajo. */
.riesgo-incendios-paso {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 0;
    border: 0;
    background: none;
    font-family: var(--riesgo-incendios-fuente);
    cursor: ew-resize;
}
.riesgo-incendios-paso-label {
    font-size: 11px;
    line-height: 1.15;
    text-align: center;
    color: #8a8a8a;
    font-weight: 500;
    white-space: nowrap;
}
.riesgo-incendios-paso-punto {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid #b5b5b5;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.riesgo-incendios-paso:hover .riesgo-incendios-paso-punto { border-color: var(--riesgo-incendios-negro); }
.riesgo-incendios-paso.activo .riesgo-incendios-paso-label {
    font-weight: 700;
    color: var(--riesgo-incendios-negro);
}
.riesgo-incendios-paso.activo .riesgo-incendios-paso-punto {
    background: var(--riesgo-incendios-negro);
    border-color: var(--riesgo-incendios-negro);
    transform: scale(1.3);
}

/* --- Caja del mapa --- */
.riesgo-incendios-mapa-box {
    position: relative;
    margin-top: 12px;
    border-radius: 2px;
    overflow: hidden;
    background: #e9e9e9;
}
.riesgo-incendios-mapa {
    width: 100%;
    height: clamp(460px, 72svh, 680px);
}

/* --- Leyenda flotante --- */
.riesgo-incendios-leyenda {
    position: absolute;
    left: 10px;
    bottom: 10px;
    background: rgba(255, 255, 255, .9);
    border-radius: 4px;
    padding: 8px 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
    font-family: var(--riesgo-incendios-fuente);
    font-size: 11px;
    max-width: calc(100% - 20px);
    pointer-events: none;
}
.riesgo-incendios-legend-title {
    font-weight: 700;
    margin-bottom: 5px;
    font-size: 11px;
}
.riesgo-incendios-legend-bar {
    display: flex;
    height: 10px;
    border-radius: 2px;
    overflow: hidden;
}
.riesgo-incendios-legend-bar span { flex: 1; }
.riesgo-incendios-legend-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    gap: 4px;
    color: #666;
    font-size: 9.5px;
    line-height: 1.1;
}
.riesgo-incendios-legend-scale span { flex: 1; text-align: center; }

/* --- Tooltip --- */
#tooltip-riesgo-incendios {
    position: absolute;
    z-index: 1000;
    visibility: hidden;
    pointer-events: none;
    background: var(--riesgo-incendios-negro);
    color: #fff;
    font-family: var(--riesgo-incendios-fuente);
    font-size: 12px;
    padding: 5px 9px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    white-space: nowrap;
}
#tooltip-riesgo-incendios .riesgo-incendios-tt-title { font-weight: 600; }
#tooltip-riesgo-incendios .riesgo-incendios-tt-meta { font-weight: 400; font-size: 11px; opacity: .85; margin-top: 1px; }

/* --- Gráfico de barras apiladas (D3) --- */
.riesgo-incendios-grafico {
    margin-top: 4px;
    font-family: var(--riesgo-incendios-fuente);
}
.riesgo-incendios-grafico-svg { display: block; width: 100%; height: auto; }
.riesgo-incendios-grafico-svg rect { cursor: default; }
.riesgo-incendios-grafico-svg text { pointer-events: none; }   /* ningún label intercepta el hover */
.riesgo-incendios-grafico-eje .tick text { font-size: 12.5px; fill: #777; }
.riesgo-incendios-grafico-eje .tick line { stroke: #ececec; }
.riesgo-incendios-grafico-valor { font-size: 12.5px; font-weight: 600; }
.riesgo-incendios-grafico-leyenda {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin: 0 2px 10px;
    font-size: 12px;
    color: #444;
}
.riesgo-incendios-grafico-leyenda-item { display: inline-flex; align-items: center; gap: 5px; }
.riesgo-incendios-grafico-leyenda-item .sw {
    width: 11px; height: 11px; border-radius: 2px; display: inline-block;
}

@media (max-width: 600px) {
    .container-title-riesgo-incendios h2 { font-size: 20px; }
    .riesgo-incendios-paso-label { font-size: 10px; }
    .riesgo-incendios-grafico-leyenda { font-size: 11px; gap: 3px 10px; }
}
