/* Robot HWAI Lab — Wiki 样式
   浅色 · Things 风格 · 深色文字 */

:root {
  --bg:        #faf9f7;
  --bg-card:   #ffffff;
  --bg-code:   #f0ede8;
  --bg-side:   #f5f3f0;
  --border:    #ddd9d0;
  --text:      #2e2e2e;
  --text-muted:#6b6b6b;
  --text-faint:#a0a0a0;
  --link:      #5b7fa6;
  --link-hover:#3d6491;
  --accent:    #6c63ff;
  --tag-bg:    #ebe9e4;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei",
               -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* ── 顶部导航栏 ── */
.topbar {
  background: rgba(250, 249, 247, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar .brand {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
}
.topbar .brand:hover { color: var(--link); text-decoration: none; }

.topbar .crumbs { color: var(--text-muted); font-size: 13px; }
.topbar .crumbs a { color: var(--text-muted); }
.topbar .crumbs a:hover { color: var(--link); text-decoration: none; }

/* ── Hero ── */
.hero {
  max-width: 1100px;
  margin: 52px auto 32px;
  padding: 0 28px;
  text-align: center;
}

.hero h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  margin: 0 0 12px;
}

.hero p {
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.7;
}

/* ── 架构图区 ── */
.arch-section {
  max-width: 960px;
  margin: 0 auto 36px;
  padding: 0 28px;
  text-align: center;
}
.arch-section img {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

/* ── 卡片网格 ── */
.card-grid {
  max-width: 1100px;
  margin: 0 auto 64px;
  padding: 0 28px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: inherit;
  transition: border-color 160ms, box-shadow 160ms, background 160ms;
}

.card:hover {
  border-color: #b8b0a4;
  box-shadow: 0 4px 14px rgba(0,0,0,.08);
  background: #fffffe;
  text-decoration: none;
}

.card .icon { font-size: 22px; }

.card .title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.card .desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

.card .meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── 布局（文档页） ── */
.layout {
  width: 100%;
  padding: 24px 24px 64px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: start;
}

/* ── 侧边栏 ── */
.sidebar {
  position: sticky;
  top: 60px;
  background: var(--bg-side);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 14px;
  font-size: 13px;
}

.sidebar h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin: 14px 0 6px;
}
.sidebar h4:first-child { margin-top: 0; }

.sidebar .group {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  margin: 10px 0 4px 2px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.sidebar ul { margin: 0 0 6px; padding: 0; list-style: none; }
.sidebar ul li a {
  display: block;
  padding: 3px 8px;
  border-radius: 5px;
  color: var(--text-muted);
  transition: background 140ms, color 140ms;
}
.sidebar ul li a:hover,
.sidebar ul li a.active {
  background: var(--tag-bg);
  color: var(--text);
  text-decoration: none;
}

/* ── 正文 ── */
.content {
  min-width: 0;
}

.content h1, .content h2, .content h3, .content h4 {
  color: var(--text);
  font-weight: 700;
  margin: 1.8em 0 .6em;
  line-height: 1.3;
}
.content h1 { font-size: 26px; margin-top: 0; }
.content h2 { font-size: 20px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.content h3 { font-size: 16px; }

.content p  { margin: .8em 0; }
.content ul, .content ol { padding-left: 1.6em; margin: .6em 0; }
.content li { margin: .25em 0; }

.content code {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 13px;
  font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
  color: #c26356;
}

.content pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 1em 0;
}
.content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 13px;
}

.content blockquote {
  border-left: 3px solid var(--border);
  margin: 1em 0;
  padding: .5em 1em;
  color: var(--text-muted);
  background: var(--bg-side);
  border-radius: 0 6px 6px 0;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 1em 0;
}
.content th {
  background: var(--tag-bg);
  border: 1px solid var(--border);
  padding: 7px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
}
.content td {
  border: 1px solid var(--border);
  padding: 7px 12px;
  color: var(--text);
}
.content tr:nth-child(even) td { background: var(--bg-side); }

.content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

.content img { max-width: 100%; border-radius: 6px; }

/* ── 目录页（index.html 内的 card-grid 中） ── */
.toc-section { margin-bottom: 32px; }
.toc-section h2 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.toc-section ul { margin: 0; padding: 0; list-style: none; }
.toc-section li { padding: 4px 0; border-bottom: 1px solid var(--bg-side); }
.toc-section li a { color: var(--text); font-size: 14px; }
.toc-section li a:hover { color: var(--link); text-decoration: none; }

/* ── 标签 ── */
.tag {
  display: inline-block;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 24px 28px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-faint);
}

/* ── Mermaid ── */
.mermaid { text-align: center; margin: 1.5em 0; }

/* ── Syntax highlight (Pygments friendly) ── */
.highlight { background: var(--bg-code); border-radius: 7px; padding: 14px 16px; overflow-x: auto; font-size: 13px; }
.highlight .k, .highlight .kd, .highlight .kn { color: #8250df; font-weight: 600; }
.highlight .s, .highlight .s1, .highlight .s2 { color: #0a7e3e; }
.highlight .c, .highlight .c1, .highlight .cm  { color: #6e7781; font-style: italic; }
.highlight .n  { color: var(--text); }
.highlight .mi { color: #953800; }
.highlight .o  { color: var(--text-muted); }

/* ── 响应式 ── */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .card-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .card-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 24px; }
}
