.gridgallery {
  margin-top: -5px;
}
ul.grid  {
  text-align:center; 
}
.grid li.j51gridgallery {
  border: 1px solid rgba(0, 0, 0, 0.04) !important;
  display: inline-block;
  position: relative;
  box-sizing:border-box;
  -moz-box-sizing: border-box;
  text-align: center;
  vertical-align: text-top;
}

ul.grid li a, ul.grid li:first-child a {
  padding:0 !important;
  margin:0 !important;
}

.grid figure {
  margin: 0;
  position: relative;
/*  border-radius: 5px;*/
}

.grid figure img {
  max-width: 100%;
  display: block;
  position: relative;
  z-index:0;
}

.grid figcaption {
  top: 0;
  left: 0;
  padding: 0px;
  background: #aaa;
  text-align: left;
  box-sizing:border-box;
  -moz-box-sizing: border-box;
  text-transform: none; 
  position: relative;
  z-index: 1;  
}

.grid h3 {
  margin: 0;
  padding: 15px 30px;
  font-size: 20px;
  font-weight: 300;
  text-transform: none;
  line-height: 1em;
  background: rgba(255,255,255,0.7);
}

.grid figcaption span {
  color: #cccccc;
  line-height: 2em;
  display: block;
  padding: 15px 30px;
}

/* Caption Style */
.j51gridgallery figure {
  overflow: hidden;
}

.j51gridgallery figure img {
  -webkit-transition: -webkit-transform 0.4s ease-out;
  -moz-transition: -moz-transform 0.4s ease-out;
  transition: transform 0.4s ease-out;
}

.no-touch .j51gridgallery figure:hover img,
.j51gridgallery figure.cs-hover img {
  bottom:0px;
  -webkit-transform: scale(1.2) translateY(-7.5%);
  -moz-transform: scale(1.2) translateY(-7.5%);
  -ms-transform: scale(1.2) translateY(-7.5%);
  transform: scale(1.2) translateY(-7.5%);
}

.j51gridgallery figcaption {
  height:100%;
  width: 100%;
  opacity: 0.7;
  -webkit-transition: opacity 0.5s 0.2s;
  -moz-transition:    opacity 0.5s 0.2s;
  transition:         opacity 0.5s 0.2s;
}

.no-touch .j51gridgallery figure:hover figcaption,
.j51gridgallery figure.cs-hover figcaption {
  opacity: 1;
  -webkit-transition: opacity 0.5s;
  -moz-transition:    opacity 0.5s;
  transition:         opacity 0.5s;
}



@media only screen and (min-width: 1024px) {

.grid li.j51gridgallery:first-of-type {margin-left: 0 !important;}
.grid li.j51gridgallery:last-of-type {margin-right: 0 !important;}

}