#gallery {
  display: flex;
  flex-wrap: wrap;  
  max-width: 80%;
  margin: 0 auto;
  padding: 20px;
  justify-content: flex-start;
}
 
#gallery figure {
  margin: 10px;
  flex-basis: calc(25% - 20px);
  max-width: 260px;
}

#gallery figcaption {
  margin-top: 8px;
  text-align: center;
  font-size: .9rem;
  font-weight: bold;
  font-family: sans-serif;
  color: white;
}

    /* Responsive breakpoints */
    @media (max-width: 1200px) {
      .gallery figure { flex-basis: calc(33.33% - 20px); } /* 3 columns */
    }

    @media (max-width: 800px) {
      .gallery figure { flex-basis: calc(50% - 20px); }   /* 2 columns */
    }

    @media (max-width: 500px) {
      .gallery figure { flex-basis: 100%; }               /* 1 column */
    }


/* [LIGHTBOX BACKGROUND] */
#lback {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: all ease 0.5s;
  image-orientation: from-image;
}
#lback.show {
  opacity: 1;
  visibility: visible;
}

/* [LIGHTBOX IMAGE] */
#lfront {
  text-align: center;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}
#lfront img {
  max-width: 100vw;
  max-height: 100vh;
}
 
body, html {
  padding: 0;
  margin: 0;
  background-color: #243444;
}
