/* =============================================
   FIRMAS — Izquierda Española
   Mapa de recogida de firmas por provincia
   ============================================= */

@font-face {
    font-family: 'RedditSans';
    src: url('/wp-content/themes/astra-child/fonts/RedditSans-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
}
@font-face {
    font-family: 'RedditSans';
    src: url('/wp-content/themes/astra-child/fonts/RedditSans-Italic-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
}

/* ── Romper el contenedor de Astra (solo en esta página) ── */
body:has(.firmas-page) #page #content,
body:has(.firmas-page) #page .ast-container,
body:has(.firmas-page) .site-content > .ast-container,
body:has(.firmas-page) #primary,
body:has(.firmas-page) .entry-content,
body:has(.firmas-page) .post-content {
    max-width: none !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
    float: none !important;
}
body:has(.firmas-page) #secondary { display: none !important; }
body:has(.firmas-page) { overflow-x: hidden; }

.firmas-page {
    --rojo:        #e52c21;
    --rojo-oscuro: #c42018;
    --tinta:       #1a1a1a;
    --gris:        #666;
    --fondo:       #f7f5f2;
    --linea:       #e8e4e0;
    --fuente:      'RedditSans', sans-serif;
    --curva:       cubic-bezier(0.22, 1, 0.36, 1);

    font-family: var(--fuente);
    color: var(--tinta);
    background: var(--fondo);
    width: 100%;
    overflow-x: hidden;
}
.firmas-page *,
.firmas-page *::before,
.firmas-page *::after { box-sizing: border-box; }

.fm-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 5vw;
}


/* =============================================
   ESCENARIO ROJO: TEXTO + MAPA
   ============================================= */
.fm-escenario {
    position: relative;
    background: var(--rojo);
    color: #fff;
    overflow: hidden;
    min-height: calc(100svh - 68px);
    display: flex;
    align-items: center;
}

/* Círculos translúcidos, como en el resto de héroes de la web */
.fm-escenario::before,
.fm-escenario::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}
.fm-escenario::before {
    width: 640px; height: 640px;
    left: -260px; top: -300px;
    background: rgba(255,255,255,0.06);
}
.fm-escenario::after {
    width: 420px; height: 420px;
    right: -160px; bottom: -220px;
    background: rgba(255,255,255,0.045);
}

.fm-escenario-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 48px 5vw 56px;
    display: grid;
    grid-template-columns: minmax(320px, 430px) 1fr;
    gap: 3vw;
    align-items: center;
}

/* ── Columna de texto ── */
.fm-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.fm-etiqueta {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.7);
    margin: 0 0 14px;
}

.fm-titulo {
    font-family: var(--fuente);
    font-size: clamp(2.3rem, 4.6vw, 3.9rem);
    font-weight: 900;
    line-height: 1.02;
    letter-spacing: -0.025em;
    color: #fff !important;
    margin: 0 0 20px;
    text-wrap: balance;
}

.fm-sub {
    font-size: 1.08rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.86);
    margin: 0 0 30px;
    max-width: 30em;
}
.fm-sub strong { color: #fff; font-weight: 800; }

/* ── Botón de descarga (la llamada a la acción principal) ── */
.fm-descarga { margin-bottom: 28px; width: 100%; }

.fm-btn-descarga,
.fm-btn-descarga:visited {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    justify-content: center;
    background: #fff;
    color: var(--rojo) !important;
    font-family: var(--fuente);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none !important;
    padding: 1.05rem 1.6rem;
    border-radius: 12px;
    box-shadow: 0 10px 0 -2px var(--rojo-oscuro), 0 18px 40px rgba(0,0,0,0.22);
    transition: transform 0.18s var(--curva), box-shadow 0.18s var(--curva), background 0.18s;
}
.fm-btn-descarga:hover {
    background: #fff;
    transform: translateY(-3px);
    box-shadow: 0 13px 0 -2px var(--rojo-oscuro), 0 24px 48px rgba(0,0,0,0.26);
    color: var(--rojo) !important;
}
.fm-btn-descarga:active {
    transform: translateY(4px);
    box-shadow: 0 4px 0 -2px var(--rojo-oscuro), 0 8px 20px rgba(0,0,0,0.2);
}
.fm-btn-descarga:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 4px;
}
.fm-btn-icono { width: 22px; height: 22px; flex-shrink: 0; }

