#viewing .photo-grid button {
  aspect-ratio: 3 / 2;
  background: #111;
  cursor: zoom-in;
}
#viewing .photo-grid button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#viewing .photo-grid button:hover img { transform: none; }
#viewing .photo-grid button:hover { border-color: #bbb; }

dialog.escalade-gallery {
  width: max-content !important;
  max-width: min(94vw, 1320px);
}
dialog.escalade-gallery > img {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: min(calc(94vw - 2px), 1318px);
  max-height: calc(90svh - 2px);
  object-fit: contain !important;
}
.escalade-gallery .gallery-dialog-bar,
.escalade-gallery .gallery-dialog-controls {
  position: absolute;
  inset: 0;
  padding: 0;
  pointer-events: none;
}
.escalade-gallery .gallery-dialog-bar > p {
  display: block;
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.escalade-gallery .gallery-dialog-controls button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid #fff9;
  border-radius: 50%;
  background: #080808e6;
  color: #fff;
  pointer-events: auto;
}
.escalade-gallery .gallery-dialog-controls button:hover { background: #fff; color: #080808; }
.escalade-gallery .gallery-dialog-controls svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.escalade-gallery :is([data-prev], [data-next]) { top: 50%; transform: translateY(-50%); }
.escalade-gallery [data-prev] { left: 12px; }
.escalade-gallery [data-next], .escalade-gallery [data-close] { right: 12px; }
.escalade-gallery [data-close] { top: 12px; }

@media (max-width: 700px) {
  #viewing .photo-grid button img { object-fit: cover; }
}

@media (max-width: 520px) {
  .escalade-gallery [data-prev] { left: 8px; }
  .escalade-gallery [data-next], .escalade-gallery [data-close] { right: 8px; }
  .escalade-gallery [data-close] { top: 8px; }
}

.escalade-gallery .gallery-dialog-controls button{touch-action:manipulation;user-select:none;-webkit-user-select:none;transition:none}

/* Stable viewing frame keeps pointer targets fixed between image orientations. */
dialog.escalade-gallery{width:min(94vw,1320px)!important;height:90svh!important;max-width:min(94vw,1320px)!important;max-height:90svh!important;padding:0;overflow:visible;background:transparent;border:0}
dialog.escalade-gallery>img{width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;object-fit:contain!important;background:transparent}
.escalade-gallery .gallery-dialog-bar,.escalade-gallery .gallery-dialog-controls{width:100%;height:100%}
.escalade-gallery .gallery-dialog-controls button{width:48px;height:48px;background:#000;border-color:#fff}
