/**
 * Стили фотогалереи ButGallery на фронтенде
 */

.butgallery-album-wrap,
.butgallery-collection-wrap,
.butgallery-all-albums-wrap {
    margin: 25px 0;
    font-family: inherit;
    box-sizing: border-box;
}

.butgallery-album-wrap *,
.butgallery-collection-wrap *,
.butgallery-all-albums-wrap * {
    box-sizing: border-box;
}

/* Заголовок и описание альбома */
.bg-album-header,
.bg-collection-header {
    margin-bottom: 25px;
    text-align: left;
}

.bg-album-title,
.bg-collection-title {
    font-size: 1.8rem;
    margin: 0 0 10px 0;
    color: #1a1a1a;
}

.bg-album-description,
.bg-collection-description {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #4a4a4a;
}

/* Адаптивная сетка фотографий */
.bg-photos-grid {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.bg-cols-1 { grid-template-columns: 1fr; }
.bg-cols-2 { grid-template-columns: repeat(2, 1fr); }
.bg-cols-3 { grid-template-columns: repeat(3, 1fr); }
.bg-cols-4 { grid-template-columns: repeat(4, 1fr); }
.bg-cols-5 { grid-template-columns: repeat(5, 1fr); }
.bg-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* Карточка фотографии */
.bg-photo-card {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
}

.bg-photo-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

/* Блок картинки */
.bg-card-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f3f4f6;
    cursor: pointer;
}

.bg-gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.bg-photo-card:hover .bg-gallery-image {
    transform: scale(1.04);
}

.bg-image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bg-photo-card:hover .bg-image-overlay {
    opacity: 1;
}

.bg-zoom-icon {
    background: rgba(255, 255, 255, 0.9);
    color: #111827;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transform: scale(0.85);
    transition: transform 0.2s ease;
}

.bg-photo-card:hover .bg-zoom-icon {
    transform: scale(1);
}

/* Тело карточки */
.bg-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.bg-card-title {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.35;
}

.bg-card-description {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: #4b5563;
    line-height: 1.5;
    flex-grow: 1;
}

/* Метаданные (Дата, Автор, Источник) */
.bg-card-metadata {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
    margin-top: auto;
    font-size: 0.85rem;
}

.bg-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #6b7280;
}

.bg-meta-date svg {
    color: #9ca3af;
}

.bg-meta-label {
    font-weight: 600;
    color: #4b5563;
}

.bg-meta-link {
    color: #2563eb;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s ease;
}

.bg-meta-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.bg-meta-text {
    color: #374151;
}

/* Футер карточки с кнопкой скачивания */
.bg-card-footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
}

.bg-btn-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #334155;
    text-decoration: none;
    transition: all 0.2s ease;
}

.bg-btn-download:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.bg-btn-download svg {
    transition: transform 0.2s ease;
}

.bg-btn-download:hover svg {
    transform: translateY(1px);
}

/* Сетка списка альбомов (Archive View) */
.bg-albums-grid {
    display: grid;
    gap: 24px;
    margin: 25px 0;
}

.bg-album-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.bg-album-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}

.bg-album-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.bg-album-card-cover {
    position: relative;
    aspect-ratio: 16 / 10;
    background: #e5e7eb;
    overflow: hidden;
}

.bg-album-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.bg-album-card:hover .bg-album-card-cover img {
    transform: scale(1.05);
}

.bg-album-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.bg-album-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
}

.bg-album-card-body {
    padding: 18px;
}

.bg-album-card-title {
    margin: 0 0 8px 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #111827;
}

.bg-album-card-desc {
    margin: 0;
    font-size: 0.9rem;
    color: #6b7280;
    line-height: 1.5;
}

/* Адаптивность для мобильных */
@media screen and (max-width: 1024px) {
    .bg-cols-4, .bg-cols-5, .bg-cols-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .bg-cols-3, .bg-cols-4, .bg-cols-5, .bg-cols-6 {
        grid-template-columns: repeat(2, 1fr);
    }
    .bg-albums-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    /* По одному кадру/альбому на строку для мобильных устройств */
    .bg-mobile-1col,
    .bg-photos-grid.bg-mobile-1col,
    .bg-albums-grid.bg-mobile-1col {
        grid-template-columns: 1fr !important;
    }
}

