header.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

header.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  font-family: var(--heading);
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
}

.brand.with-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand .logo {
  height: 44px;
  width: auto;
  flex: none;
}

/* A logo drawn only in black; dark themes set --logo-mono-filter to lighten it. */
.brand .logo.mono {
  filter: var(--logo-mono-filter, none);
}

nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

nav a {
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .95rem;
  color: var(--muted);
}

nav a:hover {
  color: var(--text);
}

nav a.btn {
  background: var(--accent);
  color: var(--accent-text);
}

@media (max-width: 640px) {
  nav a:not(.btn) {
    display: none;
  }

  .brand .logo {
    height: 36px;
  }
}

/* On small phones the logo stands in for the title. */
@media (max-width: 420px) {
  .brand.with-logo span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}
