/* tabbar.css — Top navigation tab bar */

.tab-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg, #fcfcf8);
  padding: 0;
  display: flex;
  align-items: baseline;
  gap: 0;
  font-family: 'Merriweather', 'Georgia', serif;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  padding-top: 0.9rem;
  justify-content: flex-end;
  /* Match the article's right edge */
  max-width: 800px;
  margin-left: max(var(--sidebar-width, 300px), calc(50vw - 400px));
  margin-right: 0;
  padding-right: 2.5rem;
}

@media (max-width: 899px) {
  .tab-bar {
    max-width: none;
    margin-left: 0;
    padding-right: 2.5rem;
  }
}

.tab-bar a {
  display: inline-block;
  padding: 0.4rem 0;
  margin-left: 2rem;
  color: var(--text-secondary, #555);
  text-decoration: none;
  border-bottom: none;
  transition: color 0.2s;
  white-space: nowrap;
  opacity: 0.5;
}

.tab-bar a:hover {
  color: var(--text, #1a1a1a);
  opacity: 0.8;
}

.tab-bar a.active {
  color: var(--text, #1a1a1a);
  opacity: 1;
}

/* Push TOC sidebar down to clear the sticky bar */
body.has-tabbar #toc-sidebar {
  top: 46px;
}

/* Adjust scroll targets so they don't hide behind the tab bar */
body.has-tabbar section[id],
body.has-tabbar figure[id],
body.has-tabbar h2[id],
body.has-tabbar h3[id] {
  scroll-margin-top: 3.5rem;
}
