/* LBG Frontend CSS - Luxury Bento Design */

.lbg-bento-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 250px;
    grid-auto-flow: dense;
    /* Fill the gaps */
    gap: 16px;
    width: 100%;
    margin: 40px 0;
    padding: 0;
    list-style: none;
}

@media (max-width: 1024px) {
    .lbg-bento-gallery {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 220px;
    }
}

@media (max-width: 768px) {
    .lbg-bento-gallery {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 200px;
    }
}

@media (max-width: 480px) {
    .lbg-bento-gallery {
        grid-template-columns: 1fr;
        grid-auto-rows: 250px;
    }
}

.lbg-item {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    background: #111;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    text-decoration: none !important;
    outline: none !important;

    /* Animation initial state */
    opacity: 0;
    transform: translateY(30px) scale(0.98);
    transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.lbg-item.lbg-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.lbg-item img {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    object-position: center 25%;
    /* Mantiene las caras a la vista evitando recortes severos */
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1), filter 0.5s ease;
    display: block;
}

.lbg-item .lbg-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    padding: 20px;
}

.lbg-item-title {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
    margin: 0;
    transform: translateY(10px);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
    font-family: inherit;
    line-height: 1.2;
}

.lbg-item:hover img {
    transform: scale(1.08);
}

.lbg-item:hover .lbg-overlay {
    opacity: 1;
}

.lbg-item:hover .lbg-item-title {
    transform: translateY(0);
    opacity: 1;
    transition-delay: 0.1s;
}

/* Lógica de diseño Bento más simétrica y organizada - sin columnas altas 1x2 que cortan imágenes horizontales */
/* Bloque izquierdo grande */
.lbg-bento-gallery .lbg-item:nth-child(8n + 1) {
    grid-column: span 2;
    grid-row: span 2;
}

.lbg-bento-gallery .lbg-item:nth-child(8n + 4) {
    grid-column: span 2;
}

/* Bloque derecho grande (alternancia para evitar desorden visual) */
.lbg-bento-gallery .lbg-item:nth-child(8n + 7) {
    grid-column: span 2;
    grid-row: span 2;
}

.lbg-bento-gallery .lbg-item:nth-child(8n + 8) {
    grid-column: span 2;
}

/* Ajustes responsivos para la lógica Bento */
@media (max-width: 768px) {
    .lbg-bento-gallery .lbg-item:nth-child(n) {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
    }

    /* En móviles (2 columnas), cada tercer elemento toma las 2 columnas para verse limpio */
    .lbg-bento-gallery .lbg-item:nth-child(3n + 1) {
        grid-column: span 2 !important;
        grid-row: span 2 !important;
    }
}

@media (max-width: 480px) {
    .lbg-bento-gallery .lbg-item:nth-child(n) {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
    }
}


/* LIGHTBOX LUXURY STYLES (No info displayed, just image) */
.lbg-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.98);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.lbg-lightbox.lbg-active {
    opacity: 1;
    pointer-events: all;
}

.lbg-lightbox-img-wrapper {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
}

.lbg-lightbox img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    transform: scale(0.95);
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
    opacity: 0;
}

.lbg-lightbox.lbg-active img {
    transform: scale(1);
    opacity: 1;
}

.lbg-lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 50px;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    transition: color 0.3s, transform 0.3s;
}

.lbg-lightbox-close:hover {
    color: #fff;
    transform: scale(1.1);
}

.lbg-lightbox-prev,
.lbg-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 40px;
    cursor: pointer;
    padding: 30px;
    user-select: none;
    transition: color 0.3s, transform 0.3s;
    z-index: 10;
}

.lbg-lightbox-prev:hover,
.lbg-lightbox-next:hover {
    color: #fff;
}

.lbg-lightbox-prev {
    left: 20px;
}

.lbg-lightbox-next {
    right: 20px;
}

@media (max-width: 768px) {

    .lbg-lightbox-prev,
    .lbg-lightbox-next {
        font-size: 24px;
        padding: 15px;
    }

    .lbg-lightbox-close {
        top: 15px;
        right: 20px;
        font-size: 40px;
    }
}

/* Lightbox Caption Styles */
.lbg-lightbox-caption {
    position: absolute;
    bottom: -80px;
    left: 0;
    right: 0;
    text-align: center;
    padding: 30px 24px 24px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.6) 60%, rgba(0, 0, 0, 0) 100%);
    border-radius: 0 0 8px 8px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}

.lbg-lightbox-caption.lbg-caption-active {
    bottom: 0px;
    opacity: 1;
    transform: translateY(0);
}

.lbg-lightbox-title {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    font-family: inherit;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1) 0.1s;
}

.lbg-lightbox-subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.05rem;
    font-weight: 300;
    margin: 0;
    font-family: inherit;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1) 0.25s;
}

.lbg-lightbox-caption.lbg-caption-active .lbg-lightbox-title,
.lbg-lightbox-caption.lbg-caption-active .lbg-lightbox-subtitle {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .lbg-lightbox-title {
        font-size: 1.25rem;
    }

    .lbg-lightbox-subtitle {
        font-size: 0.95rem;
    }
}