/* ===== Image gallery (Views/Partials/_Gallery.cshtml, js/lsg.widgets.js) ===== */

/* The picked image in a light frame (as the cards and tables) */
.lsg-gallery-main {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    padding: 8px;
    border: 1px solid var(--lsg-color-border);
    border-radius: 8px;
    background-color: var(--lsg-color-surface);
}

/* The picked image or video, in the gallery and fullscreen: fitted, never cropped (videos too, which the img rule misses) */
.lsg-gallery-media,
.lsg-gallery-full-media {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lsg-gallery-media {
    cursor: zoom-in;
}

video.lsg-gallery-media {
    cursor: auto;
}

.lsg-gallery-nav {
    position: absolute;
    top: 50%;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background-color: rgb(0 0 0 / 0.45);
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    transform: translateY(-50%);
}

.lsg-gallery-nav:hover {
    background-color: rgb(0 0 0 / 0.7);
}

.lsg-gallery-prev { left: 8px; }
.lsg-gallery-next { right: 8px; }

/* The thumbnails in a tray as wide as the picked image's frame (lined up on both sides), on the faded background:
   one row that scrolls sideways when there are more than fit (as on the live site) */
.lsg-gallery-thumbs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    margin-top: 12px;
    padding: 8px;
    border: 1px solid var(--lsg-color-border);
    border-radius: 8px;
    background-color: var(--lsg-color-surface-muted);
}

/* Every thumbnail framed light; the picked one in the accent (same width, so nothing moves) */
.lsg-gallery-thumb {
    flex: 0 0 auto;
    width: 80px;
    height: 80px;
    padding: 2px;
    border: 2px solid var(--lsg-color-border);
    border-radius: 6px;
    background-color: var(--lsg-color-surface);
}

.lsg-gallery-thumb:hover {
    border-color: var(--lsg-color-text-muted);
}

.lsg-gallery-thumb.active {
    border-color: var(--lsg-color-primary);
}

.lsg-gallery-thumb img,
.lsg-gallery-thumb video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Fullscreen: the picked image over a dark backdrop; a click on the backdrop closes it */
.lsg-gallery-full {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background-color: rgb(0 0 0 / 0.9);
}

.lsg-gallery-close {
    position: absolute;
    top: 12px;
    right: 16px;
    border: 0;
    background: none;
    color: #fff;
    font-size: 2.5rem;
    line-height: 1;
}
