body {
  margin-top: 40px;
}

.topnav {
  overflow: hidden;
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  float: right;
  background-color: white;
}

.topnav a {
  float: right;
  color: black;
  text-align: center;
  padding: 10px 10px;
  text-decoration: none;
  font-size: 17px;
}

#logo {
  font-size: 30px;
  float: left;
  padding: 5px 0 0 15px;
  text-transform: uppercase;
}
#logo:hover {
  background-color: white;
}

.topnav a:hover {
  background-color: purple;
  color: #ddd;
}

.topnav a.active {
  background-color: #4caf50;
  color: white;
}

.topnav .icon {
  display: none;
}

@media screen and (max-width: 1024px) {
  .topnav a:not(:last-child) {
    display: none;
  }
  .topnav a.icon {
    float: right;
    display: block;
  }
  .grid {
    margin-top: 0;
    grid-template-columns: 100%;
    grid-template-rows: repeat(8, 50%);
  }
  .grid-item {
    width: 100%;
    height: auto;
  }
  img {
    max-width: 50%;
    max-height: 50%;
    display: block;
  }
}

@media screen and (max-width: 1024px) {
  .topnav.responsive a:last-child {
    display: none;
  }
  .topnav.responsive a:nth-child(3) {
    display: none;
  }
  .topnav.responsive {
    position: fixed;
  }
  .topnav.responsive .icon {
    position: absolute;
    right: 0;
    top: 0;
  }
  .topnav.responsive a {
    float: none;
    display: block;
    text-align: left;
  }
}
