* { margin: 0; padding: 0; border: 0; font: inherit; box-sizing: border-box; }
body { min-height: 100vh; font: 1em Roboto, FontAwesome, sans-serif; font-weight: 300; }
html { background: #FFF; color: #FFF; }

label[for] { cursor: pointer; }
input[type="checkbox"] { display: none; }

.lightbox, .grid { width: 100%; position: fixed; top: 0; left: 0; }

.lightbox {
  z-index: 1;
  min-height: 100%;
  overflow: auto;
  -webkit-transform: scale(0);
          transform: scale(0);
  -webkit-transition: -webkit-transform .5s ease-out;
  transition: -webkit-transform .5s ease-out;
  transition: transform .5s ease-out;
  transition: transform .5s ease-out, -webkit-transform .5s ease-out;
}
.lightbox img {
  position: fixed;
  top: 50%;
  left: 50%;
  max-width: 96%;
  max-height: 96%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

input[type="checkbox"]:checked + .lightbox {
  -webkit-transform: scale(1);
          transform: scale(1);
}

input[type="checkbox"]:checked ~ .grid { opacity: .125; }

.grid { 
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  height: 100%;
  padding: 16px;
  overflow: auto;
  z-index: 0;
  background-color: #222;
  text-align: center;
  -webkit-transition: opacity .75s;
  transition: opacity .75s;
}
.grid .grid-item {
  display: block;
  width: 25%;
  padding: 16px;
  opacity: .75;
  -webkit-transition: opacity .5s;
  transition: opacity .5s;
}
.grid .grid-item:hover { opacity: 1; }

@media screen and (max-width: 1280px) { .grid .grid-item { width: 33.3333%; } }
@media screen and (max-width: 960px)  { .grid .grid-item { width: 50%; } }
@media screen and (max-width: 480px)  { .grid .grid-item { width: 100%; } }

.grid img { max-width: 100%; max-height: 100%; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }