/* ============================================================
   CNTOP3 P0 修复样式包  (2026-11-27)
   覆盖：C-01 目录遮挡 / C-02 移动端横向溢出 / C-03 列表标题截断
        C-11 摘要重复 / F-01 咨询入口 / G-01 商业标识
   加载于主题样式之后，全部使用高优先级选择器，避免被主题覆盖。
   ============================================================ */

/* ---------- C-01 悬浮目录：改为右侧抽屉，默认收起 ---------- */
@media screen and (min-width: 601px) {
  body.cntop3-has-toc .toc-box {
    left: auto !important;
    right: 0 !important;
    top: 50% !important;
    bottom: auto !important;
    width: 286px;
    max-width: 286px;
    min-width: 0;
    max-height: 66vh;
    padding: 12px 0 8px;
    background: #fff !important;
    border-left: 0;
    border-right: 3px solid #2f6fa8;
    border-radius: 8px 0 0 8px;
    box-shadow: -8px 0 28px rgba(15, 32, 51, .16);
    transform: translate(100%, -50%);
    visibility: hidden;
    pointer-events: none;
    transition: transform .28s ease, visibility .28s;
    z-index: 90;
  }

  body.cntop3-has-toc.cntop3-toc-open .toc-box {
    transform: translate(0, -50%);
    visibility: visible;
    pointer-events: auto;
  }

  body.cntop3-has-toc .toc-box .toc-ul-box {
    max-height: calc(66vh - 56px);
    min-height: 0;
    overflow-y: auto;
  }

  body.cntop3-has-toc .toc-ul {
    margin: 0 34px 0 14px;
  }

  .cntop3-toc-head {
    font-size: 12px;
    letter-spacing: .22em;
    color: #8c6b33;
    padding: 0 14px 8px;
    border-bottom: 1px solid #eef2f6;
    margin: 0 0 6px;
  }

  body.cntop3-has-toc .toc-ul li a {
    min-width: 0;
    white-space: normal;
    line-height: 1.6 !important;
  }

  .cntop3-toc-toggle {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 91;
    display: block;
    width: 34px;
    padding: 14px 0;
    border: 0;
    border-radius: 6px 0 0 6px;
    background: #0f2033;
    color: #fff;
    font-size: 12px;
    letter-spacing: .28em;
    line-height: 1;
    text-indent: .28em;
    writing-mode: vertical-rl;
    cursor: pointer;
    box-shadow: -4px 0 14px rgba(15, 32, 51, .22);
    transition: background .2s ease;
  }

  .cntop3-toc-toggle:hover,
  .cntop3-toc-toggle:focus-visible {
    background: #1b3a55;
  }

  body.cntop3-toc-open .cntop3-toc-toggle {
    background: #8c6b33;
  }
}

@media screen and (max-width: 600px) {
  .cntop3-toc-toggle { display: none !important; }
}

