/* ---------- reset + page ---------- */

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

/* Two values that scale with the screen. clamp() reads as
   "never below the first, never above the last, aim for the middle." */
:root {
  /* 15px on desktop, easing down to 12px on a small phone. */
  --type-size: clamp(12px, 3.4vw, 15px);
  /* Width of the divider line, and so of the whole menu. */
  --menu-width: clamp(128px, 36vw, 165px);
}

html,
body {
  height: 100%;
}

body {
  background: #ffffff;
  color: #111111;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

/* The stage centers the menu horizontally, and pins it just below
   the vertical midpoint of the screen so the closed state matches the mock. */
.stage {
  min-height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 50vh 24px 0;
}

/* ---------- menu ---------- */

/* Width is set by the divider line, the widest element. The menu is also the
   anchor the panel positions itself against ("position: relative"). */
.menu {
  position: relative;
  width: var(--menu-width);
  text-align: center;
}

.menu__toggle {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: var(--type-size);
  letter-spacing: 0.06em;
  color: #111111;
  transition: transform 1800ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Open: PROJECTS drifts up, away from the content emerging below it. */
.menu.is-open .menu__toggle {
  transform: translateY(-16px);
}

.menu__toggle:focus-visible {
  outline: 1px solid #111111;
  outline-offset: 6px;
}

/* The panel is lifted out of the normal flow, so growing or shrinking it never
   nudges PROJECTS around. Closed, it sits tucked up behind the button and
   invisible; open, it slides down into place. */
.menu__panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-26px);
  transition: transform 1800ms cubic-bezier(0.22, 0.61, 0.36, 1),
              opacity 1500ms ease,
              visibility 0s linear 1800ms;
}

.menu__panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: transform 1800ms cubic-bezier(0.22, 0.61, 0.36, 1),
              opacity 2600ms ease 250ms,
              visibility 0s linear 0s;
}

/* This padding plus the 16px PROJECTS rise sets the open gap above the line. */
.menu__panel-inner {
  padding-top: 14px;
}

.menu__rule {
  border: 0;
  border-top: 1px solid #111111;
  width: 100%;
  margin: 0 auto;
}

.menu__list {
  list-style: none;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* The link travels a little further than the divider above it, and starts a
   beat later, so the two don't arrive as one solid block. */
.menu__link {
  display: inline-block;
  color: #808080;
  text-decoration: none;
  font-size: var(--type-size);
  transform: translateY(-12px);
  transition: color 160ms ease,
              transform 1800ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.menu__panel.is-open .menu__link {
  transform: translateY(0);
  transition: color 160ms ease,
              transform 1800ms cubic-bezier(0.22, 0.61, 0.36, 1) 220ms;
}

.menu__link:hover,
.menu__link:focus-visible {
  color: #111111;
}

/* Respect the system "reduce motion" setting — no sliding, just show/hide. */
@media (prefers-reduced-motion: reduce) {
  .menu__toggle,
  .menu__panel,
  .menu__panel.is-open,
  .menu__link,
  .menu__panel.is-open .menu__link {
    transition: opacity 200ms ease;
    transform: none;
  }

  .menu.is-open .menu__toggle {
    transform: none;
  }
}
