/* ---------- 22. WordPress 动态内容适配 ---------- */
/* 真实缩略图（原型用占位块，这里让 <img> 填上同样比例）
 * 注意：height 必须是 auto —— 网格会把卡片等高拉伸，
 * 若 img 用 height:100% 会撑满整卡高度，把标题推出卡片并被 overflow:hidden 裁掉 */
.post-card__media > img,
.product-card__media > img,
.related__grid .post-card__media > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--radius-lg);  /* 保存时可能被覆盖为 var(--radius) */
}

/* 占位块里放真实图时，让图片铺满并永远的中划线 */
.post-card__media .ph > img,
.product-card__media .ph > img,
.related__grid .post-card__media .ph > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  margin: 0;
  padding: 0;
}

/* 卡片内标题可能超长会撑破布局，这里做保护 */
.post-card__title,
.product-card__name {
  overflow-wrap: anywhere;  /* 超长英文、数字等断裂 */
  word-break: break-word;
}

/* WordPress 自带的分页结构与原型 .pager 的差异 */
.pager .page-numbers.current,
.pager .current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.pager .page-numbers {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--ink-2);
  text-decoration: none;
}
.pager .page-numbers:hover {
  background: var(--navy-800);
  color: #fff;
  border-color: var(--navy-800);
}

/* 产品相册主图 */
.gallery__main > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
}
.gallery__thumbs > div {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 2px transparent solid;
  cursor: pointer;
  padding: 0;
  margin: 0;
}
.gallery__thumbs > div.is-active {
  border-color: var(--accent);
}
.gallery__thumbs > div > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 详情页右侧动态内容可能为 <p><img> 等，给它更强兼容性 */
.article__body img,
.detail-body img,
.product-card__body img {
  max-width: 100%;
  height: auto;
  display: inline-block;
  border-radius: 8px;
}

/* 后台进入 Yoast 时可能套用 WordPress 自带的 .screen-reader-text */
.screen-reader-text {
  border: 0;
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

/* 小补丁：WordPress 可能会插入 .wp-block-image 等，给它适应容器 */
.wp-block-image img {
  max-width: 100%;
  height: auto;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* 商品短描述可能为空时为避免塌陷 */
.detail__desc:empty::before {
  content: "Contact us for full specifications and customization options. The normal delivery time is 7-15 days. OEM/ODM supported. 6-year warranty, lifetime technical support.";
  color: var(--muted);
}

/* 若产品分类 / 归档 / 搜索等页面没有 banner 时的兜底 */
#main {
  min-height: 40vh;
}

/* 分类存档 / 搜索结果页面容器 */
.search-form, .search-field {
  max-width: 100%;
  border-radius: var(--radius-lg);
}

/* 搜索页结果可能过长 */
.search-results .post-card__title {
  font-size: 16px;
}

/* 后台插入 shortcode 可能生成 .woocommerce 容器，这里给它隔离 */
.woocommerce-tabs,.related.products, .upsells.products {
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding-top: 26px;
}

/* 修复 Gutenberg blocks 在详情页的 p 间距冲突 */
.article__body p, .detail-body p {
  margin: 0 0 20px 0;
}

/* 修复 Gutenberg blocks 在详情页的 ul 间距冲突 */
.article__body ul, .detail-body ul {
  padding-left: 22px;
}

/* 修复 Gutenberg blocks 在详情页的 ol 间距冲突 */
.article__body ol, .detail-body ol {
  padding-left: 22px;
}

/* 修复 Gutenberg blocks 在详情页的表格冲突 */
.article__body .wp-block-table table, .detail-body .wp-block-table table {
  width: 100%;
  border-collapse: collapse;
  margin: 26px 0;
  font-size: 14px;
}

/* WordPress 引入时的一些残留 */
#wpadminbar * {
  box-sizing: content-box;
}

/* meta 日期 / 作者 */
.entry-meta {
  font-size: 13px;
  color: var(--muted-2);
  margin: 10px 0 0 0;
}

