/* AI 建站课程静态站样式：朴素清晰，参考微信文档阅读体验 */

:root {
  --text: #1f2329;
  --text-light: #646a73;
  --link: #576b95;
  --border: #e5e6eb;
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --accent: #07c160;
  --sidebar-w: 264px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
}

/* ---------- 侧栏目录 ---------- */

#sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  overflow-y: auto;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 20px 0 32px;
  z-index: 20;
}

.sidebar-head {
  padding: 0 20px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  font-size: 17px;
  font-weight: 600;
}

.sidebar-head a { color: var(--text); text-decoration: none; }

.sidebar-scroll { padding: 4px 0 32px; }

.toc-group {
  margin: 14px 20px 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #9aa0a6;
}

#sidebar .toc {
  list-style: none;
  margin: 0;
  padding: 0 10px;
}

#sidebar .toc li { margin: 2px 0; }

#sidebar .toc a {
  display: block;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 14.5px;
  line-height: 1.5;
}

#sidebar .toc a:hover { background: #eceef1; color: var(--text); }

#sidebar .toc a.active {
  background: #e2f0e4;
  color: #0a7a3d;
  font-weight: 600;
}

/* ---------- 顶栏（手机端） ---------- */

#topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 30;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
}

#menu-btn {
  border: none;
  background: none;
  font-size: 20px;
  line-height: 1;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text);
  border-radius: 6px;
}

#menu-btn:hover { background: var(--bg-soft); }

.topbar-title { font-size: 16px; font-weight: 600; }

#mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 15;
}

/* ---------- 正文 ---------- */

#content {
  margin-left: var(--sidebar-w);
  padding: 36px 32px 64px;
}

article {
  max-width: 720px;
  margin: 0 auto;
}

h1 {
  font-size: 26px;
  line-height: 1.4;
  margin: 0 0 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

h2 {
  font-size: 20px;
  line-height: 1.5;
  margin: 36px 0 14px;
  padding-left: 10px;
  border-left: 4px solid var(--accent);
}

h3 { font-size: 17px; margin: 26px 0 10px; }

p { margin: 12px 0; }

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

ul, ol { padding-left: 26px; margin: 12px 0; }
li { margin: 6px 0; }

strong { font-weight: 600; }

code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.875em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

/* 卡片开头的状态列表 */

.card-meta {
  list-style: none;
  margin: 0 0 22px;
  padding: 12px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-light);
  font-size: 14.5px;
}

.card-meta li { margin: 3px 0; }

/* 本页目录 */

.page-toc {
  margin: 0 0 24px;
  padding: 12px 16px;
  background: #fff;
  border: 1px dashed #c9cdd4;
  border-radius: 8px;
}

.page-toc-title {
  margin: 0 0 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-light);
  letter-spacing: 1px;
}

.page-toc ol {
  margin: 0;
  padding-left: 22px;
  columns: 1;
}

.page-toc li { margin: 3px 0; font-size: 14.5px; }

@media (min-width: 901px) {
  .page-toc ol { columns: 2; column-gap: 28px; }
}

/* 小节编号 */

.sec-num {
  display: inline-block;
  min-width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 6px;
  background: #e2f0e4;
  color: #0a7a3d;
  font-size: 13px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  vertical-align: 2px;
}

/* 关键结论高亮（只提亮加粗，不整段变色） */

article strong {
  background: linear-gradient(transparent 62%, #ffefad 62%);
  padding: 0 2px;
}

.card-meta strong, .say-box strong { background: none; padding: 0; }

/* 平台位置标签 */

.where-chip {
  display: inline-block;
  margin: 2px 0 6px;
  padding: 2px 10px;
  border: 1px solid #bcd9c4;
  border-radius: 999px;
  background: #f0faf2;
  color: #0a7a3d;
  font-size: 13px;
  font-weight: 600;
}

.where-chip a { color: inherit; }

/* 对 AI 说的话：灰色线框输入框样式，可复制 */

.say-box {
  margin: 16px 0;
  border: 1px solid #d4d7dc;
  border-radius: 8px;
  background: #fafafa;
  overflow: hidden;
}

.say-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #f2f3f5;
  border-bottom: 1px solid #d4d7dc;
}

