/*
Theme Name: 轨魅网 B2 子主题
Theme URI: https://www.guimei8.com
Description: 轨魅网基于 B2 主题定制的子主题，包含计算器工具、PDF 导出、VIP 专属计算器、文章样式优化等功能。
Author: 轨魅网
Author URI: https://www.guimei8.com
Template: b2
Version: 1.0.0
Text Domain: b2child
*/
.entry-content .wp-block-table,
.post-content .wp-block-table,
.article-content .wp-block-table,
article .wp-block-table {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 18px 0;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}

/* 表格本体：不要强行压缩 */
.entry-content table,
.post-content table,
.article-content table,
article table {
  width: max-content;
  min-width: 100%;
  max-width: none;
  border-collapse: collapse;
  table-layout: auto !important;
  font-size: 14px;
  line-height: 1.65;
  background: #fff;
  border: 1px solid #d8dde6;
  color: #333;
}

/* 单元格基础 */
.entry-content table th,
.entry-content table td,
.post-content table th,
.post-content table td,
.article-content table th,
.article-content table td,
article table th,
article table td {
  border: 1px solid #d8dde6 !important;
  padding: 7px 9px;
  vertical-align: top;
  text-align: left;
  color: #333;
  background-clip: padding-box;

  /* 关键：允许长内容在必要时断开，防止文字重叠 */
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}

/* 表头 */
.entry-content table th,
.post-content table th,
.article-content table th,
article table th,
.entry-content table tr:first-child td,
.post-content table tr:first-child td,
.article-content table tr:first-child td,
article table tr:first-child td {
  background: #f3f6fa !important;
  font-weight: 700;
  color: #222;
  text-align: center;
}

/* 第一列：编号，不换行，居中 */
.entry-content table th:first-child,
.entry-content table td:first-child,
.post-content table th:first-child,
.post-content table td:first-child,
.article-content table th:first-child,
.article-content table td:first-child,
article table th:first-child,
article table td:first-child {
  min-width: 46px;
  width: 46px;
  text-align: center;
  white-space: nowrap !important;
}

/* 第二列：名称/类别，适当宽度 */
.entry-content table th:nth-child(2),
.entry-content table td:nth-child(2),
.post-content table th:nth-child(2),
.post-content table td:nth-child(2),
.article-content table th:nth-child(2),
.article-content table td:nth-child(2),
article table th:nth-child(2),
article table td:nth-child(2) {
  min-width: 100px;
  white-space: nowrap !important;
}

/* 第三列、第四列：数量、规格类，适中 */
.entry-content table th:nth-child(3),
.entry-content table td:nth-child(3),
.entry-content table th:nth-child(4),
.entry-content table td:nth-child(4),
.post-content table th:nth-child(3),
.post-content table td:nth-child(3),
.post-content table th:nth-child(4),
.post-content table td:nth-child(4),
.article-content table th:nth-child(3),
.article-content table td:nth-child(3),
.article-content table th:nth-child(4),
.article-content table td:nth-child(4),
article table th:nth-child(3),
article table td:nth-child(3),
article table th:nth-child(4),
article table td:nth-child(4) {
  min-width: 90px;
}

/* 第五列以后：说明、备注、重量等长文本列 */
.entry-content table th:nth-child(n+5),
.entry-content table td:nth-child(n+5),
.post-content table th:nth-child(n+5),
.post-content table td:nth-child(n+5),
.article-content table th:nth-child(n+5),
.article-content table td:nth-child(n+5),
article table th:nth-child(n+5),
article table td:nth-child(n+5) {
  min-width: 180px;
  max-width: 320px;
}

/* 隔行底色 */
.entry-content table tr:nth-child(even) td,
.post-content table tr:nth-child(even) td,
.article-content table tr:nth-child(even) td,
article table tr:nth-child(even) td {
  background-color: #fafafa;
}

/* 鼠标经过 */
.entry-content table tr:hover td,
.post-content table tr:hover td,
.article-content table tr:hover td,
article table tr:hover td {
  background-color: #f0f7ff;
}

/* 表格里的图片不要撑破 */
.entry-content table img,
.post-content table img,
.article-content table img,
article table img {
  max-width: 100%;
  height: auto;
}



/* 修复 WordPress 文章正文上标、下标显示 */
.entry-content sup,
.entry-content sub {
    position: relative !important;
    font-size: 75% !important;
    line-height: 0 !important;
    vertical-align: baseline !important;
}

.entry-content sup {
    top: -0.5em !important;
}

.entry-content sub {
    bottom: -0.25em !important;
}
