/* ====================================================================
   GALLERY SECTION - ULTRA PREMIUM REDESIGN
   ==================================================================== */

/* Gallery Section - Background Preserved */
.gallery-section {
    position: relative;
    padding: 8rem 0;
    background: linear-gradient(180deg, rgba(10, 10, 15, 0.95) 0%, rgba(15, 15, 20, 0.85) 100%),
        url('../images/gallery/af083af2-4f46-44b8-9f37-67d41647313e.JPG');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    overflow: hidden;
}

.gallery-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 0%, rgba(255, 215, 0, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

/* Section Header */
.section-header-center {
    text-align: center;
    margin-bottom: 6rem;
    position: relative;
    z-index: 1;
}

.section-subtitle {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--color-accent-gold);
    display: inline-block;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.section-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 4rem;
    font-weight: 500;
    color: #fff;
    margin-bottom: 1.5rem;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.section-description {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.6);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.8;
    font-weight: 300;
}

/* Modern Asymmetric Grid Layout */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: 300px;
    gap: 2rem;
    width: 100%;
    position: relative;
    z-index: 1;
    padding-bottom: 4rem;
    grid-auto-flow: dense;
    /* Helps fill gaps */
}

/* Gallery Item Container */
.gallery-item {
    position: relative;
    border-radius: 4px;
    /* Minimalist sharp corners or slight radius */
    overflow: hidden;
    cursor: pointer;
    opacity: 0;
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Item Spans - Desktop */
/* Order matters for specificity! Specific overrides generic. */

/* Default item */
.gallery-item {
    grid-column: span 3;
    grid-row: span 1;
}

.gallery-item-medium {
    grid-column: span 4;
    grid-row: span 1;
}

.gallery-item-large {
    grid-column: span 6;
    grid-row: span 2;
}

.gallery-item-tall {
    grid-column: span 3;
    grid-row: span 2;
}

.gallery-item-wide {
    grid-column: span 6;
    grid-row: span 1;
}

/* Video should be most prominent, so defined last to override others if combined */
.gallery-item-video {
    grid-column: span 8;
    grid-row: span 2;
}

/* Gallery Card (Inner) */
.gallery-card {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.gallery-card img,
.gallery-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: block;
}

/* Hover Effects */
.gallery-item:hover {
    z-index: 2;
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

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

/* Overlay - Minimalist */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2rem;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.2) 50%, transparent 100%);
}

.gallery-info {
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    opacity: 0;
}

.gallery-item:hover .gallery-info {
    transform: translateY(0);
    opacity: 1;
}

.gallery-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem;
    font-weight: 500;
    color: #fff;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.gallery-category {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.75rem;
    color: var(--color-accent-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

/* View Button - Minimalist Icon */
.gallery-view-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.gallery-item:hover .gallery-view-btn {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.gallery-view-btn:hover {
    background: #fff;
    color: #000;
    transform: translate(-50%, -50%) scale(1.1);
}

/* Load More Button */
.gallery-loadmore-container {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.gallery-loadmore-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 1rem 3rem;
    border-radius: 0;
    /* Minimalist square/rect */
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.gallery-loadmore-btn:hover {
    background: #fff;
    color: #000;
    border-color: #fff;
}

/* Sticky "Ver Menos" Button */
/* Sticky "Ver Menos" Button - Liquid Glass Style */
.gallery-showless-btn {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);

    /* Liquid Glass Effect - Identical to Header */
    --glass-opacity: 1;
    --liquid-glass-bg: rgba(20, 20, 25, 0.2);
    --liquid-glass-border: rgba(255, 255, 255, 0.2);
    --liquid-glass-shadow-alpha: 0.5;

    background-color: var(--liquid-glass-bg) !important;
    border: 1px solid var(--liquid-glass-border) !important;

    /* Dynamic shadow stack matching header */
    box-shadow:
        0 25px 50px -15px rgba(0, 0, 0, calc(var(--liquid-glass-shadow-alpha) * 1)),
        0 0 40px rgba(255, 255, 255, calc(var(--glass-opacity) * 0.08)) inset,
        0 4px 12px rgba(0, 0, 0, calc(var(--liquid-glass-shadow-alpha) * 0.5)) !important;

    /* Backdrop filter is handled by JS (SVG displacement) */

    color: #fff;
    padding: 1.2rem 4rem;
    /* Larger button */
    border-radius: 50px;
    /* Apple-style rounded */

    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.1rem;
    /* Larger font */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    /* Expo ease */
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.gallery-showless-btn i {
    font-size: 0.9rem;
    /* Larger icon */
    transition: transform 0.3s ease;
}

.gallery-showless-btn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.gallery-showless-btn.at-bottom {
    position: absolute;
    bottom: 2rem;
    /* Stick to bottom of container */
    top: auto;
    transform: translateX(-50%);
}

.gallery-showless-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateX(-50%) translateY(-2px);
    box-shadow:
        0 30px 60px -12px rgba(0, 0, 0, 0.6),
        0 0 50px rgba(255, 255, 255, 0.1) inset;
}

.gallery-showless-btn:hover i {
    transform: translateY(-3px);
}

/* ===============================================
   GLASSMORPHISM FALLBACK FOR BUTTON
   For browsers that don't support SVG backdrop filters
   =============================================== */
.gallery-showless-btn.liquid-glass-fallback {
    /* Premium translucent background with gradient */
    background: rgba(20, 20, 25, 0.2) !important;

    /* Standard blur-based glassmorphism */
    backdrop-filter: blur(20px) saturate(180%) brightness(1.1) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) brightness(1.1) !important;

    /* Refined border */
    border: 1px solid rgba(255, 255, 255, 0.2) !important;

    /* Multi-layered premium shadows */
    box-shadow:
        0 25px 50px -15px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(255, 255, 255, 0.1) inset,
        0 1px 0 rgba(255, 255, 255, 0.15) inset,
        0 -1px 0 rgba(255, 255, 255, 0.05) inset,
        0 10px 25px -8px rgba(0, 0, 0, 0.4) !important;
}

.gallery-showless-btn.liquid-glass-fallback:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    box-shadow:
        0 30px 60px -12px rgba(0, 0, 0, 0.6),
        0 0 50px rgba(255, 255, 255, 0.12) inset,
        0 1px 0 rgba(255, 255, 255, 0.2) inset !important;
}

