/* Image-only certificates in the three verified Elementor grids. */
:is(
  body.page-id-24 .elementor-element-72e8040e,
  body.page-id-26 .elementor-element-95f4809e,
  body.page-id-47 .elementor-element-da34a6d2
):has(.dh-delivery-cert-figure) {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-auto-rows: 1fr;
  align-items: stretch !important;
  gap: 18px !important;
  border: 0 !important;
}

:is(
  body.page-id-24 .elementor-element-72e8040e > .dh-quality-record,
  body.page-id-26 .elementor-element-95f4809e > .dh-about-certificate,
  body.page-id-47 .elementor-element-da34a6d2 > .dh-cap-cert
):has(.dh-delivery-cert-figure) {
  display: flex !important;
  flex-direction: column !important;
  align-self: stretch !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 100% !important;
  padding: 0 !important;
  border: 0 !important;
  gap: 0 !important;
  background: transparent !important;
  box-sizing: border-box;
}

/* Hide the original sibling headings and number copy only in converted columns. */
body.page-id-24 .elementor-element-72e8040e > .dh-quality-record:has(.dh-delivery-cert-figure)
  :is(.elementor-element-a9fce259, .elementor-element-a9011e3b,
      .elementor-element-8032001a, .elementor-element-d925fa5b,
      .elementor-element-a943e0ed, .elementor-element-8df33035,
      .elementor-element-7cb9696b, .elementor-element-a8472d39),
body.page-id-26 .elementor-element-95f4809e > .dh-about-certificate:has(.dh-delivery-cert-figure)
  :is(.elementor-element-1039165c, .elementor-element-a1271510,
      .elementor-element-f7c91fdc, .elementor-element-1a5a7086),
body.page-id-47 .elementor-element-da34a6d2 > .dh-cap-cert:has(.dh-delivery-cert-figure)
  :is(.elementor-element-528b63bd, .elementor-element-e1ac722a,
      .elementor-element-8edd0a5f, .elementor-element-aead1ff3,
      .elementor-element-d33a28f5, .elementor-element-0dddfa79,
      .elementor-element-1adf9096, .elementor-element-a6939312) {
  display: none !important;
}

/* Elementor may render a widget-container wrapper or optimized direct markup. */
:is(
  body.page-id-24 .elementor-element-72e8040e,
  body.page-id-26 .elementor-element-95f4809e,
  body.page-id-47 .elementor-element-da34a6d2
) .elementor-widget:has(.dh-delivery-cert-figure),
:is(
  body.page-id-24 .elementor-element-72e8040e,
  body.page-id-26 .elementor-element-95f4809e,
  body.page-id-47 .elementor-element-da34a6d2
) .elementor-widget-container:has(> .dh-delivery-cert-figure) {
  display: flex !important;
  flex: 1 1 auto !important;
  align-self: stretch !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  box-sizing: border-box;
}

:is(
  body.page-id-24 .elementor-element-72e8040e,
  body.page-id-26 .elementor-element-95f4809e,
  body.page-id-47 .elementor-element-da34a6d2
) .dh-delivery-cert-figure {
  display: grid;
  flex: 1 1 auto;
  place-items: stretch;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 3 / 4;
  margin: 0;
  padding: 15px;
  border: 1px solid #d8e2da;
  background: #fff;
  box-sizing: border-box;
  overflow: visible !important;
}

:is(
  body.page-id-24 .elementor-element-72e8040e,
  body.page-id-26 .elementor-element-95f4809e,
  body.page-id-47 .elementor-element-da34a6d2
) .dh-delivery-cert-image {
  display: grid;
  place-items: center;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: var(--dh-cert-preview-overflow, visible) !important;
  background: #fff;
  text-decoration: none;
}

:is(
  body.page-id-24 .elementor-element-72e8040e,
  body.page-id-26 .elementor-element-95f4809e,
  body.page-id-47 .elementor-element-da34a6d2
) .dh-delivery-cert-image img {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  margin: 0 auto !important;
  object-fit: contain !important;
  object-position: center !important;
  transform: var(--dh-cert-preview-transform, none) !important;
  transform-origin: var(--dh-cert-preview-origin, center) !important;
  scale: none !important;
  background: #fff;
}

/* Match the printed borders. The FSSC scan has a 188px white strip below the print. */
.dh-delivery-cert-image[href*="/dehui-about-certificate-fssc22000.webp"] {
  --dh-cert-preview-transform: scale(1.105);
  --dh-cert-preview-origin: center top;
  --dh-cert-preview-overflow: hidden;
}

.dh-delivery-cert-image[href*="/dehui-about-certificate-halal.webp"] {
  --dh-cert-preview-transform: scale(.98);
}

:is(
  body.page-id-24 .elementor-element-72e8040e,
  body.page-id-26 .elementor-element-95f4809e,
  body.page-id-47 .elementor-element-da34a6d2
) .dh-delivery-cert-image:hover {
  border-color: #214c3e;
  box-shadow: 0 0 0 2px #dce9e1;
}

:is(
  body.page-id-24 .elementor-element-72e8040e,
  body.page-id-26 .elementor-element-95f4809e,
  body.page-id-47 .elementor-element-da34a6d2
) .dh-delivery-cert-image:focus-visible {
  outline: 3px solid #b59e57;
  outline-offset: 4px;
}

@media (max-width: 1024px) {
  :is(
    body.page-id-24 .elementor-element-72e8040e,
    body.page-id-26 .elementor-element-95f4809e,
    body.page-id-47 .elementor-element-da34a6d2
  ):has(.dh-delivery-cert-figure) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 767px) {
  :is(
    body.page-id-24 .elementor-element-72e8040e,
    body.page-id-26 .elementor-element-95f4809e,
    body.page-id-47 .elementor-element-da34a6d2
  ):has(.dh-delivery-cert-figure) {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  :is(
    body.page-id-24 .elementor-element-72e8040e,
    body.page-id-26 .elementor-element-95f4809e,
    body.page-id-47 .elementor-element-da34a6d2
  ) .dh-delivery-cert-figure {
    padding: 12px;
  }
}
