/**
 * Component: Scoped Property Gallery Bento Matrix & Lightbox Overlay
 * Architecture: Clean Mediterranean Token Integration & Responsive Mobile Lightbox
 */

.bv-comp-gallery-container {
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 32px 0;
}

.bv-comp-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.bv-comp-gallery-tile {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-card, 12px);
    border: 1px solid rgba(2, 48, 71, 0.12);
    cursor: pointer;
    background: #023047;
    width: 100%;
    height: 100%;
}

.bv-comp-gallery-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.bv-comp-gallery-tile:hover img {
    transform: scale(1.04);
}

/* Desktop Grid Layout */
@media (min-width: 992px) {
    .bv-comp-gallery-grid {
        grid-template-rows: repeat(2, 240px);
    }
    .bv-comp-gallery-tile[data-node="hero"] {
        grid-column: span 2;
        grid-row: span 2;
    }
    .bv-comp-gallery-tile[data-node="sub"] {
        grid-column: span 1;
        grid-row: span 1;
    }
}

/* Tablet Grid Layout */
@media (max-width: 991px) and (min-width: 601px) {
    .bv-comp-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 180px);
    }
    .bv-comp-gallery-tile[data-node="hero"] {
        grid-column: span 2;
        grid-row: span 2;
    }
    .bv-comp-gallery-tile[data-node="sub"] {
        grid-column: span 1;
        grid-row: span 1;
    }
}

/* Mobile Hero Grid Card */
@media (max-width: 600px) {
    .bv-comp-gallery-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 0;
    }

    .bv-comp-gallery-tile[data-node="sub"] {
        display: none;
    }

    .bv-comp-gallery-tile[data-node="hero"] {
        grid-column: span 1;
        height: 280px;
        border-radius: var(--radius-card, 12px);
    }

    .bv-comp-gallery-tile[data-node="hero"]::after {
        content: "Tap para ver todas las fotos";
        position: absolute;
        bottom: 14px;
        right: 14px;
        background: rgba(2, 48, 71, 0.88);
        color: #FFFFFF;
        font-family: var(--font-ui, "Albert Sans", sans-serif);
        font-size: 11px;
        font-weight: 700;
        padding: 8px 14px;
        border-radius: 20px;
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
}

.bv-gallery-more-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 48, 71, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-family: var(--font-ui, "Albert Sans", sans-serif);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

/* Global Lightbox Modal Overlay */
.bv-comp-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(2, 48, 71, 0.96);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.bv-comp-lightbox-stage {
    width: 85%;
    height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bv-comp-lightbox-stage img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    border-radius: 4px;
}

.bv-comp-lightbox-ctrl {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.bv-comp-lightbox-ctrl:hover {
    background: #ffb703;
    border-color: #ffb703;
    color: #023047;
}

.bv-comp-lightbox-close {
    top: 24px;
    right: 24px;
    font-size: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.bv-comp-lightbox-arrow {
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    font-size: 20px;
}

.bv-comp-lightbox-arrow--left { left: 24px; }
.bv-comp-lightbox-arrow--right { right: 24px; }

.bv-comp-lightbox-counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-family: var(--font-ui, "Albert Sans", sans-serif);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.05em;
}

.bv-comp-gallery__fallback {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #023047;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8ecae6;
    font-weight: 700;
    border-radius: 12px;
    letter-spacing: 0.1em;
}

/* Mobile Lightbox Responsive Overrides */
@media (max-width: 768px) {
    .bv-comp-lightbox-stage {
        width: 100%;
        height: 85vh;
        padding: 0 4px;
    }

    .bv-comp-lightbox-stage img {
        width: 100%;
        max-width: 100%;
        max-height: 80vh;
        object-fit: contain;
    }

    .bv-comp-lightbox-close {
        top: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
        font-size: 22px;
        background: rgba(2, 48, 71, 0.85);
        border-color: rgba(255, 255, 255, 0.25);
    }

    .bv-comp-lightbox-arrow {
        width: 44px;
        height: 44px;
        font-size: 18px;
        background: rgba(2, 48, 71, 0.85);
        border-color: rgba(255, 255, 255, 0.25);
    }

    .bv-comp-lightbox-arrow--left {
        left: 10px;
    }

    .bv-comp-lightbox-arrow--right {
        right: 10px;
    }

    .bv-comp-lightbox-counter {
        bottom: 20px;
        font-size: 13px;
        background: rgba(2, 48, 71, 0.85);
        padding: 4px 12px;
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.15);
    }
}