/* Image Atlas — galleries and the image viewer. Colours inherit from the theme. */

.imgatlas-gallery { margin: 2em 0; }

.imgatlas-g {
    --imgatlas-gap: 8px;
    display: grid;
    grid-template-columns: repeat(var(--imgatlas-cols, 3), minmax(0, 1fr));
    gap: var(--imgatlas-gap);
    margin: 0;
    padding: 0;
}
@media (max-width: 600px) {
    .imgatlas-g { grid-template-columns: repeat(var(--imgatlas-cols-sm, 2), minmax(0, 1fr)); }
}

.imgatlas-g__item { position: relative; min-width: 0; margin: 0; padding: 0; }
.imgatlas-g__link { display: block; cursor: zoom-in; border-radius: inherit; }
.imgatlas-g__link:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.imgatlas-g__item img {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    margin: 0;
    border-radius: 2px;
}
.imgatlas-g--grid .imgatlas-g__item img {
    aspect-ratio: var(--imgatlas-shape, 3 / 2);
    object-fit: cover;
}
.imgatlas-g__caption { margin: .4em 0 0; font-size: .85em; line-height: 1.4; }
.imgatlas-g__caption .imgatlas-credit { display: block; font-size: .9em; opacity: .75; }
.imgatlas-g__text + .imgatlas-credit { margin-top: .15em; }

/* ---------- Image viewer ---------- */

.imgatlas-lb {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(10, 10, 10, .94);
    color: #f2f2f2;
    overflow: hidden;
}
.imgatlas-lb::backdrop { background: rgba(10, 10, 10, .94); }
.imgatlas-lb[open] { display: flex; flex-direction: column; }
.imgatlas-lb:focus { outline: none; }
html.imgatlas-lb-open { overflow: hidden; }

.imgatlas-lb__stage {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 64px 8px;
    touch-action: pan-y;
}
.imgatlas-lb__img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    transition: opacity .15s;
}
.imgatlas-lb__img.is-loading { opacity: .35; }

.imgatlas-lb__bar {
    flex: 0 0 auto;
    display: flex;
    gap: 1em;
    align-items: flex-start;
    justify-content: space-between;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 10px 20px 18px;
    box-sizing: border-box;
    font-size: 15px;
    line-height: 1.45;
}
.imgatlas-lb__text { flex: 1 1 auto; min-width: 0; }
.imgatlas-lb__text .imgatlas-g__text { display: block; }
.imgatlas-lb__text .imgatlas-credit { display: block; margin-top: .2em; font-size: .85em; opacity: .75; }
.imgatlas-lb__text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.imgatlas-lb__count { flex: 0 0 auto; opacity: .7; font-variant-numeric: tabular-nums; white-space: nowrap; }

.imgatlas-lb__btn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font: 400 28px/1 system-ui, sans-serif;
    cursor: pointer;
}
.imgatlas-lb__btn:hover { background: rgba(255, 255, 255, .22); }
.imgatlas-lb__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.imgatlas-lb__btn[hidden] { display: none; }
.imgatlas-lb__close { top: 8px; right: 10px; }
.imgatlas-lb__prev { left: 10px; top: 50%; transform: translateY(-50%); }
.imgatlas-lb__next { right: 10px; top: 50%; transform: translateY(-50%); }

@media (max-width: 600px) {
    .imgatlas-lb__stage { padding: 52px 0 4px; }
    .imgatlas-lb__prev, .imgatlas-lb__next { top: auto; bottom: 14px; transform: none; background: rgba(255, 255, 255, .16); }
    .imgatlas-lb__bar { padding: 8px 16px 70px; }
}
@media (prefers-reduced-motion: reduce) {
    .imgatlas-lb__img { transition: none; }
}
