/* ==========================================================================
   NEXO MONTERREY: IMMERSIVE SCROLLYTELLING CSS
   Estilos cinemáticos oscuros, scroll snapping y backgrounds sticky.
   ========================================================================== */

:root {
    --bg-dark: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --accent-blue: #3b82f6;
    --accent-amber: #f59e0b;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    
    --card-bg: rgba(15, 23, 42, 0.85);
    --card-border: rgba(255, 255, 255, 0.1);
    --card-blur: blur(12px);
    
    --radius-lg: 16px;
    --radius-full: 9999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    /* Para el scrollytelling en navegadores que lo soportan bien en el body */
}

/* --------------------------------------------------------------------------
   STICKY BACKGROUNDS (Fondos Fijos)
   -------------------------------------------------------------------------- */
.sticky-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1; /* Detrás del contenido narrativo */
    pointer-events: none; /* Dejar pasar los clics hacia el contenido, pero los mapas necesitan activarse en ciertos pasos */
}

.bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-dark); /* Color base si la imagen no carga */
}

.bg-layer.active {
    opacity: 1;
    pointer-events: auto; /* Permitir interacciones en la capa activa (ej. mapas) */
}

.bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.fullscreen-map {
    width: 100%;
    height: 100%;
}

.sim-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1e293b, #020617);
}

.sim-wrapper canvas {
    max-width: 90%;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    border: 1px solid var(--card-border);
}

/* --------------------------------------------------------------------------
   NARRATIVA SCROLLYTELLING
   -------------------------------------------------------------------------- */
.scrolly-container {
    position: relative;
    z-index: 10;
    scroll-snap-type: y mandatory;
    height: 100vh;
    overflow-y: scroll;
    overflow-x: hidden;
}

/* Ocultar barra de scroll para mayor inmersión */
.scrolly-container::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

.step {
    width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    pointer-events: none; /* Para no bloquear los clics en el fondo */
}

/* --------------------------------------------------------------------------
   TARJETAS DE TEXTO
   -------------------------------------------------------------------------- */
.step-card {
    pointer-events: auto; /* La tarjeta sí recibe clics */
    background: var(--card-bg);
    backdrop-filter: var(--card-blur);
    -webkit-backdrop-filter: var(--card-blur);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    max-width: 600px;
    width: 100%;
    text-align: left;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5);
    transform: translateY(30px);
    opacity: 0;
    transition: transform 0.6s ease-out, opacity 0.6s ease-out;
}

.step.is-visible .step-card {
    transform: translateY(0);
    opacity: 1;
}

/* Variaciones de posición para no tapar lo importante del fondo */
.align-left {
    margin-right: auto;
    margin-left: 5vw;
}

.align-right {
    margin-left: auto;
    margin-right: 5vw;
}

/* Específicos para mapas donde queremos ver más fondo */
.map-card {
    max-width: 450px;
}

/* --------------------------------------------------------------------------
   TIPOGRAFÍA Y BOTONES
   -------------------------------------------------------------------------- */
