/* =========================================================
   article-detail.css  (终极移动端防溢出版)
   - 强制移动端一列
   - 处理 flex/grid/min-width/100vw 导致的横向滚动
   - 正文媒体/长链接/表格/代码块兜底
   ========================================================= */

/* 0) 全局兜底：任何情况下不允许横向滚动（最关键） */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* 可选：某些浏览器会把 100vw 带来的滚动条算进去，这里加一层兜底 */
body {
  position: relative;
}

/* 1) 外层容器 */
.article-container {
  width: 100%;
  max-width: 1200px;
  margin: 40px auto;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  box-sizing: border-box;
}

/* 2) 布局：PC 两列 */
.article-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;

  /* ✅ 关键兜底：允许换行，防止某些元素把 flex 撑爆 */
  flex-wrap: wrap;
  max-width: 100%;
  box-sizing: border-box;
}

/* ✅ flex 子项防溢出关键 */
.article-main {
  flex: 1 1 0%;
  min-width: 0;            /* 必须有 */
  max-width: 100%;
  box-sizing: border-box;

  /* ✅ 再兜底：避免内部元素撑出横向滚动 */
  overflow-x: hidden;
}

/* 侧边栏 */
.article-sidebar {
  width: 300px;
  flex: 0 0 300px;         /* 明确固定列宽 */
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* 3) 面包屑 */
.article-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 16px;
  color: #666;
}

.article-breadcrumb::before {
  content: "";
  width: 3px;
  height: 18px;
  background: #ff6a00;
  display: inline-block;
}

.article-breadcrumb .crumb-link {
  color: #ff6a00;
  text-decoration: none;
  font-weight: 600;
}

.article-breadcrumb .crumb-link:hover {
  text-decoration: underline;
}

.article-breadcrumb .crumb-current {
  color: #ff6a00;
  font-weight: 600;
}

.article-breadcrumb .crumb-separator {
  color: #999;
}

/* 3.5) 文章元信息（来源/日期/阅读） */
.article-meta {
  margin: 10px 0 20px;
  padding: 10px 14px;
  display: block;
  color: #888;
  font-size: 15px;
  line-height: 1.55;
  border: 1px solid #eee;
  border-radius: 10px;
  background: #fafafa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.article-meta__label {
  color: #9a9a9a;
}

.article-meta__value {
  color: #595959;
  font-weight: 500;
}

.article-meta__divider {
  color: #c8c8c8;
}

/* 4) ✅ 正文：防止移动端长词/符号/URL 撑破 */
.content-text {
  max-width: 100%;
  box-sizing: border-box;

  overflow-wrap: anywhere;     /* 最强断行 */
  word-break: break-word;
  white-space: normal;

  /* 关键：不要让内部出现横向滚动把页面撑开 */
  overflow-x: hidden;
}

.content-text--collapsed {
  max-height: 980px;
  overflow: hidden;
}

.content-text-fade {
  height: 58px;
  margin-top: -58px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 70%);
  pointer-events: none;
  position: relative;
}

.content-expand-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 14px;
}

