body.menu-open {
  overflow: hidden;
}

.menu-overlay {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 90px max(8vw, 32px) 48px;
  background: var(--primary);
  color: var(--paper);
  clip-path: circle(0 at calc(100% - 44px) 44px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    clip-path 620ms cubic-bezier(.76, 0, .24, 1),
    opacity 250ms ease,
    visibility 0s linear 620ms;
}

.menu-overlay.is-open {
  clip-path: circle(150vmax at calc(100% - 44px) 44px);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    clip-path 620ms cubic-bezier(.76, 0, .24, 1),
    opacity 250ms ease,
    visibility 0s;
}

.menu-close {
  position: absolute;
  top: 28px;
  right: max(4.25vw, 24px);
  background: var(--yellow);
  color: var(--primary);
}

.menu-close:hover {
  background: var(--paper);
}

.menu-close svg {
  width: 28px;
  height: 28px;
}

.menu-nav {
  display: flex;
  width: min(100%, 760px);
  flex-direction: column;
  align-self: center;
  align-items: center;
  gap: 0;
  /* Auto margins centre the menu vertically but, unlike justify-content,
     still let it scroll from the top when it is taller than the screen. */
  margin-top: auto;
  padding: 10px 0;
}

.menu-nav a {
  width: fit-content;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, min(6vw, 7.5vh), 4.5rem);
  font-weight: 600;
  line-height: 1.2;
  text-transform: uppercase;
  transition: color 160ms ease, transform 220ms ease;
}

.menu-nav a:hover {
  color: var(--yellow);
  transform: translateX(8px);
}

.menu-nav a[aria-current="page"] {
  color: var(--yellow);
}

.menu-overlay.is-open .menu-nav a {
  animation: menu-in 500ms cubic-bezier(.22, 1, .36, 1) both;
  animation-delay: calc(var(--item) * 55ms);
}

.menu-contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: center;
  margin-top: 44px;
  margin-bottom: auto;
  padding-top: 20px;
  border-top: 1px solid rgb(255 255 255 / 35%);
}

.menu-contact .contact-mail {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: .15em;
  line-height: 2;
  color: var(--yellow);
  text-transform: uppercase;
}

.menu-socials {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

/* The footer's bulb hover, in reverse colours for the dark menu: a yellow
   disc fills up from below, the icon goes dark and three yellow rays pop out. */
.menu-socials a {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border-radius: 50%;
  color: var(--paper);
  transition: color 250ms ease;
}

.menu-socials a::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--yellow);
  clip-path: circle(0 at 50% 100%);
  transition: clip-path 450ms var(--ease-out);
}

.menu-socials a::after {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  width: 26px;
  height: 11px;
  background: var(--yellow);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 11'%3E%3Cpath d='M13 1.5v7M4 3.5l3.5 5M22 3.5l-3.5 5' stroke='%23000' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 11'%3E%3Cpath d='M13 1.5v7M4 3.5l3.5 5M22 3.5l-3.5 5' stroke='%23000' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0;
  transform: translate(-50%, 6px) scale(.4);
  transform-origin: 50% 100%;
  transition: opacity 200ms ease, transform 200ms ease;
}

.menu-socials svg {
  position: relative;
  width: 24px;
  height: 24px;
  transition: transform 450ms cubic-bezier(.34, 1.56, .64, 1);
}

.menu-socials a:hover,
.menu-socials a:focus-visible {
  color: var(--primary);
}

.menu-socials a:hover::before,
.menu-socials a:focus-visible::before {
  clip-path: circle(72% at 50% 100%);
}

.menu-socials a:hover::after,
.menu-socials a:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
  transition: opacity 200ms ease 150ms, transform 500ms cubic-bezier(.34, 1.56, .64, 1) 150ms;
}

.menu-socials a:hover svg,
.menu-socials a:focus-visible svg {
  transform: rotate(-10deg) scale(1.08);
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(1.25rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 680px) {
  .menu-overlay {
    padding: 78px 28px 32px;
  }

  .menu-close {
    top: 18px;
    right: 20px;
  }

  .menu-nav a {
    font-size: clamp(2.25rem, min(13vw, 8.5vh), 4.5rem);
  }

  .menu-contact {
    align-items: center;
    margin-top: 28px;
  }

  .menu-socials {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .menu-socials a::before,
  .menu-socials a::after,
  .menu-socials svg {
    transition: none !important;
  }
}
