.wrg-gallery {
    width: 100%;
}

.wrg-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.wrg-item {
    position: relative;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    overflow: hidden;
    cursor: pointer;
}

.wrg-ratio-1-1 .wrg-item { aspect-ratio: 1 / 1; }
.wrg-ratio-4-3 .wrg-item { aspect-ratio: 4 / 3; }
.wrg-ratio-3-2 .wrg-item { aspect-ratio: 3 / 2; }

.wrg-thumb {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform .3s ease;
}

.wrg-item:hover .wrg-thumb {
    transform: scale(1.025);
}

.wrg-item[hidden] {
    display: none !important;
}

.wrg-actions {
    margin-top: 18px;
    text-align: center;
}

.wrg-open-all {
    cursor: pointer;
}

.wrg-lightbox[hidden] {
    display: none !important;
}

.wrg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid;
    place-items: center;
}

.wrg-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .88);
}

.wrg-dialog {
    position: relative;
    z-index: 1;
    width: min(92vw, 1400px);
    height: min(90vh, 960px);
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 56px;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: center;
}

.wrg-stage {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.wrg-stage img {
    max-width: 100%;
    max-height: calc(90vh - 80px);
    width: auto;
    height: auto;
    object-fit: contain;
}

.wrg-stage figcaption {
    min-height: 24px;
    margin-top: 10px;
    color: #fff;
    text-align: center;
}

.wrg-close,
.wrg-nav {
    appearance: none;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    line-height: 1;
}

.wrg-close {
    position: absolute;
    top: -4px;
    right: 0;
    z-index: 3;
    font-size: 42px;
}

.wrg-nav {
    font-size: 58px;
    padding: 12px;
}

.wrg-prev { grid-column: 1; grid-row: 1; }
.wrg-next { grid-column: 3; grid-row: 1; }

.wrg-counter {
    grid-column: 1 / -1;
    grid-row: 2;
    color: #fff;
    text-align: center;
    padding-top: 8px;
}

body.wrg-no-scroll {
    overflow: hidden;
}

@media (max-width: 600px) {
    .wrg-grid {
        gap: 10px;
    }

    .wrg-dialog {
        width: 100vw;
        height: 100vh;
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        padding: 12px 0;
        box-sizing: border-box;
    }

    .wrg-stage img {
        max-height: calc(100vh - 110px);
    }

    .wrg-nav {
        font-size: 44px;
        padding: 4px;
    }

    .wrg-close {
        top: 10px;
        right: 14px;
    }
}
