.gallery_title {
    width: 1685px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 16px;
    margin-top: 58px;
}
    /*display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 25px;
}*/

.gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    /*gap: 20px;
    margin-left: 111px;
    margin-right: 111px;*/
    margin-bottom: 80px;
    gap: 20px;
}

/* Контейнер всей карточки */
.gallery_item {
    position: relative;
    flex: 0 0 23%;
    width: 100%;
    aspect-ratio: 4 / 3; /* Одинаковая пропорция для всех */
    overflow: hidden;    /* Прячем текст, когда он "внизу" за границей */
    border-radius: 12px;
    background-color: #000;
}

/* Картинка */
.gallery_image, .gallery_image a, .gallery_image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: opacity 1s ease;
}

/* Блок с ссылкой-текстом */
.gallery_camera {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    /*background: rgba(0, 0, 0, 0.7); /* Полупрозрачный фон */
    padding: 15px;
    box-sizing: border-box;

    /* Сдвигаем вниз на всю высоту блока */
    transform: translateY(100%);
    transition: transform 1s ease-out;
    z-index: 2;
}

/* Ссылка внутри плашки */
.gallery_camera a {
    text-decoration: none;
    font-size: 14px;
    display: block;
    /*text-align: center;*/
}

/* ЭФФЕКТ ПРИ НАВЕДЕНИИ */
.gallery_item:hover .gallery_camera {
    transform: translateY(0); /* Текст выплывает вверх */
}

.gallery_item:hover .gallery_image img {
    opacity: 0.5;
    /*transform: scale(1.05); /* Картинка чуть увеличивается */
    /*filter: brightness(0.8);  /* И немного темнеет для читаемости текста */
}

.camera_shots_gallery {
    margin-left: 111px;
    margin-right: 111px;
    overflow: hidden; /* Прячем картинки, которые уходят за край */
    position: relative;
}

/* Обертка для слайдов — оставляем дефолтной для Swiper */
.camera_shots_gallery .swiper-wrapper {
    display: flex !important;
}

/* Элемент слайдера — задаем ему жесткую ширину, чтобы Swiper мог его двигать */
.camera_shots_gallery .camera_shots_item {
    width: 551px !important; /* Ширина одной карточки в ленте */
    flex-shrink: 0 !important; /* Запрещаем картинкам сжиматься */
    aspect-ratio: 4 / 3;
    position: relative;
}

/* Картинка внутри слайда */
.camera_shots_gallery .camera_shots_item img {
    transition: opacity 0.5s ease;
    display: block;
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.camera_shots_gallery .camera_shots_item img:hover {
    opacity: 0.5;
}

.camera_shots_gallery .swiper-button-next,
.camera_shots_gallery .swiper-button-prev {
    opacity: 0;
    transition: opacity 0.5s;
/*    color: #001EE0;
    width: 40px;
    height: 40px;
    border-radius: 50%;*/
}

.camera_shots_gallery:hover .swiper-button-next,
.camera_shots_gallery:hover .swiper-button-prev {
    opacity: 1;
}

/*.camera_shots_gallery .swiper-button-next::after,
.camera_shots_gallery .swiper-button-prev::after {
    display: none;
}

.swiper-button-prev {
    margin-left: 20px !important;
}

.swiper-button-next {
    margin-right: 20px !important;
}*/

.swiper-navigation-icon {
    display: none !important;
}

.swiper-button-prev {
    margin-left: 20px !important;
    background-image: url('/static/main/images/arrow_prev_swiper.svg');
    background-repeat: no-repeat;
    background-size: contain;

}

.swiper-button-next {
    margin-right: 20px !important;
    background-image: url('/static/main/images/arrow_next_swiper.svg');
    background-repeat: no-repeat;
    background-size: contain;
}

.gallery_grid {
    display: flex;
    flex-wrap: nowrap;
    width: 1685px;
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
    gap: 20px;
    box-sizing: border-box;
    margin-bottom: 80px;
}

.grid_column {
    display: flex;
    flex-direction: column;
    flex: 1 1 0%;
    /*margin-top: 25px;*/
    /*margin-bottom: 25px;*/
    gap: 20px;
    width: 321px;
    flex-shrink: 0;
}

.grid_image {
    display: block !important;
    width: 321px;;
    position: relative;
    overflow: hidden;
}

.grid_image a {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    /*position: relative;*/
    /*overflow: hidden;*/
}

.grid_image img {
    transition: opacity 0.5s ease;
    display: block;
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.grid_image img:hover {
    opacity: 0.5;
}

/* Горизонтальная картинка (Г): 241 на 321. */
.grid_image.img-h {
    height: 241px;
}

/* Вертикальная картинка (В): 428 на 321. */
.grid_image.img-v {
    height: 428px;
}

.gallery_grid_camera {
    text-align: center;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;

    /* Красивая темная подложка, чтобы белый текст читался на любом фото */
    background: rgba(0, 0, 0, 0.6) !important;
    padding: 8px 10px 8px 15px !important;
    box-sizing: border-box !important;
    z-index: 3 !important; /* Поверх картинки */

    /* ЭФФЕКТ СХОВЫВАНИЯ: Сдвигаем плашку вниз на 100% её собственной высоты */
    transform: translateY(100%) !important;

    /* Плавность анимации (0.3 секунды) */
    transition: transform 0.3s ease-in-out !important;
}

.gallery_grid_camera a {
    align-items: center;
    /*color: #FFFFFF;*/
    text-decoration: none !important;
    font-size: 20px;
    font-weight: 500 !important;
    display: inline-flex !important;
    justify-content: space-between;
    width: 100% !important;
    height: 40px !important;
}

.gallery_grid_camera a:hover {
    /*color: #CCCCCC;*/
}

.grid_image:hover .gallery_grid_camera {
    transform: translateY(0) !important;
}

@media (max-width: 768px) {
    .gallery_title {
        width: auto;
        margin-top: 0px;
        margin-bottom: 0px;
        margin-left: 18px;
    }

    .caption {
        font-size: 22px;
        margin-bottom: 15px;
    }

    .gallery {
        margin-bottom: 12px;
        gap: 6px;
    }

    .camera_shots_gallery .camera_shots_item {
        width: 250px !important;
        margin-right: 6px !important;
    }

    /* Выкатываем темную плашку наверх при первом тапе */
    .grid_image.active-touch .gallery_grid_camera {
        transform: translateY(0) !important;
    }

    /* Притемняем фотку для визуального отклика */
    .grid_image.active-touch img {
        opacity: 0.5 !important;
    }

    .gallery_grid {
        width: auto;
        margin-bottom: 12px;
        margin-left: 18px;
        margin-right: 18px;
        gap: 6px;
    }

    .gallery_grid .grid_column:nth-child(n+3) {
        display: none;
    }

    .grid_column {
        width: auto;
        gap: 6px;
        /*flex: 0 0 calc((100% - 60px) / 2);*/
    }

    .grid_image {
        width: auto;
    }

    .grid_image img {
        border-radius: 5px;
    }

    .grid_image.img-v {
        height: 224px;
    }

    .grid_image.img-h {
        height: 120px;
    }

    .gallery_grid_camera {
        padding: 0px 4px 5px 5px !important;
    }

    .gallery_grid_camera a {
        font-size: 10px;
        height: 15px !important;
    }

    .gallery_grid_camera svg {
        width: 9px;
        height: 18px;
    }
}
