.zbi-gallery,
.zbi-gallery * {
  box-sizing: border-box;
}

.zbi-gallery {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
}

.zbi-gallery__stage {
  width: 100%;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
}

.zbi-gallery__main {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 18px;
  border: 0;
  background: #fff;
  cursor: zoom-in;
}

.zbi-gallery__main-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #fff;
}

.zbi-gallery__thumbs {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 12px;
  padding: 2px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.zbi-gallery__thumb,
.zbi-lightbox__thumb {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 82px;
  height: 82px;
  padding: 5px;
  border: 1px solid #dfe3e8;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.zbi-gallery__thumb:hover,
.zbi-lightbox__thumb:hover {
  border-color: #9aa3aa;
}

.zbi-gallery__thumb.is-active,
.zbi-lightbox__thumb.is-active {
  border-color: #23a455;
  box-shadow: 0 0 0 1px #23a455;
}

.zbi-gallery__thumb img,
.zbi-lightbox__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.zbi-lightbox[hidden] {
  display: none !important;
}

.zbi-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.zbi-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 23, 28, .72);
  backdrop-filter: blur(2px);
}

.zbi-lightbox__dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  width: min(1280px, calc(100vw - 64px));
  height: min(820px, calc(100vh - 64px));
  padding: 26px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .32);
  overflow: hidden;
}

.zbi-lightbox__close {
  position: absolute;
  top: 13px;
  right: 17px;
  z-index: 5;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #8d949a;
  font: 300 38px/38px Arial, sans-serif;
  cursor: pointer;
}

.zbi-lightbox__close:hover {
  color: #222;
}

.zbi-lightbox__thumbs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 34px 12px 12px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.zbi-lightbox__thumb {
  width: 84px;
  height: 84px;
}

.zbi-lightbox__viewer {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 54px 18px;
  background: #fff;
}

.zbi-lightbox__image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #fff;
  user-select: none;
  -webkit-user-drag: none;
}

.zbi-lightbox__nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0 0 5px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: #f0f2f4;
  color: #697177;
  font: 300 42px/1 Arial, sans-serif;
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease;
}

.zbi-lightbox__nav:hover {
  background: #e3e6e9;
  color: #222;
}

.zbi-lightbox__nav--prev {
  left: 8px;
}

.zbi-lightbox__nav--next {
  right: 8px;
}

body.zbi-lightbox-open {
  overflow: hidden !important;
}

@media (max-width: 767px) {
  .zbi-gallery__main {
    padding: 10px;
  }

  .zbi-gallery__thumb {
    width: 70px;
    height: 70px;
  }

  .zbi-lightbox {
    padding: 10px;
  }

  .zbi-lightbox__dialog {
    display: flex;
    flex-direction: column-reverse;
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    padding: 54px 12px 12px;
    border-radius: 8px;
  }

  .zbi-lightbox__viewer {
    flex: 1 1 auto;
    padding: 8px 34px;
  }

  .zbi-lightbox__thumbs {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 8px;
    padding: 10px 0 0;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .zbi-lightbox__thumb {
    width: 68px;
    height: 68px;
  }

  .zbi-lightbox__nav {
    width: 38px;
    height: 38px;
    font-size: 34px;
  }

  .zbi-lightbox__nav--prev {
    left: -2px;
  }

  .zbi-lightbox__nav--next {
    right: -2px;
  }
}

/* Mouse/touch clicks should not leave the browser's black focus ring behind.
   Keyboard focus remains visible via :focus-visible. */
.zbi-gallery button:focus:not(:focus-visible),
.zbi-lightbox button:focus:not(:focus-visible),
.zbi-lightbox__dialog:focus:not(:focus-visible) {
  outline: none !important;
  box-shadow: none;
}

.zbi-gallery button:focus-visible,
.zbi-lightbox button:focus-visible {
  outline: 2px solid #ffa005;
  outline-offset: 2px;
}

.zbi-lightbox__dialog:focus-visible {
  outline: none;
}
