/* TOP BAR */
#topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--top-h);
  background: rgba(8,1,1,0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  display: flex; align-items: center;
  padding: 0 24px 0 20px;
  z-index: 1000;
  gap: 16px;
}

#topbar-logo-wrap {
  display: flex; align-items: center; gap: 12px;
  min-width: var(--nav-w);
  padding-right: 16px;
  border-right: 1px solid var(--border2);
}

#topbar-logo {
  width: 34px; height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(255,26,26,0.7));
  animation: logopulse 3s ease-in-out infinite;
}
@keyframes logopulse {
  0%,100%{ filter: drop-shadow(0 0 6px rgba(255,26,26,0.5)); }
  50%    { filter: drop-shadow(0 0 18px rgba(255,26,26,0.9)); }
}

#topbar-name {
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--r0);
  letter-spacing: 0.06em;
}

#topbar-version {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--txt3);
  margin-left: 0;
}

#topbar-links {
  display: flex;
  gap: 12px;
  align-items: center;
}
#topbar-links a,
.topbar-contact-toggle {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--txt3);
  border: 1px solid var(--border2);
  padding: 4px 10px;
  transition: all 0.15s;
  letter-spacing: 0.04em;
  background: transparent;
  line-height: 1.35;
  cursor: pointer;
}
#topbar-links a:hover,
.topbar-contact-toggle:hover,
.topbar-contact-toggle[aria-expanded="true"] {
  color: var(--r0);
  border-color: var(--r1);
  background: var(--glowf);
  text-decoration: none;
}
.topbar-contact {
  position: relative;
  display: inline-flex;
}
.topbar-contact-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 240px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(10, 1, 1, 0.97);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.35);
  padding: 9px 10px;
  display: none;
  gap: 6px;
  z-index: 1200;
}
.topbar-contact-popover.is-open {
  display: grid;
}
.topbar-contact-popover[hidden] {
  display: none !important;
}
.topbar-contact-popover span {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--txt2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 6px 8px;
  white-space: nowrap;
}
.topbar-search {
  margin-left: auto;
  width: min(360px, 42vw);
  position: relative;
}
#topbar #docs-search-input {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(8, 1, 1, 0.90);
  color: var(--txt);
  padding: 8px 10px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.2;
}
#topbar #docs-search-input:focus {
  outline: none;
  border-color: var(--r0);
  box-shadow: 0 0 0 3px rgba(255, 26, 26, 0.10);
}
.topbar-search-results {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(520px, 74vw);
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(8, 1, 1, 0.97);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.35);
  padding: 10px;
  display: none;
  z-index: 1300;
}
.topbar-search.open .topbar-search-results {
  display: grid;
  gap: 10px;
}

#topbar-actions {
  margin-left: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-action {
  appearance: none;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,26,26,0.12), rgba(255,26,26,0.03));
  color: var(--txt);
  padding: 7px 12px;
  min-height: 34px;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  transition: border-color 0.15s, transform 0.15s, color 0.15s, background 0.15s;
}
.topbar-action:hover {
  border-color: var(--r0);
  color: var(--r0);
  background: linear-gradient(180deg, rgba(255,26,26,0.16), rgba(255,26,26,0.06));
  transform: translateY(-1px);
}
.topbar-action-menu {
  display: none;
}

