/* Shared top bar used across every page on the site, styled after
   is-back/match-queue's nav bar. Paired with topbar.js, which upgrades
   <rk-topbar> into this markup. */

rk-topbar,
.rk-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 20px;
  margin-bottom: 1.75rem;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  font-family: var(--font-text);
}

.rk-topbar-home {
  flex: 0 0 auto;
  margin-right: 0.5rem;
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.rk-topbar-home:hover {
  background: #30363d;
}

.rk-topbar-title {
  flex: 1 1 auto;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #58a6ff;
}

.rk-topbar-extra {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

.rk-topbar-extra a,
.rk-topbar-extra button {
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.rk-topbar-extra a:hover,
.rk-topbar-extra button:hover {
  background: #30363d;
}

/* Opens the site-wide search (components/global-search.js); desktop only, like its shortcut. */
.rk-topbar-extra .rk-gs-topbar-btn { display: none; }
@media not all and (pointer: coarse) {
  .rk-topbar-extra .rk-gs-topbar-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: transparent; color: #8b949e; font-size: 13px; padding: 5px 10px;
  }
  .rk-topbar-extra .rk-gs-topbar-btn:hover { color: #e6edf3; border-color: #00ffcc; background: transparent; }
  .rk-topbar-extra .rk-gs-topbar-btn kbd { font: 11px/1 var(--font-mono); color: #6e7681; }
}

@media (max-width: 560px) {
  rk-topbar,
  .rk-topbar {
    padding: 10px 14px;
    gap: 8px;
  }
  .rk-topbar-title {
    font-size: 16px;
  }
}
/* Is Back pages on a phone, under the Is Back tab bar (html.rk-shell-tabs: set by
   /is-back/play/scene.js inside the play host, by /components/isback-tabs.js elsewhere): the
   tabs take over Home, the links between the pages and the account bits that live on the
   Profile tab (marked .rk-tab-dup), so the bar keeps just the title and the page's own
   controls. */
html.rk-shell-tabs .rk-topbar-home,
html.rk-shell-tabs .rk-tab-dup { display: none !important; }
html.rk-shell-tabs rk-topbar,
html.rk-shell-tabs .rk-topbar { padding: 10px 14px; margin-bottom: 1rem; }
html.rk-shell-tabs .rk-topbar-title {
  font-size: 16px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Every other page on a phone (html.rk-tabs-page: the tab bar from /components/isback-tabs.js,
   loaded by topbar.js; html.rk-shell-tabs above hides Home): a bar with the page's own controls
   (.rk-topbar-keep: a tool's Format / Reset buttons, the poems' Filters, …) stays, without the
   search button (Ctrl+Shift+F still opens it); one with just links and log in / out goes. */
html.rk-tabs-page rk-topbar[data-phone-empty],
html.rk-tabs-page rk-topbar:not(:has(.rk-topbar-keep:not([hidden]):not(.hidden))) { display: none !important; }
html.rk-tabs-page .rk-topbar-extra .rk-gs-topbar-btn { display: none !important; }
html.rk-tabs-page .rk-topbar-extra { flex: 0 1 auto; min-width: 0; }
