* {
  box-sizing: border-box;
}

a {
  text-decoration: none;
}

.nav-links a {
  opacity: 0;
  transform: translateX(-20px);
  animation: loopAnim 15s ease-in-out infinite;
}

/* Stagger timing */
.nav-links a:nth-child(1) {
  animation-delay: 0s;
}

.nav-links a:nth-child(2) {
  animation-delay: 1s;
}

.nav-links a:nth-child(3) {
  animation-delay: 2s;
}

.nav-links a:nth-child(4) {
  animation-delay: 3s;
}

/* Animation */
@keyframes loopAnim {

  /* Fade in */
  0% {
    opacity: 0;
    transform: translateX(-20px);
  }

  10% {
    opacity: 1;
    transform: translateX(0);
  }

  /* Stay visible */
  60% {
    opacity: 1;
    transform: translateX(0);
  }

  /* Fade out */
  70% {
    opacity: 0;
    transform: translateX(-20px);
  }

  /* Hidden until restart */
  100% {
    opacity: 0;
    transform: translateX(-20px);
  }
}

nav {
  position: fixed;
  top: 0;
  left: 10;
  right: 10;
  width: 99%;
  background-color: rgb(0, 0, 0);
  border-radius: 0px;
  z-index: 100;
}

nav a {
  line-height: 50px;
  height: 50px;
  font-size: 15px;
  display: inline-block;
  position: relative;
  z-index: 1;
  text-decoration: none;
  text-transform: uppercase;
  text-align: center;
  color: #fff;
  cursor: pointer;
}

nav .animation {
  position: absolute;
  height: 100%;
  top: 0;
  z-index: 0;
  transition: all .5s ease 0s;
}

a:nth-child(1) {
  width: 350px;
}

a:nth-child(2) {
  width: 350px;
}

a:nth-child(3) {
  width: 350px;
}

a:nth-child(4) {
  width: 350px;
}

a:nth-child(5) {
  width: 250px;
}

nav .start-home,
a:nth-child(1):hover~.animation {
  width: 350px;
  left: 0px;
  background-color: #1abc9c;
}

nav .start-home,
a:nth-child(2):hover~.animation {
  width: 350px;
  left: 350px;
  background-color: #e74c3c;
}

nav .start-home,
a:nth-child(3):hover~.animation {
  width: 350px;
  left: 700px;
  background-color: #3498db;
}

nav .start-home,
a:nth-child(4):hover~.animation {
  width: 350px;
  left: 1050px;
  background-color: #9b59bc;
}

nav .start-home,
a:nth-child(5):hover~.animation {
  width: 10px;
  left: 0px;
  background-color: black;
}


@media (max-width: 1024px) {
  nav {
    width: 98.4%;
  }

  a:nth-child(1) {
    width: 210px;
  }

  a:nth-child(2) {
    width: 210px;
  }

  a:nth-child(3) {
    width: 210px;
  }

  a:nth-child(4) {
    width: 210px;
  }

  nav .start-home,
  a:nth-child(5):hover~.animation {
    left: 990px;
  }
}

@media (max-width: 768px) {
  nav a {
    font-size: 10px;
  }

  nav {
    width: 97.9%;
  }

  a:nth-child(1) {
    width: 175px;
  }

  a:nth-child(2) {
    width: 175px;
  }

  a:nth-child(3) {
    width: 175px;
  }

  a:nth-child(4) {
    width: 175px;
  }
}

@media (max-width: 360px) {
  nav {
    width: 95.5%;
  }

  a:nth-child(1) {
    width: 80px;
  }

  a:nth-child(2) {
    width: 70px;
  }

  a:nth-child(3) {
    width: 80px;
  }

  a:nth-child(4) {
    width: 80px;
  }
}