.fm-descarga-estado {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
    margin: 18px 0 0;
}
.fm-descarga-estado::before {
    content: '';
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #fff;
    animation: fmLatido 1.8s ease-in-out infinite;
}
@keyframes fmLatido {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.25; }
}

/* ── Ficha de provincia ── */
.fm-ficha {
    width: 100%;
    background: #fff;
    color: var(--tinta);
    border-radius: 16px;
    padding: 20px 22px 22px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.18);
}

.fm-buscar-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rojo);
    margin-bottom: 8px;
}

.fm-select-wrap { position: relative; }
.fm-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    font-family: var(--fuente);
    font-size: 1rem;
    font-weight: 600;
    color: var(--tinta);
    background: var(--fondo);
    border: 1.5px solid transparent;
    border-radius: 10px;
    padding: 0.7rem 2.6rem 0.7rem 0.9rem;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s;
}
.fm-select:hover { background: #f0ede9; }
.fm-select:focus { outline: none; border-color: var(--rojo); background: #fff; }
.fm-select-wrap svg {
    position: absolute;
    right: 14px; top: 50%;
    width: 12px; height: 12px;
    transform: translateY(-50%);
    color: var(--gris);
    pointer-events: none;
}

.fm-ficha-datos { margin-top: 18px; }
.fm-ficha-datos[hidden] { display: none; }

.fm-ficha-firmas {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f0ede9;
}
.fm-ficha-num {
    font-size: clamp(3rem, 5vw, 4.2rem);
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: -0.04em;
    color: var(--rojo);
    font-variant-numeric: tabular-nums;
}
.fm-ficha-unidad {
    font-size: 1rem;
    font-weight: 700;
    color: var(--tinta);
}

.fm-ficha-censo {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 12px;
    font-size: 0.9rem;
    color: var(--gris);
}
.fm-ficha-censo strong {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--tinta);
    font-variant-numeric: tabular-nums;
}

.fm-ficha-datos.es-excluida .fm-ficha-num { color: #bbb; }
.fm-ficha-datos.es-excluida .fm-ficha-unidad::after { content: ' · aquí no nos presentamos'; color: var(--gris); font-weight: 500; }

.fm-ficha-vacia {
    margin: 16px 0 0;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--gris);
}
.fm-ficha-vacia[hidden] { display: none; }


/* =============================================
   MAPA
   ============================================= */
.fm-mapa {
    position: relative;
    width: 100%;
    max-height: calc(100svh - 68px - 80px);
    aspect-ratio: 708 / 750;
    justify-self: center;
}

.fm-svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Provincias: blanco translúcido sobre rojo, más opaco cuantas más firmas */
.fm-prov {
    stroke: var(--rojo);
    stroke-width: 1.1;
    stroke-linejoin: round;
    cursor: pointer;
    transition: fill 0.2s ease;
    outline: none;
}
.fm-t0 { fill: rgba(255,255,255,0.20); }
.fm-t1 { fill: rgba(255,255,255,0.32); }
.fm-t2 { fill: rgba(255,255,255,0.46); }
.fm-t3 { fill: rgba(255,255,255,0.62); }
.fm-t4 { fill: rgba(255,255,255,0.80); }
.fm-t5 { fill: rgba(255,255,255,0.96); }
.fm-excluida { fill: rgba(0,0,0,0.16); cursor: default; }

/* Capas de resaltado (un <use> por encima de todo) */
.fm-capa { fill: none; stroke-linejoin: round; }
.fm-capa-es-fijada { fill: var(--tinta); stroke: #fff; stroke-width: 2.4; }
.fm-capa-es-hover {
    fill: #fff;
    stroke: var(--tinta);
    stroke-width: 2.4;
    filter: drop-shadow(0 6px 10px rgba(0,0,0,0.28));
}

/* Cuando hay provincia fijada, el resto se apaga un poco */
.fm-svg.hay-fijada .fm-prov:not(.es-fijada):not(.es-hover) { opacity: 0.78; }

/* Recuadro de Canarias */
.fm-recuadro {
    fill: rgba(255,255,255,0.05);
    stroke: rgba(255,255,255,0.45);
    stroke-width: 1.2;
    stroke-dasharray: 5 5;
}
.fm-recuadro-txt,
.fm-punto-txt {
    font-family: var(--fuente);
    font-size: 13px;
    font-weight: 700;
    fill: rgba(255,255,255,0.85);
    letter-spacing: 0.02em;
    pointer-events: none;
}

/* Ceuta y Melilla: punto + halo para poder tocarlas */
.fm-punto { cursor: pointer; outline: none; }
.fm-punto-halo { fill: rgba(255,255,255,0.18); stroke: rgba(255,255,255,0.6); stroke-width: 1.2; transition: fill 0.2s; }
.fm-punto-nucleo { fill: #fff; stroke: var(--rojo); stroke-width: 1; }
.fm-punto.es-hover .fm-punto-halo { fill: #fff; stroke: var(--tinta); stroke-width: 2.4; }
.fm-punto.es-hover .fm-punto-nucleo { fill: var(--rojo); }
.fm-punto.es-fijada .fm-punto-halo { fill: var(--tinta); stroke: #fff; stroke-width: 2.4; }
.fm-punto.es-fijada .fm-punto-nucleo { fill: #fff; }
.fm-punto.es-fijada .fm-punto-txt,
.fm-punto.es-hover .fm-punto-txt { fill: #fff; }

/* Foco de teclado visible en el mapa */
.fm-prov:focus-visible { stroke: #fff; stroke-width: 3; }
.fm-punto:focus-visible .fm-punto-halo { stroke: #fff; stroke-width: 3; }

/* Entrada del mapa: un barrido oeste → este */
.fm-svg.fm-entrada .fm-prov {
    animation: fmProvEntrada 0.7s var(--curva) both;
}
@keyframes fmProvEntrada {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}
.fm-svg .fm-prov { transform-box: fill-box; transform-origin: center; }

/* ── Tooltip ── */
.fm-tooltip {
    position: absolute;
    top: 0; left: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--tinta);
    color: #fff;
    padding: 9px 13px 10px;
    border-radius: 10px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.14s ease;
    white-space: nowrap;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.fm-tooltip.visible { opacity: 1; }
.fm-tooltip-nombre { font-size: 0.8rem; font-weight: 600; color: rgba(255,255,255,0.7); }
.fm-tooltip-num { font-size: 1.15rem; font-weight: 900; letter-spacing: -0.01em; }

/* ── Leyenda ── */
.fm-leyenda {
    position: absolute;
    left: 0;
    bottom: 2%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.88);
}
.fm-leyenda-titulo {
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.65);
}
.fm-leyenda-escala { display: flex; flex-direction: column; gap: 5px; }
.fm-leyenda-tramo { display: flex; align-items: center; gap: 8px; fill: none; }
.fm-leyenda-tramo i {
    width: 22px; height: 12px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.35);
}
.fm-leyenda-tramo.fm-t0 i { background: rgba(255,255,255,0.20); }
.fm-leyenda-tramo.fm-t1 i { background: rgba(255,255,255,0.32); }
.fm-leyenda-tramo.fm-t2 i { background: rgba(255,255,255,0.46); }
.fm-leyenda-tramo.fm-t3 i { background: rgba(255,255,255,0.62); }
.fm-leyenda-tramo.fm-t4 i { background: rgba(255,255,255,0.80); }
.fm-leyenda-tramo.fm-t5 i { background: rgba(255,255,255,0.96); }


/* =============================================
   CÓMO PUEDES AYUDAR
   ============================================= */
.fm-pasos-seccion {
    padding: 72px 0 80px;
    background: var(--fondo);
}

.fm-h2 {
    font-family: var(--fuente);
    font-size: clamp(1.7rem, 3.2vw, 2.4rem);
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--tinta);
    margin: 0 0 32px;
}

.fm-pasos {
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.fm-paso {
    background: #fff;
    border-radius: 16px;
    padding: 28px 26px 26px;
    margin: 0;
}
.fm-paso-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--rojo);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 900;
    margin-bottom: 16px;
}
.fm-paso h3 {
    font-family: var(--fuente);
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--tinta);
    margin: 0 0 8px;
    line-height: 1.25;
}
.fm-paso p {
    font-size: 0.93rem;
    line-height: 1.6;
    color: var(--gris);
    margin: 0;
}

.fm-reglas {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 44px;
}
.fm-reglas p {
    margin: 0;
    padding: 20px 24px;
    border-left: 4px solid var(--rojo);
    background: #fff;
    border-radius: 0 12px 12px 0;
    font-size: 0.93rem;
    line-height: 1.6;
    color: #444;
}
.fm-reglas strong { color: var(--tinta); font-weight: 800; }

.fm-cierre {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 22px;
}

.fm-btn-rojo,
.fm-btn-rojo:visited {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--rojo);
    color: #fff !important;
    font-family: var(--fuente);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none !important;
    padding: 1.05rem 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 0 -2px #a8190f;
    transition: transform 0.18s var(--curva), box-shadow 0.18s var(--curva), background 0.18s;
}
.fm-btn-rojo:hover {
    background: var(--rojo);
    color: #fff !important;
    transform: translateY(-3px);
    box-shadow: 0 11px 0 -2px #a8190f;
}
.fm-btn-rojo:active { transform: translateY(4px); box-shadow: 0 3px 0 -2px #a8190f; }
.fm-btn-rojo:focus-visible { outline: 3px solid var(--tinta); outline-offset: 4px; }

.fm-fuente {
    max-width: 620px;
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.55;
    color: #999;
}

/* ── Aviso flotante (formulario aún no publicado) ── */
.fm-aviso {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 1000;
    max-width: min(460px, calc(100vw - 32px));
    background: var(--tinta);
    color: #fff;
    font-family: var(--fuente);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.45;
    padding: 14px 20px;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.3);
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s var(--curva);
}
.fm-aviso.visible { opacity: 1; transform: translate(-50%, 0); }


/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1080px) {
    .fm-escenario-inner { grid-template-columns: minmax(300px, 380px) 1fr; }
    .fm-leyenda { display: none; }
}

@media (max-width: 900px) {
    .fm-escenario { min-height: 0; display: block; }
    .fm-escenario-inner {
        grid-template-columns: 1fr;
        padding: 36px 5vw 40px;
        gap: 8px;
    }
    /* En móvil: titular → mapa → ficha → botón */
    .fm-col { display: contents; }
    .fm-etiqueta, .fm-titulo, .fm-sub { order: 1; }
    .fm-descarga { order: 2; margin: 14px 0 20px; }
    .fm-mapa { order: 3; max-height: none; width: 100%; max-width: 560px; margin: 0 auto 10px; }
    .fm-ficha { order: 4; }
    .fm-sub { margin-bottom: 10px; }
    .fm-ficha-vacia { font-size: 0.88rem; }

    .fm-pasos { grid-template-columns: 1fr; }
    .fm-reglas { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .fm-btn-descarga, .fm-btn-rojo { font-size: 0.95rem; padding: 1rem 1.1rem; }
    .fm-btn-rojo { width: 100%; justify-content: center; }
    .fm-pasos-seccion { padding: 52px 0 60px; }
    .fm-recuadro-txt, .fm-punto-txt { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
    .fm-svg.fm-entrada .fm-prov { animation: none; }
    .fm-descarga-estado::before { animation: none; }
    .fm-btn-descarga, .fm-btn-rojo, .fm-aviso, .fm-tooltip { transition: none; }
}
