/* Load after the layout styles. Proof previews open the uncropped source image. */
#results a[data-gallery^="proof-"] {
  display: block;
  cursor: zoom-in;
  border-radius: 18px;
  -webkit-tap-highlight-color: transparent;
}

#results a[data-gallery^="proof-"] .proof-frame::after {
  content: "Увеличить ↗";
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 1;
  padding: 10px 13px;
  border: 1px solid #ffffff65;
  border-radius: 999px;
  background: #124dff;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: 0 3px 14px #14213230;
  pointer-events: none;
}

#results a[data-gallery^="proof-"]:hover .proof-frame {
  border-color: #124dff;
}

#results a[data-gallery^="proof-"]:focus-visible {
  outline: none;
}

#results a[data-gallery^="proof-"]:focus-visible .proof-frame {
  outline: 3px solid #124dff;
  outline-offset: 4px;
}

dialog#gallery-dialog [hidden] {
  display: none;
}

dialog#gallery-dialog button:focus-visible {
  outline: 3px solid #a9c4ff;
  outline-offset: 3px;
}

/* An ID-based selector overrides universal.css's :has() proof rules. */
dialog#gallery-dialog[data-gallery-kind="proof"] {
  width: min(920px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #7891b0 #102032;
}

dialog#gallery-dialog[data-gallery-kind="proof"] #gallery-image {
  display: block;
  width: calc(100% - 32px);
  height: auto;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  margin: 0 auto;
  object-fit: contain;
  object-position: center;
  transform: none;
}

dialog#gallery-dialog[data-gallery-kind="proof"] .dialog-top,
dialog#gallery-dialog[data-gallery-kind="proof"] .dialog-bottom {
  position: sticky;
  z-index: 2;
  min-height: 68px;
  padding: 12px 16px;
  background: #102032;
}

dialog#gallery-dialog[data-gallery-kind="proof"] .dialog-top {
  top: 0;
  gap: 16px;
  border-bottom: 1px solid #ffffff20;
}

dialog#gallery-dialog[data-gallery-kind="proof"] .dialog-bottom {
  bottom: 0;
  border-top: 1px solid #ffffff20;
}

dialog#gallery-dialog[data-gallery-kind="proof"] #gallery-caption {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
}

@media (max-width: 760px) {
  dialog#gallery-dialog[data-gallery-kind="proof"] {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 14px;
  }

  dialog#gallery-dialog[data-gallery-kind="proof"] #gallery-image {
    width: 100%;
  }

  dialog#gallery-dialog[data-gallery-kind="proof"] .dialog-top,
  dialog#gallery-dialog[data-gallery-kind="proof"] .dialog-bottom {
    padding-inline: 12px;
  }
}
