/* --- FRONTEND STYLES --- */
.bento-grid-wrapper { margin-bottom: 2em; position: relative; width: 100%; }

.bento-grid-container { 
    display: grid; gap: 8px; width: 100%; 
    height: var(--bento-desk-height, 500px); 
}

.bento-grid-wrapper.is-landscape .bento-grid-container { grid-template-columns: 2fr repeat(calc(var(--bento-desk-cols, 3) - 1), 1fr); grid-template-rows: 1fr 1fr; }
.bento-grid-wrapper.is-portrait .bento-grid-container { grid-template-columns: 1.2fr repeat(calc(var(--bento-desk-cols, 3) - 1), 1fr); grid-template-rows: 1fr 1fr; }

.gallery-item { position: relative; display: block; overflow: hidden; width: 100%; height: 100%; background: #f0f0f0; border-radius: 8px; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; display: block; }
.gallery-item:hover img { transform: scale(1.05); }

.item-1 { grid-column: 1 / 2; grid-row: 1 / 3; }

/* Overlay Visibilità */
.hide-on-desktop { display: none !important; }
.mobile-overlay { display: none !important; }
.desktop-overlay { display: flex; }

.view-more-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.2); justify-content: flex-end; align-items: flex-end; padding: 10px; transition: background 0.3s; }
.view-more-btn { background: white; color: #333; padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,0.2); cursor: pointer; white-space: nowrap; }
.view-more-btn span.dashicons { font-size: 16px; width: 16px; height: 16px; margin-right: 5px; margin-top: 1px; }

/* --- MOBILE LAYOUT --- */
@media (max-width: 768px) {
    .hide-on-desktop { display: block !important; }
    .hide-on-mobile { display: none !important; }
    .mobile-overlay { display: flex !important; }
    .desktop-overlay { display: none !important; }

    .bento-grid-container { 
        grid-template-columns: repeat(4, 1fr) !important; 
        grid-template-rows: auto auto !important; 
        gap: 5px !important; 
        height: auto !important; 
    }

    .gallery-item { border-radius: 0 !important; width: 100% !important; height: auto !important; grid-column: auto; grid-row: auto; }

    .item-1 { grid-column: 1 / -1 !important; grid-row: 1 !important; height: 250px !important; border-top-left-radius: 8px !important; border-top-right-radius: 8px !important; }
    
    .gallery-item:not(.item-1) { aspect-ratio: 1 / 1 !important; height: auto !important; }

    .gallery-item:nth-child(2) { border-bottom-left-radius: 8px !important; }
    .gallery-item:nth-child(5), .gallery-item:last-child { border-bottom-right-radius: 8px !important; }

    .view-more-overlay { justify-content: center !important; align-items: center !important; background: rgba(0,0,0,0.4) !important; padding: 0 !important; }
    .view-more-btn { font-size: 9px !important; padding: 4px 6px !important; width: auto !important; max-width: 95%; }
    .view-more-btn span.dashicons { font-size: 10px !important; width: 10px !important; height: 10px !important; margin-right: 2px !important; }
}

/* --- LIGHTBOX STYLES --- */
.bento-lightbox { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.95); z-index: 99999; display: flex; flex-direction: column; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; overscroll-behavior: none; }
.bento-lightbox.active { opacity: 1; pointer-events: auto; }
.bento-lightbox-content { position: relative; width: 100%; height: calc(100vh - 100px); display: flex; justify-content: center; align-items: center; margin: 0; padding: 0; touch-action: pan-y; }
.bento-lightbox img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; box-shadow: 0 0 20px rgba(0,0,0,0.5); }
.bento-lightbox-close { position: absolute; top: 20px; right: 30px; color: white; font-size: 40px; cursor: pointer; z-index: 1002; }
.bento-lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); color: white; font-size: 50px; cursor: pointer; padding: 20px; z-index: 1002; }
.bento-nav-prev { left: 10px; }
.bento-nav-next { right: 10px; }

.bento-lightbox-thumbs { height: 90px; width: 100%; display: flex; justify-content: center; gap: 10px; overflow-x: auto; overflow-y: hidden; touch-action: pan-x; overscroll-behavior-x: contain; z-index: 1002; padding: 10px 0; box-sizing: border-box; flex-shrink: 0; scrollbar-width: none !important; -ms-overflow-style: none !important; }
.bento-lightbox-thumbs::-webkit-scrollbar { display: none !important; width: 0 !important; height: 0 !important; }
.bento-lightbox-thumbs::-webkit-scrollbar-track { background: transparent !important; }
.bento-lightbox-thumbs::-webkit-scrollbar-thumb { background: transparent !important; border: none !important; }
.bento-thumb-item { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; cursor: pointer; opacity: 0.5; transition: opacity 0.2s, transform 0.2s; border: 2px solid transparent; box-sizing: content-box; flex-shrink: 0; }
.bento-thumb-item:hover { opacity: 1; transform: scale(1.05); }
.bento-thumb-item.active { opacity: 1; border-color: #fff; transform: scale(1.1); box-shadow: 0 0 10px rgba(0,0,0,0.5); }

@media (max-width: 768px) {
    .bento-lightbox { justify-content: flex-end; padding-bottom: 20px; }
    .bento-lightbox-content { flex: 1; height: auto; width: 100%; margin-bottom: 10px; touch-action: pan-y; }
    .bento-lightbox-thumbs { justify-content: flex-start; height: 70px; gap: 5px; width: 96%; margin: 0 auto; padding: 0; }
    .bento-thumb-item { flex: 0 0 calc(25% - 5px); width: calc(25% - 5px); height: 60px; border-radius: 2px; }
    .bento-lightbox-nav { font-size: 30px; padding: 10px; } 
}