@media screen and (max-width: 540px) {
    .bg-cols-2, .bg-cols-3, .bg-cols-4, .bg-cols-5, .bg-cols-6 {
        grid-template-columns: 1fr;
    }
    .bg-albums-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   СЛАЙДЕР ПОДБОРКИ (Режим слайдов с выступающими краями и свайпом)
   ========================================================================== */

/* Соотношения сторон кадров (Aspect Ratios) */
.bg-ratio-1-1 .bg-card-image-wrap { aspect-ratio: 1 / 1; }
.bg-ratio-4-5 .bg-card-image-wrap { aspect-ratio: 4 / 5; }
.bg-ratio-16-9 .bg-card-image-wrap { aspect-ratio: 16 / 9; }
.bg-ratio-9-16 .bg-card-image-wrap { aspect-ratio: 9 / 16; }

.bg-slider-wrapper {
    position: relative;
    width: 100%;
    margin: 25px 0;
    overflow: hidden;
    user-select: none;
}

.bg-slider-track-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 15px 0;
}

.bg-slider-track {
    display: flex;
    gap: 24px;
    transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
    width: 100%;
    align-items: center;
}

/* Слайды на ПК: ширина 66%, выступающие соседние карточки на ~17% с каждой стороны */
.bg-slider-slide {
    flex: 0 0 66%;
    max-width: 66%;
    transition: transform 0.4s ease, opacity 0.4s ease;
    opacity: 0.55;
    transform: scale(0.92);
    cursor: pointer;
    box-sizing: border-box;
}

.bg-slider-slide.active {
    opacity: 1;
    transform: scale(1);
    cursor: default;
}

.bg-slider-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

.bg-slider-slide.active .bg-slider-card {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}

.bg-slider-card .bg-card-image-wrap {
    width: 100%;
    position: relative;
    overflow: hidden;
    background: #e5e7eb;
}

.bg-slider-card .bg-gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Навигационные стрелки */
.bg-slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #1f2937;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
    transition: all 0.25s ease;
}

.bg-slider-nav:hover {
    background: #ffffff;
    color: #2563eb;
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.bg-slider-prev { left: 16px; }
.bg-slider-next { right: 16px; }

/* Пагинация (точки) */
.bg-slider-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}

.bg-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d1d5db;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bg-slider-dot:hover {
    background: #9ca3af;
}

.bg-slider-dot.active {
    width: 28px;
    border-radius: 14px;
    background: #2563eb;
}

/* Кнопка перехода в полный альбом */
.bg-collection-album-btn-wrap {
    margin-top: 25px;
    text-align: center;
}

.bg-album-redirect-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.bg-album-redirect-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.bg-album-redirect-btn.bg-radius-rounded { border-radius: 8px; }
.bg-album-redirect-btn.bg-radius-pill { border-radius: 40px; }
.bg-album-redirect-btn.bg-radius-square { border-radius: 0px; }

.bg-album-redirect-btn.bg-btn-outline {
    background-color: transparent !important;
}

.bg-album-redirect-btn.bg-btn-minimal {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 8px 14px;
}

.bg-album-redirect-btn.bg-btn-minimal:hover {
    transform: translateX(4px);
}

/* Мобильная адаптация слайдера (Touch Swipe & Visible Peek) */
@media screen and (max-width: 768px) {
    .bg-slider-track-container {
        padding: 10px 0;
    }

    .bg-slider-track {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        padding: 10px 10%;
        gap: 14px;
        scrollbar-width: none;
    }

    .bg-slider-track::-webkit-scrollbar {
        display: none;
    }

    .bg-slider-slide {
        flex: 0 0 80%;
        max-width: 80%;
        scroll-snap-align: center;
        opacity: 0.75;
        transform: scale(0.96);
    }

    .bg-slider-slide.active {
        opacity: 1;
        transform: scale(1);
    }

    .bg-slider-nav {
        width: 38px;
        height: 38px;
    }

    .bg-slider-prev { left: 6px; }
    .bg-slider-next { right: 6px; }
}
