/* ==========================================================================
   使用帮助 · 站長教程
   复用 portal.css 令牌与 landing.css 的导航/按钮/页脚；本文件只承载教程版式。
   ========================================================================== */

.help { background: #fff; }

.help-main {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
  padding: 120px 0 72px;
}

.system-demo {
  margin-block-end: clamp(24px, 4vw, 48px);
  padding: clamp(20px, 3.4vw, 36px);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: var(--accent-soft);
  box-shadow: var(--shadow-1);
}

.system-demo h2 { margin: 0 0 16px; color: var(--ink); font-size: clamp(22px, 3vw, 28px); }
.system-demo-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.system-demo-actions .btn { min-height: 44px; }
.system-demo-note { margin: 14px 0 0; color: var(--ink-2); font-size: 14px; }
.system-demo-note a { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 420px) {
  .system-demo-actions .btn { flex: 1 1 100%; }
}

/* 教程页导航固定为浅色 */
.help .nav {
  background: #fff;
  border-block-end: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .03);
}

.help .brand,
.help .nav-links a,
.help .nav-login,
.help .nav-help summary { color: var(--ink-2); }

.help .brand:hover,
.help .nav-links a:hover,
.help .nav-login:hover,
.help .nav-help summary:hover { color: var(--ink); }

.help .nav-toggle { border-color: var(--line-strong); }
.help .nav-toggle span { background: var(--ink); }
.help .nav-links .is-current { color: var(--ink); font-weight: 600; }

/* ---------- 页头 ---------- */

.help-hero {
  display: block;
  position: static;
  min-height: 0;
  max-width: 780px;
  margin: 0;
  padding: 0 0 36px;
  border: 0;
  border-block-end: 1px solid var(--line);
  background: none;
  gap: 0;
}

.help-hero h1 {
  margin: 16px 0 14px;
  font-size: clamp(32px, 4vw, 46px);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -.03em;
}

.help-hero p {
  max-width: 66ch;
  margin: 0;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.75;
}

.help-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 20px;
  padding: 0;
  list-style: none;
}

.help-meta li {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

/* ---------- 双栏 ---------- */

.help-layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
  margin-block-start: 40px;
}

.help-toc {
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100dvh - 120px);
  overflow: auto;
  padding-inline-end: 8px;
}

.help-toc h2 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.help-toc ol {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  border-inline-start: 1px solid var(--line);
}

.help-toc a {
  display: block;
  padding: 7px 0 7px 14px;
  border-inline-start: 2px solid transparent;
  margin-inline-start: -1px;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.45;
  text-decoration: none;
}

.help-toc a:hover { color: var(--accent); border-inline-start-color: var(--line-strong); }
.help-toc a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.help-toc .toc-sub a { padding-inline-start: 26px; color: var(--muted); font-size: 12.5px; }

.toc-mobile { display: none; }

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

.help-content { min-width: 0; }

.help-content section {
  padding-block: 40px;
  border-block-start: 1px solid var(--line);
  scroll-margin-top: 88px;
}

.help-content section:first-child { padding-block-start: 0; border-block-start: 0; }

.help-content h2 {
  margin: 0 0 14px;
  font-size: 28px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -.02em;
  scroll-margin-top: 88px;
}

.help-content h3 {
  margin: 32px 0 10px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  scroll-margin-top: 88px;
}

.help-content h4 {
  margin: 22px 0 8px;
  font-size: 15px;
  font-weight: 600;
  scroll-margin-top: 88px;
}

.help-content p,
.help-content li {
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.8;
}

.help-content p { margin: 0 0 14px; }
.help-content ul,
.help-content ol { margin: 0 0 16px; padding-inline-start: 22px; }
.help-content li + li { margin-block-start: 6px; }
.help-content strong { color: var(--ink); font-weight: 600; }

.help-content a { color: var(--accent); text-decoration: none; }
.help-content a:hover { text-decoration: underline; }

.help-content code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.help-content hr { height: 1px; margin: 24px 0; border: 0; background: var(--line); }

/* 提示块 */
.note,
.warn,
.ok {
  display: grid;
  gap: 4px;
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--surface-2);
}