/* comment / 回复框（后续接入 functioning WP comments 时可用） */
.comment-reply-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.comment-form-comment label {
  display: block;
  font-size: 13px;
  color: var(--muted-2);
  margin-bottom: 6px;
  font-weight: 500;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.comment-form-author>label,
.comment-form-email>label,
.comment-form-url>label {
  display: block;
  font-size: 13px;
  color: var(--muted-2);
  margin-bottom: 6px;
  font-weight: 500;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.comment-form input[type=text], .comment-form input[type=email], .comment-form input[type=url], .comment-form textarea {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  transition: border-color .25s var(--ease);
}

.comment-form textarea {
  resize: vertical;
  min-height: 96px;
}

.comment-form input:focus, .comment-form textarea:focus {
  outline: none;
  border-color: var(--brand);
}

.comment-form .form-submit input[type=submit] {
  padding: 12px 28px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color:#fff;
  font-weight: 600;
  cursor: pointer;
  transition: background .25s var(--ease);
}

.comment-form .form-submit input[type=submit]:hover {
  background: var(--navy-800);
}


/* 小补丁：让 WordPress 插入的 .alignleft / .alignright 等可以浮动 */
.alignleft { float:left; margin: 0 20px 20px 0; }
.alignright { float:right; margin: 0 0 20px 20px; }
.aligncenter { display:block; margin-left:auto; margin-right:auto; }
.wp-caption-text, .wp-element-caption { font-size:13px; color:var(--muted-2); text-align:center; margin-top:8px; }


/* ------- 为了让旧 <img width/height> WordPress 不再冲突 ----- */
.size-medium, .size-large, .size-thumbnail, .size-full {
  max-width: 100%;
  height: auto;
}

/* ------- WordPress 的其他 ------- */
.navigation .nav-links {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.navigation .nav-links a, .navigation .nav-links span {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--ink-2);
  text-decoration: none;
}

.navigation .nav-links a:hover { background: var(--navy-800); color:#fff; border-color: var(--navy-800); }
.navigation .nav-links .current { background: var(--brand); color:#fff; border-color: var(--brand); }

/* 产品列表无结果时的占位 */
.no-products {
  padding: 60px 0;
  text-align: center;
  color: var(--muted-2);
}

/* 无图占位 */
.post-card__media .ph, .product-card__media .ph {
  display:flex; align-items:center; justify-content:center; overflow:hidden; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--bg-soft), #fff);
}

/* 详情页 .related 可能没有标题（not found / no related products） 时的塌陷保护 */
.related__head:empty { display:none; }
.related__grid:empty { display:none; }
.related:empty, .related__head:empty + .related__grid:empty { display:none; }


/* 分頁 */
navigation.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
  flex-wrap: wrap;
}

navigation.pagination .nav-links {
  display:flex; gap:8px;
}

/* nav-links 里的 page-numbers 需要再次强调，因为可能没 .pager */
.navigation.pagination .page-numbers {
  min-width: 38px; height: 38px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-2); border-radius: 8px;
  font-size: 13.5px; color: var(--ink-2);
  text-decoration: none;
}
.navigation.pagination .page-numbers.current {
  background: var(--brand); border-color: var(--brand); color:#fff;
}
.navigation.pagination .page-numbers:hover {
  background: var(--navy-800); color:#fff; border-color: var(--navy-800);
}

/* WooCommerce 面包屑 */
.woocommerce-breadcrumb {
  font-size: 13px;
  color: var(--muted-2);
  margin-bottom: 12px;
}
.woocommerce-breadcrumb a { color: var(--ink-2); text-decoration:none; }
.woocommerce-breadcrumb a:hover { color: var(--brand); text-decoration: underline; }

/* WooCommerce 通知 */
.woocommerce-error, .woocommerce-info, .woocommerce-message {
  padding: 12px 20px;
  margin: 0 0 24px;
  background: var(--bg-soft);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink-2);
}

/* 产品列表排序 */
.woocommerce-ordering {
  margin-bottom: 24px;
}
.woocommerce-ordering select {
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  color: var(--ink-2);
  background: #fff;
  cursor: pointer;
}


/* 数量 / 加入购物车按钮 (虽然原型没有购物车，但 WooCommerce 可能仍会输出) */
.quantity input.qty {
  width: 60px;
  padding: 10px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  text-align: center;
  font: inherit;
  font-size: 14px;
}
.single_add_to_cart_button, .add_to_cart_button, .ley_add_to_cart {
  display: inline-block;
  padding: 14px 34px;
  background: var(--brand);
  color:#fff!important;
  border:0;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  text-decoration:none!important;
  transition: background .25s var(--ease);
}
.single_add_to_cart_button:hover, .add_to_cart_button:hover {
  background: var(--navy-800);
}