/* ---------- C-02 移动端与窄屏：容器与媒体不越界 ---------- */
@media screen and (max-width: 900px) {
  html,
  body {
    overflow-x: hidden !important;
    max-width: 100%;
  }

  #page,
  #content,
  .site-content,
  #primary,
  #primary-l,
  .be-main,
  .site-main,
  .single-content,
  .entry-content,
  article,
  main {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    box-sizing: border-box;
  }

  .single-content,
  .entry-content,
  .single-content p,
  .single-content li {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .single-content img,
  .single-content video,
  .single-content iframe,
  .single-content embed,
  .single-content object,
  .single-content table,
  .single-content pre,
  .entry-content img,
  .entry-content iframe,
  .entry-content table {
    max-width: 100% !important;
    height: auto !important;
    box-sizing: border-box;
  }

  .single-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .single-content pre {
    white-space: pre-wrap;
    word-break: break-word;
  }

  .single-content h1,
  .single-content h2,
  .single-content h3,
  .single-content h4 {
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  /* 主题标题条使用左右 -20px 负边距，窄屏会越界 4px，此处归零 */
  .single-content h2,
  .single-content h3,
  .single-content h4 {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .single-content .toc-box-h {
    max-width: 100% !important;
    overflow: hidden;
  }
}

/* ---------- C-03 移动端列表标题：两行截断，不再右侧硬切 ---------- */
@media screen and (max-width: 900px) {
  .entry-title,
  .entry-title a,
  .grid-title,
  .grid-title a,
  .post-item-list .entry-title,
  .post-item-list .grid-title,
  .card-list .entry-title,
  .card-list .grid-title,
  .list-title,
  .list-title a {
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden !important;
    white-space: normal !important;
    word-break: break-word;
    line-height: 1.5 !important;
    max-height: 3.1em;
    text-overflow: ellipsis;
  }

  /* 文章页 / 页面标题不参与列表截断，避免长标题被裁 */
  body.single .entry-title,
  body.single .entry-title a,
  body.page .entry-title,
  body.page .entry-title a {
    display: block !important;
    -webkit-line-clamp: unset !important;
    max-height: none !important;
    overflow: visible !important;
    white-space: normal !important;
  }
}

/* ---------- F-01 咨询入口 ---------- */
.cntop3-consult {
  margin: 26px 0 8px;
  border: 1px solid #d8e3ee;
  border-left: 4px solid #8c6b33;
  border-radius: 4px;
  background: #f7fafd;
  padding: 20px 22px 18px;
}

.cntop3-consult-head {
  font-size: 17px;
  font-weight: 700;
  color: #132a40;
  line-height: 1.4;
}

.cntop3-consult-sub {
  margin: 6px 0 14px;
  font-size: 13px;
  color: #5d6f82;
  line-height: 1.7;
}

.cntop3-consult-ways {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
}

.cntop3-consult-way {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 3px;
  background: #0f2033;
  color: #fff !important;
  font-size: 13px;
  text-decoration: none !important;
}

.cntop3-consult-way.is-light {
  background: #fff;
  color: #132a40 !important;
  border: 1px solid #cfdbe8;
}

.cntop3-consult-form {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cntop3-consult-form input,
.cntop3-consult-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d5dfe9;
  border-radius: 3px;
  padding: 9px 11px;
  font-size: 13px;
  background: #fff;
  color: #20364b;
}

.cntop3-consult-form textarea {
  grid-column: 1 / -1;
  min-height: 76px;
  resize: vertical;
}

.cntop3-consult-form .cntop3-consult-full {
  grid-column: 1 / -1;
}

.cntop3-consult-form button {
  grid-column: 1 / -1;
  justify-self: start;
  border: 0;
  border-radius: 3px;
  padding: 10px 22px;
  background: #8c6b33;
  color: #fff;
  font-size: 13px;
  letter-spacing: .08em;
  cursor: pointer;
}

.cntop3-consult-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.cntop3-notice {
  margin: 14px 0;
  padding: 12px 16px;
  border-radius: 3px;
  background: #eef6ee;
  border: 1px solid #cfe4cf;
  color: #245a2a;
  font-size: 13px;
}

@media screen and (max-width: 600px) {
  .cntop3-consult { padding: 16px; }
  .cntop3-consult-form { grid-template-columns: 1fr; }
}

/* ---------- G-01 商业推广标识 ---------- */
.cntop3-ad-badge {
  display: inline-block;
  margin: 0 0 14px;
  padding: 4px 10px;
  border: 1px solid #d9c39a;
  border-radius: 2px;
  background: #fbf6ea;
  color: #7a5a22;
  font-size: 12px;
  letter-spacing: .06em;
  line-height: 1.6;
}

.cntop3-ad-note {
  margin: 22px 0 6px;
  padding: 12px 16px;
  border-top: 1px dashed #d8c7a4;
  color: #6d5a35;
  font-size: 12px;
  line-height: 1.8;
}

/* ---------- 站点级联系条（页脚上方） ---------- */
.cntop3-footbar {
  margin: 26px 0 0;
  padding: 18px 0 6px;
  border-top: 1px solid #e2e8ef;
  text-align: center;
  font-size: 13px;
  color: #5d6f82;
  line-height: 1.9;
}

.cntop3-footbar a {
  color: #132a40;
  text-decoration: none;
  border-bottom: 1px solid #c8a15a;
}

/* ---------- 404 增强（主题模板同步） ---------- */
.cntop3-404-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0 8px;
}

.cntop3-404-grid a {
  display: block;
  padding: 12px 14px;
  border: 1px solid #e0e7ef;
  border-radius: 3px;
  background: #fff;
  color: #20364b;
  text-decoration: none;
  font-size: 14px;
}

.cntop3-404-grid a:hover {
  border-color: #c8a15a;
}

@media screen and (max-width: 600px) {
  .cntop3-404-grid { grid-template-columns: 1fr; }
}
