/* ========================================
   PREMIUM MASONRY GALLERY SYSTEM
   ======================================== */
   
.projects-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  padding: 40px 0;
  width: 100%;
}

.gallery-item {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3; /* Fixed aspect ratio for perfect alignment */
  border-radius: 8px; /* Elegant subtle radius */
  overflow: hidden;
  cursor: pointer;
  background-color: transparent;
  vertical-align: top;
  font-size: 0;
  line-height: 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transform: translateY(0);
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.5s ease;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Ensures image fills the aspect-ratio box without gaps */
  display: block;
  margin: 0;
  padding: 0;
  will-change: transform;
  transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Premium Hover Overlay */
.gallery-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to top, rgba(10, 10, 26, 0.9) 0%, rgba(10, 10, 26, 0.4) 40%, rgba(244, 160, 28, 0.1) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none; /* Let clicks pass through to container */
}

/* Add a majestic frame inside the overlay */
.gallery-overlay::before {
  content: '';
  position: absolute;
  top: 15px; left: 15px; right: 15px; bottom: 15px;
  border: 1px solid rgba(244, 160, 28, 0.5); /* Golden border */
  border-radius: 4px;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.zoom-icon {
  font-size: 2.5rem;
  color: #fff;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
  text-shadow: 0 0 15px #f4a01c;
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  border-color: rgba(244, 160, 28, 0.3);
  z-index: 10;
}

.gallery-item:hover img {
  transform: scale(1.05); /* Smooth upscale */
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-item:hover .gallery-overlay::before {
  opacity: 1;
  transform: scale(1);
}

.gallery-item:hover .zoom-icon {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================
   LIGHTBOX MODAL
   ======================================== */
.lightbox {
  display: none;
  position: fixed;
  z-index: 9999999;
  left: 0; top: 0; width: 100%; height: 100%;
  background-color: rgba(6, 6, 15, 0.95);
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  backdrop-filter: blur(15px); /* Strong glass blur */
}

.lightbox.show {
  opacity: 1;
}

.lightbox-content {
  max-width: 90%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 0 80px rgba(0,0,0,0.8), 0 0 30px rgba(244, 160, 28, 0.1); /* Subtle gold glow behind image */
  transform: scale(0.95);
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.lightbox.show .lightbox-content {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 30px;
  right: 40px;
  color: #fff;
  font-size: 45px;
  font-weight: 300;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}

.lightbox-close:hover {
  color: #f4a01c;
  background: rgba(255,255,255,0.1);
  transform: rotate(90deg);
}
