.aprg-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 1em 0;
}

.aprg-grid a {
    /* exact width/height are assigned by JS (justified layout), so each
       row fills the full container width with equal row heights. */
    position: relative;
    flex: 0 0 auto;
    line-height: 0;
    cursor: pointer;
    overflow: hidden;
}

.aprg-grid img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity .2s;
}

.aprg-cap {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px 8px 6px;
    font-size: 13px;
    line-height: 1.25;
    color: #fff;
    background: linear-gradient(transparent, rgba(0, 0, 0, .72));
    pointer-events: none;
}

.aprg-more {
    display: inline-flex;
    align-items: center;
    margin: 10px auto 5px;
    padding: 8px 20px;
    font-size: 20px;
    line-height: 1;
    color: #fff;
    background: #444;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: background .2s;
}

/* the button sits centered on its own line */
.aprg-grid + .aprg-more {
    display: flex;
    width: -moz-fit-content;
    width: fit-content;
}

.aprg-more:hover {
    background: #222;
}

.aprg-grid a:hover img {
    opacity: .8;
}

/* ---------- lightbox ---------- */

/* reset global template button styles that bleed into lightbox controls */
.aprg-lb button,
.aprg-lb button:hover,
.aprg-lb button:focus {
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    margin: 0;
    display: block;
    background: none;
    background-image: none;
    line-height: normal;
}

.aprg-lb {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .92);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, visibility .25s;
}

.aprg-lb.is-open {
    opacity: 1;
    visibility: visible;
}

.aprg-lb img {
    max-width: 90vw;
    max-height: 88vh;
    object-fit: contain;
    user-select: none;
    -webkit-user-select: none;
    transition: opacity .2s;
}

.aprg-lb img.is-loading {
    opacity: 0;
}

.aprg-lb-close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    color: #fff;
    font-size: 32px;
    line-height: 40px;
    text-align: center;
    cursor: pointer;
    opacity: .7;
    transition: opacity .2s;
    z-index: 2;
}

.aprg-lb-close:hover {
    opacity: 1;
}

.aprg-lb-prev,
.aprg-lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 64px;
    border: none;
    background: rgba(0, 0, 0, .35);
    color: #fff;
    font-size: 28px;
    line-height: 64px;
    text-align: center;
    cursor: pointer;
    opacity: .7;
    transition: opacity .2s;
    z-index: 2;
    border-radius: 4px;
}

.aprg-lb-prev { left: 12px; }
.aprg-lb-next { right: 12px; }

.aprg-lb-prev:hover,
.aprg-lb-next:hover {
    opacity: 1;
}

.aprg-lb-counter {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, .7);
    font-size: 14px;
    z-index: 2;
}

.aprg-lb-title {
    position: absolute;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, .85);
    font-size: 15px;
    max-width: 80vw;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 2;
}
