.desktop {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.link {
  font-weight: 600;
  font-size: var(--text-base);
  text-decoration: none;
  color: var(--color-text-muted);
  white-space: nowrap;
  padding: var(--space-2) 0;
}
.link:hover { color: var(--color-accent-text); }
.active { color: var(--color-accent-text); }

.emphasis {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  color: var(--color-accent-text);
}
.emphasis:hover { background: var(--color-accent-wash); }

/* --- the toggle, phones only ------------------------------------------------ */
.toggle {
  display: none;
  align-items: center;
  gap: var(--space-2);
  background: none;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  /* Comfortably tappable — 44px is the smallest target that reliably works. */
  min-height: 44px;
}
.toggle:hover { border-color: var(--color-accent); color: var(--color-accent-text); }

.bars {
  display: grid;
  gap: 3px;
  width: 18px;
}
.bar, .barTopOpen, .barMidOpen, .barBottomOpen {
  display: block;
  height: 2px;
  width: 18px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 160ms ease, opacity 120ms ease;
}
.barTopOpen { transform: translateY(5px) rotate(45deg); }
.barMidOpen { opacity: 0; }
.barBottomOpen { transform: translateY(-5px) rotate(-45deg); }

/* --- the panel --------------------------------------------------------------- */
.panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3) var(--space-4) var(--space-4);
  z-index: 30;
}
.panel nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-width: var(--shell);
  margin-inline: auto;
}
.panel .link {
  padding: var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--color-border);
  min-height: 48px;
  display: flex;
  align-items: center;
}
.panel .link:last-child { border-bottom: none; }
.panel .emphasis {
  margin-top: var(--space-3);
  justify-content: center;
  border-bottom: 1px solid var(--color-accent);
}

@media (max-width: 820px) {
  .desktop { display: none; }
  .toggle { display: inline-flex; }

  /*
    Scoped to :not([hidden]) deliberately. The panel is closed by React setting
    the `hidden` attribute, whose `display: none` comes from the user-agent
    stylesheet — and any author `display` declaration outranks it. A plain
    `.panel { display: block }` here therefore pinned the menu open on phones
    and left the toggle apparently dead: it flipped the attribute, and nothing
    on screen changed.
  */
  .panel:not([hidden]) { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .bar, .barTopOpen, .barMidOpen, .barBottomOpen { transition: none; }
}
