/* 
  VINTAGE GALLERY CUSTOM STYLES 
  Theme: Polaroid / Vintage / Animated
*/

/* --- SECTION BACKGROUND --- */
.gallery-section {
    background-color: #ffffff;
    position: relative;
    overflow: hidden;
}

/* --- POLAROID ITEM --- */
.gallery-item {
    background-color: #ffffff;
    /* Polaroid typical dimensions: classic square image area + thick bottom */
    padding: 15px 15px 50px 15px;
    box-shadow: 2px 5px 15px rgba(0, 0, 0, 0.25);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy transition */
    cursor: pointer;
    position: relative;
    transform: rotate(0deg);
    border-radius: 2px;
    margin-bottom: 30px;
    /* Optional: Slight rotation variance can be done via :nth-child in separate rules if desired, 
       but keeping it clean for now */
}

/* Image Filter for Vintage Look */
.gallery-item img {
    border: 1px solid #eaeaea;
    width: 100%;
    height: auto;
    display: block;
    filter: sepia(15%) contrast(110%) brightness(105%);
    /* Subtle vintage feel */
    transition: filter 0.3s ease;
}

/* --- HOVER EFFECTS --- */
.gallery-item:hover {
    transform: scale(1.05) rotate(-2deg) translateY(-10px);
    box-shadow: 5px 20px 35px rgba(0, 0, 0, 0.35);
    z-index: 10;
}

.gallery-item:hover img {
    filter: none;
    /* Restore full color on hover */
}

/* --- ENTRANCE ANIMATION --- */
/* Simple staggered fade in */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.gallery-item {
    animation-name: fadeInUp;
    animation-duration: 0.8s;
    animation-fill-mode: both;
}

/* Stagger delays (manual for first few items for effect) */
.col-lg-3:nth-child(1) .gallery-item {
    animation-delay: 0.1s;
}

.col-lg-3:nth-child(2) .gallery-item {
    animation-delay: 0.2s;
}

.col-lg-3:nth-child(3) .gallery-item {
    animation-delay: 0.3s;
}

.col-lg-3:nth-child(4) .gallery-item {
    animation-delay: 0.4s;
}

.col-lg-3:nth-child(5) .gallery-item {
    animation-delay: 0.15s;
}

.col-lg-3:nth-child(6) .gallery-item {
    animation-delay: 0.25s;
}

.col-lg-3:nth-child(7) .gallery-item {
    animation-delay: 0.35s;
}

.col-lg-3:nth-child(8) .gallery-item {
    animation-delay: 0.45s;
}


/* --- MODAL STYLES (REDUNDANT SAFEGUARD) --- */
.gallery-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.92);
    /* Darker backdrop */
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.gallery-modal.show {
    display: flex;
    opacity: 1;
}

.gallery-modal .modal-content {
    margin: auto;
    display: block;
    max-width: 85%;
    max-height: 85vh;
    width: auto;
    /* Prevent stretching */
    height: auto;
    /* Prevent stretching */
    object-fit: contain;
    /* Ensure aspect ratio is preserved */
    border-radius: 4px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    border: 10px solid #fff;
    /* Photo frame in modal */
    background: #fff;
}

.gallery-modal.show .modal-content {
    transform: scale(1);
}

.gallery-modal .close-modal {
    position: absolute;
    top: 20px;
    right: 40px;
    color: #fff;
    font-size: 50px;
    font-weight: 300;
    transition: 0.3s;
    cursor: pointer;
    z-index: 10000;
    line-height: 0.7;
}

.gallery-modal .close-modal:hover {
    color: #F8CB2E;
    /* Primary color */
    transform: rotate(90deg);
}

@media only screen and (max-width: 700px) {
    .gallery-modal .modal-content {
        width: 95%;
        border: 5px solid #fff;
    }
}

/* --- STATS SECTION (BLACK BG, WHITE TEXT) --- */
.stats-section {
    background-color: #000000;
    background-image: none !important;
    /* Remove any previous image */
    color: #ffffff;
}

.stats-section h2,
.stats-section p,
.stats-section span,
.stats-section .text-white {
    color: #ffffff !important;
}

