/* =============================================
   Projects Gallery Lightbox — gallery.css v2
   ============================================= */

/* ── Overlay ── */
.pgl-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.93);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.pgl-overlay.pgl-active {
    opacity: 1;
    pointer-events: all;
}

/* ── Lightbox container ── */
.pgl-lightbox {
    position: relative;
    width: 92vw;
    max-width: 980px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    outline: none;
}

/* ── Close button ── */
.pgl-close {
    position: fixed;
    top: 18px;
    right: 22px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 100001;
    padding: 0;
}
.pgl-close:hover { background: rgba(255,255,255,0.22); }

/* ── Stage ── */
.pgl-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #0d0d0d;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Image ── */
.pgl-img-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
#pgl-main-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    transition: opacity 0.22s ease, transform 0.25s ease;
    user-select: none;
    -webkit-user-drag: none;
}
#pgl-main-img.pgl-fade-out {
    opacity: 0;
    transform: scale(0.97);
}

/* ── Arrows ── */
.pgl-prev,
.pgl-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.42);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 3;
    padding: 0;
}
.pgl-prev { left: 14px; }
.pgl-next { right: 14px; }
.pgl-prev:hover,
.pgl-next:hover { background: rgba(0,0,0,0.75); }
.pgl-prev:active { transform: translateY(-50%) translateX(-2px); }
.pgl-next:active { transform: translateY(-50%) translateX(2px); }

/* ── Spinner ── */
.pgl-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 5;
}
.pgl-spinner.pgl-spinner-active {
    opacity: 1;
    pointer-events: all;
}
.pgl-spin {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pgl-rotate 0.7s linear infinite;
}
@keyframes pgl-rotate {
    to { transform: rotate(360deg); }
}

/* ── Meta row ── */
.pgl-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 4px;
    min-height: 20px;
}
.pgl-caption {
    font-size: 13px;
    color: rgba(255,255,255,0.72);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pgl-counter {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.06em;
    flex-shrink: 0;
    margin-left: 12px;
}

/* ── Thumbnail strip ── */
.pgl-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    max-width: 100%;
    padding: 2px 2px 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.18) transparent;
}
.pgl-thumbs::-webkit-scrollbar { height: 4px; }
.pgl-thumbs::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 2px; }

.pgl-thumb {
    flex-shrink: 0;
    width: 62px;
    height: 44px;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.5;
    transition: border-color 0.18s, opacity 0.18s;
}
.pgl-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.pgl-thumb.pgl-thumb-active {
    border-color: #fff;
    opacity: 1;
}
.pgl-thumb:hover { opacity: 0.85; }

/* ── Elementor Icon Widget cursor hint ── */
.pgl-gallery-icon {
    cursor: pointer !important;
}

/* ── Mobile ── */
@media (max-width: 600px) {
    .pgl-stage { aspect-ratio: 4 / 3; }
    .pgl-prev, .pgl-next { width: 38px; height: 38px; }
    .pgl-thumb { width: 50px; height: 36px; }
}

/* ── Error message inside lightbox ── */
.pgl-error-msg {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    color: rgba(255,255,255,0.75);
    font-size: 14px;
    padding: 24px;
    line-height: 1.6;
    z-index: 6;
}
.pgl-error-msg.pgl-error-active {
    display: flex;
}
.pgl-error-msg small {
    display: block;
    margin-top: 8px;
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    font-family: monospace;
}
