.cp-photo-grid a.cp-photo {
  display: block;
  overflow: hidden;
}

.cp-photo-grid a.cp-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cp-photo-dialog {
  box-sizing: border-box;
  width: min(960px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 16px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: var(--radius-lg, 16px);
  background: #fff;
  color: var(--text, #202128);
  box-shadow: 0 18px 60px #0005;
}

.cp-photo-dialog::backdrop { background: #121319c7; }
html:has(.cp-photo-dialog[open]) { overflow: hidden; }
.cp-photo-dialog__header, .cp-photo-dialog__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cp-photo-dialog__header { margin-bottom: 12px; }
.cp-photo-dialog__title { margin: 0; font-size: 18px; }
.cp-photo-dialog__controls { margin-top: 12px; }
.cp-photo-dialog__button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius, 10px);
  background: var(--accent-light, #fff1f1);
  color: var(--accent, #e93134);
  font: inherit;
  font-size: 23px;
  cursor: pointer;
}

.cp-photo-dialog__button:hover { background: var(--accent, #e93134); color: white; }
.cp-photo-dialog__button:focus-visible, .cp-photo-grid a.cp-photo:focus-visible {
  outline: 2px solid var(--accent, #e93134);
  outline-offset: 2px;
}

.cp-photo-dialog__stage {
  display: grid;
  place-items: center;
  height: min(62vh, 620px);
  height: min(62dvh, 620px);
  overflow: hidden;
  border-radius: var(--radius-md, 10px);
  background: #17181d;
  color: #fff;
  text-align: center;
}

.cp-photo-dialog__image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.cp-photo-dialog__image[hidden] { display: none; }
.cp-photo-dialog__caption { flex: 1; text-align: center; font-size: 14px; }
