﻿/* ===================================================================
   IMPORTACIÓN TIPOGRAFÍA INTER (Para legibilidad extrema)
   =================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800;900&display=swap');

/* ===================================================================
   SECCIÓN HISTORIA (Abanico Dinámico + Galería + Modal)
   =================================================================== */
.historia-premium {
    background: #F8FAFC; /* Gris-Celeste muy claro y limpio */
    padding: 100px 0;
    font-family: 'Inter', system-ui, sans-serif; /* Forzamos Inter */
    overflow: hidden;
}

/* --- Cabecera --- */
.historia-header {
    text-align: center;
    margin-bottom: 60px;
}

.kicker-gold {
    display: inline-block;
    background: rgba(199, 149, 50, 0.1);
    color: #C79532;
    border: 1px solid rgba(199, 149, 50, 0.3);
    padding: 8px 20px;
    border-radius: 999px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 11px;
    margin-bottom: 16px;
}

.massive-title-inter {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 900;
    color: var(--brandDark);
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin: 0 0 16px 0;
}

.text-inter-muted {
    color: var(--muted);
    font-size: 18px;
    max-width: 650px;
    margin: 0 auto;
    line-height: 1.6;
}

/* =========================================
   1. EL ABANICO DE TARJETAS (CSS Coverflow)
   ========================================= */
.abanico-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 480px; /* Altura para contener las tarjetas */
    margin-bottom: 80px;
    perspective: 1200px; /* Le da el efecto 3D al rotar */
}

.abanico-card {
    position: absolute;
    width: 340px;
    background: #ffffff;
    border-radius: 28px;
    padding: 40px 32px;
    box-shadow: 0 20px 40px rgba(16, 24, 40, 0.08);
    border: 1px solid rgba(16, 24, 40, 0.04);
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    cursor: default;
}

/* Posicionamiento del Abanico */
.card-left {
    transform: translateX(-65%) scale(0.85) rotateY(15deg) rotate(-4deg);
    z-index: 1;
    opacity: 0.7;
    filter: blur(1px);
}

.card-right {
    transform: translateX(65%) scale(0.85) rotateY(-15deg) rotate(4deg);
    z-index: 1;
    opacity: 0.7;
    filter: blur(1px);
}

.card-center {
    transform: translateX(0) scale(1) translateY(-10px);
    z-index: 5;
    opacity: 1;
    box-shadow: 0 30px 60px rgba(16, 24, 40, 0.12);
}

/* Efecto Hover Magnético */
.card-left:hover {
    transform: translateX(-70%) scale(0.9) rotateY(0) rotate(0);
    opacity: 1;
    filter: blur(0);
    z-index: 10;
    box-shadow: 0 25px 50px rgba(16, 24, 40, 0.1);
}

.card-right:hover {
    transform: translateX(70%) scale(0.9) rotateY(0) rotate(0);
    opacity: 1;
    filter: blur(0);
    z-index: 10;
    box-shadow: 0 25px 50px rgba(16, 24, 40, 0.1);
}

.card-center:hover {
    transform: translateX(0) scale(1.02) translateY(-15px);
}


/* =========================================
   CONTENIDO INTERNO DE LAS TARJETAS (Dinámico)
   ========================================= */