/* --- ABOUT SECTION (WHITE BG, BLACK TEXT) --- */
.about-section {
    background-color: #ffffff;
    background-image: none !important;
    color: #000000;
}

.about-section h2,
.about-section h3,
.about-section p,
.about-section .text-white {
    color: #000000 !important;
}

/* FIX: Consultas Page Header & Layout */
.page-consultas .desktop-header .nav-link,
.page-consultas .desktop-header .bi-person,
.page-consultas .desktop-header .navbar-brand {
    color: #ffffff !important;
}

.page-consultas .desktop-header.header-text-dark .nav-link,
.page-consultas .desktop-header.header-text-dark .bi-person,
.page-consultas .desktop-header.header-text-dark .navbar-brand {
    color: #ffffff !important;
}

.page-consultas .desktop-header.header-text-dark .navbar-brand img {
    filter: none !important;
}

/* FIX: Gallery Page Header (Initial Load -> Black) */
/* Force black text for the gallery page when at top (not scrolled) */
.page-galeria .desktop-header:not(.scrolled) .nav-link,
.page-galeria .desktop-header:not(.scrolled) .bi-person,
.page-galeria .desktop-header:not(.scrolled) .navbar-brand {
    color: #000000 !important;
}

.page-galeria .desktop-header:not(.scrolled) .navbar-brand img {
    filter: brightness(0) !important;
}

/* FIX: Course Pages Header (Initial Load -> Black) */
/* Force black text for course pages when at top (not scrolled) */
.page-jefe .desktop-header:not(.scrolled) .nav-link,
.page-jefe .desktop-header:not(.scrolled) .bi-person,
.page-jefe .desktop-header:not(.scrolled) .navbar-brand,
.page-reentrenamiento .desktop-header:not(.scrolled) .nav-link,
.page-reentrenamiento .desktop-header:not(.scrolled) .bi-person,
.page-reentrenamiento .desktop-header:not(.scrolled) .navbar-brand,
.page-autorizado .desktop-header:not(.scrolled) .nav-link,
.page-autorizado .desktop-header:not(.scrolled) .bi-person,
.page-autorizado .desktop-header:not(.scrolled) .navbar-brand,
.page-coordinador .desktop-header:not(.scrolled) .nav-link,
.page-coordinador .desktop-header:not(.scrolled) .bi-person,
.page-coordinador .desktop-header:not(.scrolled) .navbar-brand,
.page-espacios .desktop-header:not(.scrolled) .nav-link,
.page-espacios .desktop-header:not(.scrolled) .bi-person,
.page-espacios .desktop-header:not(.scrolled) .navbar-brand,
.page-entrante .desktop-header:not(.scrolled) .nav-link,
.page-entrante .desktop-header:not(.scrolled) .bi-person,
.page-entrante .desktop-header:not(.scrolled) .navbar-brand,
.page-vigia .desktop-header:not(.scrolled) .nav-link,
.page-vigia .desktop-header:not(.scrolled) .bi-person,
.page-vigia .desktop-header:not(.scrolled) .navbar-brand,
.page-supervisor-espacios .desktop-header:not(.scrolled) .nav-link,
.page-supervisor-espacios .desktop-header:not(.scrolled) .bi-person,
.page-supervisor-espacios .desktop-header:not(.scrolled) .navbar-brand {
    color: #000000 !important;
}

.page-jefe .desktop-header:not(.scrolled) .navbar-brand img,
.page-reentrenamiento .desktop-header:not(.scrolled) .navbar-brand img,
.page-autorizado .desktop-header:not(.scrolled) .navbar-brand img,
.page-coordinador .desktop-header:not(.scrolled) .navbar-brand img,
.page-espacios .desktop-header:not(.scrolled) .navbar-brand img,
.page-entrante .desktop-header:not(.scrolled) .navbar-brand img,
.page-vigia .desktop-header:not(.scrolled) .navbar-brand img,
.page-supervisor-espacios .desktop-header:not(.scrolled) .navbar-brand img {
    filter: brightness(0) !important;
}