@import url("https://fonts.googleapis.com/css2?family=Roboto&display=swap");

:root {
  --navbar-width: 350px;
  --navbar-height: 60px;
  --duration: 0.5s;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Roboto", sans-serif;
}

body {
  display: flex;
  height: 100vh;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  font-size: 1rem;
}

.navbar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: var(--navbar-width);
  max-width: 100%;
  border: 2px solid black;
  border-radius: 5px;
  height: var(--navbar-height);
  transition: width var(--duration) ease;
}

.navbar.hidden {
  width: var(--navbar-height);
}

.navbar li {
  list-style: none;
  text-align: center;
  min-width: var(--navbar-height);
}

.navbar li a {
  text-decoration: none;
  color: black;
}

.nav-item,
.nav-toggle {
  position: relative;
  left: 0px;
  cursor: pointer;
  transition: left var(--duration) ease, opacity var(--duration) ease;
  min-height: var(--navbar-height);

  display: flex;
  justify-content: center;
  align-items: center;
}

.nav-toggle::before, .nav-toggle::after {
  background-color: black;
  content: '';
  position: absolute;
  height: 4px;
  width: calc(0.35 * var(--navbar-height));
  border-radius: 3px;
  transition: transform var(--duration) ease-in-out;
  left: calc(var(--navbar-height) / 3);
}

.nav-toggle::before {
  top: calc(0.35 * var(--navbar-height));
  transform: rotate(45deg) translate(5px, 5px);
}
.nav-toggle::after {
  bottom: calc(0.35 * var(--navbar-height));
  transform: rotate(-45deg) translate(5px, -5px);
}

.navbar.hidden .nav-toggle::before {
  /* transform: rotate(35deg) translateY(6px); */
  transform: rotate(0) translate(0, 0);
}

.navbar.hidden .nav-toggle::after {
  /* transform: rotate(-35deg) translateY(-6px); */
  transform: rotate(0) translate(0, 0);
}

.navbar.hidden .nav-item {
  pointer-events: none;
  left: 200px;
  opacity: 0%;
}

.navbar.hidden .nav-toggle {
  left: calc(-2 * var(--navbar-height));
}