.step-card h1 {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.step-card h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.step-card p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.step-card strong {
    color: #fff;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.badge-blue { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }
.badge-amber { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-emerald { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.badge-rose { background: rgba(244, 63, 94, 0.2); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.4); }

.scroll-indicator {
    margin-top: 2rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.btn-primary {
    display: inline-block;
    background: #fff;
    color: #000;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s, background 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: #e2e8f0;
}

.btn-back {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    background: rgba(15, 23, 42, 0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.3s;
}

.btn-back:hover {
    background: rgba(15, 23, 42, 0.95);
}

/* --------------------------------------------------------------------------
   CONTROLES DE SIMULADOR
   -------------------------------------------------------------------------- */
.sim-controls {
    background: rgba(0, 0, 0, 0.4);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px solid rgba(255,255,255,0.05);
}

.range-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.2);
    outline: none;
    margin-top: 8px;
}
.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .step-card {
        margin: 0 !important;
        max-width: 100%;
    }
    .step-card h1 { font-size: 2.2rem; }
    .step-card h2 { font-size: 1.8rem; }
    .step { padding: 1.5rem; }
}

/* --------------------------------------------------------------------------
   COLLAGE DE NOTICIAS
   -------------------------------------------------------------------------- */
.news-collage {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: radial-gradient(circle at center, #1e293b, #020617);
}

.news-card {
    position: absolute;
    border-radius: 8px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.8);
    opacity: 0.65;
    transition: transform 0.6s ease, opacity 0.6s ease, z-index 0s;
    object-fit: cover;
    object-position: top;
}

.news-card:hover {
    opacity: 1;
    z-index: 10 !important;
    transform: scale(1.05) !important;
}

/* Scattered positions */
.news-card:nth-child(1) { width: 35vw; max-width:400px; top: 5%; left: 2%; transform: rotate(-4deg); z-index: 1; }
.news-card:nth-child(2) { width: 40vw; max-width:450px; top: 15%; right: 5%; transform: rotate(3deg); z-index: 2; }
.news-card:nth-child(3) { width: 30vw; max-width:350px; bottom: 10%; left: 8%; transform: rotate(5deg); z-index: 3; }
.news-card:nth-child(4) { width: 45vw; max-width:500px; top: 40%; left: 25%; transform: rotate(-2deg); z-index: 4; }
.news-card:nth-child(5) { width: 35vw; max-width:400px; bottom: 5%; right: 10%; transform: rotate(-5deg); z-index: 2; }
.news-card:nth-child(6) { width: 28vw; max-width:300px; top: -5%; left: 40%; transform: rotate(4deg); z-index: 1; }

/* --------------------------------------------------------------------------
   FIDGET AGUA PANTALLA COMPLETA
   -------------------------------------------------------------------------- */
#water-canvas-imm {
    max-width: none !important;
    max-height: none !important;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
}

/* --------------------------------------------------------------------------
   IMAGE COMPARISON SLIDER
   -------------------------------------------------------------------------- */
.img-comp-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #000;
}

.img-comp-img {
    position: absolute;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.img-comp-img img {
    display: block;
    width: 100vw;
    height: 100vh;
    object-fit: contain;
    background: #000;
}

.img-comp-overlay {
    width: 50%;
}

.img-comp-slider {
    position: absolute;
    z-index: 9;
    cursor: ew-resize;
    width: 4px;
    height: 100vh;
    background-color: #3b82f6;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

.img-comp-slider::before {
    content: "↔";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: #3b82f6;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* ==========================================================================
   RESPONSIVE – MÓVIL (Tarjetas compactas, ancladas abajo)
   ========================================================================== */
@media (max-width: 768px) {
    /* Cada pantalla de la historia */
    .step {
        padding: 0.75rem;
        align-items: flex-end;       /* Anclar tarjeta ABAJO */
        padding-bottom: 1.5rem;
    }

    /* La tarjeta de texto ocupa ~40 % de la pantalla como máximo */
    .step-card {
        padding: 1rem 1.2rem;
        max-width: 100%;
        max-height: 40vh;            /* ← clave: nunca más del 40 % de la altura */
        overflow-y: auto;            /* scroll interno si hay mucho texto */
        margin: 0 !important;        /* anular align-left / align-right */
        background: rgba(15, 23, 42, 0.80);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        font-size: 0.9rem;
    }

    .step-card h1 { font-size: 1.6rem; line-height: 1.2; margin-bottom: 0.4rem; }
    .step-card h2 { font-size: 1.25rem; line-height: 1.25; margin-bottom: 0.4rem; }
    .step-card p  { font-size: 0.88rem; line-height: 1.45; }

    /* Map cards aún más pequeñas */
    .map-card {
        max-height: 30vh;
    }

    /* Collage de noticias: apilar más compacto */
    .news-card {
        max-width: 75vw !important;
        width: 75vw !important;
    }

    /* Controles de slider dentro de las tarjetas */
    .sim-controls {
        margin-top: 0.5rem;
    }
    .sim-controls label {
        font-size: 0.82rem;
    }

    /* Scroll indicator */
    .scroll-indicator {
        font-size: 0.85rem;
    }
}

