/* ============================================================
   HorizonX 游玩文档页样式（css/docs.css）
   ------------------------------------------------------------
   - 只补充 css/style.css 里没有的布局类，颜色/圆角/阴影一律复用 :root 变量
   - 与全站一致的白底浅灰卡片风格：.container + .panel + .section-title
   - 结构： .docs-layout = 左侧目录 + 右侧正文；<=760px 时目录折到上方
   ============================================================ */

/* ---------- 页面外框 ---------- */
.docs-page { padding: 56px 0 72px; }

/* ---------- 两栏布局 ---------- */
.docs-layout {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-top: 26px;
}

/* 目录面板：跟随滚动（页面很长时目录始终可见） */
.docs-side { position: sticky; top: 84px; }

.docs-index {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 26px rgba(20, 24, 32, .05);
  overflow: hidden;
}

.docs-index-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfcfd, #f4f5f7);
}
.docs-index-title { font-size: 15px; font-weight: 600; }
.docs-index-count { font-size: 12px; color: var(--text-muted); }

/* 目录列表：页面多时可以滚动 */
.docs-nav {
  display: flex;
  flex-direction: column;
  max-height: min(62vh, 620px);
  overflow: auto;
  padding: 6px;
}

.docs-nav-item {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  border-left: 3px solid transparent;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.docs-nav-item + .docs-nav-item { margin-top: 2px; }
.docs-nav-item:hover { background: var(--bg-soft); }

.docs-nav-title {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.6;
}
.docs-nav-summary {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
  /* 摘要只留一行，列表更整齐 */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 当前页高亮 */
.docs-nav-item.is-active {
  background: var(--bg-soft);
  border-left-color: var(--dark);
}
.docs-nav-item.is-active .docs-nav-title { font-weight: 600; }

/* 加载失败/空列表时的提示（侧栏里也留可见文字，避免空白） */
.docs-nav-empty {
  padding: 14px 12px;
  font-size: 13px;
  color: var(--text-muted);
}

/* 侧栏底部的管理员入口 */
.docs-admin { border-top: 1px solid var(--line); padding: 10px 12px 12px; }
.docs-admin-link {
  display: inline-block;
  font-size: 13px;
  color: var(--text-muted);
  transition: color .2s ease;
}
.docs-admin-link:hover { color: var(--text); }
.docs-admin-link::before { content: "· "; }

/* ---------- 正文区 ---------- */
.docs-main { min-width: 0; }

.docs-article .panel-head { position: relative; }
.docs-updated { font-size: 12px; color: var(--text-muted); }

/* 正文容器：窄屏时左右留白收一点 */
.docs-content { min-height: 120px; }

/* 加载/出错时的状态文字 */
.docs-state {
  margin: 8px 0;
  font-size: 14px;
  line-height: 1.9;
  color: var(--text-muted);
}

/* 正文里的基础排版（只作用于 .docs-content 内部，不影响站点其它页面） */
.docs-content .doc-h {
  margin: 26px 0 12px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text);
}
.docs-content .doc-h:first-child { margin-top: 0; }
.docs-content h3.doc-h { font-size: 16px; }
.docs-content h4.doc-h { font-size: 15px; }
.docs-content h5.doc-h { font-size: 14px; }

.docs-content .doc-p {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.95;
  color: var(--text);
  overflow-wrap: break-word;
}

.docs-content .doc-list {
  margin: 0 0 14px;
  padding-left: 22px;
  font-size: 14px;
  line-height: 1.95;
}
.docs-content .doc-list li + li { margin-top: 5px; }

.docs-content .doc-quote {
  margin: 0 0 14px;
  padding: 10px 16px;
  border-left: 3px solid var(--line);
  border-radius: 0 10px 10px 0;
  background: var(--bg-soft);
  font-size: 14px;
  line-height: 1.9;
  color: var(--text-muted);
}
.docs-content .doc-quote .doc-p:last-child { margin-bottom: 0; }

.docs-content .doc-hr {
  height: 1px;
  margin: 22px 0;
  border: 0;
  background: var(--line);
}

/* 行内代码：与全站灰白风格统一 */
.docs-content code {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-soft);
  font-family: Consolas, Menlo, monospace;
  font-size: 13px;
  color: var(--text);
}

/* 代码块 */
.docs-content .doc-pre {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
  overflow-x: auto;
}
.docs-content .doc-pre code {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre;
}

/* 表格：窄屏不限死，横向滚动查看 */
.docs-content .doc-table-wrap {
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
}
.docs-content .doc-table {
  width: 100%;
  min-width: 380px;
  border-collapse: collapse;
  font-size: 14px;
}
.docs-content .doc-table th,
.docs-content .doc-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  line-height: 1.8;
  vertical-align: top;
}
.docs-content .doc-table th {
  font-weight: 600;
  color: var(--text);
  background: linear-gradient(180deg, #fbfcfd, #f4f5f7);
  white-space: nowrap;
}
.docs-content .doc-table tr:last-child td { border-bottom: 0; }
.docs-content .doc-td-empty { color: var(--text-muted); text-align: center; }

/* 正文里的链接：统一深色 + 下划线，鼠标悬停加深 */
.docs-content a {
  color: var(--text);
  border-bottom: 1px solid rgba(35, 38, 43, .35);
  transition: border-color .18s ease;
}
.docs-content a:hover { border-bottom-color: var(--text); }
.docs-content a:hover code { border-color: var(--dark); }

/* 找不到页面 / 地址不合法时的提示卡片 */
.docs-missing { padding: 10px 0 4px; }
.docs-missing-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.docs-missing-text {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--text-muted);
}

/* ---------- 窄屏：目录折到上方 ---------- */
@media (max-width: 760px) {
  .docs-page { padding: 36px 0 52px; }
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  /* 折到上方后不再吸顶，避免和固定导航抢位置 */
  .docs-side { position: static; }
  .docs-nav { max-height: none; }
  .docs-nav-summary { white-space: normal; }
  .docs-content .doc-table { min-width: 320px; }
}