.content-expand-btn {
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #111827;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

/* 富文本所有子元素：强制不超过容器 */
.content-text * {
  box-sizing: border-box;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ✅ 链接：长 URL 强制断行 */
.content-text a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ✅ 媒体元素自适应 */
.content-text img,
.content-text video,
.content-text iframe,
.content-text embed,
.content-text object {
  max-width: 100% !important;
  height: auto !important;

  /* 避免图片/iframe 自带 display:inline 导致奇怪空隙 */
  display: block;
}

/* ✅ 表格：不删除的话必须横向滚动，不可撑破页面 */
.content-text table {
  max-width: 100% !important;
  width: 100% !important;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ✅ 代码块：允许内部滚动，但不撑破页面 */
.content-text pre,
.content-text code {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 5) 侧边栏样式 */
.sidebar-block {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  background: #fafafa;
}

.sidebar-block h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: #333;
}

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-list li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px dashed #e6e6e6;
}

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

.sidebar-list a {
  color: #333;
  text-decoration: none;
}

.sidebar-list a:hover {
  color: #ff4757;
}


.article-breadcrumb .crumb-link:focus-visible,
.content-expand-btn:focus-visible,
.sidebar-list a:focus-visible,
.comment-login-link:focus-visible,
.comment-submit-btn:focus-visible,
.comment-retry-btn:focus-visible {
  outline: 2px solid rgba(200, 29, 37, 0.55);
  outline-offset: 2px;
  border-radius: 6px;
}

.sidebar-list .meta {
  font-size: 12px;
  color: #999;
}

.sidebar-list .empty {
  color: #999;
  padding: 8px 0;
}

/* 6) ✅ 关键：移动端强制一列（用 !important 压住其它 CSS） */
@media (max-width: 960px) {
  .article-layout {
    display: block !important;     /* 强制取消两列 */
    width: 100% !important;
    max-width: 100% !important;
  }

  .article-main,
  .article-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* 侧边栏如果在别处被 sticky/fixed，这里强制还原 */
  .article-sidebar {
    position: static !important;
    flex: none !important;
  }
}

/* 7) ✅ 手机再优化：减少左右 padding */
@media (max-width: 600px) {
  .article-container {
    margin: 16px auto;
    padding: 14px;
    border-radius: 10px;

    /* ✅ 防止外层被某些 100vw 影响：锁死为 100% */
    width: 100% !important;
    max-width: 100% !important;
  }

  .content-text {
    font-size: 16px;
    line-height: 1.75;
  }

  .article-meta {
    margin: 10px 0 16px;
    padding: 8px 10px;
    font-size: 14px;
  }
}
/* ===== chinaqw 图集正文（figure/figcaption） ===== */
.content-text figure{
  margin: 16px 0;
  padding: 0;
}

.content-text figure img{
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 10px;
}

/* 图注更舒服：断行 + 行距 */
.content-text figure figcaption{
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.65;
  opacity: .9;

  overflow-wrap: anywhere;
  word-break: break-word;
}

/* 可选：让图注像“卡片”一样（想要就取消注释） */
/*
.content-text figure figcaption{
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0,0,0,.04);
}
*/

.comment-section--enhanced {
  margin-top: 30px;
  border-top: 2px solid #333;
  padding-top: 20px;
}

.comment-item--row {
  border-bottom: 1px solid #f0f0f0;
  padding: 15px 0;
}

.comment-item__meta {
  font-size: 13px;
  color: #999;
}

.comment-item__body {
  margin-top: 6px;
  color: #333;
  line-height: 1.65;
  white-space: pre-wrap;
}

.comment-item--new {
  background: #fffcf5;
}

.comment-empty-tip {
  color: #999;
  padding: 20px 0;
}

.comment-form-wrap {
  margin-top: 30px;
}

.comment-textarea {
  width: 100%;
  min-height: 88px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  resize: vertical;
}

.comment-textarea:focus {
  outline: none;
  border-color: rgba(200, 29, 37, 0.45);
  box-shadow: 0 0 0 3px rgba(200, 29, 37, 0.12);
}

.comment-textarea:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.comment-submit-btn,
.comment-retry-btn {
  border: none;
  border-radius: 4px;
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 600;
}

.comment-submit-btn {
  background: #333;
  color: #fff;
}

.comment-submit-btn:disabled {
  cursor: not-allowed;
  opacity: 0.75;
}

.comment-retry-btn {
  background: #f59e0b;
  color: #fff;
}

.comment-msg-tip {
  margin-left: 2px;
  font-size: 14px;
  color: #666;
}

.comment-msg-tip.is-pending {
  color: #6b7280;
}

.comment-msg-tip.is-success {
  color: #15803d;
}

.comment-msg-tip.is-warning {
  color: #b45309;
}

.comment-msg-tip.is-error {
  color: #b91c1c;
}

.comment-login-tip {
  text-align: center;
  padding: 20px;
  background: #f9f9f9;
}

.comment-login-link {
  color: #ff4757;
  font-weight: bold;
}

.sidebar-author-card {
  background: #fff;
  border-radius: 12px;
}

.sidebar-author-card__head {
  text-align: center;
}

.sidebar-author-card__avatar-wrap {
  width: 112px;
  height: 112px;
  margin: 4px auto 14px;
  border-radius: 50%;
  border: 1px solid #ececec;
  display: block;
  overflow: visible;
  position: relative;
  background: #fff;
  text-decoration: none;
}

.sidebar-author-card__head img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.sidebar-author-card__badge {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #f7ad2b;
  color: #fff;
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  text-align: center;
}

.sidebar-author-card__head h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.22;
}

.sidebar-author-card__head h3 a {
  color: #333;
  text-decoration: none;
}

.sidebar-author-card__head p {
  margin: 8px 0 0;
  color: #666;
  font-size: 14px;
}

.sidebar-author-card__stats {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  align-items: center;
}

.sidebar-author-card__stats::before {
  content: "";
  grid-column: 2;
  grid-row: 1;
  width: 1px;
  height: 44px;
  background: #e9e9e9;
}

.sidebar-author-card__stats div {
  text-align: center;
}

.sidebar-author-card__stats strong {
  display: block;
  font-size: 34px;
  color: #333;
  line-height: 1.1;
  font-weight: 700;
}

.sidebar-author-card__stats span {
  display: block;
  margin-top: 4px;
  color: #777;
  font-size: 14px;
}

@media (max-width: 960px) {
  .sidebar-author-card__head h3 {
    font-size: 22px;
  }

  .sidebar-author-card__head p {
    font-size: 14px;
  }

  .sidebar-author-card__stats strong {
    font-size: 30px;
  }

  .sidebar-author-card__stats span {
    font-size: 14px;
  }
}

.article-cover--spaced {
  margin: 16px 0;
}

.article-cover__image {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.article-tag-empty {
  color: #ccc;
}

.article-nav__label {
  color: #999;
}
