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
========================= */

.listado-preview-container {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) 320px;
    gap: 24px;
    align-items: start;
}

.signos-listado {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 16px;
}

.signo-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;
}

.signo-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;
}

/* =========================
   FICHA MUNICIPIO
========================= */

.ficha-grid {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr) 210px;
    grid-template-areas:
        "escudo video bandera"
        "mapa   video .";
    gap: 22px;
    align-items: start;
}

.escudo-box {
    grid-area: escudo;
}

.video-box {
    grid-area: video;
}

.bandera-box {
    grid-area: bandera;
}

.mapa-box {
    grid-area: mapa;
}

.recurso-box {
    background: #f8fafc;
    border: 1px solid #dbe4ec;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.recurso-title {
    margin: 0 0 12px;
    font-size: 1rem;
    color: #1E3A5F;
    font-family: 'Montserrat', sans-serif;
    text-align: center;
    font-weight: 700;
}

.recurso-media {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recurso-media-small {
    min-height: 180px;
}

.recurso-media-flag {
    min-height: 140px;
}

.recurso-media img {
    display: block;
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
}

.bandera-box .recurso-media img {
    max-height: 140px;
}

.mapa-box .recurso-media img {
    max-height: 180px;
}

.video-principal-wrapper {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    background: black;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.video-principal-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.sin-video-box {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #eef3f7;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.sin-recurso {
    color: #777;
    font-size: 0.95rem;
    text-align: center;
    line-height: 1.5;
    margin: 0;
}

/* =========================
   VARIANTES
========================= */

.variantes {
    margin-top: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.variantes-video {
    margin-top: 16px;
    margin-bottom: 4px;
}

.variante-btn {
    cursor: pointer;
    padding: 12px 18px;
    border-radius: 8px;
    border: none;
    background-color: #ffffff;
    color: #2c2c2c;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.variante-btn:hover {
    background-color: #e0ecf4;
    transform: translateY(-1px);
}

.variante-btn.active {
    background-color: #1E3A5F;
    color: #ffffff;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1100px) {
    .listado-preview-container {
        grid-template-columns: minmax(0, 1fr) 280px;
        gap: 18px;
    }

    .signos-listado {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .preview-box {
        min-height: 300px;
        padding: 14px;
    }

    .preview-image {
        max-width: 100%;
        max-height: 240px;
    }

    .ficha-grid {
        grid-template-columns: 180px minmax(0, 1fr) 180px;
    }

    .recurso-media-small {
        min-height: 150px;
    }
}

@media (max-width: 900px) {
    .ficha-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "video"
            "escudo"
            "bandera"
            "mapa";
    }

    .recurso-media img {
        max-height: 180px;
    }

    .bandera-box .recurso-media img {
        max-height: 120px;
    }
}

@media (max-width: 768px) {
    .main-title {
        font-size: 2.2rem;
    }

    .contenedor {
        padding: 20px;
    }

    .listado-preview-container {
        grid-template-columns: 1fr 220px;
        gap: 14px;
    }

    .signos-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;
    }

    .variante-btn {
        width: 100%;
    }
}