.gallery-item-hidden {
    display: none;
}

.gallery-item.revealed {
    display: block;
    /* Ensure it's block */
    opacity: 1 !important;
    /* Force visibility immediately */
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: 0s !important;
    /* No delay for revealed items */
}

/* Premium Collapse Animation */
.gallery-item-collapsing {
    animation: premiumCollapse 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOutScale {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

@keyframes premiumCollapse {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
        filter: blur(10px);
    }
}

/* Staggered Delays */
.gallery-item:nth-child(1) {
    animation-delay: 0.1s;
}

.gallery-item:nth-child(2) {
    animation-delay: 0.2s;
}

.gallery-item:nth-child(3) {
    animation-delay: 0.3s;
}

.gallery-item:nth-child(4) {
    animation-delay: 0.4s;
}

.gallery-item:nth-child(5) {
    animation-delay: 0.5s;
}

.gallery-item:nth-child(n+6) {
    animation-delay: 0.6s;
}

/* Responsive Design */

/* Tablet (Portrait) */
@media (max-width: 1199px) {
    .gallery-grid {
        grid-template-columns: repeat(6, 1fr);
        grid-auto-rows: 250px;
    }

    .gallery-item-video {
        grid-column: span 6;
        grid-row: span 2;
    }

    .gallery-item-large {
        grid-column: span 6;
        grid-row: span 2;
    }

    .gallery-item-medium {
        grid-column: span 3;
        grid-row: span 1;
    }

    .gallery-item-tall {
        grid-column: span 3;
        grid-row: span 2;
    }

    .gallery-item-wide {
        grid-column: span 6;
        grid-row: span 1;
    }

    .gallery-item {
        grid-column: span 2;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .section-title {
        font-size: 2.5rem;
    }

    .gallery-grid {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
        padding: 0 1rem;
    }

    .gallery-item {
        width: 100%;
        height: 300px;
        /* Fixed height for mobile uniformity */
    }

    .gallery-item-video,
    .gallery-item-large,
    .gallery-item-tall {
        height: 400px;
        /* Taller items on mobile */
    }

    /* Always show overlay on mobile or use a different interaction? 
       Let's keep hover/active for simplicity, or make it always visible gradient */
    .gallery-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 60%);
        padding: 1.5rem;
    }

    .gallery-info {
        opacity: 1;
        transform: translateY(0);
    }

    .gallery-view-btn {
        display: none;
        /* Hide button on mobile, tap image to open */
    }

    .gallery-title {
        font-size: 1.4rem;
    }

    /* Keep button smaller on mobile */
    .gallery-showless-btn {
        padding: 0.8rem 5rem;
        font-size: 0.95rem;
        border-radius: 32px;
    }
}

/* Lightbox Styles (Preserved/Refined) */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.98);
    /* Darker for premium feel */
    backdrop-filter: blur(20px);
    z-index: 10000;
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    align-items: center;
    justify-content: center;
}

.lightbox-modal.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.lightbox-modal.active .lightbox-content {
    transform: scale(1);
}

.lightbox-content img,
.lightbox-content video {
    max-width: 100%;
    max-height: 85vh;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 1rem;
    z-index: 10001;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    color: #fff;
    transform: scale(1.1);
}

.lightbox-close {
    top: 2rem;
    right: 2rem;
}

.lightbox-prev {
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-caption {
    position: absolute;
    bottom: -3rem;
    left: 0;
    right: 0;
    text-align: center;
    color: #fff;
}

.lightbox-caption h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    margin: 0;
}

/* Mobile Background Fix - Handled in ultra-premium.css now */
/* @media (max-width: 1024px) {
    .gallery-section {
        background-attachment: scroll !important;
        background-position: center center !important;
        background-size: cover !important;
    }
} */