/* 设计手册页：宽屏左右两栏（目录 | 正文），手机上目录变成左侧抽屉 */

.hb-wrap { max-width: 1180px; }

.hb-zh-only {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--transition-bg);
  color: var(--transition);
  font-size: .88rem;
}

.hb-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

/* ---------- 侧栏 ---------- */
.hb-side {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.hb-search {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 12px 8px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.hb-search svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.hb-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: .9rem;
  padding: 8px 0;
  outline: none;
}
.hb-search:focus-within { border-color: var(--focus); }

.hb-toc, .hb-results { overflow-y: auto; padding: 0 8px 12px; overscroll-behavior: contain; }

.hb-ch summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-radius: 6px;
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  list-style: none;
}
.hb-ch summary::-webkit-details-marker { display: none; }
.hb-ch summary::after {
  content: "";
  margin-left: auto;
  width: 6px; height: 6px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform .15s;
}
.hb-ch[open] summary::after { transform: rotate(45deg); }
.hb-ch summary:hover { background: var(--surface-2); }
.hb-ch-no {
  display: inline-grid;
  place-items: center;
  min-width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}
.hb-ch ul, .hb-results ul { list-style: none; margin: 0; padding: 0; }
.hb-ch ul { padding: 0 0 6px 30px; }
.hb-ch li a {
  display: block;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: .87rem;
  line-height: 1.4;
  text-decoration: none;
}
.hb-ch li a:hover { background: var(--surface-2); color: var(--text); }
.hb-ch li a[aria-current="true"] { background: var(--hole-fill); color: var(--accent); font-weight: 600; }
.hb-wip { color: var(--muted); font-size: .85rem; margin: 4px 8px 8px 36px; }
.hb-results .hb-wip { margin: 8px; }

.hb-results li a {
  display: block;
  padding: 8px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}
.hb-results li a:hover { background: var(--surface-2); }
.hb-r-title { display: block; font-weight: 600; font-size: .9rem; }
.hb-r-ch { display: block; color: var(--muted); font-size: .75rem; }
.hb-r-snip { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.hb-results mark { background: var(--transition-bg); color: inherit; border-radius: 2px; }

/* ---------- 正文 ---------- */
.hb-toc-btn, .hb-scrim { display: none; }
.hb-article { padding: 20px 24px 16px; min-height: 60vh; scroll-margin-top: 12px; }
.hb-article h2 { font-size: 1.3rem; margin: 0 0 14px; line-height: 1.35; }
.hb-article h3 {
  font-size: 1.02rem;
  margin: 22px 0 8px;
  padding-left: 9px;
  border-left: 3px solid var(--accent);
  line-height: 1.35;
}
.hb-article p, .hb-article li { font-size: .95rem; line-height: 1.75; }
.hb-article p { margin: 8px 0; }
.hb-article ul, .hb-article ol { margin: 8px 0; padding-left: 1.5em; }
.hb-article li { margin: 3px 0; }
.hb-article a { color: var(--accent); }
.hb-article code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.hb-crumb { margin: 0 0 2px !important; color: var(--muted); font-size: .82rem !important; }

/* 表格：手册表格是中文混排，居中对齐、细边框，和计算器的数据表区分开 */
.hb-table { margin: 14px 0; }
.hb-table table { width: 100%; border-collapse: collapse; font-size: .87rem; font-variant-numeric: tabular-nums; }
.hb-table caption { caption-side: top; text-align: center; font-weight: 600; font-size: .9rem; padding-bottom: 6px; }
.hb-table th, .hb-table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: center;
  vertical-align: middle;
  line-height: 1.5;
}
.hb-table thead th { background: var(--surface-2); font-weight: 600; }
.hb-table tbody tr:hover td { background: var(--surface-2); }
.hb-table-note { color: var(--muted); font-size: .82rem !important; line-height: 1.6 !important; margin: 6px 0 0 !important; }

.hb-eq {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface-2);
}
.hb-eq-row { display: flex; align-items: center; gap: 12px; }
.hb-eq-body { flex: 1; text-align: center; font-family: "Times New Roman", "Cambria Math", serif; font-size: 1.08rem; font-style: italic; }
.hb-eq-no { color: var(--muted); font-size: .85rem; flex: none; }
.hb-eq-where { margin-top: 6px; color: var(--muted); font-size: .84rem; line-height: 1.65; }

.hb-note {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: 8px;
  border-left: 3px solid;
  font-size: .9rem;
  line-height: 1.7;
}
.hb-note-tip { background: var(--hole-fill); border-color: var(--hole); }
.hb-note-warn { background: var(--transition-bg); border-color: var(--transition); }

.hb-fig { margin: 14px 0; text-align: center; }
.hb-fig svg { max-width: 100%; max-height: 360px; height: auto; color: var(--text); }
.hb-fig figcaption { color: var(--muted); font-size: .84rem; margin-top: 4px; }

.hb-tool {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text) !important;
  text-decoration: none;
}
.hb-tool:hover { border-color: var(--accent); }
.hb-tool-name { font-weight: 700; }
.hb-tool-text { color: var(--muted); font-size: .88rem; flex: 1; min-width: 12em; }
.hb-tool-go { color: var(--accent); font-weight: 600; font-size: .88rem; }

.hb-src {
  margin-top: 20px !important;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  color: var(--muted);
  font-size: .82rem !important;
}

.hb-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.hb-pager a {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
}
.hb-pager a:hover { border-color: var(--accent); }
.hb-pager small { display: block; color: var(--muted); font-weight: 400; font-size: .76rem; }
.hb-next { text-align: right; }

/* ---------- 手机：目录变抽屉 ---------- */
@media (max-width: 820px) {
  .hb-layout { display: block; }
  .hb-side {
    position: fixed;
    z-index: 30;
    top: 0; bottom: 0; left: 0;
    width: min(320px, 86vw);
    max-height: none;
    border-radius: 0 12px 12px 0;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .hb-toc-open .hb-side { transform: none; }
  .hb-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 29;
    background: rgba(0, 0, 0, .35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
  }
  .hb-toc-open .hb-scrim { opacity: 1; pointer-events: auto; }
  .hb-toc-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: .88rem;
    cursor: pointer;
  }
  .hb-toc-btn svg { width: 16px; height: 16px; }
  .hb-article { padding: 16px; }
  .hb-pager { grid-template-columns: 1fr; }
  .hb-next { text-align: left; }
}
