body {
    margin: 0;
    font-family: 'Open Sans', sans-serif;
    background-color: #f4f6f9;
    color: #2c2c2c;
}

.page-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    margin: 10px auto 40px;
    padding: 0 20px;
    box-sizing: border-box;
}

.back-link {
    position: absolute;
    left: 40px;
    top: 110px;
    color: #1E3A5F;
    font-size: 28px;
    transition: color 0.3s ease, transform 0.3s ease;
    z-index: 10;
}

.back-link:hover {
    color: #2C7DA0;
    transform: scale(1.08);
}

.main-title {
    font-size: 3rem;
    color: #003b6f;
    text-align: center;
    margin: 50px 0 20px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    letter-spacing: 1px;
    position: relative;
}

.main-title::after {
    content: '';
    display: block;
    width: 70px;
    height: 4px;
    background-color: #0077b6;
    margin: 12px auto 0;
    border-radius: 2px;
}

.contenedor {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
    margin-top: 20px;
}

/* =========================
   LISTADO + ILUSTRACIÓN
========================= */

.fuentes-link-wrapper {
    text-align: center;
    margin-bottom: 26px;
}

.fuentes-link {
    display: inline-block;
    text-decoration: none;
    color: #ffffff;
    background-color: #1E3A5F;
    padding: 12px 22px;
    border-radius: 8px;
    font-weight: 700;
    transition: background-color 0.25s ease, transform 0.2s ease;
}

.fuentes-link:hover {
    background-color: #2C7DA0;
    transform: translateY(-1px);
}

.listado-preview-container {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) 320px;
    gap: 24px;
    align-items: start;
}

.municipios-listado {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 16px;
}

.municipio-card {
    display: block;
    text-decoration: none;
    color: #1E3A5F;
    background: #ffffff;
    border: 1px solid #dbe4ec;
    border-radius: 10px;
    padding: 16px 18px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.25s ease;
}

.municipio-card:hover {
    background-color: #eaf3f9;
    transform: translateY(-2px);
    border-color: #2C7DA0;
}

.preview-panel {
    position: sticky;
    top: 120px;
    align-self: start;
}

.preview-box {
    background: #f8fafc;
    border: 1px solid #dbe4ec;
    border-radius: 12px;
    padding: 18px;
    min-height: 360px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.4);
}

.preview-image {
    width: 100%;
    max-width: 360px;
    max-height: 320px;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 0.25s ease, transform 0.25s ease;
    margin-bottom: 16px;
}

.preview-image.visible {
    opacity: 1;
    transform: scale(1);
}

.preview-text {
    margin: 0;
    text-align: center;
    color: #5a6472;
    font-size: 0.98rem;
    line-height: 1.5;
    font-weight: 600;
}

.preview-text.active {
    color: #1E3A5F;
}

/* =========================
   FICHA DEL MUNICIPIO
========================= */

.contenedor-ficha {
    max-width: 1100px;
}

.ficha-contenido {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.bloque-ficha {
    background: #f8fafc;
    border: 1px solid #dbe4ec;
    border-radius: 14px;
    padding: 26px 28px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.bloque-titulo {
    margin: 0 0 18px;
    font-size: 1.55rem;
    color: #1E3A5F;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    line-height: 1.3;
}

.bloque-texto {
    margin: 0;
    color: #444;
    font-size: 1.06rem;
    line-height: 1.85;
    text-align: justify;
}

.bloque-texto p {
    margin: 0 0 14px;
}

.bloque-texto p:last-child {
    margin-bottom: 0;
}

.bloque-texto ul {
    margin: 0;
    padding-left: 20px;
}

.bloque-texto li {
    margin-bottom: 8px;
    line-height: 1.75;
}

.bloque-texto strong,
.bloque-texto b {
    color: #1E3A5F;
    font-weight: 700;
}

/* Si la ubicación viene como lista */
.ficha-ubicacion ul,
.ficha-ubicacion ol {
    margin: 0;
    padding-left: 22px;
}

.ficha-ubicacion li {
    margin-bottom: 8px;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #333;
}

/* Si la historia viene en párrafos */
.ficha-historia p {
    margin: 0 0 14px;
    font-size: 1.06rem;
    line-height: 1.85;
    color: #444;
    text-align: justify;
}

.ficha-historia p:last-child {
    margin-bottom: 0;
}

/* =========================
   PDF
========================= */

.contenedor-pdf {
    padding: 18px;
}

.pdf-frame {
    width: 100%;
    height: 900px;
    border: none;
    border-radius: 10px;
    background: #ffffff;
}

/* =========================
   MENSAJES
========================= */

.empty-state {
    font-size: 1.05rem;
    color: #555;
    text-align: center;
    padding: 30px 15px;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1100px) {
    .listado-preview-container {
        grid-template-columns: minmax(0, 1fr) 280px;
        gap: 18px;
    }

    .municipios-listado {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .preview-box {
        min-height: 300px;
        padding: 14px;
    }

    .preview-image {
        max-width: 100%;
        max-height: 240px;
    }

    .bloque-ficha {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .main-title {
        font-size: 2.2rem;
    }

    .contenedor {
        padding: 20px;
    }

    .listado-preview-container {
        grid-template-columns: 1fr 220px;
        gap: 14px;
    }

    .municipios-listado {
        grid-template-columns: 1fr;
    }

    .back-link {
        left: 20px;
        top: 105px;
    }

    .preview-box {
        min-height: 240px;
        padding: 12px;
    }

    .preview-image {
        max-height: 170px;
    }

    .preview-text {
        font-size: 0.9rem;
    }

    .bloque-ficha {
        padding: 18px;
    }

    .bloque-titulo {
        font-size: 1.3rem;
        margin-bottom: 14px;
    }

    .bloque-texto,
    .ficha-historia p,
    .ficha-ubicacion li {
        font-size: 1rem;
        line-height: 1.7;
        text-align: left;
    }

    .pdf-frame {
        height: 75vh;
    }
}