/* Masonry Gallery Layout for Project Pages */

.masonry-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  grid-gap: 1rem;
  grid-auto-flow: dense;
}

.masonry-item {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background-color: #fff;
}

.masonry-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.masonry-item img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.5s ease;
}

.masonry-item:hover img {
  transform: scale(1.03);
}

.masonry-item.wide {
  grid-column: span 2;
}

.masonry-item.tall {
  grid-row: span 2;
}

.masonry-caption {
  padding: 0.75rem;
  background-color: white;
  font-size: 0.875rem;
  line-height: 1.4;
}

.masonry-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0);
  transition: background-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.masonry-item:hover .masonry-overlay {
  background-color: rgba(0, 0, 0, 0.2);
}

.view-button {
  background-color: white;
  color: #1a202c;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.masonry-item:hover .view-button {
  opacity: 1;
  transform: translateY(0);
}

/* Lightbox Styles */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
}

.lightbox.is-active {
  display: flex;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
}

.lightbox-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.lightbox-caption {
  color: white;
  text-align: center;
  padding: 1rem;
  font-size: 1rem;
  max-width: 80%;
  margin: 0 auto;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
}

.lightbox-close:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: 2rem;
  cursor: pointer;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 1;
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .masonry-gallery {
    grid-template-columns: 1fr;
  }
  
  .masonry-item.wide,
  .masonry-item.tall {
    grid-column: auto;
    grid-row: auto;
  }
  
  .lightbox-prev,
  .lightbox-next {
    width: 2.5rem;
    height: 2.5rem;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .masonry-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}
