.product-photo > img,
.detail-card-photo > img,
.product-image > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-photo > img,
.detail-card-photo > img { z-index: 0; }
.product-photo::before,
.product-photo::after,
.detail-card-photo::before,
.detail-card-photo::after { z-index: 1; }
.product-photo .product-badge { position: relative; z-index: 2; }

/* 主营产品首页每个分类只展示前四项，接口失败时静态兜底内容也遵循相同规则。 */
body:not(.main-products-loaded) .category-section .product-card:nth-child(n + 5) {
  display: none;
}

.sidebar-cat-title,
.main-product-group-link {
  width: 100%;
  border: 0;
  font: inherit;
  text-align: left;
}

.main-product-group-link {
  display: block;
  padding: 9px 22px 9px 44px;
  color: var(--muted);
  background: transparent;
  border-left: 3px solid transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.main-product-group-link:hover,
.main-product-group-link.active {
  color: var(--green-900);
  background: rgba(255, 255, 255, 0.6);
  border-left-color: var(--green-700);
}

.main-products-empty {
  grid-column: 1 / -1;
  padding: 34px 24px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--rule);
  text-align: center;
}

/* 页面原样式给 sidebar-header 内所有 span 设置了 display:block，需提高双语规则优先级。 */
.sidebar-header .zh {
  display: none;
}

.sidebar-header .en {
  display: block;
}

body.cn-mode .sidebar-header .zh {
  display: block;
}

body.cn-mode .sidebar-header .en {
  display: none;
}

/* The product overview intentionally omits category and regulatory code chips. */
.product-info-head .badge,
.product-info-head .product-codes {
  display: none !important;
}

/* Hide the same code fields in the legacy fallback while catalog data loads. */
body:not(.main-products-loaded) .detail-card .detail-card-en,
body:not(.main-products-loaded) .detail-card-body > .spec-row:nth-of-type(1),
body:not(.main-products-loaded) .detail-card-body > .spec-row:nth-of-type(2) {
  display: none !important;
}

/* 双语字段数量不一致时，只显示当前语言实际填写的行，禁止跨语言补位。 */
body.main-products-loaded:not(.cn-mode) .spec-row:not(.has-en),
body.main-products-loaded:not(.cn-mode) .spec-table tr:not(.has-en) {
  display: none;
}

body.main-products-loaded.cn-mode .spec-row:not(.has-cn),
body.main-products-loaded.cn-mode .spec-table tr:not(.has-cn) {
  display: none;
}