/* 价格 */
.price, .woocommerce-Price-amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 16px;
  display: block;
}
/* 原型产品卡没价格，这里先隐藏 WooCommerce 自带的的价格，避免破坏版式 */
.product-card .price { display:none; }

.stock.out-of-stock { color:#d32f2f; font-size:13px; font-weight:600; margin-bottom:12px; }
.stock.in-stock { color:#2e7d32; font-size:13px; font-weight:600; margin-bottom:12px; }


 /* 商品短描述为空时的上下文 */
.detail__desc:empty::before {
  content: "Contact us for full specifications and customization options. The normal delivery time is 7-15 days. OEM/ODM supported. 6-year warranty, lifetime technical support.";
  color: var(--muted);
}

/* detail__body / single-product 的数据 */
.detail {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 48px;
}
.gallery__main .ph { aspect-ratio: 1 / 1; border-radius: var(--radius-lg); }
.detail h1 { font-size: clamp(24px, 2.6vw, 34px); margin-bottom: 14px; }
.detail__desc { color: var(--muted); }

/* ---------- 23. 评论 / 回复框（接入 WP 原生系统评论） ---------- */
.comments { margin-top: 46px; padding-top: 34px; border-top: 1px solid var(--line); }
.comments h2 { font-size: clamp(19px, 2vw, 25px); margin-bottom: 22px; }
.comment {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.comment__avatar .ph { aspect-ratio: 1 / 1; border-radius: 50%; }
.comment__who { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.comment__who small { font-weight: 400; color: var(--muted-2); margin-left: 8px; }
.comment p { font-size: 14px; color: var(--muted); margin: 0; }

.comment-form { margin-top: 26px; padding: 26px; background: var(--bg-soft); border-radius: var(--radius-lg); }
.comment-form input,
.comment-form textarea {
  width: 100%; padding: 11px 14px; margin-bottom: 12px;
  border: 1px solid var(--line-2); border-radius: 8px;
  background: #fff; font: inherit; font-size: 14px; color: var(--ink);
  transition: border-color .25s var(--ease);
}
.comment-form textarea { resize: vertical; min-height: 96px; }
.comment-form input:focus,
.comment-form textarea:focus { outline: none; border-color: var(--brand); }

/* 回复链接 */
.comment-reply-link {
  font-size: 12.5px;
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}
.comment-reply-link:hover{cursor:pointer; text-decoration: underline;}


/* ---------- 24. 面包屑 ---------- */
.breadcrumb { display:flex; flex-wrap:wrap; align-items:center; gap: 8px; font-size: 13px; color: rgba(255,255,255,.6); }
.breadcrumb a { color: rgba(255,255,255,.6); text-decoration:none; }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }
.breadcrumb span { color: rgba(255,255,255,.35); }


/* ---------- 25. 搜索 ---------- */
.search-form { display:flex; gap: 8px; margin: 24px 0; }
.search-field { flex:1; padding: 12px 16px; border:1px solid var(--line-2); border-radius: 8px; font:inherit; font-size:14px; }
.search-submit { padding: 0 24px; border:0; border-radius:8px; background:var(--brand); color:#fff; font-weight:600; cursor:pointer; }
.search-submit:hover { background: var(--navy-800); }


/* ---------- 26. 产品列表页 ---------- */
.shop { display:grid; grid-template-columns: 280px 1fr; gap: 40px; }
.shop__side {}
.shop__main {}

/* 原型产品卡 */
.product-card { display: block; }
.product-card__media { position: relative; overflow: hidden; border-radius: var(--radius-lg); }
.product-card__media .ph { aspect-ratio: 3 / 2; transition: transform .5s var(--ease); }
.product-card:hover .product-card__media .ph { transform: scale(1.06); }
.product-card__body { padding: 14px 0 0; }
.product-card__name { font-size: 15px; font-weight: 600; line-height: 1.45; margin-bottom: 0; min-height: 2.9em; }
.product-card__name a { color: var(--ink); text-decoration:none; }
.product-card:hover .product-card__name a { color: var(--brand); }
.product-card__meta { display:flex; flex-wrap:wrap; gap: 6px; margin: 12px 0 0; }
.product-card__foot { margin-top: 14px; }
.product-card__badge { position:absolute; top:12px; left:12px; z-index:2; padding: 4px 10px; border-radius: 4px; background: var(--accent); color:#fff; font-size: 11.5px; font-weight:700; letter-spacing:.04em; text-transform: uppercase; }
.more { font-size: 13.5px; font-weight:600; color: var(--brand); text-decoration:none; }
.more:hover { text-decoration: underline; }


/* 侧边筛选板块 */
.side-block { margin-bottom: 28px; padding: 22px; background: #fff; border:1px solid var(--line); border-radius: var(--radius-lg); }
.side-block h3 { font-size: 15px; font-weight:700; margin:0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.side-list { display:flex; flex-direction:column; gap: 2px; }
.side-list a { display:flex; align-items:center; justify-content: space-between; padding: 9px 10px; border-radius: 6px; font-size: 13.5px; color: var(--ink-2); text-decoration:none; transition: background .25s var(--ease), color .25s var(--ease); }
.side-list a:hover { background: var(--bg-soft); color: var(--brand); }
.side-list a em { font-style: normal; color: var(--muted-2); font-size: 12px; }
.side-list a.is-current { background:rgba(0,110,255,.06); color: var(--brand); font-weight:600; }

/* Send your inquiry 侧边询盘表单 */
.side-block--inquiry { background: linear-gradient(160deg, var(--navy-700), var(--navy-800)); color:#fff; }
.side-block--inquiry h3 { color:#fff; border-bottom-color: rgba(255,255,255,.18); }
.side-block__tip { font-size: 12.5px; line-height: 1.65; color: rgba(255,255,255,.75); margin: 0 0 16px; }
.inquiry-form { display:grid; gap: 10px; }
.inquiry-form input,
.inquiry-form textarea {
  width:100%; padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.22); border-radius: 6px;
  background: rgba(255,255,255,.1); color:#fff;
  font: inherit; font-size: 13px;
  transition: border-color .25s var(--ease), background .25s var(--ease);
}
.inquiry-form textarea { resize: vertical; min-height: 78px; }
.inquiry-form input::placeholder,
.inquiry-form textarea::placeholder { color: rgba(255,255,255,.55); }
.inquiry-form input:focus,
.inquiry-form textarea:focus { outline:none; border-color: var(--accent); background: rgba(255,255,255,.16); }
.inquiry-form .btn { margin-top: 4px; }


/* ---------- 27. 轮播响应式：每屏显示数量 ---------- */
@media (max-width: 1199px) { .cases-track { --per: 2; } }
@media (max-width: 767px)  { .cases-track { --per: 1; } }
@media (max-width: 1199px) { .certs-track, .feedbacks-track { --per: 3; } }
@media (max-width: 767px)  { .certs-track, .feedbacks-track { --per: 2; } }


/* ---------- 28. 响应式 ---------- */
@media (max-width: 991px) {
  .shop { grid-template-columns: 1fr; }
  .shop__side { order: 2; }
  .shop__main { order: 1; }
  .detail { grid-template-columns: 1fr; gap: 32px; }
  .gallery__main .ph { aspect-ratio: 4/3; }
  .related__grid { grid-template-columns: repeat(2,1fr); }
  .blog-grid { grid-template-columns: repeat(2,1fr); }
  .article-nav { grid-template-columns: 1fr; }
  .article-nav__next { text-align: left; }
}
@media (max-width: 520px) {
  .related__grid { grid-template-columns: 1fr; }
  .blog-grid { grid-template-columns: repeat(2,1fr); gap: 14px; }
  .gallery__thumbs > div { flex: 0 0 25%; }
  .detail h1 { font-size: 22px; }
  .product-card__name { font-size: 14px; min-height: auto; }
  .post-card__title { font-size: 14.5px; }
  .inquiry-form input, .inquiry-form textarea { font-size: 14px; padding: 12px 14px; }
  .detail-body h2, .article__body h2 { font-size: 20px; }
  .form-card { padding: 22px 18px; }
}

/* ---------- 29. 打印 ---------- */
@media print {
  .header, .footer, .dock, .to-top, .topbar, .breadcrumb { display:none!important; }
  .page-banner { background: #fff!important; color:#000!important; }
  .page-banner h1 { color:#000!important; }
  * { box-shadow: none!important; }
  .product-card__media .ph, .post-card__media .ph { display:none; }
}
