/* ============================================================
   document.css — 文档页样式
   布局：内容区在左（article），大导航在右（aside）
   卡片：一行最多 3 个，小卡片宽度约 18vw
   ============================================================ */

/* ---------- 搜索区 ---------- */
.search-nav {
  margin: 1.6rem 0 0.4rem;
}

/* ---------- 文档分区 ---------- */
.doc-section {
  margin-top: 2.8rem;
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2vw;
}

/* ---------- 文档卡片：标题 + 副标题 + 文章列表 ---------- */
.doc-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem 1.1rem;
  max-height: 250px;
  overflow: hidden;
}

.doc-card-head h3 {
  font-size: 0.98rem;
  line-height: 1.35;
}

.doc-card-head p {
  margin-top: 0.12rem;
  color: var(--text-2);
  font-size: 0.8rem;
}

.doc-list {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.4rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* 让页面标题与收窄后的内容区对齐 */
.page-head {
  width: min(60vw, 1080px);
  margin-inline: auto;
  text-align: center;
}

.page-head .page-sub {
  margin-inline: auto;
}

.doc-list::-webkit-scrollbar {
  width: 6px;
}

.doc-list::-webkit-scrollbar-track {
  background: transparent;
}

.doc-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.doc-list::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

.doc-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.42rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text);
  transition: background 0.2s ease, color 0.2s ease;
}

.doc-link:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.doc-link::after {
  content: "→";
  flex-shrink: 0;
  font-size: 0.8rem;
  opacity: 0.45;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.doc-link:hover::after {
  opacity: 1;
  transform: translateX(2px);
}

.doc-card[hidden] {
  display: none;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .doc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .doc-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- 文章详情页 ---------- */
.article-crumb {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-bottom: 1rem;
}

.article-crumb a {
  color: var(--text-2);
}

.article-crumb a:hover {
  color: var(--primary);
}

.article-crumb span {
  margin: 0 0.4rem;
  opacity: 0.6;
}

.article-body h1 {
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  font-weight: 800;
  line-height: 1.35;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 1.8rem;
}

.article-meta span {
  font-size: 0.8rem;
  color: var(--text-2);
  background: var(--surface-2);
  padding: 0.18rem 0.65rem;
  border-radius: 999px;
}

.article-body h2 {
  margin-top: 2.2rem;
  margin-bottom: 0.7rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.article-body p {
  margin-bottom: 1rem;
}

.article-body ul {
  margin: 0 0 1.2rem 1.2rem;
  list-style: disc;
}

.article-body li {
  margin-bottom: 0.35rem;
}

.article-body pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 1.2rem;
}

.article-body code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

.article-body p code {
  background: var(--surface-2);
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
  font-size: 0.85em;
}

.article-tip {
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.2rem;
  font-size: 0.92rem;
}

.article-nav {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.article-nav a {
  color: var(--text-2);
}

.article-nav a:hover {
  color: var(--primary);
}

.article-nav .is-muted {
  color: var(--text-2);
  opacity: 0.7;
}
