* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #fff;
  font-family: sans-serif;
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

ul {
  display: flex;
  flex-wrap: wrap;
}

ul li {
  list-style: none;
}

ul li a {
  position: relative;
  display: block;
  padding: 10px 20px;
  margin: 20px 0;
  text-decoration: none;
  text-transform: uppercase;
  color: #262626;
  font-weight: bold;
  transition: 0.5s;
}

ul li a::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-top: 2px solid #222;
  border-bottom: 2px solid #222;
  transform: scaleY(2);
  opacity: 0;
  z-index: -1;
  transition: 0.5s;
}

ul li a:hover::before {
  opacity: 1;
  transform: scaleY(1);
}

ul li a::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 0;
  width: 100%;
  height: 100%;
  background: #222;
  transform: scale(0);
  z-index: -1;
  transition: 0.5s;
}

ul li a:hover::after {
  opacity: 1;
  transform: scale(1);
}

ul li a:hover {
  color: #fff;
  z-index: 2;
}
