/* Top navigation bar, brand lockup, and the phone menu. */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  padding: calc(env(safe-area-inset-top,0px) + 14px) var(--gutter) 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: color-mix(in srgb,var(--bg) 82%,transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid color-mix(in srgb,var(--line) 70%,transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
}

.brand img {
  width: 46px;
  height: auto;
  image-rendering: pixelated;
  flex: none;
}

.brand .bt {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-family: var(--display);
  white-space: nowrap;
}

.brand .b1 {
  font-size: 23px;
  line-height: 1.05;
  letter-spacing: -.015em;
  font-weight: 400;
}

.brand .b1 b {
  font-weight: 600;
}

.brand .b2 {
  font-size: 13.5px;
  line-height: 1.3;
  font-style: italic;
  color: var(--fg-muted);
  margin-top: 2px;
}

.links {
  display: flex;
  align-items: center;
  gap: clamp(10px,1.2vw,18px);
  font-size: 14.5px;
}

.links a {
  white-space: nowrap;
  text-decoration: none;
  color: var(--fg-muted);
}

.links a:hover {
  color: var(--fg);
}

.links a.btn-dark,
.links a.btn-dark:hover {
  color: var(--btn-fg);
}

.links a[data-nav] {
  position: relative;
  padding: 6px 0;
  transition: color .2s ease;
}

.links a[data-nav]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform .25s ease;
}

.links a[data-nav][aria-current="true"] {
  color: var(--fg);
}

.links a[data-nav][aria-current="true"]::after {
  transform: scaleX(1);
}

.menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  cursor: pointer;
  position: relative;
  flex: none;
}

.menu-btn span {
  position: absolute;
  left: 11px;
  right: 11px;
  height: 1.8px;
  border-radius: 2px;
  background: var(--fg);
  transition: transform .25s ease,top .25s ease;
}

.menu-btn span:first-child {
  top: 15px;
}

.menu-btn span:last-child {
  top: 23px;
}

.menu-btn[aria-expanded="true"] span:first-child {
  top: 19px;
  transform: rotate(45deg);
}

.menu-btn[aria-expanded="true"] span:last-child {
  top: 19px;
  transform: rotate(-45deg);
}

.m-menu {
  position: fixed;
  z-index: 19;
  left: 0;
  right: 0;
  top: var(--nav-h,72px);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 8px var(--gutter) 16px;
  display: flex;
  flex-direction: column;
  animation: drop .22s ease;
}

.m-menu a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 2px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  font: 400 22px/1.2 var(--display);
  color: var(--fg);
}

.m-menu a:last-child {
  border-bottom: 0;
}

.m-menu a::after {
  content: "→";
  font-family: var(--ui);
  font-size: 16px;
  color: var(--fg-muted);
}

@media (max-width:460px) {
  .brand {
    gap: 8px;
  }

  .brand img {
    width: 34px;
  }

  .brand .b1 {
    font-size: 18px;
  }

  .brand .b2 {
    font-size: 10.5px;
  }
}

/* Collapse section links before they crowd the persistent Join action. */
@media (max-width:1000px) {
  .links a:not(.btn) {
    display: none;
  }

  .menu-btn {
    display: block;
  }

  .links {
    display: none;
  }

  .links {
    gap: 8px;
  }
}

@media (max-width:960px) {
  .links {
    gap: 14px;
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .m-menu {
    animation: none!important;
  }
}

@keyframes drop {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: clamp(12px,1.6vw,22px);
  flex: none;
}

.nav-join {
  padding: 10px 14px;
  font-size: 13px;
  gap: 5px;
  white-space: nowrap;
}

.nav-join-long {
  margin-left: -2px;
}

@media (max-width:460px) {
  .nav {
    gap: 8px;
  }

  .nav-actions {
    gap: 8px;
  }

  .nav-join {
    padding: 10px 12px;
    font-size: 12px;
  }

  .nav-join-long {
    display: none;
  }

  .brand .b2 {
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
