/* Estilos Base Divinos */
:root {
    --primary: #006994;
    --secondary: #00A5CF;
    --accent: #00C9B1;
    --dark: #0A2342;
    --light: #F7F9FC;
    --text: #333333;
    --gold: #FFD700;
    --deep-blue: #002366;
    --glow: 0 0 30px rgba(0, 201, 177, 0.7);
}

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

body {
    font-family: 'Playfair Display', serif;
    background-color: var(--dark);
    color: var(--light);
    overflow-x: hidden;
}

/* Loader Sobrenatural */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 1s ease;
}

.loader-logo {
    font-size: 5rem;
    color: var(--accent);
    margin-bottom: 2rem;
    animation: pulse 2s infinite ease-in-out;
}

.loader-text {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--light);
    text-transform: uppercase;
    letter-spacing: 3px;
}

.loader-bar {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loader-progress {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.3s ease;
}

/* Partículas Cuánticas */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    background: rgba(0, 201, 177, 0.7);
    border-radius: 50%;
    pointer-events: none;
    animation: float-up 15s linear infinite;
}

/* Header Galáctico */
.gallery-header {
    text-align: center;
    padding: 5rem 2rem 3rem;
    position: relative;
    overflow: hidden;
}

.gallery-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--light);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.gallery-header h1 span {
    color: var(--accent);
}

.gallery-header p {
    font-size: 1.2rem;
    color: var(--light);
    opacity: 0.8;
}

.water-effect {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(to top, var(--dark), transparent);
    z-index: 1;
}

/* Filtros Mágicos */
.filters {
    position: relative; /* added */
    z-index: 2;         /* added */
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 2rem;
    margin-bottom: 2rem;
}

.filter-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--light);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

.filter-btn.active {
    background: var(--accent);
    color: var(--dark);
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(0, 201, 177, 0.4);
}

/* Galería Divina */
.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem;
    max-width: 1500px;
    margin: 0 auto;
}

.gallery-item {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    aspect-ratio: 4/3;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 201, 177, 0.4);
}

.gallery-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover::after {
    opacity: 1;
}

/* Lightbox Épico */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(10px);
}

.lightbox.active {
    opacity: 1;
    pointer-events: all;
}

/* Lightbox Mejorado para Pantalla Completa */
.lightbox-content {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-img, #lightbox-video {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    box-shadow: none;
}

/* Update close button for Lightbox */
.close-btn {
    position: absolute;
    top: 10px;  /* Changed from -50px to 10px */
    right: 10px;
    color: white;
    font-size: 2.5rem;  /* Large enough for mobile */
    cursor: pointer;
    transition: transform 0.3s ease;
    z-index: 1010;  /* Ensure it's above other content */
}
.close-btn:hover {
    transform: rotate(90deg);
    color: var(--accent);
}

/* Optional: further adjust for very small screens */
@media (max-width: 480px) {
    .close-btn {
        top: 5px;
        right: 5px;
        font-size: 2rem;
    }
}

.lightbox-nav {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    background: var(--accent);
    transform: scale(1.1);
}

.img-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

#img-title {
    font-size: 1.2rem;
    font-weight: 600;
}

#img-counter {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Footer Mágico */
.gallery-footer {
    text-align: center;
    padding: 3rem 2rem;
    position: relative;
    margin-top: 5rem;
}

.water-reflection {
    position: absolute;
    top: -100px;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(to bottom, var(--dark), transparent);
    z-index: 1;
}

.gallery-footer p {
    color: var(--light);
    opacity: 0.7;
    font-size: 0.9rem;
}

/* Animaciones Celestiales */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes float-up {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100px) rotate(360deg); opacity: 0; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Responsive Divino */
@media (max-width: 1200px) {
    .gallery-container {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .gallery-header h1 {
        font-size: 2.5rem;
    }
    
    .gallery-container {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
        padding: 1rem;
    }
    
    .filters {
        padding: 1rem;
    }
    
    .filter-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .gallery-header {
        padding: 3rem 1rem 2rem;
    }
    
    .gallery-header h1 {
        font-size: 2rem;
    }
    
    .gallery-container {
        grid-template-columns: 1fr;
    }
    
    .lightbox-nav {
        margin-top: 1rem;
    }
    
    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* Home Button Styles */
.home-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: transparent;
    color: var(--light);
    border: 2px solid var(--accent);
    border-radius: 50px;
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
}
.home-btn:hover {
    background: var(--accent);
    color: var(--dark);
    box-shadow: var(--glow);
}
.home-btn i {
    font-size: 1.2rem;
}
.home-btn .liquid-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--accent);
    z-index: -1;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}
