/* ============================================================
   GALLERY SECTION — Quinta 87 Premium Image Gallery
   ============================================================ */

/* ---------- Google Font ---------- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

/* ---------- CSS Variables ---------- */
:root {
    --gallery-accent: #00e6e6;
    --gallery-accent-glow: rgba(0, 230, 230, 0.35);
    --gallery-bg: #0a0a0a;
    --gallery-card-bg: #141414;
    --gallery-overlay: rgba(0, 0, 0, 0.85);
    --gallery-radius: 14px;
    --gallery-transition: 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ---------- Section Wrapper ---------- */
.gallery-section {
    padding: 5rem 0 6rem;
    background: linear-gradient(180deg, #0d0d0d 0%, #080818 50%, #0d0d0d 100%);
    color: #fff;
    overflow: hidden;
    font-family: 'Outfit', 'Segoe UI', sans-serif;
}

.gallery-section .section-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 2.6rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-align: center;
    margin-bottom: 1rem;
    color: #fff;
    text-shadow: 0 0 8px var(--gallery-accent-glow);
}

.gallery-section .gallery-subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 300;
    font-size: 1.1rem;
    letter-spacing: 1px;
    margin-bottom: 3rem;
}

/* ============================================================
   CAROUSEL (Auto-scroll with infinite loop)
   ============================================================ */
.gallery-carousel-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: var(--gallery-radius);
    margin-bottom: 3rem;
}

/* Gradient fade edges */
.gallery-carousel-wrapper::before,
.gallery-carousel-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 80px;
    z-index: 2;
    pointer-events: none;
}

.gallery-carousel-wrapper::before {
    left: 0;
    background: linear-gradient(90deg, var(--gallery-bg) 0%, transparent 100%);
}

.gallery-carousel-wrapper::after {
    right: 0;
    background: linear-gradient(-90deg, var(--gallery-bg) 0%, transparent 100%);
}

.gallery-carousel-track {
    display: flex;
    gap: 20px;
    will-change: transform;
    animation: galleryScroll var(--scroll-duration, 40s) linear infinite;
    width: max-content;
}

.gallery-carousel-track:hover {
    animation-play-state: paused;
}

@keyframes galleryScroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-50% - 10px));
    }
}

/* ---------- Carousel Slide ---------- */
.gallery-carousel-slide {
    flex-shrink: 0;
    height: 320px;
    border-radius: var(--gallery-radius);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: var(--gallery-transition);
}

.gallery-carousel-slide img {
    height: 100%;
    width: auto;
    display: block;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery-carousel-slide::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent 50%,
        rgba(0, 0, 0, 0.6) 100%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.gallery-carousel-slide:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 16px 48px var(--gallery-accent-glow),
                0 0 20px var(--gallery-accent-glow);
    border-color: var(--gallery-accent);
}

.gallery-carousel-slide:hover::after {
    opacity: 1;
}

.gallery-carousel-slide:hover img {
    transform: scale(1.08);
}

/* Neon glow icon on hover */
.gallery-carousel-slide .slide-expand-icon {
    position: absolute;
    bottom: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 230, 230, 0.15);
    border: 1px solid var(--gallery-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gallery-accent);
    font-size: 1rem;
    z-index: 3;
    opacity: 0;
    transform: scale(0.7);
    transition: all 0.35s ease;
    backdrop-filter: blur(6px);
}

.gallery-carousel-slide:hover .slide-expand-icon {
    opacity: 1;
    transform: scale(1);
}

/* ============================================================
   MASONRY GRID (Responsive grid below carousel)
   ============================================================ */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    padding: 0 1rem;
}

.gallery-grid-item {
    position: relative;
    border-radius: var(--gallery-radius);
    overflow: hidden;
    cursor: pointer;
    background: var(--gallery-card-bg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: var(--gallery-transition);
    opacity: 0;
    transform: translateY(40px) scale(0.96);
}

.gallery-grid-item.revealed {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.gallery-grid-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 0.4s ease;
}

.gallery-grid-item::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(
        180deg,
        transparent 40%,
        rgba(0, 0, 0, 0.7) 100%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.gallery-grid-item::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--gallery-radius);
    border: 2px solid transparent;
    transition: border-color 0.4s ease;
    pointer-events: none;
    z-index: 2;
}

