/* ===== Галерея изображений, встраиваемая прямо в контент статьи ===== */
.content-gallery {
    position: relative;
    margin: 1rem 0;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    user-select: none;
}

.content-gallery-track-wrap {
    position: relative;
    width: 100%;
    max-height: 480px;
    overflow: hidden;
    background: #000;
}

.content-gallery-track {
    display: flex;
    transition: transform 0.35s ease;
    height: 100%;
}

.content-gallery-slide {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
}

.content-gallery-slide img {
    width: 100%;
    max-height: 480px;
    object-fit: contain;
    display: block;
    background: #000;
    pointer-events: none;
}

.content-gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.2s, transform 0.2s;
    z-index: 2;
}

.content-gallery-arrow:hover {
    background: var(--primary-color, #2ecc71);
    transform: translateY(-50%) scale(1.08);
}

.content-gallery-arrow.prev { left: 12px; }
.content-gallery-arrow.next { right: 12px; }

.content-gallery-counter {
    position: absolute;
    bottom: 10px;
    right: 12px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    z-index: 2;
    pointer-events: none;
}

.content-gallery-thumbs {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem;
    background: #111;
    overflow-x: auto;
    scrollbar-width: thin;
}

.content-gallery-thumbs img {
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.55;
    border: 2px solid transparent;
    transition: opacity 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.content-gallery-thumbs img.active {
    opacity: 1;
    border-color: var(--primary-color, #2ecc71);
}

/* Единичная картинка внутри блока (без стрелок/миниатюр) — тоже можно открыть в лайтбоксе */
.content-gallery.single .content-gallery-slide { cursor: zoom-in; }

/* ===== Лайтбокс (полноэкранный просмотр) ===== */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.gallery-lightbox.open {
    display: flex;
}

.gallery-lightbox-img-wrap {
    max-width: 92vw;
    max-height: 82vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox img {
    max-width: 92vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 4px;
    animation: gallery-lightbox-zoom-in 0.2s ease;
}

@keyframes gallery-lightbox-zoom-in {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.gallery-lightbox-close {
    position: absolute;
    top: 18px;
    right: 22px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
}

.gallery-lightbox-close:hover { background: rgba(231, 76, 60, 0.8); }

.gallery-lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 2;
}

.gallery-lightbox-arrow:hover {
    background: var(--primary-color, #2ecc71);
    transform: translateY(-50%) scale(1.08);
}

.gallery-lightbox-arrow.prev { left: 18px; }
.gallery-lightbox-arrow.next { right: 18px; }

.gallery-lightbox-counter {
    color: #ccc;
    font-size: 0.9rem;
    margin-top: 0.8rem;
}

/* ===== Мобильная адаптация ===== */
@media (max-width: 768px) {
    .content-gallery-track-wrap { max-height: 300px; }
    .content-gallery-slide img { max-height: 300px; }

    .content-gallery-arrow {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }
    .content-gallery-arrow.prev { left: 6px; }
    .content-gallery-arrow.next { right: 6px; }

    .content-gallery-thumbs img { width: 48px; height: 36px; }

    .gallery-lightbox-arrow {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }
    .gallery-lightbox-arrow.prev { left: 6px; }
    .gallery-lightbox-arrow.next { right: 6px; }

    .gallery-lightbox-close {
        top: 10px;
        right: 10px;
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 480px) {
    .content-gallery-track-wrap { max-height: 220px; }
    .content-gallery-slide img { max-height: 220px; }
    .content-gallery-counter { font-size: 0.7rem; padding: 0.2rem 0.5rem; }
}