/* Badge Base */
.badge-edicion {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 6px 16px;
    border-radius: 999px;
    z-index: 10;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Atenuar badges en las tarjetas laterales */
.card-left .badge-edicion, .card-right .badge-edicion {
    opacity: 0.85;
    transform: translateX(-50%) scale(0.9);
}

.card-center .badge-edicion {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* Año Base (Para las que están a los lados) */
.card-year {
    text-align: center; /* Año centrado */
    font-size: 52px;
    font-weight: 900;
    color: rgba(36, 75, 92, 0.15); /* Color suave/transparente atrás */
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: -0.04em;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1); /* Transición fluida al rotar */
}

/* Título Base */
.card-title {
    text-align: center; /* Título centrado para acompañar al año */
    font-size: 22px;
    font-weight: 800;
    color: var(--brandDark);
    margin: 0 0 24px 0;
    letter-spacing: -0.01em;
}

/* Stats Base */
.card-stats {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

    .card-stats li {
        display: flex;
        align-items: center;
        gap: 12px;
        font-size: 15px;
        color: var(--muted);
        font-weight: 500;
        transition: all 0.5s ease;
    }

        .card-stats li svg {
            width: 20px;
            height: 20px;
            flex-shrink: 0;
            transition: all 0.5s ease;
        }

/* ---------------------------------------------------
   TEMAS DE COLOR (Mantiene la línea visual)
   --------------------------------------------------- */
/* Tema 2025 (Dorado) */
.theme-gold .badge-edicion {
    background: #C79532;
    box-shadow: 0 4px 10px rgba(199, 149, 50, 0.3);
}

.theme-gold .card-stats li svg {
    color: #C79532;
}

/* Tema 2023 (Turquesa) */
.theme-turq .badge-edicion {
    background: #3A989A;
    box-shadow: 0 4px 10px rgba(58, 152, 154, 0.3);
}

.theme-turq .card-stats li svg {
    color: #3A989A;
}

/* Tema 2024 (Terracota) */
.theme-terra .badge-edicion {
    background: #D36545;
    box-shadow: 0 4px 10px rgba(211, 101, 69, 0.3);
}

.theme-terra .card-stats li svg {
    color: #D36545;
}

/* ---------------------------------------------------
   LA FUERZA DEL CENTRO (Cuando la tarjeta pasa al frente)
   --------------------------------------------------- */
/* Borde superior dinámico según el tema solo si está en el centro */
.card-center.theme-gold {
    border-top: 6px solid #C79532;
}

.card-center.theme-turq {
    border-top: 6px solid #3A989A;
}

.card-center.theme-terra {
    border-top: 6px solid #D36545;
}

/* El Año explota y se hace oscuro */
.card-center .card-year {
    color: var(--brandDark);
    font-size: 64px;
    margin-top: 10px;
}

/* Los textos de la lista se hacen fuertes (bold) */
.card-center .card-stats li {
    color: var(--brandDark);
    font-weight: 600;
}


/* =========================================
   CONTROLES DEL ABANICO (Flechas Flotantes)
   ========================================= */
.abanico-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid rgba(36,75,92,0.08);
    color: var(--brandDark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20; /* Siempre por encima de las tarjetas */
    box-shadow: 0 10px 20px rgba(16,24,40,0.05);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

    .abanico-btn svg {
        width: 22px;
        height: 22px;
    }

    /* Efecto magnético al hover */
    .abanico-btn:hover {
        background: var(--brandDark);
        color: #ffffff;
        border-color: var(--brandDark);
        box-shadow: 0 15px 30px rgba(16,24,40,0.15);
        transform: translateY(-50%) scale(1.1);
    }

/* Posicionamiento a los extremos del contenedor */
.prev-btn {
    left: 0;
}

.next-btn {
    right: 0;
}


/* =========================================
   2. GALERÍA DE FOTOS (Caja con Borde Degradado Real)
   ========================================= */
.gallery-master-wrapper {
    position: relative; /* Necesario para el borde degradado */
    z-index: 1; /* <--- ¡ESTA ES LA LÍNEA MÁGICA QUE FALTABA! */
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 32px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.03);
    /* Reemplazamos el borde sólido por uno transparente para el efecto */
    border: 2px solid transparent;
    background-clip: padding-box; /* Previene que el fondo del wrapper se escape */
}

    /* El truco del borde degradado premium real */
    .gallery-master-wrapper::before {
        content: '';
        position: absolute;
        inset: -2px; /* Mismo grosor que el borde transparente */
        border-radius: 34px; /* 32px de la caja + 2px del borde */
        /* Degradado de Dorado institucional a Turquesa institucional */
        background: linear-gradient(135deg, rgba(199, 149, 50, 0.6), rgba(58, 152, 154, 0.6));
        z-index: -1; /* Lo pone detrás del wrapper blanco */
    }

.gallery-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--brandDark);
    margin: 0 0 24px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

    .gallery-title::before {
        content: '';
        display: block;
        width: 6px;
        height: 24px;
        background: #3A989A;
        border-radius: 4px;
    }

/* Contenedor del Scroll */
.gallery-scroll-container {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 20px; /* Espacio para barra de scroll */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

    /* Custom Scrollbar Elegante */
    .gallery-scroll-container::-webkit-scrollbar {
        height: 8px;
    }

    .gallery-scroll-container::-webkit-scrollbar-track {
        background: #F1F5F9;
        border-radius: 10px;
    }

    .gallery-scroll-container::-webkit-scrollbar-thumb {
        background: #CBD5E1;
        border-radius: 10px;
    }

        .gallery-scroll-container::-webkit-scrollbar-thumb:hover {
            background: #94A3B8;
        }

/* La Grilla Mágica 3x3 a 3xX */
.gallery-grid-3xX {
    display: grid;
    grid-template-rows: repeat(3, 160px); /* 3 filas fijas */
    grid-auto-columns: 240px; /* Ancho de cada foto */
    grid-auto-flow: column; /* Llena hacia la derecha */
    gap: 16px;
}

.gallery-img {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: #E2E8F0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

    .gallery-img img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.5s ease;
        cursor: zoom-in; /* Cursor lupa indicando que se puede hacer clic */
    }

    .gallery-img:hover img {
        transform: scale(1.1);
    }


/* =========================================
   3. MODAL DE FOTOS (Zoom Pequeño y Sutil)
   ========================================= */
.gallery-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(11, 22, 30, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

    .gallery-modal.show {
        display: flex;
        opacity: 1;
    }

/* El contenedor usa inline-flex para tomar el tamaño EXACTO de la foto */
.modal-content-wrapper {
    position: relative;
    display: inline-flex;
    /* Tamaño pequeño/sutil de la imagen respecto a la pantalla */
    max-width: 70vw;
    max-height: 70vh;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-modal.show .modal-content-wrapper {
    transform: scale(1);
}

/* La foto misma redondeada y con sombra */
.modal-content-wrapper img {
    display: block;
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

/* Botones del Modal pegados a la foto */
.modal-btn {
    position: absolute;
    /* Fondo oscuro semitransparente para que destaquen sobre fotos claras y oscuras */
    background: rgba(11, 22, 30, 0.5);
    backdrop-filter: blur(4px);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 20;
}

    .modal-btn:hover {
        background: #ffffff;
        color: var(--brandDark);
        transform: scale(1.1);
        box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    }

/* Flechas LATERALES (Centradas verticalmente y apoyadas en los bordes internos) */
.modal-prev, .modal-next {
    top: 50%;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    margin-top: -22px; /* Las centra exacto */
}

    .modal-prev svg, .modal-next svg {
        width: 22px;
        height: 22px;
    }

/* Separación interna desde el borde de la foto */
.modal-prev {
    left: 16px;
}

.modal-next {
    right: 16px;
}

/* Botón CERRAR en la esquina superior derecha de la foto */
.modal-close {
    top: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
}

    .modal-close svg {
        width: 18px;
        height: 18px;
    }


/* =========================================
   RESPONSIVE (Ajustes para Tablets y Celulares)
   ========================================= */
@media (max-width: 1024px) {
    .abanico-card {
        width: 300px;
        padding: 32px 24px;
    }

    .card-left {
        transform: translateX(-55%) scale(0.85);
    }

    .card-right {
        transform: translateX(55%) scale(0.85);
    }

    /* Ajuste de flechas en tablet */
    .prev-btn {
        left: -20px;
    }

    .next-btn {
        right: -20px;
    }

    /* Ajuste modal size tablet */
    .modal-content-wrapper {
        max-width: 85vw;
        max-height: 80vh;
    }
}

@media (max-width: 768px) {
    /* En móvil apagamos el abanico y apilamos */
    .abanico-container {
        height: auto;
        perspective: none;
        flex-direction: column;
        gap: 24px;
        margin-bottom: 40px;
    }

    .abanico-card {
        position: relative;
        width: 100%;
        transform: none !important;
        opacity: 1;
        filter: none;
    }

    /* Ocultamos flechas en celular */
    .abanico-btn {
        display: none;
    }

    /* Forzamos que todas las tarjetas en móvil se vean "fuertes" (como si estuvieran en el centro) */
    .abanico-card.theme-gold {
        border-top: 6px solid #C79532;
    }

    .abanico-card.theme-turq {
        border-top: 6px solid #3A989A;
    }

    .abanico-card.theme-terra {
        border-top: 6px solid #D36545;
    }

    .abanico-card .card-year {
        color: var(--brandDark);
        font-size: 52px;
        margin-top: 10px;
    }

    .abanico-card .badge-edicion {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }

    .gallery-master-wrapper {
        padding: 24px;
        border-radius: 24px;
    }

        /* Ajuste del borde degradado en celular */
        .gallery-master-wrapper::before {
            border-radius: 26px;
        }

    /* Achicamos las fotos para que entren más en la pantalla del celular */
    .gallery-grid-3xX {
        grid-template-rows: repeat(3, 120px);
        grid-auto-columns: 180px;
    }

    /* Responsive Modal Cell */
    .modal-content-wrapper {
        max-width: 95vw;
        max-height: 80vh;
    }

        .modal-content-wrapper img {
            max-height: 80vh;
        }

    .modal-prev {
        left: 8px;
        width: 38px;
        height: 38px;
        margin-top: -19px;
    }

    .modal-next {
        right: 8px;
        width: 38px;
        height: 38px;
        margin-top: -19px;
    }

    .modal-close {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
    }
}
