#gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  column-gap: 5px;
  row-gap: 5px;
  margin-top: 15px;
  margin-bottom: 50px;
}

#gallery div {
  width: calc((100% / 5) - 4px);
  aspect-ratio: 16 / 10;
  cursor: pointer;
}

#gallery div img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#gallery-overlay-dimmer {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;

  background-color: rgba(0, 0, 0, 0.85);

  transition: opacity 0.5s;
}

#gallery-overlay-dimmer img {
  position: fixed;
  top: 20px;
  right: 20px;
  max-width: 30px;
  width: 5%;

  cursor: pointer;
  outline: none;
}

#gallery-overlay {
  position: fixed;
  top: 50px;
  bottom: 50px;
  left: 0;
  right: 0;

  display: flex;
  flex-direction: row;

  transition: opacity 0.5s;
}

#gallery-overlay-image {
  flex-grow: 1;
  flex-basis: 0;
}

#gallery-overlay-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-overlay-button {
  flex-grow: 0;

  width: 15%;
  max-width: 150px;

  display: flex;
  justify-content: center;
  align-items: center;
}

.gallery-overlay-button-click-area {
  height: 300px;
  max-height: 100%;
  width: 100%;

  display: flex;
  justify-content: center;
  align-items: center;

  cursor: pointer;
}

.gallery-overlay-button img {
  width: 30%;
}

#gallery-overlay-right-button img {
  transform: scaleX(-1);
}

.hidden {
  opacity: 0;
  pointer-events: none;
}

#gallery-overlay:not(.hidden) {
  pointer-events: none;
}

#gallery-overlay:not(.hidden) #gallery-overlay-image img{
  pointer-events: all;
}

#gallery-overlay:not(.hidden) .gallery-overlay-button-click-area{
  pointer-events: all;
}

@media screen and (max-width: 920px) {
  #gallery div {
    width: calc((100% / 4) - 4px);
  }
}

@media screen and (max-width: 720px) {
  #gallery div {
    width: calc((100% / 3) - 4px);
  }
}

@media screen and (max-width: 540px) {
  #gallery div {
    width: calc((100% / 2) - 4px);
  }
}
