/* =========================================================
8) MENU BUTTON (hamburger) — NO-JUMP VERSION
Fixes the “moves when clicked” issue by:
- reserving border space (transparent border)
- locking padding/line-height
- using outline/box-shadow for focus (no layout shift)
- preventing any active state from nudging it
========================================================= */
.menuBtn {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 10px;

  /* lock the box so states can't change size */
  box-sizing: border-box;
  line-height: 1; /* prevents text baseline wiggle */
  padding: 10px 14px;
  border-radius: 999px;

  /* reserve the border space even if you change border on states later */
  border: 1px solid transparent;
  border-color: rgba(255, 255, 255, 0.16);

  background: rgba(255, 255, 255, 0.05);

  color: var(--text);
  font-weight: 900;
  cursor: pointer;

  /* prevent tiny "tap" nudge some browsers apply */
  transform: translateZ(0);
}

/* keep hover purely visual (no padding/border/margin changes) */
.menuBtn:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* IMPORTANT: don't let :active shift the button */
.menuBtn:active {
  transform: translateZ(0); /* explicitly no translate */
}

.menuBtn__labelWrap {
  display: inline-grid;
  width: 6.5ch; /* adjust: big enough for the longer label */
}

.menuBtn__label--open,
.menuBtn__label--closed {
  grid-area: 1 / 1;
  white-space: nowrap;
}

/* Focus ring that does NOT move layout */
.menuBtn:focus {
  outline: none;
}
.menuBtn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.45);
  outline-offset: 3px; /* outline doesn't affect layout */
}

/* If you are using aria-expanded styles elsewhere, lock them too */
.menuBtn[aria-expanded="true"] {
  padding: 10px 14px; /* re-assert */
  border-width: 1px; /* re-assert */
}

/* label swap (keep as-is) */
.menuBtn__label--open {
  display: none;
}
body.is-megaOpen .menuBtn__label--closed {
  display: none;
}
body.is-megaOpen .menuBtn__label--open {
  display: inline;
}

/* ===== Menu button morph (hamburger -> X) ===== */
.menuBtn__icon {
  position: relative;
  width: 22px;
  height: 16px;
  display: inline-block;
  flex: 0 0 auto; /* keep icon from flex-resizing */
}

.menuBtn__icon i {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 220ms ease, top 220ms ease, opacity 160ms ease;
}

.menuBtn__icon i:nth-child(1) {
  top: 3px;
}
.menuBtn__icon i:nth-child(2) {
  top: 11px;
}

/* When open: lines cross */
.menuBtn[aria-expanded="true"] .menuBtn__icon i:nth-child(1) {
  top: 7px;
  transform: rotate(45deg);
}
.menuBtn[aria-expanded="true"] .menuBtn__icon i:nth-child(2) {
  top: 7px;
  transform: rotate(-45deg);
}

.menuBtn__label--open {
  display: none;
}
body.is-megaOpen .menuBtn__label--closed {
  display: none;
}
body.is-megaOpen .menuBtn__label--open {
  display: inline;
}
