/**
 * HCN product watermark — same look as www.hcn-atta.com
 * Diagonal tiled logo, moderate density, ~22–24% opacity.
 */

:root {
  --hcn-pw-mark: url("watermark-hcn.png");
}

/* Generic wrapper (Woo + HCN 产品中心 + 畜牧站首页 + 矿山站 + 林业/园林 astra-child) */
.hcn-pw-wrap,
.hcn-product-card-media,
.hcn-product-main-image,
.hcn-product-thumb,
.hcn-product-card__thumb,
.hcn-pd-main-image,
.hcn-pd-thumb,
.hcn-store-card-img,
.hcn-sf-img,
.hcn-related-card,
.hp-product-img,
.product-card__img,
.hcn-product-single__media-box,
.hcn-product-single__main-image,
.hcn-product-single__gallery,
.hcn-product-single__thumb,
.hcn-gallery__stage,
.hcn-gallery__slide,
.hcn-gallery__thumb,
.woocommerce-product-gallery__image,
.woocommerce ul.products li.product .woocommerce-LoopProduct-link {
  position: relative;
  overflow: hidden;
}

.hcn-pw-wrap--inline {
  display: inline-block;
  max-width: 100%;
  line-height: 0;
}

.hcn-pw-mark,
.hcn-product-card-media > .hcn-product-wm,
.hcn-product-main-image > .hcn-product-wm {
  position: absolute;
  inset: -35%;
  width: 170%;
  height: 170%;
  background-image: var(--hcn-pw-mark);
  background-repeat: repeat;
  background-size: 340px auto;
  opacity: 0.24;
  pointer-events: none;
  z-index: 2;
  transform: rotate(-28deg);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.22));
}

.hcn-product-card-media > .hcn-product-wm,
.hcn-pw-wrap--inline > .hcn-pw-mark {
  background-size: 300px auto;
  opacity: 0.22;
}

/* WooCommerce + HCN 畜牧站/矿山站/林业站产品图 — CSS 铺贴（模板无 .hcn-product-wm 时也能显示） */
.woocommerce-product-gallery__image::after,
.woocommerce ul.products li.product a.woocommerce-LoopProduct-link::after,
.hcn-product-card-media::after,
.hcn-product-main-image::after,
.hcn-product-thumb::after,
.hcn-product-card__thumb::after,
.hp-product-img::after,
.product-card__img::after,
.hcn-gallery__slide::after,
.hcn-gallery__thumb::after,
.hcn-pd-main-image::after,
.hcn-store-card-img::after,
.hcn-sf-img::after,
.hcn-related-card::after,
.hcn-product-single__main-image::after,
.hcn-product-single__thumb::after {
  content: "";
  position: absolute;
  inset: -35%;
  width: 170%;
  height: 170%;
  background-image: var(--hcn-pw-mark);
  background-repeat: repeat;
  background-size: 300px auto;
  opacity: 0.22;
  pointer-events: none;
  z-index: 2;
  transform: rotate(-28deg);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.22));
}

.hcn-product-main-image::after,
.hcn-pd-main-image::after,
.hcn-gallery__slide::after,
.hcn-product-single__main-image::after {
  background-size: 340px auto;
  opacity: 0.24;
}

.hcn-gallery__thumb::after,
.hcn-product-single__thumb::after {
  background-size: 160px auto;
  opacity: 0.2;
}

.hcn-product-thumb::after {
  background-size: 180px auto;
  opacity: 0.2;
}

/* 林业站卡片悬停遮罩需盖过 CSS 水印层 */
.hcn-product-card__thumb .hcn-product-card__overlay {
  z-index: 3;
}

/* 无真实图片时不铺水印 */
.hcn-product-main-image--empty::after,
.hcn-product-card-media:not(:has(img))::after,
.hcn-product-card__thumb:not(:has(img))::after,
.hp-product-img:not(:has(img))::after,
.product-card__img:not(:has(img))::after,
.hcn-gallery__slide:not(:has(img))::after,
.hcn-product-single__main-image:not(:has(img))::after {
  display: none;
}

/* Hide CSS when burned-in copy is served */
.hcn-pw-wrap:has(img[src*="/hcn-wm-v6/"]) .hcn-pw-mark,
.hcn-product-card-media:has(img[src*="/hcn-wm-v6/"]) .hcn-product-wm,
.hcn-product-main-image:has(img[src*="/hcn-wm-v6/"]) .hcn-product-wm,
.hcn-product-card-media:has(img[src*="/hcn-wm-v6/"])::after,
.hcn-product-main-image:has(img[src*="/hcn-wm-v6/"])::after,
.hcn-product-thumb:has(img[src*="/hcn-wm-v6/"])::after,
.hcn-product-card__thumb:has(img[src*="/hcn-wm-v6/"])::after,
.hp-product-img:has(img[src*="/hcn-wm-v6/"])::after,
.product-card__img:has(img[src*="/hcn-wm-v6/"])::after,
.hcn-gallery__slide:has(img[src*="/hcn-wm-v6/"])::after,
.hcn-gallery__thumb:has(img[src*="/hcn-wm-v6/"])::after,
.woocommerce-product-gallery__image:has(img[src*="/hcn-wm-v6/"])::after,
.woocommerce ul.products li.product a.woocommerce-LoopProduct-link:has(img[src*="/hcn-wm-v6/"])::after,
.hcn-pd-main-image:has(img[src*="/hcn-wm-v6/"])::after,
.hcn-store-card-img:has(img[src*="/hcn-wm-v6/"])::after,
.hcn-sf-img:has(img[src*="/hcn-wm-v6/"])::after,
.hcn-related-card:has(img[src*="/hcn-wm-v6/"])::after,
.hcn-product-single__main-image:has(img[src*="/hcn-wm-v6/"])::after,
.hcn-product-single__thumb:has(img[src*="/hcn-wm-v6/"])::after {
  display: none;
}

/* HCN home product covers */
.products-section .wp-block-cover {
  position: relative;
  overflow: hidden;
}

.products-section .wp-block-cover::after {
  content: "";
  position: absolute;
  inset: -35%;
  width: 170%;
  height: 170%;
  background-image: var(--hcn-pw-mark);
  background-repeat: repeat;
  background-size: 320px auto;
  opacity: 0.24;
  pointer-events: none;
  z-index: 3;
  transform: rotate(-28deg);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.22));
}

.products-section .wp-block-cover:has(img[src*="/hcn-wm-v6/"])::after {
  display: none;
}

@media (max-width: 768px) {
  .hcn-pw-mark,
  .hcn-product-card-media > .hcn-product-wm,
  .hcn-product-main-image > .hcn-product-wm {
    background-size: 240px auto;
    opacity: 0.26;
  }
}
