/* The one-screen menu stage: nav words, social icons, and the credit line. */

.bar {
  position: relative;
  background-color: var(--paper);
  min-height: 100vh;
  min-height: 100svh; /* the height a phone shows with its toolbars out */
  box-sizing: border-box;
  overflow: hidden;
}

/* The up arrow at the top of the menu shows only while nothing is selected */
.scroll-up {
  position: absolute;
  top: calc(2rem + var(--safe-top));
  left: 50%;
  color: var(--ink);
  opacity: 0.85;
  cursor: pointer;
  animation: bounceUp var(--bounce-period) ease-in-out infinite;
  transition: opacity var(--hover) ease var(--scroll-up-return-delay);
}

.scroll-up svg {
  width: 30px;
  height: 30px;
  display: block;
}

/* Once a word is selected, the arrow fades out before the words rise */
.bar.active .scroll-up {
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--logo-fade-out) ease;
}

@keyframes bounceUp {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-10px);
  }
}

/* Five words: centered by default, moved to the top while a panel is open */
.nav {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% - 1.75rem);
  transform: translateY(-50%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  padding: 0 var(--gutter);
  box-sizing: border-box;
  transition:
    top var(--stage-move) ease,
    transform var(--stage-move) ease;
}

.bar.active .nav {
  top: calc(1.75rem + var(--safe-top));
  transform: translateY(0);
}

.nav button {
  /* Buttons reset font and case; take the site's instead */
  font: inherit;
  text-transform: inherit;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--ink);
  text-decoration: none;
  font-size: var(--text-base);
  letter-spacing: 0.12em;
  font-weight: 400;
  transition: color var(--nav-fade) ease;
}

/* Hover feedback only where a pointer hovers: on a touch screen a tap leaves
   :hover on what it touched, so the look would stick. */
@media (hover: hover) {
  .nav button:hover {
    text-decoration: underline;
  }
}

/* While a panel is open, unselected words gray out; hover returns them to ink */
.bar.active .nav button {
  color: var(--dim);
}

@media (hover: hover) {
  .bar.active .nav button:hover {
    color: var(--ink);
  }
}

.bar.active .nav button[aria-expanded='true'] {
  color: var(--ink);
  font-weight: 700;
}

/* Social icons: centered by default, moved down near the credit while a panel
   is open */
.social {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(50% - 1.75rem);
  transform: translateY(50%);
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  transition:
    bottom var(--stage-move) ease,
    transform var(--stage-move) ease;
}

.bar.active .social {
  bottom: calc(3.75rem + var(--safe-bottom));
  transform: translateY(0);
}

.social a {
  display: inline-flex;
  color: var(--ink);
  transition: opacity var(--hover) ease;
}

@media (hover: hover) {
  .social a:hover {
    opacity: 0.55;
  }
}

.social a svg {
  width: 28px;
  height: 28px;
  display: block;
}

.credit {
  position: absolute;
  bottom: calc(1.75rem + var(--safe-bottom));
  left: 0;
  right: 0;
  text-align: center;
  color: var(--dim);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
}

/* Phones: the nav wraps onto two rows, so tighten its gaps and pin it closer
   to the top while a panel is open. */
@media (max-width: 720px) {
  /* The row gap is twice each word's 14px hit reach (css/controls.css), so
     the two rows' 44px tap areas meet without overlapping. The idle words
     rise by the same 1rem, so they keep clear of the social icons below. */
  .nav {
    top: calc(50% - 2.75rem);
    gap: 1.75rem 1.4rem;
    padding: 0 5vw;
  }

  .bar.active .nav {
    top: calc(1.25rem + var(--safe-top));
  }
}

/* Without JavaScript the panels stay empty, so say so below the nav words
   and the social icons, which rest just under the words in the idle stage */
.noscript {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% + 4.5rem);
  margin: 0;
  padding: 0 var(--gutter);
  text-align: center;
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--ink);
}

.noscript a {
  color: inherit;
}
