/**
 * VCN Fountain Gallery CSS
 * Springbrunnen-Animation, Justified Row Layout, 3D-Hover, Lightbox
 */

/* ================================================================
   Container
   ================================================================ */
.vcn-fountain-gallery {
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    /* max-height is set via Elementor selector */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.25) transparent;
}

.vcn-fountain-gallery::-webkit-scrollbar {
    width: 6px;
}
.vcn-fountain-gallery::-webkit-scrollbar-track {
    background: transparent;
}
.vcn-fountain-gallery::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.25);
    border-radius: 3px;
}

/* ================================================================
   Justified Flex Layout  (Google Photos / Flickr style)
   ================================================================ */
.vcn-fountain-grid {
    display: flex;
    flex-wrap: wrap;
    /* gap is set via Elementor selector */
    perspective: 1200px;
}

/* Last row: don't stretch items to fill */
.vcn-fountain-grid::after {
    content: '';
    flex-grow: 999;
}

/* ================================================================
   Individual Image Item
   ================================================================ */
.vcn-fountain-item {
    /* flex-grow is set dynamically by JS based on aspect ratio */
    /* flex-basis is set dynamically by JS */
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    will-change: transform, opacity;
    /* border-radius is set via Elementor selector */
    /* margin (gap) is set via Elementor selector */

    /* ── Fountain starting state ─────────────────── */
    opacity: 0;
    transform: scale(0.15) rotate3d(1, 1, 0, 60deg);
}

/* ── Fountain end state (JS adds this class) ──── */
.vcn-fountain-item.is-sprung {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1) rotate3d(0, 0, 0, 0deg);
    transition:
        opacity   var(--vcn-fg-duration, 800ms) cubic-bezier(0.34, 1.56, 0.64, 1),
        transform var(--vcn-fg-duration, 800ms) cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── 3D hover tilt (overridden by JS mousemove) ── */
.vcn-fountain-item.is-sprung:hover {
    z-index: 10;
}

.vcn-fountain-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.vcn-fountain-item:hover img {
    filter: brightness(1.08) contrast(1.02);
}

/* ================================================================
   Lightbox
   ================================================================ */
.vcn-fg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vcn-fg-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(28px) saturate(120%);
    -webkit-backdrop-filter: blur(28px) saturate(120%);
}

.vcn-fg-lightbox-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 40px;
}

.vcn-fg-lightbox-content img {
    max-width: 90vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    user-select: none;
    animation: vcnFgLightboxIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes vcnFgLightboxIn {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.vcn-fg-lightbox-close {
    position: absolute;
    top: 16px;
    right: 24px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s ease, transform 0.2s ease;
    line-height: 1;
}
.vcn-fg-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

/* Nav Buttons */
.vcn-fg-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 22px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s ease, transform 0.2s ease;
}
.vcn-fg-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
}
.vcn-fg-prev {
    left: 24px;
}
.vcn-fg-next {
    right: 24px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .vcn-fg-lightbox-content {
        padding: 16px;
    }
    .vcn-fg-lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    .vcn-fg-prev { left: 8px; }
    .vcn-fg-next { right: 8px; }
    .vcn-fg-lightbox-close {
        top: 10px;
        right: 12px;
    }
}
