/* Remove padding and margin */
* {
    margin: 0;
    padding: 0;
    border: 0;
    /*classes for floating and clearing*/
  }

  html { 
    background: url("image/underwater-min.jpg") no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
  }

  body {
    font: Arial;
    text-align: center;
    font-family: 'Lato', sans-serif;
    width: 100%;
  }

  .clear {
    clear: both;
  }

  .right {
    float: right;
  }

  .left {
    float: left;
  }

  h1 {
    font-size: 2.2em;
    color: #424041;
    outline: 2px solid black;
    background-color: rgba(242, 242, 242, 0.75);
    text-align: center;
  }

  h2 {
    font-size: 2em;
    color: #424041;
    background-color: rgba(242, 242, 242, 0.5);
    text-align: center;
  }

  h3 {
    font-size: 1.8em;
  }

  h4 {
    font-size: 1.6em;
  }

  h5 {
    font-size: 1.4em;
  }

  p {
    font-size: 1.2em;
  }



/*https://stackoverflow.com/questions/54390359/how-to-keep-css-grid-layout-the-same-on-resize*/

figure {
  width: 100%;
  height: 100%;
  margin: 0;
}
img {
  width: 80%;
  height: 80%;
  object-fit: cover;
  max-width: 80%; 
  height: auto;   
  filter: drop-shadow(0 3px 8px rgb(136, 136, 136));
}
main {
  width: 90vw;
  margin: 0 auto;
  position: relative;
  padding-bottom: 42%;
}
.grid {
  margin-top: 4em;
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  grid-template-rows: repeat(20, 5%); /*The grid-auto-rows property sets a size for the rows in a grid container.*/
  grid-column-gap: 3%;
  grid-row-gap: 0.4%;
  position: absolute;
  top: 0;
  bottom: 0;
  /*media-query: grid-row-gap: 4px;*/
}
.grid article:first-of-type {
  grid-column: 4/10; /*If you want this to take 2 column you can do 1/3 or 2/4*/
  grid-row: 10 / 11;
}
.grid article:nth-child(2) {
  grid-column: 6/12;
  grid-row: 1 / 2;
}

.grid article:nth-child(3) {
  grid-column: 21/27;
  grid-row: 1 / 2;
}
.grid article:nth-child(4) {
  grid-column: 16/22;
  grid-row: 10 / 11;
}
.grid article:nth-child(5) {
  grid-column: 4/10;
  grid-row: 15 / 19;
}
.grid article:nth-child(6) {
  grid-column: 10/16;
  grid-row: 10 / 11;
}
.grid article:nth-child(7) {
  grid-column: 22/28;
  grid-row: 15 / 19;
}
.grid article:nth-child(8) {
  grid-column: 22/28;
  grid-row: 10 / 11;
}
.grid article:nth-child(9) {
  grid-column: 12/21;
  grid-row: 1 / 2;
}

.grid article a {
  text-decoration: none;
  color: #474747;
}
.grid article h1 {
  font-size: 3.2vw;
  letter-spacing: 0.3vw;
  font-weight: lighter;
}
.grid article p {
  font-size: 0.7rem;
  letter-spacing: 0.1rem;
}
.grid figcaption {
  padding: 0;
}

.grid article:first-of-type, .grid article:nth-child(2), .grid article:nth-child(3), .grid article:nth-child(4), .grid article:nth-child(5), .grid article:nth-child(6), .grid article:nth-child(7), .grid article:nth-child(8), .grid article:nth-child(9) {
  position: relative;
  text-align: center;

}

footer {
  position: fixed;
  bottom: 0;
  width: 100vw;
  font-size: 2vmax;
  color: #424041;
  background-color: rgba(242, 242, 242, 0.5);
  text-align: center;
  padding: 0.5vh;
}

footer a {
  color: #2F1E4F;
}


/* 
   Imacs, Big desktop monitor.
*/

@media (min-width: 1281px) {

  /* CSS */

}

/* 
 Laptops,Desktop monitors,ipad pros
*/

@media (min-width: 1025px) and (max-width: 1280px) {

  /* CSS */

}

/* 
  portrait tablets and ipads
*/

@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {

  /* CSS */
  main {
    display: flex;
    justify-content: center;
  }

  .grid {
    display: flex;
    flex-direction: column;
    justify-self: center;
    align-self: center;
    height: 80vh;
    text-align: center;
  }

  footer{
    padding: 1vh;
  }
}

/* 
  Landscape tablets and ipads
*/

@media (min-width: 768px) and (max-width: 1023px) and (orientation: landscape) {

  /* CSS */
  .grid {
    grid-row-gap: 4px;
    position: absolute;
    top: -15vh;
    bottom: 0;
    margin-bottom: 24vh;
  }


}

/* 
Landscape for mobiles and tablets
*/

@media (min-width: 481px) and (max-width: 767px) and 
(orientation: landscape)  {

  /* CSS */
  h2{
    margin-bottom: 1vh;
  }
  .grid {
    grid-row-gap: 4px;
    position: absolute;
    top: -15vh;
    bottom: 0;
    margin-bottom: 24vh;

  }
}

/* 
 Mostly all smartphones
*/

@media (min-width: 280px) and (max-width: 480px) and (orientation: portrait) {

  /* CSS */

  .grid {
    display: flex;
    flex-direction: column;
    justify-self: center;
    align-self: center;
    height: 80vh;
    text-align: center;
    }

    footer{
      padding: 1vh;
    }
    
}

/* Specific Devices*/


@media only screen and (min-width : 600px) and (max-width : 603px) and (orientation: portrait) { /*Nexus 7 and similar - Portrait*/

  /* CSS */

  .grid {
    display: flex;
    flex-direction: column;
    justify-self: center;
    align-self: center;
    height: 80vh;
    text-align: center;
    }

    footer{
      padding: 1vh;
    }
}

@media screen 
  and (device-width: 960px) 
  and (device-height: 600px) 
  and (orientation: landscape) { /*Nexus 7 and similar - Landscape*/
    
    h2{
      margin-bottom: 1vh;
    }
    .grid {
      grid-row-gap: 10px;
      position: absolute;
      top: 0;
      bottom: 0;
      margin-bottom: 24vh;
    }
  }

  @media screen 
  and (device-width: 720px) 
  and (device-height: 540px) 
  and (orientation: landscape) { /*Surface Duo and similar - Landscape*/
    
    h2{
      margin-bottom: 1vh;
    }
    .grid {
      grid-row-gap: 10px;
      position: absolute;
      top: 0;
      bottom: 0;
      margin-bottom: 24vh;
    }

  }

  @media screen 
  and (device-width: 540px) 
  and (device-height: 720px) 
  and (orientation: portrait) { /*Surface Duo and similar - Portrait*/
    
    .grid {
      display: flex;
      flex-direction: column;
      justify-self: center;
      align-self: center;
      height: 80vh;
      text-align: center;
      }
  
      footer{
        padding: 1vh;
      }

  }