@import url('https://fonts.googleapis.com/css?family=Muli&display=swap');

* {
  box-sizing: border-box;
}

body {
  background-color: #eafbff;
  background-image: linear-gradient(
    to bottom,
    #eafbff 0%,
    #eafbff 50%,
    #5290f9 50%,
    #5290f9 100%
  );
  font-family: 'Muli', sans-serif;
  height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

nav {
  background-color: #fff;
  padding: 20px;
  border-radius: 3px;
  width: 80px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.6s linear;
  overflow: hidden;
}

nav.active {
  width: 350px;
}

nav ul {
  display: flex;
  list-style-type: none;
  margin: 0;
  padding: 0;
  width: 0;
  z-index: -1; /* garante que não seja possível dar miss click */
  transition: width 0.6s linear, z-index 0.6s linear;
}

nav.active ul {
  width: 100%;
  z-index: 1;
}

nav ul li {
  opacity: 0;
  transform: rotateY(0deg); /* eixo vertical */
  transition: transform 0.6s linear, opacity 0.6s linear;
}

nav.active ul li {
  opacity: 1;
  transform: rotateY(360deg);
}

nav ul a {
  color: #000;
  text-decoration: none;
  margin: 0 10px;
}

/* botão */
.icon {
  background-color: #fff;
  border: 0;
  padding: 0;
  cursor: pointer;
  position: relative;
  height: 30px;
  width: 30px;
}

.icon:focus {
  outline: 0;
}

/* linhas do ícone */
.icon .line {
  background-color: #5290f9;
  height: 2px;
  width: 20px;
  position: absolute;
  top: 10px;
  left: 5px;
  transition: transform 0.6s linear;
}

.icon .line2 {
  top: auto;
  bottom: 10px;
}

/* transição do ícone */
nav.active .icon .line1 {
  transform: rotate(405deg) translateY(5.5px); /* desce 5.5px */
}

nav.active .icon .line2 {
  transform: rotate(-405deg) translateY(-5.5px); /* sobe 5.5px */
}
/* Para rotate: 765 405 45 = Translate positivo (line1) e negativo (line2) */