/* === Galerie 3D - Styles généraux === */
.pg-gallery-grid:not(.pg-gallery-masonry) {
    display: grid;
    /* colonnes automatiques : min 200px, max 1fr */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* === Layout Masonry full width via Masonry.js === */
.pg-gallery-masonry {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
}

.pg-gallery-masonry .pg-gallery-item {
    /* Desktop : 3 colonnes (on retire le gap total de 2rem pour 3 items) */
    width: calc((100% - 2rem) / 3);
    margin-bottom: 1rem;
}

@media (max-width: 1024px) {
    .pg-gallery-masonry .pg-gallery-item {
        /* Tablette : 2 colonnes (gap 1rem) */
        width: calc((100% - 1rem) / 2);
    }
}

@media (max-width: 600px) {
    .pg-gallery-masonry .pg-gallery-item {
        /* Mobile : 1 colonne */
        width: 100%;
    }
}

/* === Styles communs aux items === */
.pg-gallery-item {
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.pg-gallery-item:hover {
    transform: scale(1.03);
}

.pg-gallery-img {
    width: 100%;
    height: auto;
    display: block;
}

/* === Caption overlay === */
.pg-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 0.5em 0.8em;
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.pg-gallery-item:hover .pg-caption {
    opacity: 1;
    transform: translateY(0);
}

/* === Lightbox === */
.pg-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);  /* <-- opacité du fond */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.pg-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.pg-lightbox img {
    max-width: 90%;
    max-height: 90%;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.pg-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
}

.pg-lightbox-link {
    position: absolute;
    bottom: 20px;
    right: 30px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 1.2rem;
    display: none;
    transition: background 0.3s ease, color 0.3s ease;
}

.pg-lightbox-link.visible {
    display: inline-block;
}

.pg-lightbox-link:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
}
