nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 200;
  padding: 22px 40px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}
/* Explicit column assignment matters here: .nav-links gets display:none on
   mobile, and CSS grid auto-placement re-packs items into whatever columns
   remain when a sibling drops out of layout — without this, .nav-right
   would slide into the middle column next to the logo instead of staying
   pinned right. */
.nav-logo { grid-column: 1; justify-self: start; }
.nav-links { grid-column: 2; justify-self: center; }
.nav-right { grid-column: 3; justify-self: end; }
nav.scrolled {
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(14px);
  border-color: var(--border);
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.5px; color: var(--white);
  text-decoration: none;
}
.nav-links { display: flex; align-items: center; gap: 36px; }
.nav-links a {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500; color: #888;
  letter-spacing: 0.12em; text-transform: uppercase;
  text-decoration: none; transition: color 0.15s;
}
.nav-links a:hover { color: var(--white); }
.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-signin {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 500; color: #888;
  letter-spacing: 0.1em; text-transform: uppercase;
  text-decoration: none; padding: 8px 4px;
  transition: color 0.15s;
}
.nav-signin:hover { color: var(--white); }

.nav-burger {
  display: none; width: 36px; height: 36px;
  border: 1px solid var(--border-light); border-radius: 8px;
  background: transparent; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.nav-burger span { width: 16px; height: 1.5px; background: var(--white); transition: transform 0.2s, opacity 0.2s; }
.nav-burger.open span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

.nav-mobile-panel {
  position: fixed; top: 68px; left: 16px; right: 16px;
  background: rgba(10,10,10,0.98);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 10px;
  display: none;
  flex-direction: column;
  z-index: 199;
  backdrop-filter: blur(16px);
}
.nav-mobile-panel.open { display: flex; }
.nav-mobile-panel a {
  color: var(--white); text-decoration: none;
  font-size: 15px; font-weight: 600;
  padding: 14px 12px; border-radius: 10px;
  transition: background 0.15s;
}
.nav-mobile-panel a:hover { background: rgba(255,255,255,0.06); }

@media (max-width: 720px) {
  nav { padding: 16px 20px; }
  .nav-links { display: none; }
  .nav-burger { display: flex; }
  /* "Sign In" already lives in the mobile panel below the burger — showing
     it a second time here is what was crowding the top bar on phones. */
  .nav-signin { display: none; }
  .nav-right { gap: 12px; }
  .nav-right .pill-btn { padding: 10px 14px 10px 16px; font-size: 11px; }
}

@media (max-width: 380px) {
  nav { padding: 14px 16px; }
  .nav-logo { font-size: 19px; }
  .nav-right { gap: 8px; }
  .nav-right .pill-btn span,
  .nav-right .pill-btn svg { flex-shrink: 0; }
  .nav-right .pill-btn { padding: 9px 12px 9px 13px; font-size: 10px; }
}
