/* =========================================
   ESTILOS GENERALES Y TÍTULOS
   ========================================= */
body, html { height: 100%; font-family: 'Georgia', serif; }

/* Tipografía local (offline): alternativas serif a Cinzel sin CDN */
h1, h2 {
    font-family: "Book Antiqua", Palatino, "Palatino Linotype", Georgia, serif;
    font-weight: 700;
    letter-spacing: 0.04em;
}

body { margin: 0; }

/* ——— Barra de etapas (elegir “mapa” / momento histórico) ——— */
.barra-etapas {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.5rem min(16px, 3vw);
    background: linear-gradient(180deg, rgba(12, 9, 6, 0.92) 0%, rgba(12, 9, 6, 0.75) 100%);
    border-bottom: 1px solid rgba(168, 141, 89, 0.35);
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

.barra-etapas-marca {
    font-family: "Book Antiqua", Palatino, "Palatino Linotype", Georgia, serif;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #c9b896;
    white-space: nowrap;
}

.etapas-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
}

.btn-etapa {
    padding: 0.35rem 0.65rem;
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #c9b896;
    background: rgba(40, 32, 22, 0.6);
    border: 1px solid rgba(168, 141, 89, 0.35);
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-etapa:hover {
    background: rgba(74, 59, 34, 0.75);
    border-color: rgba(212, 180, 120, 0.45);
    color: #f0e6d2;
}

.btn-etapa[aria-selected="true"] {
    background: rgba(168, 141, 89, 0.35);
    border-color: rgba(255, 220, 160, 0.55);
    color: #fffef8;
    box-shadow: 0 0 12px rgba(255, 200, 120, 0.15);
}

/* ——— Panel lateral: instrumentos, batallas, etc. ——— */
.panel-filtros {
    position: fixed;
    top: 52px;
    left: min(12px, 2vw);
    max-height: calc(100vh - 68px);
    width: min(15.5rem, 86vw);
    z-index: 1090;
    padding: 0.85rem 0.9rem;
    background: rgba(20, 16, 10, 0.78);
    border: 1px solid rgba(168, 141, 89, 0.4);
    border-radius: 4px;
    backdrop-filter: blur(10px);
    box-shadow: 4px 8px 28px rgba(0, 0, 0, 0.45);
    overflow-y: auto;
    pointer-events: auto;
}

.panel-filtros-titulo {
    margin: 0 0 0.35rem;
    font-family: "Book Antiqua", Palatino, "Palatino Linotype", Georgia, serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #e8dcc4;
}

.panel-filtros-hint {
    margin: 0 0 0.65rem;
    font-size: 0.72rem;
    line-height: 1.45;
    color: rgba(200, 190, 170, 0.88);
}

.filtros-lista {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.filtro-tipo {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    color: #e0d5c4;
    cursor: pointer;
    user-select: none;
}

.filtro-tipo input {
    accent-color: #a88d59;
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

@media (max-width: 640px) {
    .panel-filtros {
        top: auto;
        bottom: 120px;
        left: 8px;
        max-height: 40vh;
    }
}

.mapa-wrap {
    position: relative;
    height: 100vh;
    width: 100%;
    padding-top: 48px;
    box-sizing: border-box;
}

#mapa_argentina {
    height: 100%;
    width: 100%;
    transition: filter 0.9s ease;
}

/* Tres niveles de vista (reemplaza +/- de Leaflet) */
.controles-zoom {
    position: absolute;
    right: min(14px, 2vw);
    bottom: min(24px, 4vh);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: auto;
}

.btn-zoom-nivel {
    min-width: 11rem;
    padding: 0.55rem 0.9rem;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #e8dcc4;
    background: rgba(20, 16, 10, 0.72);
    border: 1px solid rgba(168, 141, 89, 0.55);
    border-radius: 3px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
}

.btn-zoom-nivel:hover:not(:disabled) {
    background: rgba(74, 59, 34, 0.88);
    border-color: rgba(212, 180, 120, 0.65);
}

.btn-zoom-nivel:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-zoom-nivel:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

/* =========================================
   PINES Y MARCADORES EN EL MAPA
   ========================================= */

.icono-juego {
    background: transparent;
    border: none;
}

/* El parche rojo que ya teníamos, pero más "militar" */
.pin-contenedor {
    width: 25px; height: 25px;
    background-color: rgba(211, 47, 47, 0.9); /* Rojo sangre */
    border-radius: 50%;
    border: 3px solid #ffcc00; /* Oro */
    box-shadow: 0 0 15px rgba(211, 47, 47, 0.8), inset 0 0 10px rgba(0,0,0,0.5);
    transition: transform 0.2s;
}

.pin-contenedor img { display: none; }

.icono-juego:hover .pin-contenedor {
    transform: scale(1.4) translateY(-10px);
    cursor: pointer;
    background-color: #ffcc00; /* Oro al hover */
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

/* Sombra dinámica en el piso del pin */
.icono-juego .sombra {
    width: 25px; height: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 50%;
    position: absolute; bottom: -5px; left: 0;
    filter: blur(2px);
    z-index: -1;
    transition: all 0.2s;
}

.icono-juego:hover .sombra {
    transform: scale(1.2);
    background: rgba(0,0,0,0.5);
}

/* =========================================
   CRÓNICA INMERSIVA — niebla / humo (sin caja lateral)
   ========================================= */
#modal_historia {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: min(5vh, 2rem) min(6vw, 2.5rem);
    overflow: auto;
    pointer-events: auto;
}

#modal_historia:not(.oculto) {
    animation: nieblaEntrar 1s ease-out both;
}

@keyframes nieblaEntrar {
    from { opacity: 0; }
    to { opacity: 1; }
}

.oculto { display: none !important; }

/* Velos que oscurecen el mapa y dejan respirar solo el centro */
.niebla-fondo {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 120% 90% at 50% 45%, rgba(18, 14, 9, 0.15) 0%, rgba(8, 6, 4, 0.82) 55%, rgba(4, 3, 2, 0.94) 100%),
        linear-gradient(180deg, rgba(35, 28, 18, 0.55) 0%, rgba(12, 9, 6, 0.88) 100%);
    pointer-events: none;
}

