html:has(.gdm-photo-viewer[open]) { overflow: hidden; }
html body dialog.gdm-photo-viewer {
  --side-space: clamp(64px, 7vw, 102px);
  --photo-room-width: calc(100vw - var(--side-space) * 2 - 12px);
  --photo-room-height: calc(100dvh - 74px);
  position: fixed; inset: 0; margin: auto; padding: 0; border: 0; border-radius: 0;
  width: 100%; height: 100%; max-width: none; max-height: none;
  background: transparent; box-shadow: none; overflow: hidden;
}
html body .gdm-photo-viewer[open] { display: grid; place-items: center; }
.gdm-photo-viewer::backdrop { background: #100e0f; }
html body dialog.gdm-photo-viewer::before, html body dialog.gdm-photo-viewer::after { content: none; }
html body .gdm-viewer-print {
  position:relative; padding:0; background:transparent;
  touch-action: pan-y pinch-zoom;
}
html body .gdm-viewer-print img {
  display: block; width: calc(.5 * min(var(--photo-width), var(--photo-room-width), var(--photo-room-height) * var(--photo-ratio))); height: auto; border: 0; border-radius: 0; padding: 0; margin: 0;
  max-width: calc(100vw - var(--side-space) * 2 - 12px);
  max-height: calc(100vh - 74px); max-height: calc(100dvh - 74px);
  object-fit: contain; filter: none; box-shadow: none;
}
html body .gdm-photo-viewer button {
  position: absolute; z-index: 1; width: 54px; height: 52px; min-width: 44px; min-height: 44px;
  padding: 0; border: 0; margin: 0; border-radius: 0; box-shadow: none;
  background: transparent center / 86% auto no-repeat; cursor: pointer; appearance: none;
}
html body .gdm-photo-viewer button::before, html body .gdm-photo-viewer button::after { content: none; }
html body .gdm-photo-viewer button[hidden] { display: none; }
html body .gdm-photo-viewer button:not(.gdm-viewer-close):focus-visible { outline: 2px dashed white; outline-offset: 1px; border-radius: 4px; }
html body .gdm-photo-viewer .gdm-viewer-close {
  top: max(8px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right));
  background-image: url('/images/navigation/viewer-close.svg?v=365e5279711e'); background-size: 44px 44px;
}
html body .gdm-photo-viewer :is(.gdm-viewer-previous,.gdm-viewer-next) {
  top: 50%; transform: translateY(-50%); background-image: url('/images/navigation/viewer-arrow.svg');
}
html body .gdm-photo-viewer .gdm-viewer-previous { left: max(6px, calc((var(--side-space) - 54px) / 2)); transform: translateY(-50%) scaleX(-1); }
html body .gdm-photo-viewer .gdm-viewer-next { right: max(6px, calc((var(--side-space) - 54px) / 2)); }
@media (max-width: 640px) {
  html body dialog.gdm-photo-viewer { --photo-room-width: calc(100vw - 22px); --photo-room-height: calc(100dvh - 150px); }
  html body .gdm-viewer-print img { max-width: calc(100vw - 22px); max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); }
  html body .gdm-photo-viewer :is(.gdm-viewer-previous,.gdm-viewer-next) { top: auto; bottom: max(8px, env(safe-area-inset-bottom)); transform: none; }
  html body .gdm-photo-viewer .gdm-viewer-previous { left: calc(50% - 76px); transform: scaleX(-1); }
  html body .gdm-photo-viewer .gdm-viewer-next { right: calc(50% - 76px); }
}

html body .gdm-viewer-print {
  mask: var(--photo-cut,linear-gradient(#000,#000)) center / 100% 100% no-repeat;
}
.gdm-viewer-print::after {
  content:""; pointer-events:none; position:absolute; inset:0;
  background:var(--photo-surface,none) center / 100% 100% no-repeat;
}

/* Position the ink relative to the photograph, including in the enlarged view. */
[data-sale-stamp] .shop-photo-print::before,
.gdm-viewer-print[data-sale-stamp]::before {
  content:"";
  position:absolute;
  z-index:1;
  inset:auto 7% 9% auto;
  width:min(52%, 10rem);
  height:auto;
  aspect-ratio:200 / 86;
  transform:rotate(-7deg);
  background:url('/images/tampon-vendu-photo.svg') center / contain no-repeat;
  filter:drop-shadow(0 1px .5px #28131570);
  pointer-events:none;
}
html:lang(en) [data-sale-stamp] .shop-photo-print::before,
html:lang(en) .gdm-viewer-print[data-sale-stamp]::before {background-image:url('/images/tampon-sold-photo.svg');}

html body .gdm-photo-viewer .gdm-viewer-zoom {
  top:max(8px, env(safe-area-inset-top));
  right:calc(max(10px, env(safe-area-inset-right)) + 58px);
  background:#171616;
  color:#fff;
  border:1px solid currentColor;
  border-radius:50%;
  width:48px;
  height:48px;
  font: 32px/1 system-ui, sans-serif;
}
.gdm-viewer-viewport {
  max-width:var(--photo-room-width);
  max-height:var(--photo-room-height);
}
.gdm-photo-viewer[data-zoomed] .gdm-viewer-viewport {
  max-width: calc(.5 * var(--photo-room-width));
  max-height: calc(.5 * var(--photo-room-height));
  overflow:auto;
  overscroll-behavior:contain;
}
html body .gdm-photo-viewer[data-zoomed] .gdm-viewer-print {
  cursor: grab;
  width:max-content;
  touch-action:pan-x pan-y;
}
html body .gdm-photo-viewer[data-zoomed] .gdm-viewer-print img {
  width:min(var(--photo-width), var(--photo-room-width), calc(var(--photo-room-height) * var(--photo-ratio)));
  max-width:none;
  max-height:none;
}

html body dialog.gdm-photo-viewer {isolation:isolate;}
html body .gdm-viewer-backdrop {
  position:absolute;
  inset:0;
  z-index:-1;
  width:100%;
  height:100%;
  object-fit:cover;
  pointer-events:none;
  filter:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='edge' color-interpolation-filters='sRGB'%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeConvolveMatrix order='3' kernelMatrix='-1 -1 -1 -1 8 -1 -1 -1 -1' preserveAlpha='true'/%3E%3C/filter%3E%3C/svg%3E#edge");
  mix-blend-mode:screen;
  opacity:.43;
}
.gdm-viewer-backdrop:not([src]) {display:none;}
