/* Галерея: сетка альбомов и фотографий */
.gallery-albums,
.gallery-photos {
    list-style: none;
    margin: 24px 0 48px;
    padding: 0;
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.gallery .gallery-album,
.gallery .gallery-photo,
.gallery .gallery-album:hover,
.gallery .gallery-photo:hover {
    display: block;
    color: inherit;
    text-decoration: none;
}

.gallery-album__cover,
.gallery-photo {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border-radius: 6px;
    background: var(--thead-bg-color);
}

.gallery-album__cover img,
.gallery-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.gallery-album:hover img,
.gallery-photo:hover img,
.gallery-album:focus-visible img,
.gallery-photo:focus-visible img {
    transform: scale(1.05);
}

.gallery-album__title {
    display: block;
    margin-top: 12px;
    font-weight: 600;
    color: var(--primary-color);
}

.gallery-album__count {
    display: block;
    margin-top: 4px;
    font-size: 14px;
    color: var(--secondary-text-color);
}

.gallery-photo__caption {
    position: absolute;
    inset: auto 0 0 0;
    padding: 24px 12px 10px;
    color: #fff;
    font-size: 14px;
    line-height: 1.3;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-photo:hover .gallery-photo__caption,
.gallery-photo:focus-visible .gallery-photo__caption {
    opacity: 1;
}

@media (hover: none) {
    .gallery-photo__caption {
        opacity: 1;
    }
}

.gallery .gallery-back,
.gallery .gallery-back:hover {
    display: inline-block;
    margin-top: 24px;
    font-size: 14px;
}

.gallery-video {
    margin: 24px 0 48px;
    max-width: 960px;
}

.gallery-video video {
    width: 100%;
    height: auto;
    border-radius: 6px;
    background: #000;
}

@media (width < 600px) {
    .gallery-albums,
    .gallery-photos {
        gap: 16px;
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (width < 380px) {
    .gallery-albums,
    .gallery-photos {
        grid-template-columns: 1fr;
    }
}
