/**
 * Универсальный лайтбокс IWEB.
 * Работает в любой теме, использует переменные темы через fallback.
 */

.iweb-lb {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .92);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s ease;
}

.iweb-lb.open {
    display: flex;
    opacity: 1;
}

.iweb-lb-stage {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 96vw;
    max-height: 94vh;
    padding: 4vh 4vw;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    animation: iwebLbIn .3s ease both;
}

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

.iweb-lb-stage img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(94vh - 12vh);
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
    background: #111;
    user-select: none;
    -webkit-user-drag: none;
    flex: 0 1 auto;
}

.iweb-lb-caption {
    color: #e2e8f0;
    font-size: 13px;
    margin-top: 12px;
    text-align: center;
    max-width: 90vw;
    line-height: 1.4;
    padding: 0 10px;
}

.iweb-lb-close,
.iweb-lb-prev,
.iweb-lb-next {
    position: absolute;
    background: rgba(255, 255, 255, .08);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .22s ease, transform .22s ease;
    -webkit-tap-highlight-color: transparent;
}

.iweb-lb-close {
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 26px;
    line-height: 1;
    font-weight: 300;
    z-index: 2;
}

.iweb-lb-prev,
.iweb-lb-next {
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 32px;
    line-height: 1;
    font-weight: 300;
    z-index: 2;
}

.iweb-lb-prev { left: 20px; }
.iweb-lb-next { right: 20px; }

.iweb-lb-close:hover,
.iweb-lb-prev:hover,
.iweb-lb-next:hover {
    background: rgba(255, 255, 255, .18);
}

.iweb-lb-prev:hover { transform: translateY(-50%) translateX(-2px); }
.iweb-lb-next:hover { transform: translateY(-50%) translateX(2px); }

.iweb-lb.single .iweb-lb-prev,
.iweb-lb.single .iweb-lb-next {
    display: none;
}

@media (max-width: 768px) {
    .iweb-lb-prev,
    .iweb-lb-next {
        width: 44px;
        height: 44px;
        font-size: 24px;
    }
    .iweb-lb-prev { left: 8px; }
    .iweb-lb-next { right: 8px; }

    .iweb-lb-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .iweb-lb-stage img {
        border-radius: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .iweb-lb,
    .iweb-lb-stage,
    .iweb-lb-stage img,
    .iweb-lb-close,
    .iweb-lb-prev,
    .iweb-lb-next {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
    .iweb-lb-prev:hover { transform: translateY(-50%); }
    .iweb-lb-next:hover { transform: translateY(-50%); }
}