/* === Art Gallery Lightbox v1.3 (Blocksy-safe) === */

.agl-wrap {
    --agl-columns: 4;
    --agl-gap: 12px;
    --agl-radius: 0px;
    display: block;
    margin: 1.5em 0;
}

.agl-grid {
    display: grid !important;
    grid-template-columns: repeat(var(--agl-columns), 1fr) !important;
    gap: var(--agl-gap) !important;
}

@media (max-width: 768px) {
    .agl-grid {
        grid-template-columns: repeat(min(var(--agl-columns), 2), 1fr) !important;
    }
}
@media (max-width: 480px) {
    .agl-grid {
        grid-template-columns: 1fr !important;
    }
}

.agl-item {
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    display: block;
    width: 100%;
}
.agl-blur-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f0f0f0;
    line-height: 0;
}
.agl-tiny {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(12px);
    transform: scale(1.1);
    transition: opacity .5s ease;
    z-index: 1;
}
.agl-img {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .4s ease;
    z-index: 2;
}
.agl-img.agl-loaded { opacity: 1; }

/* Lightbox */
.agl-lightbox {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(0,0,0,.92);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease; touch-action: none;
}
.agl-lightbox.agl-open { opacity: 1; pointer-events: auto; }
.agl-lb-stage {
    flex: 1 1 auto; display: flex; align-items: center; justify-content: center;
    width: 100%; position: relative; overflow: hidden;
}
.agl-lb-img-wrap {
    position: relative; max-width: 90vw; max-height: 80vh;
    transition: transform .15s ease, opacity .25s ease; will-change: transform, opacity;
}
.agl-lb-img-wrap.agl-dragging { transition: none; }
.agl-lb-img {
    max-width: 90vw; max-height: 80vh; object-fit: contain; border-radius: 4px;
    display: block; opacity: 0; transition: opacity .35s ease;
}
.agl-lb-img.agl-shown { opacity: 1; }
.agl-lb-blur {
    position: absolute; inset: 0; filter: blur(20px); transform: scale(1.1);
    opacity: 0; transition: opacity .35s ease; z-index: -1;
}
.agl-lb-blur.agl-active { opacity: .6; }
.agl-lb-arrow {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 48px; height: 48px; border: none; border-radius: 3px;
    background: rgba(255,255,255,.15); color: #fff; font-size: 22px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    z-index: 10; transition: background .2s; user-select: none;
}
.agl-lb-arrow:hover { background: rgba(255,255,255,.3); }
.agl-lb-prev { left: 16px; }
.agl-lb-next { right: 16px; }
.agl-lb-close {
    position: absolute; top: 16px; right: 16px; width: 44px; height: 44px;
    border: none; border-radius: 3px; background: rgba(255,255,255,.15);
    color: #fff; font-size: 24px; cursor: pointer; z-index: 11;
    display: flex; align-items: center; justify-content: center; transition: background .2s;
}
.agl-lb-close:hover { background: rgba(255,255,255,.3); }
.agl-lb-caption { color: #ccc; font-size: 14px; text-align: center; padding: 8px 16px; min-height: 20px; }
.agl-lb-thumbs {
    display: flex; gap: 6px; padding: 10px 16px 16px;
    overflow-x: auto; max-width: 100%;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent;
}
.agl-lb-thumbs::-webkit-scrollbar { height: 6px; }
.agl-lb-thumbs::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 3px; }
.agl-lb-thumb {
    flex: 0 0 auto; width: 60px; height: 60px; border-radius: 4px; overflow: hidden;
    border: 2px solid transparent; cursor: pointer; opacity: .5;
    transition: opacity .2s, border-color .2s; background: none; padding: 0;
}
.agl-lb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.agl-lb-thumb:hover { opacity: .8; }
.agl-lb-thumb.agl-active { opacity: 1; border-color: #fff; }
