.gallery-container {
  max-width: 56rem;
  width: 100%;
}

.gallery-title {
  margin-bottom: 0.75rem;
}

.gallery-desc {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  cursor: pointer;
  aspect-ratio: 1;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
}

.gallery-item .caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  font-size: 0.8rem;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s;
}

.gallery-item:hover .caption,
.gallery-item:focus-visible .caption {
  opacity: 1;
}

@media (hover: none), (pointer: coarse) {
  .gallery-item .caption {
    opacity: 1;
  }

  .gallery-item:hover img {
    transform: none;
  }
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 100;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  max-height: 90dvh;
  object-fit: contain;
  border-radius: 0.5rem;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
}

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}