.gallery-grid-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6),
                0 0 30px var(--gallery-accent-glow);
}

.gallery-grid-item:hover::before {
    opacity: 1;
}

.gallery-grid-item:hover::after {
    border-color: var(--gallery-accent);
}

.gallery-grid-item:hover img {
    transform: scale(1.1);
    filter: brightness(1.1) saturate(1.15);
}

.gallery-grid-item .grid-expand-icon {
    position: absolute;
    bottom: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 230, 230, 0.12);
    border: 1px solid var(--gallery-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gallery-accent);
    font-size: 1.1rem;
    z-index: 3;
    opacity: 0;
    transform: scale(0.6) rotate(-90deg);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(8px);
}

.gallery-grid-item:hover .grid-expand-icon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* ============================================================
   LIGHTBOX MODAL
   ============================================================ */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gallery-overlay);
    backdrop-filter: blur(20px) saturate(1.2);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.gallery-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.gallery-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.85) translateY(20px);
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gallery-lightbox.active .gallery-lightbox-content {
    transform: scale(1) translateY(0);
}

.gallery-lightbox-content img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--gallery-radius);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7),
                0 0 60px var(--gallery-accent-glow);
    border: 1px solid rgba(0, 230, 230, 0.2);
    transition: opacity 0.4s ease;
}

.gallery-lightbox-close {
    position: absolute;
    top: -50px;
    right: -10px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.gallery-lightbox-close:hover {
    background: var(--gallery-accent);
    color: #0d0d0d;
    transform: rotate(90deg) scale(1.1);
    border-color: var(--gallery-accent);
}

.gallery-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    z-index: 10;
}

.gallery-lightbox-nav:hover {
    background: var(--gallery-accent);
    color: #0d0d0d;
    border-color: var(--gallery-accent);
    box-shadow: 0 0 25px var(--gallery-accent-glow);
}

.gallery-lightbox-prev {
    left: -70px;
}

.gallery-lightbox-next {
    right: -70px;
}

/* Counter badge */
.gallery-lightbox-counter {
    position: absolute;
    bottom: -45px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 2px;
    white-space: nowrap;
}

/* ============================================================
   LOADING SKELETON
   ============================================================ */
.gallery-skeleton {
    background: linear-gradient(90deg, #1a1a1a 25%, #252525 50%, #1a1a1a 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: var(--gallery-radius);
    min-height: 200px;
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Tablets */
@media (max-width: 992px) {
    .gallery-carousel-slide {
        height: 260px;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 14px;
    }

    .gallery-lightbox-prev { left: 10px; }
    .gallery-lightbox-next { right: 10px; }

    .gallery-lightbox-content img {
        max-width: 95vw;
        max-height: 80vh;
    }

    .gallery-carousel-wrapper::before,
    .gallery-carousel-wrapper::after {
        width: 40px;
    }
}

/* Mobile */
@media (max-width: 576px) {
    .gallery-section {
        padding: 3rem 0 4rem;
    }

    .gallery-section .section-title {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }

    .gallery-section .gallery-subtitle {
        font-size: 0.95rem;
        margin-bottom: 2rem;
        padding: 0 1rem;
    }

    .gallery-carousel-slide {
        height: 200px;
    }

    .gallery-carousel-track {
        gap: 12px;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 0 0.5rem;
    }

    .gallery-lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .gallery-lightbox-prev { left: 8px; }
    .gallery-lightbox-next { right: 8px; }

    .gallery-lightbox-close {
        top: -45px;
        right: 0;
        width: 38px;
        height: 38px;
    }

    .gallery-carousel-wrapper::before,
    .gallery-carousel-wrapper::after {
        width: 24px;
    }
}

/* Small mobile */
@media (max-width: 380px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-carousel-slide {
        height: 170px;
    }
}
