.sg-gallery {
    max-width: 800px;
    margin: 1.5em auto;
}

/* Scene principale */
.sg-stage {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    line-height: 0;
    aspect-ratio: 3 / 2; /* hauteur constante quelle que soit l'orientation */
}
.sg-stage .sg-main {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain; /* photo entiere, centree, sans deformation ni recadrage */
    margin: 0 auto;
    cursor: zoom-in;
}
/* Repli pour les navigateurs sans aspect-ratio */
@supports not (aspect-ratio: 1 / 1) {
    .sg-stage { height: 520px; }
}
.sg-stage .sg-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .45);
    color: #fff;
    font-size: 28px;
    line-height: 44px;
    text-align: center;
    cursor: pointer;
    z-index: 2;
}
.sg-stage .sg-nav:hover {
    background: rgba(0, 0, 0, .75);
}
.sg-stage .sg-prev { left: 10px; }
.sg-stage .sg-next { right: 10px; }

/* Miniatures */
.sg-thumbs {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin: 10px 0 0;
    padding: 4px 0;
    list-style: none;
    overflow-x: auto;
}
.sg-thumb {
    flex: 0 0 auto;
    width: 80px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    opacity: .55;
    border: 2px solid transparent;
    transition: opacity .2s ease, border-color .2s ease;
}
.sg-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.sg-thumb:hover { opacity: .85; }
.sg-thumb.is-active {
    opacity: 1;
    border-color: #333;
}

/* Lightbox */
.sg-lightbox {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, .9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}
.sg-lightbox.is-open { display: flex; }
.sg-lightbox img {
    max-width: 92vw;
    max-height: 92vh;
}
.sg-lightbox .sg-close {
    position: absolute;
    top: 16px;
    right: 24px;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    line-height: 1;
}
.sg-lightbox .sg-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 48px;
    cursor: pointer;
    padding: 0 18px;
    -webkit-user-select: none;
    user-select: none;
}
.sg-lightbox .sg-lb-prev { left: 8px; }
.sg-lightbox .sg-lb-next { right: 8px; }
