.gallery {
  display: flex;
  flex-wrap: wrap;
  margin: 0 auto;
  justify-content:center;
}

.gallery-item {
  flex: 0 1 33%;
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  cursor: pointer;
  padding:1vmax;
}

.gallery-item1:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.img-wrapper {
  border-radius: 8px;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  position: relative;
  background-color: #334155;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.gallery-item:hover img {
  transform: scale(1.08);
}

.item-caption {
  padding: 1rem;
  display:none;
}

.item-caption h3 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-caption p {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.lightbox {
  display: none; /* Controlled by jQuery */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--overlay-bg);
  backdrop-filter: blur(8px);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity var(--transition-speed) ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(0.95);
  transition: transform var(--transition-speed) ease;
}

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

.lightbox-img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.lightbox-title {
  margin-top: 1rem;
  color: var(--text-main);
  font-size: 1.1rem;
  font-weight: 400;
  text-align: center;
  letter-spacing: 0.02em;
}

/* Close Button */
.lightbox-close {
  position: absolute;
  top: -45px;
  right: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  transition: color 0.2s ease, transform 0.2s ease;
}

.lightbox-close:hover {
  color: var(--text-main);
  transform: scale(1.1);
}

@media screen and (max-device-width:800px){ /* phone */
  .gallery-grid {
	flex: 1 1 100%;
    max-width: 100%;
  }
  .lightbox-close {
	top: -10px;
	right: -45px;
  }
}