.top-bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  background: black;
  font-family: "m3x6", "Mona", monospace;
  line-height: 1;
}

.top-bar-brand {
  display: flex;
  flex-shrink: 0;
}

.world-clock {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 4px;
  padding-inline: 4px;
}

.world-clock > span {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Nudge the pixel-font labels so they sit centered in the bar. */
.world-clock > span,
.server-status > span,
.top-bar-navigation a > span {
  transform: translateY(-1px);
}

.top-bar-controls {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 6px;
  padding-inline: 4px;
}

.lite-icon {
  width: 8px;
}

/* Navigation */
.top-bar-navigation {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  gap: 2px;
  min-width: 0;
  height: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-bar-navigation::-webkit-scrollbar {
  display: none;
}

.top-bar-navigation > a {
  flex-shrink: 0;
}

.top-bar-navigation img {
  flex-shrink: 0;
  filter: brightness(0) invert(1);
}

.top-bar-navigation a:is([data-current], :hover, :focus-visible) {
  --surface: var(--button-focus);
}

.top-bar-navigation a:not([data-current]):active {
  --surface: var(--button-pressed);
  color: #000000;
}

.top-bar-navigation a:not([data-current]):active img {
  filter: brightness(0);
}

/* Inverted highlight that slides to the hovered link. Positioned by navigation.js. */
.navigation-selector {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  border: 3px solid transparent;
  border-image: var(--round-rect) 3 fill;
  mix-blend-mode: difference;
  pointer-events: none;
}

.navigation-selector.animated {
  transition: 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
  transition-property: transform, width, height;
}

/* Server status */
.server-status {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.server-status::before {
  content: "";
  flex-shrink: 0;
  width: 4px;
  height: 4px;
  background: #a6a6ae;
}

.server-status[data-status="unknown"]::before {
  background: #eabf4b;
}

.server-status:is([data-status="online"], [data-status="offline"]) {
  align-items: flex-end;
}

.server-status:is([data-status="online"], [data-status="offline"]) #server-status-word {
  font-family: "1980 P02", "Mona", monospace;
}

.server-status[data-status="online"]::before {
  width: 16px;
  height: 16px;
  background: url("../assets/textures/icons/signal_icon.png");
  transform: translateY(0.3333px);
}

.server-status[data-status="offline"]::before {
  width: 16px;
  height: 16px;
  background: url("../assets/textures/icons/signal_offline_icon.png");
  transform: translateY(-0.6667px);
}

.server-status[data-status="online"] #server-status-word {
  color: #78d957;
}

.server-status[data-admission="full"] #server-status-word {
  color: #eabf4b;
}

.server-status:is([data-status="offline"], [data-admission="closed"]) #server-status-word {
  color: #ee6b6b;
}

/* Mobile: hide the clock and server status, and move the navigation into the sidebar. */
.mobile-navigation-panel {
  display: none;
}

@media (max-width: 767px) {
  .top-bar .world-clock,
  .top-bar .server-status,
  .top-bar .top-bar-navigation {
    display: none;
  }

  .top-bar-controls {
    margin-left: auto;
  }

  .top-bar-controls > .solid-button {
    min-height: 18px;
  }

  .mobile-navigation-panel {
    display: block;
  }

  #mobile-navigation {
    padding: 4px;
  }

  #mobile-navigation .top-bar-navigation {
    flex-direction: column;
    align-items: stretch;
    height: auto;
    overflow: visible;
  }

  #mobile-navigation .top-bar-navigation > a {
    justify-content: flex-start;
    min-height: 18px;
  }
}

/* Firefox: see the note at the end of style.css. */
@supports (-moz-appearance: none) {
  .navigation-selector {
    border-image: none;
  }

  .navigation-selector::after {
    content: "";
    position: absolute;
    zoom: calc(1 / var(--site-scale));
    inset: calc(3 * var(--site-scale) * -1px);
    border: calc(3 * var(--site-scale) * 1px) solid transparent;
    border-image: var(--round-rect) 3 fill;
  }
}
