:root {
  --gap: 0.1rem;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: #333;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #333;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.gallery {
  margin-top: calc(var(--gap) - 0.4rem);
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  justify-content: center;
}

.gallery img {
  flex: 1 1 calc(50% - var(--gap)); /* 2 per row on mobile */
  max-width: calc(50% - var(--gap));
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: pointer;
  border-radius: 0rem;
  transition: transform 0.2s;
}

/* larger screens: fit as many as possible */
@media (min-width: 700px) {
  .gallery img {
    flex: 1 1 200px; /* minimum size 200px */
    max-width: 300px; /* allow them to grow equally */
  }
}

/* fullscreen lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.lightbox img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 0.5rem;
}
.lightbox .close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 3rem;
  color: white;
  cursor: pointer;
}

@media (min-width: 1000px) {
  .gallery {
    gap: 2rem;
    margin-top: 1.5rem;
  }
  .gallery img:hover {
    transform: scale(1.03);
  }
}
