/* The certificate content needs breathing room inside its white card. */
#certificate-card.customer-certificate {
  padding: clamp(16px, 2.2vw, 32px);
}

/* The image stage is a neutral canvas. Only the actual image carries its own backdrop. */
html:root:not([data-contrast="on"]) body #image-lightbox.customer-gallery .lightbox-stage,
html:root:not([data-contrast="on"]) body #expanded-image-dialog.customer-gallery .expanded-image-stage {
  background: #fff !important;
}
html:root:not([data-contrast="on"]) body #image-lightbox.customer-gallery button.lightbox-image-expand,
html:root:not([data-contrast="on"]) body #image-lightbox.customer-gallery button.lightbox-image-expand:hover,
html:root:not([data-contrast="on"]) body #image-lightbox.customer-gallery button.lightbox-image-expand:focus-visible {
  background: #fff !important;
  border: 0 !important;
  box-shadow: none !important;
}

#image-lightbox.customer-gallery .lightbox-header,
#expanded-image-dialog.customer-gallery header {
  flex-wrap: wrap;
}
.customer-gallery .viewer-zoom-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-left: auto;
  color: #333942;
}
.customer-gallery .viewer-zoom-panel output {
  min-width: 52px;
  text-align: center;
  font: 700 13px/1.2 'DM Sans', Arial, sans-serif;
}
html:root body .customer-gallery .viewer-zoom-panel button {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #aa8745 !important;
  background: #70531e !important;
  color: #fff !important;
  font: 700 14px/1 'DM Sans', Arial, sans-serif;
  cursor: pointer;
}
html:root body .customer-gallery .viewer-zoom-panel button:hover:not(:disabled) {
  background: #563f15 !important;
}
.customer-gallery .viewer-zoom-panel button:disabled {
  opacity: .42;
  cursor: default;
}
.customer-gallery .viewer-zoom-panel button:focus-visible {
  outline: 3px solid #aa8745;
  outline-offset: 2px;
}
#image-lightbox.customer-gallery .lightbox-image-expand,
#expanded-image-dialog.customer-gallery .expanded-image-stage {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  touch-action: none;
}
#image-lightbox.customer-gallery .lightbox-image-expand img,
#expanded-image-dialog.customer-gallery .expanded-image-stage img {
  display: block;
  flex: none;
  max-width: none !important;
  max-height: none !important;
  object-fit: fill;
  transform-origin: center center;
  will-change: transform;
}
.customer-gallery .viewer-zoom-viewport.is-zoomed {
  cursor: grab !important;
  touch-action: none;
}
.customer-gallery .viewer-zoom-viewport.is-dragging {
  cursor: grabbing !important;
}
@media (max-width: 760px) {
  #image-lightbox.customer-gallery .lightbox-header,
  #expanded-image-dialog.customer-gallery header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  }
  #image-lightbox.customer-gallery .lightbox-header > div:first-child,
  #expanded-image-dialog.customer-gallery header > h2 {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }
  #image-lightbox.customer-gallery .lightbox-header > .customer-gallery-toolbar,
  #expanded-image-dialog.customer-gallery header > .customer-gallery-toolbar {
    grid-column: 2;
    grid-row: 1;
  }
  #image-lightbox.customer-gallery .viewer-zoom-panel,
  #expanded-image-dialog.customer-gallery .viewer-zoom-panel {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    margin: 0;
    justify-content: center;
  }
  #image-lightbox.customer-gallery .customer-gallery-navigation {
    padding: 6px 8px;
    gap: 6px;
  }
  #expanded-image-dialog.customer-gallery header > .vaultvision-background-controls {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
    flex: initial;
  }
  #image-lightbox.customer-gallery .lightbox-footer { padding-bottom: max(6px, env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  #certificate-card.customer-certificate .customer-identity {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  #certificate-card.customer-certificate .customer-identity > div + div {
    border-left: 0;
    padding-left: 0;
  }
  #certificate-card.customer-certificate #certificate-number-display { white-space: nowrap; }
  #image-lightbox.customer-gallery .lightbox-header h2,
  #expanded-image-dialog.customer-gallery h2 { font-size: 15px; }
  html:root body .customer-gallery .viewer-zoom-panel button {
    min-width: 42px;
    padding-inline: 7px;
  }
  .customer-gallery .viewer-zoom-panel output { min-width: 44px; }
  #image-lightbox.customer-gallery .vaultvision-background-controls,
  #expanded-image-dialog.customer-gallery .vaultvision-background-controls {
    flex-wrap: nowrap;
    gap: 6px;
    padding: 4px 6px;
  }
  #image-lightbox.customer-gallery .vaultvision-background-controls > span,
  #expanded-image-dialog.customer-gallery .vaultvision-background-controls > span {
    display: none;
  }
  #image-lightbox.customer-gallery .vaultvision-background-controls button,
  #expanded-image-dialog.customer-gallery .vaultvision-background-controls button {
    padding-inline: 9px;
  }
}
@media print {
  #certificate-card.customer-certificate { padding: 0; }
  .viewer-zoom-panel { display: none !important; }
}
