/* mystx 书籍层：单列阅读宽度 + 导航细节 + 页眉工具箱 */

:root {
  --mystx-content-width: 46rem;
}

@media (min-width: 960px) {
  .bd-main .bd-content .bd-article-container {
    max-width: var(--mystx-content-width);
  }
}

/* 页面没有页内标题（分区首页、搜索页）时基座不渲染右侧目录栏，
   正文限宽后被居中，左侧会留出一整条空白；改成从侧栏右侧起排。 */
@media (min-width: 960px) {
  .mystx-no-toc .bd-main .bd-content {
    justify-content: flex-start;
  }
}

/* 侧栏当前页：与书籍阅读流一致的左侧强调 */
.mystx-book-nav .current > a {
  font-weight: 600;
}

.mystx-book-nav .bd-sidenav {
  font-size: 0.95rem;
}

/* 页眉工具箱 */
.book-header-buttons {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.book-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--pst-color-border);
  border-radius: 0.375rem;
  background: transparent;
  color: var(--pst-color-text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.book-button:hover,
.book-button:focus-visible {
  color: var(--pst-color-primary);
  border-color: var(--pst-color-primary);
  text-decoration: none;
}

.book-button:focus-visible {
  outline: 2px solid var(--pst-color-primary);
  outline-offset: 2px;
}

/* 内容页脚：条目数据来自 book_footer_items */
.book-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1.5rem;
  font-size: 0.85rem;
  color: var(--pst-color-text-muted);
}

.book-footer__item {
  margin: 0;
}

.book-footer__last-updated {
  margin-left: auto;
}

.book-footer a {
  color: inherit;
  text-decoration: underline;
}

@media (max-width: 767.98px) {
  .book-footer {
    flex-direction: column;
    gap: 0.25rem;
  }

  .book-footer__last-updated {
    margin-left: 0;
  }
}
