/* ============================================================
   LIGHTBOX — corrected for mobile (arrows always on top)
   ============================================================ */

.sgc-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10, 31, 68, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 40px;
    animation: sgcFadeIn .3s ease;
}
.sgc-lightbox.open { display: flex; }

@keyframes sgcFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ---- Image container ---- */
.sgc-lb-content {
    position: relative;
    max-width: 92vw;
    max-height: 88vh;
    text-align: center;
    /* NEW: ensure image never bleeds over the arrows */
    z-index: 1;
}

.sgc-lb-img {
    display: block;
    max-width: 100%;
    max-height: 88vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    animation: sgcZoomIn .35s ease;
    /* NEW: image itself must never cover the arrows */
    position: relative;
    z-index: 1;
    pointer-events: none;   /* so taps fall through to the backdrop, not the image */
}

@keyframes sgcZoomIn {
    from { transform: scale(.92); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

/* ---- Close / Prev / Next buttons ---- */
.sgc-lb-close,
.sgc-lb-prev,
.sgc-lb-next {
    position: fixed;                 /* ← was absolute; fixed keeps them on screen */
    background: rgba(255, 255, 255, 0.18);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: background .25s, border-color .25s, transform .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    /* NEW: arrows sit ABOVE the image */
    z-index: 100001;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.sgc-lb-close {
    top: 24px;
    right: 24px;
    width: 46px;
    height: 46px;
    font-size: 26px;
    line-height: 1;
}

.sgc-lb-prev,
.sgc-lb-next {
    top: 50%;
    transform: translateY(-50%);
    width: 54px;
    height: 54px;
    font-size: 30px;
}
.sgc-lb-prev { left: 20px; }
.sgc-lb-next { right: 20px; }

.sgc-lb-close:hover,
.sgc-lb-prev:hover,
.sgc-lb-next:hover {
    background: #C9A227;
    border-color: #C9A227;
    color: #0A1F44;
}

.sgc-lb-prev:active,
.sgc-lb-next:active,
.sgc-lb-close:active {
    transform: translateY(-50%) scale(0.92);
}
.sgc-lb-close:active {
    transform: scale(0.92);
}

/* ---- Counter ---- */
.sgc-lb-counter {
    color: #C9A227;
    margin-top: 16px;
    font-size: 14px;
    letter-spacing: 2px;
    position: relative;
    z-index: 2;
}

/* ============================================================
   MOBILE — big, accessible, always on top
   ============================================================ */
@media (max-width: 768px) {
    .sgc-lightbox {
        padding: 16px;
    }

    .sgc-lb-content {
        max-width: 100vw;
        max-height: 78vh;   /* leaves room for arrows top/bottom */
    }

    .sgc-lb-img {
        max-height: 78vh;
        max-width: 100%;
    }

    .sgc-lb-close {
        top: 12px;
        right: 12px;
        width: 42px;
        height: 42px;
        font-size: 22px;
    }

    .sgc-lb-prev,
    .sgc-lb-next {
        width: 46px;
        height: 46px;
        font-size: 24px;
        background: rgba(10, 31, 68, 0.75);
        border-color: rgba(255, 255, 255, 0.6);
    }

    .sgc-lb-prev { left: 10px; }
    .sgc-lb-next { right: 10px; }
}

/* Very narrow phones */
@media (max-width: 400px) {
    .sgc-lb-img { max-height: 72vh; }

    .sgc-lb-prev,
    .sgc-lb-next {
        width: 42px;
        height: 42px;
        font-size: 22px;
    }
    .sgc-lb-prev { left: 6px; }
    .sgc-lb-next { right: 6px; }
}

/* Prevent body scroll when lightbox is open */
body.sgc-noscroll { overflow: hidden; }
.sgc-lightbox.open { display: flex; }

@keyframes sgcFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sgc-lb-content {
    max-width: 92vw;
    max-height: 88vh;
    position: relative;
    text-align: center;
}
.sgc-lb-img {
    max-width: 100%;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 8px;
    animation: sgcZoomIn .35s ease;
}
@keyframes sgcZoomIn {
    from { transform: scale(.92); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.sgc-lb-close,
.sgc-lb-prev,
.sgc-lb-next {
    position: absolute;
    background: rgba(255,255,255,0.12);
    border: 2px solid rgba(255,255,255,0.35);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: background .25s, border-color .25s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sgc-lb-close {
    top: 24px; right: 24px;
    width: 46px; height: 46px;
    font-size: 26px;
    line-height: 1;
}
.sgc-lb-prev,
.sgc-lb-next {
    top: 50%;
    transform: translateY(-50%);
    width: 54px; height: 54px;
    font-size: 30px;
}
.sgc-lb-prev { left: 24px; }
.sgc-lb-next { right: 24px; }

.sgc-lb-close:hover,
.sgc-lb-prev:hover,
.sgc-lb-next:hover {
    background: #1C51AC;
    border-color: #1C51AC;
    color: #0A1F44;
}

.sgc-lb-counter {
    color: #1C51AC;
    margin-top: 16px;
    font-size: 14px;
    letter-spacing: 2px;
}

@media (max-width: 640px) {
    .sgc-lightbox { padding: 16px; }
    .sgc-lb-close { top: 12px; right: 12px; width: 38px; height: 38px; font-size: 20px; }
    .sgc-lb-prev, .sgc-lb-next { width: 42px; height: 42px; font-size: 24px; }
    .sgc-lb-prev { left: 8px; }
    .sgc-lb-next { right: 8px; }
}

body.sgc-noscroll { overflow: hidden; }