/*
 * Haolinchen round 3 visual system.
 * Component-scoped rules only. Loaded after legacy and visual refresh styles.
 */

:root {
  --hln-r3-paper: #f2f0ea;
  --hln-r3-ink: #111821;
  --hln-r3-gold: #d6aa43;
  --hln-r3-line: rgba(214, 170, 67, .34);
}

/* Shared social and language controls */
.hln-social-links {
  display: flex;
  align-items: center;
  gap: 7px;
}

.hln-social-link {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 4px;
  color: #eef2f6;
  background: rgba(255, 255, 255, .035);
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}

.hln-social-link svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.hln-social-link:hover {
  color: var(--hln-r3-gold);
  border-color: rgba(214, 170, 67, .62);
  background: rgba(214, 170, 67, .08);
}

.hln-social-link--pending {
  opacity: .48;
  cursor: default;
}

.hln-language-switch {
  position: relative;
}

.hln-language-switch__toggle {
  min-width: 64px;
  height: 30px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 4px;
  color: #eef2f6;
  background: rgba(255, 255, 255, .035);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.hln-language-switch__toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.hln-language-switch__toggle i {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.hln-language-switch__menu {
  position: absolute;
  z-index: 120;
  top: calc(100% + 8px);
  right: 0;
  width: 154px;
  padding: 6px;
  display: none;
  border: 1px solid rgba(214, 170, 67, .28);
  border-radius: 6px;
  background: #151b23;
  box-shadow: 0 16px 36px rgba(0, 0, 0, .32);
}

.hln-language-switch__toggle[aria-expanded="true"] + .hln-language-switch__menu {
  display: grid;
}

.hln-language-switch__menu a,
.hln-language-switch__menu span {
  min-height: 34px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 3px;
  color: #e7ebf0;
  font-size: 12px;
  text-decoration: none;
}

.hln-language-switch__menu b {
  width: 22px;
  color: var(--hln-r3-gold);
}

.hln-language-switch__menu .is-current {
  background: rgba(214, 170, 67, .12);
}

.hln-language-switch__menu .is-pending {
  color: #929aa5;
}

.hln-site-header__utility-links,
.hln-site-footer__connect,
.hln-site-mobile-nav__connect {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hln-site-footer__connect {
  margin-top: 18px;
  flex-wrap: wrap;
}

.hln-site-mobile-nav__connect {
  padding: 14px 0 4px;
  justify-content: space-between;
}

/* One true square product media system */
.page-template-template-index .pcard-img,
.hln-products-page .hln-product-media,
.lmain .lcard-img {
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: 1 / 1 !important;
  padding: 0 !important;
  display: grid !important;
  place-items: center !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  background: #f1f2f0 !important;
}

.page-template-template-index .pcard-img img,
.hln-products-page .hln-product-media img,
.lmain .lcard-img img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  margin: auto !important;
  display: block !important;
  object-fit: contain !important;
  object-position: center !important;
  background: transparent !important;
  mix-blend-mode: multiply !important;
  filter: drop-shadow(0 14px 18px rgba(16, 24, 34, .12));
  --hln-product-scale: 1;
  transform: scale(var(--hln-product-scale)) !important;
}

.page-template-template-index .pcard,
.hln-products-page .hln-product-card,
.lmain .lcard {
  overflow: hidden;
}

/* Product detail galleries remain square at every viewport, including mobile. */
.product-page .gallery-main {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  display: grid !important;
  place-items: center !important;
  overflow: hidden !important;
  background: var(--hln-r3-paper) !important;
}

.product-page .gallery-main img {
  width: 100% !important;
  height: 100% !important;
  padding: clamp(24px, 4vw, 42px) !important;
  object-fit: contain !important;
  object-position: center !important;
  background: transparent !important;
}

/* Buyer-type cards use a useful 3:2 visual, not a narrow banner crop. */
.page-template-template-solutions .bt-img {
  width: 100%;
  height: auto !important;
  aspect-ratio: 3 / 2;
  overflow: hidden;
}

.page-template-template-solutions .bt-img img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
}

/* Bundle and program image slots: remove empty icon wells and shallow strips. */
.page-template-template-amazon-private-label .bundle .imgs,
.page-template-template-smart-pet-brand-oem .bundle .imgs,
.page-template-template-pet-retail-chain .bundle .imgs,
.page-template-template-distributor-wholesale .bundle .imgs {
  width: 100%;
  height: auto !important;
  aspect-ratio: 4 / 3;
  margin: 0 0 18px !important;
  padding: 0 !important;
  overflow: hidden;
  border-radius: 6px !important;
  background-color: #232a33 !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
}

.page-template-template-amazon-private-label .bundle .imgs {
  background-color: #232a33 !important;
  background-size: cover !important;
  background-position: center !important;
}

.page-template-template-amazon-private-label .bundle:nth-child(1) .imgs {
  background-image: url("images/visual-refresh-20260718/ai-generated-replace-later__process-product-recommendation.webp") !important;
}

.page-template-template-amazon-private-label .bundle:nth-child(2) .imgs {
  background-image: url("images/visual-refresh-20260718/ai-generated-replace-later__process-brand-customization.webp") !important;
}

.page-template-template-amazon-private-label .bundle:nth-child(3) .imgs {
  background-image: url("images/visual-refresh-20260718/ai-generated-replace-later__solutions-hero__desktop.webp") !important;
}

.page-template-template-amazon-private-label .bundle .imgs img,
.page-template-template-smart-pet-brand-oem .bundle .imgs svg,
.page-template-template-pet-retail-chain .bundle .imgs svg,
.page-template-template-distributor-wholesale .bundle .imgs svg {
  display: none !important;
}

.page-template-template-distributor-wholesale .azh h1 span.hln-keep-together {
  display: inline;
  white-space: nowrap;
}

.page-template-template-smart-pet-brand-oem .bundle:nth-child(1) .imgs {
  background-image: url("images/visual-refresh-20260718/ai-generated-replace-later__process-brand-customization.webp") !important;
}

.page-template-template-smart-pet-brand-oem .bundle:nth-child(2) .imgs {
  background-image: url("images/visual-refresh-20260718/ai-generated-replace-later__process-product-recommendation.webp") !important;
}

.page-template-template-smart-pet-brand-oem .bundle:nth-child(3) .imgs {
  background-image: url("images/visual-refresh-20260718/ai-generated-replace-later__process-production-qc.webp") !important;
}

.page-template-template-pet-retail-chain .bundle:nth-child(1) .imgs {
  background-image: url("images/visual-refresh-20260718/ai-generated-replace-later__solutions-hero__desktop.webp") !important;
}

.page-template-template-pet-retail-chain .bundle:nth-child(2) .imgs {
  background-image: url("images/visual-refresh-20260718/ai-generated-replace-later__process-product-recommendation.webp") !important;
}

.page-template-template-pet-retail-chain .bundle:nth-child(3) .imgs {
  background-image: url("images/visual-refresh-20260718/ai-generated-replace-later__process-brand-customization.webp") !important;
}

.page-template-template-distributor-wholesale .bundle:nth-child(1) .imgs {
  background-image: url("images/visual-refresh-20260718/ai-generated-replace-later__factory-final-packing.webp") !important;
}

.page-template-template-distributor-wholesale .bundle:nth-child(2) .imgs {
  background-image: url("images/visual-refresh-20260718/ai-generated-replace-later__factory-conveyor-line.webp") !important;
}

.page-template-template-distributor-wholesale .bundle:nth-child(3) .imgs {
  background-image: url("images/visual-refresh-20260718/ai-generated-replace-later__resources-hero__desktop.webp") !important;
}

/*
 * Product media acceptance rule:
 * the square frame is only valid when the complete product remains visible.
 * This selector intentionally outranks the legacy pilot-head inline rule.
 */
.hln-fidelity-template .lcard .lcard-img {
  background: #f1f2f0 !important;
}

.hln-fidelity-template .lcard .lcard-img img {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  object-fit: contain !important;
  object-position: center !important;
  background: transparent !important;
  mix-blend-mode: multiply !important;
  filter: none !important;
  transform: scale(var(--hln-product-scale, 1)) !important;
}

.hln-fidelity-template .lcard:hover .lcard-img img {
  transform: scale(var(--hln-product-scale, 1)) !important;
}

/*
 * Normalize product presence without altering product pixels.
 * Values are based on the measured non-background bounds of each source image.
 */
.page-template-template-index .pcard-img img[src*="/v20/"],
.hln-products-page .hln-product-media img[src*="/v20/"],
.lmain .lcard-img img[src*="/v20/"],
.hln-fidelity-template .lcard .lcard-img img[src*="/v20/"] {
  --hln-product-scale: 1.08;
}

.page-template-template-index .pcard-img img[src*="/smart-litter-box/"],
.hln-products-page .hln-product-media img[src*="/smart-litter-box/"],
.lmain .lcard-img img[src*="/smart-litter-box/"],
.hln-fidelity-template .lcard .lcard-img img[src*="/smart-litter-box/"] {
  --hln-product-scale: 1;
}

.page-template-template-index .pcard-img img[src*="/neo-ae/"],
.hln-products-page .hln-product-media img[src*="/neo-ae/"],
.lmain .lcard-img img[src*="/neo-ae/"],
.hln-fidelity-template .lcard .lcard-img img[src*="/neo-ae/"] {
  --hln-product-scale: 1.2;
}

.page-template-template-index .pcard-img img[src*="/mini-f/"],
.hln-products-page .hln-product-media img[src*="/mini-f/"],
.lmain .lcard-img img[src*="/mini-f/"],
.hln-fidelity-template .lcard .lcard-img img[src*="/mini-f/"] {
  --hln-product-scale: 1.15;
}

.page-template-template-index .pcard-img img[src*="/high-end/"],
.hln-products-page .hln-product-media img[src*="/high-end/"],
.lmain .lcard-img img[src*="/high-end/"],
.hln-fidelity-template .lcard .lcard-img img[src*="/high-end/"] {
  --hln-product-scale: 1.05;
}

.page-template-template-index .pcard-img img[src*="/pff040/"],
.hln-products-page .hln-product-media img[src*="/pff040/"],
.lmain .lcard-img img[src*="/pff040/"],
.hln-fidelity-template .lcard .lcard-img img[src*="/pff040/"] {
  --hln-product-scale: .9;
}

.page-template-template-index .pcard-img img[src*="/ty08/"],
.hln-products-page .hln-product-media img[src*="/ty08/"],
.lmain .lcard-img img[src*="/ty08/"],
.hln-fidelity-template .lcard .lcard-img img[src*="/ty08/"] {
  --hln-product-scale: 1.1;
}

.page-template-template-index .pcard-img img[src*="/c08/"],
.hln-products-page .hln-product-media img[src*="/c08/"],
.lmain .lcard-img img[src*="/c08/"],
.hln-fidelity-template .lcard .lcard-img img[src*="/c08/"] {
  --hln-product-scale: 2.05;
}

.page-template-template-index .pcard-img img[src*="/c09/"],
.hln-products-page .hln-product-media img[src*="/c09/"],
.lmain .lcard-img img[src*="/c09/"],
.hln-fidelity-template .lcard .lcard-img img[src*="/c09/"] {
  --hln-product-scale: 1.17;
}

/*
 * Certificates remain legible without dominating the page.
 * Four documents share one row on desktop; smaller viewports step down safely.
 */
.hln-fidelity-template .real-certs-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: clamp(12px, 1.25vw, 20px) !important;
  max-width: 1480px !important;
  padding: 12px 0 4px !important;
  align-items: start !important;
}