.home-btn:hover .liquid-effect {
    transform: translateY(0);
}
.home-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background: var(--accent);
    animation: wave 3s linear infinite;
    z-index: -1;
}
@keyframes wave {
    0% { transform: scaleX(0); opacity: 1; }
    100% { transform: scaleX(1); opacity: 0; }
}
@media (max-width: 480px) {
    .home-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
}
/* Añade estos estilos al archivo CSS existente */

/* Estilos para videos en la galería */
.gallery-item.video-item {
    position: relative;
}

/* Ensure video thumbnails display correctly */
/* Ensure video thumbnails are visible and properly sized */
.video-thumbnail {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Fill the container without distortion */
    background-color: #000; /* Fallback background if the video fails to load */
}

/* Fallback image inside the video element */
.video-fallback {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Ensure the gallery item container supports the thumbnail */
.gallery-item.video-item {
    position: relative;
    overflow: hidden;
    background-color: #000; /* Fallback background */
}

/* Remove debug border */
.gallery-item.video-item video {
    border: none; /* Remove the red debug border */
}

/* Estilos para videos: Botón de Play siempre visible */
.video-item .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 201, 177, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    opacity: 1;  /* Siempre visible */
    transition: transform 0.3s ease;
}

.video-item:hover .play-icon {
    transform: translate(-50%, -50%) scale(1.1);
}

/* Lightbox para videos */
#lightbox-video {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 10px;
    box-shadow: 0 0 50px rgba(0, 201, 177, 0.5);
    outline: none;
}

@media (max-width: 768px) {
    #lightbox-video {
        max-width: 95vw;
        max-height: 60vh;
    }
    
    .play-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* Estilos para los filtros */
.filters {
    position: relative; /* added */
    z-index: 2;         /* added */
    margin-top: 2rem;
    padding-bottom: 1rem;
}
/* Estilos Mejorados para la Galería */
.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    aspect-ratio: 1/1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 201, 177, 0.25);
}

.gallery-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Ensure video thumbnails are visible in the gallery menu */
.gallery-item.video-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 1 !important;
    border: 2px solid red;  /* DEBUG: remove once confirmed */
}

/* Badge para tipo de media */
.media-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    backdrop-filter: blur(5px);
}

/* Estilos para videos */
.video-item .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 201, 177, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    opacity: 1;  /* Siempre visible */
    transition: transform 0.3s ease;
}

.video-item:hover .play-icon {
    transform: translate(-50%, -50%) scale(1.1);
}

/* Filtros Simplificados */
.filters {
    position: relative; /* added */
    z-index: 2;         /* added */
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem;
    margin: 1rem 0;
}

.filter-btn {
    padding: 0.8rem 1.8rem;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--light);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 1px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--accent);
    color: var(--dark);
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(0, 201, 177, 0.3);
}

/* Mensaje cuando no hay elementos */
.empty-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    color: rgba(255, 255, 255, 0.5);
}

.empty-message i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Lightbox Mejorado */
.lightbox-content {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-img, #lightbox-video {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    box-shadow: none;
}

/* Asegurar que las miniaturas de video se muestren correctamente, tanto en img como en video */
.video-thumbnail {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background-color: #000; /* Fallback para depuración */
}

@media (max-width: 768px) {
    .gallery-container {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
        padding: 1rem;
    }
    
    .filters {
        flex-wrap: wrap;
        padding: 1rem;
    }
    
    .filter-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .lightbox-content {
        width: 95vw;
    }
}

/* Estilos Pro para la galería sin previsualización */
.pro-item {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    position: relative;
    padding-bottom: 100%;  /* mantiene una relación 1:1 */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}
