.modal {
  display: none;
  position: fixed;
  z-index: 1;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 5vw;
  background-color: rgba(0, 0, 0, .8);
}

.gallery-container {
  position: relative;
  height: 100%;
  width: 100%;
  margin: auto;
  max-width: var(--maximum-page-width);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: var(--content-background-color);
}

.gallery-header {
  flex-grow: 0;
  display: flex;
  align-items: center;
  padding-left: 28px;
  border-bottom: var(--default-border);
}

.gallery-header h1 {
  margin: 0;
  font-size: 36px;
  line-height: 56px;
  font-weight: var(--medium);
  flex-grow: 1;
}

.gallery-header .close {
  flex-grow: 0;
  color: var(--accent-color);
  font-size: 35px;
  width: 56px;
  line-height: 56px;
  text-align: center;
  font-weight: bold;
}

.close:hover,
.close:focus {
  background-color: var(--page-background-color);
  text-decoration: none;
  cursor: pointer;
}

.gallery-thumbnails {
  flex-grow: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  background-color: var(--page-background-color);
  padding: 8px;
}

.gallery-thumbnail {
  display: flex;
  height: 8vw;
  width: 16vw;
  margin: 8px;
  justify-content: center;
  align-items: center;
  background-color: var(--content-background-color);
  border: var(--default-border);
  padding: 4px;
  cursor: pointer;
}

.gallery-thumbnail.active {
  border: 5px solid var(--accent-color);
  padding: 0;
}

.gallery-thumbnail img {
  max-width: 100%;
  max-height: 100%;
}

.gallery-images {
  flex-grow: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.gallery-images .main-image {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 16px;
  flex-grow: 1;
}

.prev,
.next {
  flex-grow: 0;
  flex-shrink: 0;
  cursor: pointer;
  width: 56px;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 36px;
  font-weight: bold;
  color: var(--accent-color);
}

.prev:hover,
.next:hover {
  background-color: var(--page-background-color);
  text-decoration: none;
}

@media only screen and (max-width: 1023px) {
  /* removes the overlay and stretches the gallery to the edges */
  .modal {
    padding: unset;
  }

  .gallery-thumbnail {
    margin: 4px;
  }

  .gallery-thumbnail.active {
    border-width: 2px;
    padding: 3px;
  }

  /* move the arrows to the thumbnail box */
  .prev,
  .next {
    font-size: 24px;
    position: absolute;
    margin: 12px;
    bottom: 0;
    padding: 5px;
    height: 8vw;
    width: 24px;
  }

  .prev {
    left: 0;
  }

  .next {
    right: 0;
  }

  /* make space for the arrows in the thumbnail box*/
  .gallery-thumbnails {
    padding: 8px 32px;
  }
}