.hln-fidelity-template .real-certs-grid > div {
  min-width: 0;
}

.hln-fidelity-template .real-certs-grid img {
  width: 100% !important;
  height: clamp(280px, 21vw, 390px) !important;
  object-fit: contain !important;
  object-position: center top !important;
  background: #fff !important;
}

/* Keep established readable form select styling. */
.hln-fidelity-template select,
.hln-fidelity-template select option {
  color: #111821;
  background: #fff;
}

/* Keep service hero copy readable over light product surfaces without darkening the image. */
.page-template-template-oem-odm .pg-hero .crumb,
.page-template-template-oem-odm .pg-hero .crumb a,
.page-template-template-oem-odm .pg-hero .sub,
.page-template-template-oem-service .pg-hero .crumb,
.page-template-template-oem-service .pg-hero .crumb a,
.page-template-template-oem-service .pg-hero .sub,
.page-template-template-odm-service .pg-hero .crumb,
.page-template-template-odm-service .pg-hero .crumb a,
.page-template-template-odm-service .pg-hero .sub {
  color: #e3e9f0;
}

@media (max-width: 960px) {
  .hln-site-header__utility-links {
    display: none;
  }

  .hln-fidelity-template .real-certs-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    max-width: 760px !important;
  }

  .hln-fidelity-template .real-certs-grid img {
    height: clamp(280px, 46vw, 390px) !important;
  }
}

