/* Базовая сетка */
.gallery {
    column-count: 4;
    column-gap: 10px;
    padding: 10px;
}

.gallery-item {
    display: inline-block;
    margin: 0 0 10px;
    border-radius: 10px;
    overflow: hidden;
    position: relative; /* обязательно для бейджа */
}

.gallery-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

@media (max-width: 999px) { .gallery { column-count: 3; } }
@media (max-width: 599px) { .gallery { column-count: 2; } }

/* Модалка */
.modal {
    display: none;
    position: fixed;
    z-index: 999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    justify-content: center;
    align-items: center;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
}

.modal-header {
  position: absolute;
  top: 15px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1010;
}

.close,
.download {
  color: white;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s;
}

.close:hover,
.download:hover {
  opacity: 0.7;
}

/* Видео */
.video-preview {
    position: relative;
    cursor: pointer;
}

.video-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 10px;
}

.video-icon {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 20px;
    background: rgba(0,0,0,0.6);
    padding: 4px 6px;
    border-radius: 6px;
    color: #fff;
}

/* Бейдж просмотров */
.views-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 2;
}

/* Эффект обновления счётчика просмотров */
.views-badge.updated {
    animation: bounce 0.5s ease forwards;
}

@keyframes bounce {
    0%   { transform: scale(1); background-color: rgba(0,0,0,0.6); }
    30%  { transform: scale(1.4); background-color: rgba(255,165,0,0.9); }
    50%  { transform: scale(1.2); background-color: rgba(255,140,0,0.8); }
    70%  { transform: scale(1.3); background-color: rgba(255,165,0,0.9); }
    100% { transform: scale(1); background-color: rgba(0,0,0,0.6); }
}