.lightbox {
  position: fixed;
  z-index: 9999;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 20px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, .8);
  cursor: pointer;
}

.lightbox__dialog {
  width: max-content;
  max-width: 100%;
  margin: auto;
  overflow: hidden;
  background: #fff;
  cursor: default;
}

.lightbox__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  min-height: 20px;
  background: #fff;
}

.lightbox__image {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 60px);
  max-height: calc(100vh - 120px);
  box-sizing: border-box;
  border: 10px solid #fff;
  object-fit: contain;
}

.lightbox__navigation {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  padding: 0;
  border: 0;
  outline-offset: -2px;
  background: transparent;
  cursor: pointer;
}

.lightbox__previous {
  left: 0;
}

.lightbox__next {
  right: 0;
}

.lightbox__previous:hover,
.lightbox__previous:focus-visible {
  background: transparent url('../images/viewer/prevlabel.gif') no-repeat 0 15%;
}

.lightbox__next:hover,
.lightbox__next:focus-visible {
  background: transparent url('../images/viewer/nextlabel.gif') no-repeat 100% 15%;
}

.lightbox__footer {
  min-height: 42px;
  padding: 0 10px 10px;
  box-sizing: border-box;
  color: #666;
  font: 10px/1.4em Verdana, Arial, Geneva, Helvetica, sans-serif;
}

.lightbox__caption,
.lightbox__counter {
  margin-right: 71px;
}

.lightbox__caption {
  font-weight: bold;
}

.lightbox__counter {
  min-height: 1.4em;
}

.lightbox__close {
  float: right;
  width: 66px;
  height: 22px;
  margin: 5px 0;
  padding: 0;
  border: 0;
  background: transparent url('../images/viewer/closelabel.gif') no-repeat center;
  cursor: pointer;
}

.lightbox__close:focus-visible,
.lightbox__navigation:focus-visible {
  outline: 1px dotted #555;
}

@media (max-width: 480px) {
  .lightbox {
    padding: 10px;
  }

  .lightbox__image {
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 100px);
  }
}