.note b, .warn b, .ok b { color: var(--ink); font-size: 13.5px; }
.note p, .warn p, .ok p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.warn { border-inline-start-color: var(--warn); background: #fffaf0; }
.ok { border-inline-start-color: var(--ok); background: #f3faf7; }

/* 代码块 */
.code {
  position: relative;
  margin: 16px 0 20px;
  overflow: hidden;
  border: 1px solid #1f2a3a;
  border-radius: 10px;
  background: #0b1220;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-block-end: 1px solid #1f2a3a;
  color: #8ba0bd;
  font-size: 11.5px;
}

.code-head button {
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid #2b3a4f;
  border-radius: 5px;
  background: transparent;
  color: #b9c8dd;
  font-size: 11.5px;
  cursor: pointer;
}

.code-head button:hover { border-color: #5b7da8; color: #fff; }
.code-head button:focus-visible { outline: 2px solid #67e8f9; outline-offset: 2px; }
.code-head button.is-done { border-color: #2f7d5e; color: #8ff0c5; }

.code pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  color: #e6edf7;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  tab-size: 2;
}

.code code { padding: 0; border: 0; background: none; color: inherit; font-size: inherit; overflow-wrap: normal; }

/* 表格 */
.table-scroll {
  margin: 16px 0 22px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.table-scroll table { width: 100%; min-width: 680px; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.table-scroll th,
.table-scroll td { padding: 10px 12px; border-block-end: 1px solid var(--line); text-align: start; vertical-align: top; line-height: 1.6; }
.table-scroll th { background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.table-scroll tr:last-child td { border-block-end: 0; }
.table-scroll td { white-space: normal; overflow-wrap: anywhere; }
.table-scroll td code { white-space: normal; overflow-wrap: anywhere; }

/* 部署结构图 */
.arch {
  margin: 20px 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.arch-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
.arch-box {
  display: grid;
  gap: 3px;
  align-content: center;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  text-align: center;
}
.arch-box b { color: var(--ink); font-size: 13px; }
.arch-box span { color: var(--muted); font-size: 11px; }
.arch-box.is-cloud { border-style: dashed; background: #f8fbff; }
.arch-arrows { display: grid; grid-template-columns: repeat(4, 1fr); color: var(--muted); font-size: 12px; text-align: center; padding-block: 6px; }
.arch-caption { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

/* 清单 */
.checklist { display: grid; gap: 8px; margin: 14px 0 18px; padding: 0; list-style: none; }
.checklist li { position: relative; padding-inline-start: 22px; }
.checklist li::before {
  content: "";
  position: absolute;
  inset: 6px auto auto 0;
  width: 12px;
  height: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #fff;
}

/* 步骤 */
.steps-list { display: grid; gap: 12px; margin: 16px 0 20px; padding: 0; list-style: none; }
.steps-list li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; }
.steps-list b { display: block; margin-block-end: 2px; color: var(--ink); font-size: 14px; }
.steps-list p { margin: 0; }
.steps-list .step-index { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-family: var(--mono); font-size: 12px; }

/* 页脚返回 */
.help-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-block-start: 28px; padding-block-start: 24px; border-block-start: 1px solid var(--line); }
.help-actions .btn { height: 42px; }

/* ---------- 响应式 ---------- */

@media (max-width: 1024px) {
  .help-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .help-toc { display: none; }
  .toc-mobile {
    display: block;
    margin-block-end: 24px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
  }
  .toc-mobile summary {
    padding: 12px 14px;
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
  }
  .toc-mobile summary::-webkit-details-marker { display: none; }
  .toc-mobile summary::after { content: "+"; float: right; color: var(--muted); }
  .toc-mobile[open] summary::after { content: "−"; }
  .toc-mobile ol { display: grid; gap: 2px; margin: 0; padding: 0 10px 10px; list-style: none; }
  .toc-mobile a { display: block; padding: 7px 8px; border-radius: 6px; color: var(--ink-2); font-size: 13px; text-decoration: none; }
  .toc-mobile a:hover { background: #fff; color: var(--accent); }
  .arch-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .arch-arrows { display: none; }
}

@media (max-width: 768px) {
  .help-main { width: calc(100% - 32px); padding: 96px 0 56px; }
  .help-hero h1 { font-size: 32px; }
  .help-content h2 { font-size: 24px; }
  .help-content section { padding-block: 32px; }
  .help-content p, .help-content li { font-size: 14px; }
  .code pre { font-size: 12px; }
}

@media (max-width: 480px) {
  .help-meta li { font-size: 11px; }
  .help-hero h1 { font-size: 29px; }
  .help-content h2 { font-size: 22px; }
  .steps-list li { grid-template-columns: 28px minmax(0, 1fr); }
}

@media print {
  .help .nav, .help-toc, .toc-mobile, .help-actions, .code-head button { display: none !important; }
  .help-main { padding: 0; width: 100%; }
  .help-layout { display: block; }
  .code { break-inside: avoid; }
}