.say-label {
  font-size: 12.5px;
  color: #8a9099;
  letter-spacing: 0.5px;
}

.copy-btn {
  border: 1px solid #c9cdd4;
  border-radius: 5px;
  background: #fff;
  color: var(--text-light);
  font-size: 12.5px;
  line-height: 1.4;
  padding: 2px 10px;
  cursor: pointer;
}

.copy-btn:hover { color: #0a7a3d; border-color: #0a7a3d; }

.say-box blockquote {
  margin: 0;
  padding: 10px 14px;
  background: transparent;
  border-left: none;
  border-radius: 0;
  font-family: "SF Mono", Menlo, Consolas, "PingFang SC", monospace;
  font-size: 14.5px;
  color: #2b2f36;
  white-space: pre-wrap;
}

.say-box blockquote p { margin: 4px 0; }

/* 截图与图注 */

figure {
  margin: 18px 0;
  text-align: center;
}

figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  cursor: zoom-in;
}

figcaption {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--text-light);
}

/* 放大预览 */

#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.82);
  padding: 24px;
  overflow: auto;
  cursor: zoom-out;
}

#lightbox.open { display: flex; align-items: center; justify-content: center; }

.lightbox-inner { max-width: 100%; text-align: center; }

#lightbox img {
  max-width: min(96vw, 1400px);
  max-height: 86vh;
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.lightbox-cap {
  margin: 10px 0 0;
  color: #e6e6e6;
  font-size: 13.5px;
}

.lightbox-hint {
  margin: 6px 0 0;
  color: #9aa0a6;
  font-size: 12px;
  letter-spacing: 0.5px;
}

#lightbox img {
  transition: transform 0.08s ease-out;
  touch-action: none; /* 捏合与拖动交给 Pointer Events 处理 */
  user-select: none;
  -webkit-user-select: none;
}

#lightbox.zoomed { cursor: move; }

/* 页脚事实信息 */

.page-foot {
  margin-top: 36px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  color: var(--text-light);
  font-size: 13px;
}

/* 表格 */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14.5px;
  display: block;
  overflow-x: auto;
}

th, td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

th { background: var(--bg-soft); font-weight: 600; }

tr:nth-child(even) td { background: #fafbfc; }

/* 上一张 / 下一张 */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 44px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 14.5px;
}

.pager .next { margin-left: auto; text-align: right; }

/* ---------- 首页 ---------- */

.lead { font-size: 17px; color: var(--text-light); }

.download-entry { margin: 18px 0 6px; }

.download-btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 10px;
  background: #07c160;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(7, 193, 96, 0.28);
}

.download-btn:hover { text-decoration: none; filter: brightness(1.05); }

.download-note { display: block; margin-top: 8px; font-size: 13px; color: var(--text-light); }

.card-list { list-style: none; padding: 0; }

.card-list > li {
  margin: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.card-list > li:last-child { border-bottom: none; }

.card-list a { font-size: 16px; font-weight: 500; }

.card-num {
  display: inline-block;
  min-width: 34px;
  margin-right: 10px;
  color: #0a7a3d;
  font-weight: 600;
}

.card-summary {
  margin: 4px 0 0 44px;
  font-size: 14px;
  color: var(--text-light);
}

/* ---------- 手机端 ---------- */

@media (max-width: 900px) {
  #topbar { display: flex; }

  #sidebar {
    top: 48px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    background: var(--bg);
    width: min(300px, 82vw);
  }

  .sidebar-head { display: none; }

  body.nav-open #sidebar { transform: translateX(0); }
  body.nav-open #mask { display: block; }

  #content { margin-left: 0; padding: 20px 16px 48px; }

  body { font-size: 15.5px; }
  h1 { font-size: 22px; }
  h2 { font-size: 18px; }

  .pager { flex-direction: column; }
  .pager .next { margin-left: 0; text-align: left; }
}