/* Dos capas de “vapor” que se mueven muy lento (pure CSS) */
.niebla-voluta {
    position: absolute;
    inset: -20%;
    pointer-events: none;
    opacity: 0.45;
    filter: blur(40px);
    mix-blend-mode: screen;
}

.niebla-cap-1 {
    background: radial-gradient(ellipse 60% 50% at 30% 40%, rgba(180, 160, 130, 0.35) 0%, transparent 55%);
    animation: volutaDrift 28s ease-in-out infinite alternate;
}

.niebla-cap-2 {
    background: radial-gradient(ellipse 55% 45% at 70% 55%, rgba(140, 120, 95, 0.28) 0%, transparent 50%);
    animation: volutaDrift 36s ease-in-out infinite alternate-reverse;
}

@keyframes volutaDrift {
    0% { transform: translate(-2%, 1%) scale(1); opacity: 0.35; }
    100% { transform: translate(3%, -2%) scale(1.08); opacity: 0.5; }
}

.niebla-arriba {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(8, 6, 4, 0.65) 0%,
        transparent 22%,
        transparent 78%,
        rgba(6, 5, 3, 0.75) 100%
    );
    pointer-events: none;
}

/* Contenido: imagen fundida en niebla + texto debajo */
.cronica-inmersiva {
    position: relative;
    z-index: 2;
    max-width: 56rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1.25rem, 4vh, 2.5rem);
}

.cronica-visual-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* La ilustración IA se disuelve en el humo (sin marco cuadrado) */
.imagen-en-niebla,
#modal_imagen_container {
    position: relative;
    width: min(92vw, 48rem);
    aspect-ratio: 16 / 10;
    max-height: min(52vh, 28rem);
    overflow: visible;
}

.imagen-en-niebla::after,
#modal_imagen_container::after {
    content: "";
    position: absolute;
    inset: -12%;
    background: radial-gradient(ellipse 70% 65% at 50% 48%,
        transparent 35%,
        rgba(12, 9, 6, 0.4) 72%,
        rgba(8, 6, 4, 0.85) 100%
    );
    pointer-events: none;
    z-index: 1;
}

#modal_imagen {
    position: relative;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
    opacity: 0.95;
    mask-image:
        radial-gradient(ellipse 85% 75% at 50% 48%, #000 22%, transparent 78%);
    -webkit-mask-image:
        radial-gradient(ellipse 85% 75% at 50% 48%, #000 22%, transparent 78%);
    box-shadow:
        0 0 80px rgba(0, 0, 0, 0.65),
        0 0 120px rgba(80, 60, 40, 0.15);
}

.cronica-narrativa {
    text-align: center;
    max-width: 42rem;
    padding: 0 0.5rem 2rem;
}

#modal_titulo {
    margin: 0 0 1rem;
    font-size: clamp(1.35rem, 3.8vw, 2rem);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #e8dcc4;
    text-shadow:
        0 0 24px rgba(0, 0, 0, 0.9),
        0 2px 4px rgba(0, 0, 0, 0.8),
        0 0 2px rgba(255, 220, 160, 0.35);
}

#modal_texto {
    margin: 0;
    font-size: clamp(1.05rem, 2.2vw, 1.2rem);
    line-height: 1.85;
    color: rgba(232, 224, 208, 0.92);
    text-align: justify;
    text-align-last: center;
    hyphens: auto;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.85), 0 0 1px rgba(0, 0, 0, 0.95);
}

.btn-cerrar-cronica,
#btn_cerrar {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 10001;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    border: 1px solid rgba(168, 141, 89, 0.55);
    background: rgba(20, 16, 10, 0.55);
    color: #e8dcc4;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}

#btn_cerrar:hover {
    background: rgba(74, 59, 34, 0.75);
    border-color: rgba(212, 180, 120, 0.65);
    transform: scale(1.05);
}

@media (prefers-reduced-motion: reduce) {
    #modal_historia:not(.oculto) { animation: none; }
    .niebla-cap-1, .niebla-cap-2 { animation: none; }
    .animar-imagen { animation: none !important; }
}

/* Animación Ken Burns (Mantenemos la que ya funcionaba) */
@keyframes zoomCinematico {
    0% { transform: scale(1); }
    100% { transform: scale(1.15); }
}

.animar-imagen {
    animation: zoomCinematico 20s ease-out forwards;
}