/* The legacy ODM capability grid keeps three columns inline at tablet width. */
@media (min-width: 641px) and (max-width: 900px) {
  .page-template-template-odm-service .wrap > [style*="grid-template-columns:repeat(3"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .page-template-template-odm-service .wrap > [style*="grid-template-columns:repeat(3"] > * {
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 700px) {
  .page-template-template-distributor-wholesale .azh h1 span.hln-keep-together {
    white-space: normal;
  }

  .hln-fidelity-template .real-certs-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .hln-fidelity-template .real-certs-grid img {
    height: clamp(205px, 56vw, 280px) !important;
  }

  .page-template-template-oem-odm .pg-hero .crumb,
  .page-template-template-oem-odm .pg-hero .sub,
  .page-template-template-oem-service .pg-hero .crumb,
  .page-template-template-oem-service .pg-hero .sub,
  .page-template-template-odm-service .pg-hero .crumb,
  .page-template-template-odm-service .pg-hero .sub {
    text-shadow: 0 2px 8px rgba(0, 0, 0, .88);
  }

  .page-template-template-oem-odm .pg-hero .badge,
  .page-template-template-oem-service .pg-hero .badge,
  .page-template-template-odm-service .pg-hero .badge {
    color: #f1ca70;
    background: rgba(7, 10, 15, .68);
    border-color: rgba(226, 190, 110, .58);
    backdrop-filter: blur(3px);
  }

  .page-template-template-solutions .bt-img,
  .page-template-template-amazon-private-label .bundle .imgs,
  .page-template-template-smart-pet-brand-oem .bundle .imgs,
  .page-template-template-pet-retail-chain .bundle .imgs,
  .page-template-template-distributor-wholesale .bundle .imgs {
    aspect-ratio: 4 / 3;
  }
}
