/* Site-wide image lightbox – see wwwroot/js/lightbox.js */

img.slb-zoomable {
    cursor: zoom-in;
}

img.slb-zoomable:focus-visible {
    outline: 3px solid var(--dl-color-success-700, #15803d);
    outline-offset: 3px;
}

html.slb-open,
html.slb-open body {
    overflow: hidden;
}

.slb {
    --slb-fade: 1;
    position: fixed;
    inset: 0;
    z-index: 2000; /* above Bootstrap navbar (1030) and modals (1055) */
    background: rgba(6, 10, 15, calc(0.94 * var(--slb-fade)));
    color: #f8fafc;
    opacity: 0;
    transition: opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.slb[hidden] {
    display: none;
}

.slb.is-visible {
    opacity: 1;
}

.slb-stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px 72px 72px;
    overflow: hidden;
    touch-action: none;
    user-select: none;
}

.slb-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    background: #fff; /* product shots with transparent background stay readable */
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    transform-origin: center center;
    will-change: transform;
    cursor: zoom-in;
}

.slb.is-zoomed .slb-image {
    cursor: grab;
    border-radius: 0;
}

.slb.is-zoomed .slb-image:active {
    cursor: grabbing;
}

.slb.is-loading .slb-image {
    opacity: 0;
}

.slb-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 42px;
    height: 42px;
    margin: -21px 0 0 -21px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: slb-spin 0.8s linear infinite;
    display: none;
}

.slb.is-loading .slb-spinner {
    display: block;
}

@keyframes slb-spin {
    to {
        transform: rotate(360deg);
    }
}

.slb-toolbar {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 2;
}

.slb-counter {
    margin-right: 6px;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    color: rgba(248, 250, 252, 0.75);
}

.slb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    background: rgba(15, 23, 32, 0.7);
    color: #fff;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease;
}

.slb-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.18);
}

.slb-btn:focus-visible {
    outline: 2px solid #a7f3d0;
    outline-offset: 2px;
}

.slb-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.slb-nav {
    position: absolute;
    top: 50%;
    width: 52px;
    height: 52px;
    margin-top: -26px;
    font-size: 1.4rem;
    z-index: 2;
}

.slb-prev {
    left: 12px;
}

.slb-next {
    right: 12px;
}

.slb.is-single .slb-nav,
.slb.is-zoomed .slb-nav {
    display: none;
}

.slb-caption {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    max-width: min(90vw, 760px);
    padding: 8px 14px;
    border-radius: 10px;
    background: rgba(15, 23, 32, 0.7);
    font-size: 0.95rem;
    text-align: center;
    z-index: 2;
    pointer-events: none;
}

.slb-caption[hidden],
.slb.is-zoomed .slb-caption {
    display: none;
}

@media (max-width: 767.98px) {
    .slb-stage {
        padding: 60px 8px 64px;
    }

    .slb-image {
        border-radius: 4px;
    }

    /* swipe replaces the arrows on phones, but keep them reachable at the bottom */
    .slb-nav {
        top: auto;
        bottom: 12px;
        margin-top: 0;
        width: 44px;
        height: 44px;
    }

    .slb-caption {
        bottom: 64px;
        font-size: 0.85rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .slb,
    .slb-btn {
        transition: none;
    }
}
