#hexGrid {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  margin: 40px auto 0;
  overflow: hidden;
  font-family: inherit;
  list-style-type: none;
}

.hex {
  position: relative;
  visibility:hidden;
  outline:1px solid transparent; /* fix for jagged edges in FF on hover transition */
}
.hex::after{
  content:'';
  display:block;
  padding-bottom: 86.602%;  /* =  100 / tan(60) * 1.5 */
}
.hexIn{
  position: absolute;
  width:96%;
  padding-bottom: 110.851%; /* =  width / sin(60) */
  margin:0 2%;
  overflow: hidden;
  visibility: hidden;
  outline:1px solid transparent; /* fix for jagged edges in FF on hover transition */
  -webkit-transform: rotate3d(0,0,1,-60deg) skewY(30deg);
      -ms-transform: rotate3d(0,0,1,-60deg) skewY(30deg);
          transform: rotate3d(0,0,1,-60deg) skewY(30deg);
}
.hexIn * {
  position: absolute;
  visibility: visible;
  outline:1px solid transparent; /* fix for jagged edges in FF on hover transition */
}
a.hexLink {
  color: #fff;
}
.hexLink {
    display:block;
    width: 100%;
    height: 100%;
    text-align: center;
    color: #fff;
    overflow: hidden;
    -webkit-transform: skewY(-30deg) rotate3d(0,0,1,60deg);
        -ms-transform: skewY(-30deg) rotate3d(0,0,1,60deg);
            transform: skewY(-30deg) rotate3d(0,0,1,60deg);
}

/*** HEX CONTENT **********************************************************************/
.hex img {
  left: -100%;
  right: -100%;
  width: auto;
  height: 100%;
  margin: 0 auto;
  -webkit-transform: rotate3d(0,0,0,0deg);
      -ms-transform: rotate3d(0,0,0,0deg);
          transform: rotate3d(0,0,0,0deg);
}

.hex h1, .hex p {
  color: #fff;
  width: 100%;
  padding: 0 5%;
  margin: 0;
  box-sizing:border-box;
  background-color: rgba(78, 43, 99, 0.8);
  font-weight: 300;
  -webkit-transition:  -webkit-transform .1s ease-out, opacity .2s ease-out;
          transition:          transform .1s ease-out, opacity .2s ease-out;
}

li.hex:first-child h1,
li.hex:first-child p {
  background-color: rgba(244, 67, 54, 0.8);
}

li.hex:nth-child(2) h1,
li.hex:nth-child(2) p {
  background-color: rgba(255, 193, 7, 0.8);
}

li.hex:nth-child(3) h1,
li.hex:nth-child(3) p {
  background-color: rgba(255, 235, 59, 0.8);
}

li.hex:nth-child(4) h1,
li.hex:nth-child(4) p {
  background-color: rgba(76, 175, 80, 0.8);
}

li.hex:nth-child(5) h1,
li.hex:nth-child(5) p {
  background-color: rgba(33, 150, 243, 0.8);
}

li.hex:nth-child(6) h1,
li.hex:nth-child(6) p {
  background-color: rgba(63, 81, 181, 0.8);
}
.hex h1 {
  bottom: 50%;
  padding-top:50%;
  font-size: 1.5em;
  font-weight: 600;
  z-index: 1;
  text-transform: uppercase;
  -webkit-transform:translate3d(0,-100%,0);
      -ms-transform:translate3d(0,-100%,0);
          transform:translate3d(0,-100%,0);
}
.hex h1::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 45%;
  width: 10%;
  text-align: center;
}
.hex p {
  top: 50%;
  padding-bottom:50%;
  -webkit-transform:translate3d(0,100%,0);
      -ms-transform:translate3d(0,100%,0);
          transform:translate3d(0,100%,0);
}


/*** HOVER EFFECT  **********************************************************************/
.hexLink:hover h1, .hexLink:focus h1,
.hexLink:hover p, .hexLink:focus p{
  -webkit-transform:translate3d(0,0,0);
      -ms-transform:translate3d(0,0,0);
          transform:translate3d(0,0,0);
}

/*** HEXAGON SIZING AND EVEN ROW INDENTATION *****************************************************************/
@media (min-width:901px) { /* <- 5-4  hexagons per row */
  #hexGrid{
    padding-bottom: 4.4%;
    padding-left: 30px;
    padding-right: 29px;
  }
  .hex {
    width: 16.666%; /* = 100 / 5 */
  }
}

@media (max-width: 900px) and (min-width:601px) { /* <- 3-2  hexagons per row */
  #hexGrid{
    padding-bottom: 7.4%
  }
  .hex {
    width: 33.333%; /* = 100 / 3 */
  }
  .hex:nth-child(6n+1){ /* first hexagon of even rows */
    margin-left:16.666%;  /* = width of .hex / 2  to indent even rows */
  }
}

@media (max-width: 600px) { /* <- 2-1  hexagons per row */
  #hexGrid{
    padding-bottom: 11.2%
  }
  .hex {
    width: 33.333%; /* = 100 / 3 */
  }
  .hex:nth-child(6n+1){ /* first hexagon of even rows */
    margin-left:16.666%;  /* = width of .hex / 2  to indent even rows */
  }
}

@media (max-width: 599px) {
    #hexGrid {
        font-size: 13px;
        padding-bottom: 22%;
        padding-left: 15px;
        padding-right: 15px;
    }
    .hex {
      width: 100%; /* = 100 / 3 */
    }
    .hex::after{
      padding-bottom: 45%;  /* =  100 / tan(60) * 1.5 */
    }
    .hex:nth-child(6n+1){ /* first hexagon of even rows */
      margin-left:0;  /* = width of .hex / 2  to indent even rows */
    }
    .hexIn{
      width:100%;
      padding-bottom:66.62%; /* =  width / sin(60) */
      margin:0;
      -webkit-transform: none;
          -ms-transform: none;
              transform: none;
    }
    .hexLink {
      -webkit-transform: none;
          -ms-transform: none;
              transform: none;
    }

    .hex img {
      -webkit-transform: none;
          -ms-transform: none;
              transform: none;
    }
}
