#content {
  min-height: 0;
}
#ggallery {
  display: block; width: 100%; padding: 0; margin: 1em 0;
  background: transparent;
}
.gallery {
  width: 100%; max-width: 100%; margin: 0 auto; background: transparent;
}
.picwrapper {
  position: relative; display: block; float: left; margin: 0;
}
/*.gallery a img {
  display: block; width: 100%; height: auto;
}*/
.gallery img {
  display: block; width: 100%; height: auto;
}
a.overlay {
  display: block; width: 100%; height: 100%; position: absolute; top: 0; left: 0;
}
a.overlay:hover {
  color:white;text-align: center;
  background: rgba(255, 0, 0, 0.4); /* will need changing per site */
}

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

@media only screen and (min-width:768px){
  .picwrapper {
    width: 14.28%; height:14.28%;
  }
  .gallery a:nth-child(5n+5) {
    margin-right:0;
  }
}

@media only screen and (min-width:481px) and (max-width:767px){
  .picwrapper {
    width: 33%; height: auto;
  }
  .gallery a:nth-child(3n+3) { margin-right:0;}
}

/* iphone6 landscape */
@media only screen and (min-device-width:375px) and (max-device-width:667px) and (orientation:landscape) and (-webkit-min-device-pixel-ratio:2){
  .picwrapper {
    width: 33%; height: auto;
  }
  .gallery a:nth-child(3n+3) { margin-right:0;}
}

/* iphone6 plus landscape */
@media only screen and (min-device-width:414px) and (max-device-width:736px) and (orientation:landscape) and (-webkit-min-device-pixel-ratio:3){
  .picwrapper {
    width: 25%; height: auto;
  }
  .gallery a:nth-child(4n+4) { margin-right:0;}
}

/* iphone 5 landscape */
@media only screen and (min-device-width:320px) and (max-device-width:568px) and (orientation:landscape) {
  .picwrapper {
    width: 33%; height: auto;
  }
  .gallery a:nth-child(3n+3) { margin-right:0;}
}

/* all phones portrait */
@media only screen and (max-width:480px){
  .picwrapper {
    width: 50%;
  }
  .gallery a:nth-child(2n+2) { margin-right:0;}
}

/* all phones 480 landscape */
@media only screen and (max-width:480px) and (orientation:landscape){

}

/* ipad landscape */
@media only screen and (min-device-width:768px) and (max-device-width:1024px) and (orientation:landscape) and (-webkit-min-device-pixel-ratio:1){
}

/* ipad portrait */
@media only screen and (min-device-width:768px) and (max-device-width:1024px) and (orientation:portrait) and (-webkit-min-device-pixel-ratio:1){
  .picwrapper {
    width: 33%; height: auto;
  }
  .gallery a:nth-child(3n+3) { margin-right:0;}
}

/* ipad retina landscape */
@media only screen and (min-device-width:768px) and (max-device-width:1024px) and (orientation:landscape) and (-webkit-min-device-pixel-ratio:2){
}

/* ipad retina portrait */
@media only screen and (min-device-width:768px) and (max-device-width:1024px) and (orientation:portrait) and (-webkit-min-device-pixel-ratio:2){
  .picwrapper {
    width: 25%; height: auto;
  }
  .gallery a:nth-child(4n+4) { margin-right:0;}
}