.pro-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}
.pro-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--light);
}
.pro-content i {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}
.pro-content p {
    font-size: 1rem;
    margin: 0;
}

/* === FOOTER UNIFICADO Y RESPONSIVO COMO EN NOTICIAS === */
.news-footer {
    background: var(--dark);
    color: white;
    padding: 2rem 0 1rem 0;
    position: relative;
    min-height: 120px;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.wave-divider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 120px;
    overflow: hidden;
    line-height: 0;
    z-index: 2;
}

.footer-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    padding: 0 1rem;
}

.social-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.social-icon {
    color: white;
    font-size: 1.7rem;
    transition: all 0.3s ease;
    background: rgba(0,0,0,0.08);
    border-radius: 50%;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-icon:hover {
    color: var(--accent);
    background: rgba(0,201,177,0.12);
    transform: translateY(-3px) scale(1.15);
}

.footer-content p {
    margin: 0;
    font-size: 1rem;
    opacity: 0.85;
    width: 100%;
    text-align: center;
}

@media (max-width: 600px) {
    .news-footer {
        padding: 1.2rem 0 0.5rem 0;
    }
    .footer-content {
        font-size: 0.95rem;
        gap: 0.7rem;
        padding: 0 0.5rem;
    }
    .social-links {
        gap: 1rem;
    }
    .social-icon {
        font-size: 1.3rem;
        padding: 0.35rem;
    }
}

.news-footer .social-links a {
    color: white !important;
    text-decoration: none !important;
    border: none;
    box-shadow: none;
}

.news-footer .social-icon {
    color: white !important;
    font-size: 2rem !important;
    background: rgba(0,201,177,0.13) !important;
    border-radius: 50%;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.news-footer .social-icon:hover {
    color: var(--accent) !important;
    background: rgba(0,201,177,0.22) !important;
    transform: translateY(-3px) scale(1.15);
}

.news-footer .footer-content p {
    margin: 0;
    font-size: 1rem;
    opacity: 0.85;
    width: 100%;
    text-align: center;
}
/* ========================================= */
/* === BLOQUE MAESTRO 2.0 (FLUIDO & RESPONSIVE) === */
/* ========================================= */

/* 1. Configuración de Texto (Se adapta automáticamente) */
body, p, span, a, li, input, textarea, label {
    font-family: 'Roboto', sans-serif; 
    font-weight: 400;
    line-height: 1.6;
    color: var(--light);
}

/* 2. Títulos Inteligentes (Usa clamp para escalar suavemente) */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    /* Evita que palabras largas rompan el celular */
    word-wrap: break-word; 
    hyphens: auto;
}

/* TAMAÑOS: (Mínimo móvil, Ideal variable, Máximo escritorio) */
h1 { 
    font-size: clamp(2.2rem, 5vw + 1rem, 3.5rem) !important; 
}

h2 { 
    font-size: clamp(1.8rem, 4vw + 1rem, 2.5rem) !important; 
    color: var(--light);
}

h3 { 
    font-size: clamp(1.3rem, 3vw + 1rem, 1.8rem) !important; 
}

/* 3. SALVAVIDAS MÓVIL (Evita el desastre lateral) */
html, body {
    max-width: 100vw;
    overflow-x: hidden; /* Bloquea el scroll horizontal indeseado */
}

img, video, iframe, .map-container {
    max-width: 100% !important; /* Nada puede ser más ancho que la pantalla */
    height: auto !important;
}

/* 4. Ajustes Específicos para Celulares ( < 768px ) */
@media (max-width: 768px) {
    /* Reduce el relleno lateral excesivo */
    .contact-header, .about-header, .exp-header, .news-header, .lab-header {
        padding: 3rem 1rem !important; 
    }
    
    /* Asegura que los contenedores no se peguen a los bordes */
    .main-container, .contact-container, .about-container, .section {
        padding-left: 15px !important;
        padding-right: 15px !important;
        width: 100% !important;
    }

    /* Fuerza que las cajas se apilen verticalmente */
    .contact-container, .about-card, .news-container {
        flex-direction: column !important;
        display: flex !important;
    }
}

/* ========================================= */
/* === FIN DEL BLOQUE MAESTRO 2.0 === */
/* ========================================= */