.gallery {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 300px;
  gap: 1rem;
}

.gallery-item {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border-radius: 12px;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease, filter 0.3s ease;
  opacity: 0;
  border-radius: 0.5rem;
}

.gallery-item-top {
  object-position: top;
}
.gallery-item-center {
  object-position: center;
}

.gallery-item img.loaded {
  opacity: 1;
}

/* Hover effect */
.gallery-item:hover img {
  transform: scale(1.05);
  filter: brightness(1.2);
}

/* Example spans (you can reorder for asymmetry) */
.wide {
  grid-column: span 4;
}
.small {
  grid-column: span 2;
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal img.loaded {
  opacity: 1;
}

.modal.active {
  display: flex;
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
}

@media (max-width: 768px) {
  .gallery {
    width: 100%;
    display: flex;
    flex-direction: column;
  }
}
