/* Define transition animation (Chrome, Safari, Opera) */
@-webkit-keyframes opacity-transition {
    from {opacity: 0;}
    to {opacity:1;}
}

/* Define transition animation (Chrome, Safari, Opera) */
@-webkit-keyframes opacity-transition {
    from {opacity: 0;}
    to {opacity:1;}
}

/* Define transition animation (Standard syntax) */
@keyframes opacity-transition {
    from {opacity: 0;}
    to {opacity:1;}
}

/* The gallery thumbnails */
.thumb {
  width: 24%;
  height: 180px;
  float: left;
  margin-right: 3px;
  margin-bottom: 3px;
  background-size: cover;
  background-color: white;
  background-position: 50% 50%;
  position: relative;
}

/* The thumbnails' captions */
.caption {
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  position: absolute;
  width: 100%;
  bottom: 0;
  opacity: 0;
  line-height: 1;
}

.caption h2 {
  font-family: 'Barlow Condensed',sans-serif;
  font-weight: lighter;
}

.caption p, .caption h2 {
  padding: 0 10px;
  width: 80%;
  word-wrap: break-word;
}

.thumb:hover > .caption {
  opacity: 1;

  /* Link the animation to the caption div */
  -webkit-animation-name: opacity-transition; /* Chrome, Safari, Opera */
  -webkit-animation-duration: 0.5s; /* Chrome, Safari, Opera */
  animation-name: opacity-transition;
  animation-duration: 0.5s;
}

/* The popup's background */
.popup {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  text-align: center;
  z-index: 1;
}

/* Display the popup when targeted */
.popup:target {
  display: block;
}

/* The popup's content */
.gallery {
  text-align: center;
  height: 80%;
  width: 90%;
  margin: 0 5%;
  position: fixed;
  top: 10px;
  z-index: 2;

  /* Linking the animation to the popup */
  -webkit-animation-name: opacity-transition; /* Chrome, Safari, Opera */
  -webkit-animation-duration: 0.5s; /* Chrome, Safari, Opera */
  animation-name: opacity-transition;
  animation-duration: 0.5s;
}

.image {
  position: relative;
  top: 50%;
  transform: translateY(-50%);
  width:auto;
  height:auto;
  max-height:100%;
  max-width: 100%;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

.image-post {
  position: relative;
  top: 55%;
  transform: translateY(-50%);
  width:auto;
  height:auto;
  max-height:100%;
  max-width: 100%;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

.image-info {
  position: fixed;
  bottom: 0;
  left: 10%;
  height: 18%;
  width: 80%;
  word-wrap: break-word;
  line-height: 1;
}

.image-info-post {
  position: fixed;
  bottom: 0;
  left: 10%;
  height: 13%;
  width: 80%;
  word-wrap: break-word;
  line-height: 1;
}

/* The buttons */
.backbtn, .nextbtn {
  display: inline-block;
  width: 50px;
  height: auto;
  position: absolute;
  top: 0;
}

.nextbtn {
  right: 0;
}

.backbtn {
  left: 0;
}

.closebtn {
  display: inline-block;
  width: 50px;
  height: auto;
  position: fixed;
  right: 10px;
  top: 10px;
  z-index: 2;
}

.closebtn:hover, .backbtn:hover, .nextbtn:hover {
  opacity: 0.3;
  text-decoration: none;
  cursor: pointer;
}

/* Responsive adjustments */
@media (max-width: 800px) {

    .gallery {
      top: 47px;
      height: 75%;
    }

    .thumb {
      width: 32%;
    }

    .closebtn {
      position: initial;
    }

    div h2 {
      font-size: 23px;
    }
  
  .image-info h2 {
    font-size: 25px;
  }
  
  .image-info p {
    font-size: 15px;
    margin-top: -12px;
  }
  
  .image-info .date {
    font-size: 0;
  }
  

@media (max-width: 500px) {

  .thumb {
      width: 49%;
    }

  .closebtn, .nextbtn, .backbtn {
    width: 45px;
    height: auto;
  }

  .closebtn {
    margin: -5px;
  }

  .backbtn {
    margin-left: -20px;
    margin-top: 10px;
  }

  .nextbtn {
    margin-right: -20px;
    margin-top: 10px;
  }

  .gallery {
    top: 33px;
    height: 72%;
    }

  .image-info {
    height: 23%;
  }

}
