.gallery-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
}

.gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gallery-item {
    flex: 1 1 200px;
    max-height: 200px;
    overflow: hidden;
    border-radius: 6px;
    transition: transform 0.3s ease;
    position: relative; /* &#128072; necessario per caption */
}

.gallery-item img {
    width: 100%; /* &#128072; FIX */
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-item img:hover {
    transform: scale(1.05);
      cursor: pointer;
}

/* =========================
   CAPTION TESTO
========================= */
.caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;

    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: #fff;

    padding: 8px;
    font-size: 14px;
    text-align: center;

    text-shadow: 0 1px 3px rgba(0,0,0,0.8);

    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Mostra caption al passaggio */
.gallery-item:hover .caption {
    opacity: 1;
}

/* =========================
   PAGINAZIONE
========================= */
.page {
    display: inline-block;
    padding: 6px 10px;
    margin: 2px;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
    font-size: 14px;
}

.page:hover {
    background: #f2f2f2;
    border-color: #aaa;
   
}

.page.current {
    background: #333;
    color: #fff;
    border-color: #333;
    font-weight: bold;
}

.pagination {
    text-align: center;
    margin-top: 20px;
}










.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: rgba(0,0,0,0.9);
}

.lightbox-content {
    display: block;
    max-width: 90%;
    max-height: 90%;
    margin: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: #fff;
    cursor: pointer;
}

.nav {
    position: absolute;
    top: 50%;
    font-size: 50px;
    color: #fff;
    cursor: pointer;
    user-select: none;
    padding: 10px;
    transform: translateY(-50%);
}

.prev { left: 20px; }
.next { right: 20px; }



.lightbox-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;

    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: #fff;

    padding: 15px;
    font-size: 16px;
    text-align: center;

    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Mobile */
@media (max-width: 768px) {
    .gallery-item {
        flex: 1 1 300px;
        max-height: 300px;
    }
}
