/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  width: 100%;
  max-width: 1200px;
  padding: 1rem 0;
}

/* Gallery Item Container */
.gallery-item {
  border-radius: 2rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  width: 100%;
  overflow: visible;
  cursor: pointer;
}

/* Gallery Images */
.gallery-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 1rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Hover Effect */
.gallery-item:hover .gallery-image {
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
  position: relative;
}

/* Modal/Lightbox Overlay */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(16, 40, 100, 0.85);
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

/* Modal Content Wrapper */
.modal-content-wrapper {
  position: relative;
  max-width: 75%;
  max-height: 75%;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: modalZoom 0.3s ease;
}

/* Modal Image */
.modal-image {
  max-width: 100%;
  max-height: calc(75vh - 100px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Modal Caption */
.modal-caption {
  background-color: #EFF1F2;
  color: #102864;
  padding: 1rem 1.5rem;
  margin-top: 1rem;
  border-radius: 8px;
  max-width: 600px;
  text-align: center;
  font-size: 1rem;
  line-height: 1.5;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Close Button */
.modal-close {
  position: absolute;
  top: -3rem;
  right: -1rem;
  color: #EFF1F2;
  font-size: 3rem;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s ease, transform 0.2s ease;
  line-height: 1;
  z-index: 1001;
}

.modal-close:hover,
.modal-close:focus {
  color: #ffffff;
  transform: scale(1.1);
}

/* Modal Animation */
@keyframes modalZoom {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .modal-content-wrapper {
    max-width: 90%;
    max-height: 90%;
  }
  
  .modal-close {
    font-size: 2.5rem;
    top: -2.5rem;
    right: -0.5rem;
  }
}