

/* --- Обёртка миниатюры --- */
.frame-wrap {
    display: inline-block;
    margin: 4px;
}
.frame-wrap.align-center { display: block; text-align: center; }
.frame-wrap.align-left   { float: left;  margin-right: 12px; }
.frame-wrap.align-right  { float: right; margin-left:  12px; }

.frame-wrap a.frame-lightbox {
    display: inline-block;
    cursor: zoom-in;
    outline: none;
}
.frame-wrap a.frame-lightbox img {
    display: block;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
}
.frame-wrap a.frame-lightbox:hover img {
    border-color: #0073aa;
    transform: scale(1.03);
}

/* --- Оверлей --- */
#fl-overlay {
    display: none;
    position: fixed;
    inset: 0;                       /* top/right/bottom/left: 0 */
    background: rgba(0, 0, 0, 0.88);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
#fl-overlay.fl-active {
    display: flex;
}

/* --- Контейнер изображения --- */
#fl-img-wrap {
    position: relative;
    max-width: 92vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
#fl-img-wrap img {
    max-width: 92vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 3px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
    opacity: 0;
    transition: opacity 0.25s ease;
}
#fl-img-wrap img.fl-loaded {
    opacity: 1;
}

/* --- Спиннер загрузки --- */
#fl-spinner {
    position: absolute;
    width: 40px; height: 40px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fl-spin 0.7s linear infinite;
}
@keyframes fl-spin {
    to { transform: rotate(360deg); }
}

/* --- Подпись --- */
#fl-caption {
    color: #ddd;
    font-size: 13px;
    margin-top: 10px;
    min-height: 18px;
    text-align: center;
    max-width: 80vw;
}

/* --- Счётчик --- */
#fl-counter {
    color: rgba(255,255,255,0.45);
    font-size: 12px;
    margin-top: 4px;
}

/* --- Кнопки --- */
.fl-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    padding: 14px 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    z-index: 100001;
    user-select: none;
}
.fl-btn:hover { background: rgba(255,255,255,0.25); }

#fl-prev { left:  10px; }
#fl-next { right: 10px; }

#fl-close {
    position: fixed;
    top: 14px; right: 18px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    z-index: 100001;
    opacity: 0.7;
    transition: opacity 0.2s;
}
#fl-close:hover { opacity: 1; }

/* --- Скрываем стрелки если группа из 1 элемента --- */
.fl-single #fl-prev,
.fl-single #fl-next {
    display: none;
}