/* 岁寒输入法官网 - 教程页专用样式（依赖 style.css 的变量与基础组件） */

/* ------------------------------ 教程首页 ------------------------------ */

.doc-hero-tight { padding: 52px 0 8px; }

.doc-hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 26px;
}

.doc-index-search { max-width: 520px; margin: 0 auto 40px; }

.doc-index-search input {
  width: 100%;
  padding: 13px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: 0.2s;
}

.doc-index-search input::placeholder { color: var(--muted); }

.doc-index-search input:focus {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.doc-chapters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.doc-chapter { padding: 24px 26px; }

.doc-chapter-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.doc-chapter-no {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  color: var(--brand);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 8px;
  padding: 3px 8px;
}

.doc-chapter-head h3 { font-size: 17px; margin: 0; flex: 1; }

.doc-chapter-count { font-size: 12.5px; color: var(--muted); }

.doc-chapter ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

.doc-chapter li a {
  display: block;
  padding: 8px 10px;
  margin: 0 -10px;
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 14.5px;
  transition: 0.18s;
}

.doc-chapter li a::before {
  content: "›";
  color: var(--brand);
  margin-right: 8px;
  opacity: 0.7;
}

.doc-chapter li a:hover {
  background: rgba(56, 189, 248, 0.08);
  color: #fff;
}

.doc-empty { text-align: center; color: var(--muted); margin-top: 30px; }

/* ------------------------------ 文章页布局 ------------------------------ */

.doc-layout {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.doc-side {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.doc-side::-webkit-scrollbar { width: 6px; }
.doc-side::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 3px; }

.doc-side-inner {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
  padding: 18px 16px;
}

.doc-side-toggle { display: none; }

.doc-side-home {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  padding: 6px 10px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.doc-side-home:hover { color: var(--brand); }

.doc-side-ch {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 14px 10px 6px;
  font-weight: 600;
}

.doc-side ul { list-style: none; margin: 0 0 4px; padding: 0; }

.doc-side li a {
  display: block;
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.45;
  transition: 0.18s;
  border-left: 2px solid transparent;
}

.doc-side li a:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }

.doc-side li a.active {
  background: rgba(56, 189, 248, 0.1);
  border-left-color: var(--brand);
  color: var(--brand);
  font-weight: 600;
}

.doc-body { max-width: none; }

.doc-body > :first-child { margin-top: 0; }

/* 正文标题层级（style.css 只定义了 h2/h3） */

.doc-body h1 {
  font-size: 26px;
  margin: 40px 0 16px;
  padding-left: 14px;
  border-left: 3px solid var(--brand);
}

.doc-body h4 {
  font-size: 16px;
  margin: 26px 0 10px;
  color: var(--brand-2);
}

.doc-body h5 {
  font-size: 15px;
  margin: 20px 0 8px;
  color: var(--text);
}

.doc-body p { line-height: 1.85; }

.doc-body em { color: var(--muted); }

/* 图片 */

.img-wrap { text-align: center; margin: 24px 0; }

.doc-body img.doc-img {
  display: block;
  margin: 24px auto;
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}

.img-wrap img.doc-img { margin: 0 auto; }

.doc-body img.doc-img[src$=".gif"] { border-color: rgba(56, 189, 248, 0.25); }

/* 上下篇 */

.doc-pager {
  display: flex;
  gap: 16px;
  margin: 56px 0 10px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}

.doc-pager a {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  transition: 0.2s;
  text-decoration: none;
}

.doc-pager a:hover {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.07);
  transform: translateY(-2px);
}

.doc-pager small { font-size: 12px; color: var(--muted); }

.doc-pager span { font-size: 14.5px; color: var(--text); }

.doc-pager-next { text-align: right; }

/* ------------------------------ 响应式 ------------------------------ */

@media (max-width: 1000px) {
  .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 22px; }

  .doc-layout,
  .doc-body,
  .doc-side { min-width: 0; }

  .doc-body img.doc-img { max-width: 100%; height: auto; }

  .img-wrap { overflow: hidden; }

  .doc-side {
    position: static;
    max-height: none;
    overflow: visible;
    order: -1;
  }

  .doc-side-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 13px 18px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 14.5px;
    font-family: inherit;
    cursor: pointer;
  }

  .doc-side.open .doc-side-toggle {
    border-color: rgba(56, 189, 248, 0.45);
    color: var(--brand);
  }

  .doc-side-inner { display: none; margin-top: 10px; padding: 14px; }

  .doc-side.open .doc-side-inner { display: block; }

  .doc-side li a {
    border-left: 0;
    border-radius: 9px;
    padding: 8px 10px;
    font-size: 14px;
  }

  .doc-side li a.active { background: rgba(56, 189, 248, 0.14); }
}

@media (max-width: 720px) {
  .doc-chapters { grid-template-columns: minmax(0, 1fr); }
  .doc-hero-tight { padding: 38px 0 4px; }
  .doc-pager { flex-direction: column; }
  .doc-pager-next { text-align: left; }
  .doc-body h1 { font-size: 22px; }
}
