body {
  margin: 0;
}

.header {
  background: linear-gradient(to right, #2f2f2f 0%, #191919 25%, #191919 75%, #2f2f2f 100%);
  color: #fff; /* Цвет текста */
  padding: 20px; /* Внутренний отступ */
  text-align: center; /* Выравнивание текста по центру */
  font-size: 36px; /* Размер шрифта */
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Современный шрифт */
  letter-spacing: 2px; /* Расстояние между буквами */
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); /* Тень текста */
  text-transform: uppercase;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  grid-auto-rows: 240px;
  grid-auto-flow: dense;
  grid-gap: 15px;
  background: #2f2f2f;
  padding: 20px;

}
.image {
  background: var(--bg) center / contain no-repeat;
  border-radius: 8px;
  box-shadow: inset 0 0 15px #000, 0 0 0 #000;
  transition: all 0.3s ease-in-out;
}

.image:hover {
  box-shadow: inset 0 0 15px #000, 0 8px 15px #000;
  transform: scale(1.02);
}

.image:nth-child(5n) {
  grid-column: span 2;
  grid-row: span 2;
}

.image:nth-child(2n) {
  grid-row: span 2;
}
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9); /* Изменено начальное значение прозрачности и цвета */
  transition: opacity 0.3s ease; /* Добавлена плавная анимация изменения прозрачности */
}

.modal-content-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  width: 100%;
}

.modal-content {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
}

.close {
  color: #fff;
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
}

@media only screen and (max-width: 768px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    grid-gap: 10px;
    padding: 10px;
  }

  .image {
    border-radius: 4px;
  }

  .modal-content {
    max-width: 90%;
    max-height: 90%;
  }

  .close {
    font-size: 24px;
    top: 10px;
    right: 15px;
  }
}

/* Добавляем стили для стрелок */
.modal-content-wrapper {
  position: relative; /* Для позиционирования стрелок относительно изображения */
}

.prev,
.next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 36px;
  color: white;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 8px;
  border-radius: 50%;
  transition: background-color 0.3s;
}

.prev:hover,
.next:hover {
  background-color: rgba(0, 0, 0, 0.7);
}

.prev {
  left: 10px;
}

.next {
  right: 10px;
}