.image-gallery {
  --gallery-accent: #ffb400;
  --gallery-control: #063f8c;
  width: 100%;
}

.image-gallery button {
  font: inherit;
}

.image-gallery__stage {
  position: relative;
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr) 3.25rem;
  align-items: center;
  height: 34rem;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

.image-gallery__zoom {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 1.5rem;
  overflow: hidden;
  cursor: zoom-in;
  background: transparent;
  border: 0;
}

.image-gallery__main {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 180ms ease, transform 180ms ease;
}

.image-gallery__main.is-changing {
  opacity: 0;
  transform: scale(.985);
}

.image-gallery__button,
.image-gallery__scroll,
.image-gallery__lightbox-nav,
.image-gallery__close {
  display: grid;
  place-items: center;
  color: var(--gallery-control);
  cursor: pointer;
  background: #fff;
  border: 1px solid #d4e0ee;
  border-radius: 50%;
  box-shadow: 0 .2rem .7rem rgb(6 63 140 / 14%);
  transition: color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.image-gallery__button {
  z-index: 1;
  width: 2.5rem;
  height: 2.5rem;
  margin: auto;
  font-size: 2rem;
  line-height: 1;
}

.image-gallery.is-single .image-gallery__button,
.image-gallery.is-single .image-gallery__lightbox-nav,
.image-gallery.is-single .image-gallery__carousel {
  display: none;
}

.image-gallery__button:hover,
.image-gallery__button:focus-visible,
.image-gallery__scroll:hover,
.image-gallery__scroll:focus-visible,
.image-gallery__lightbox-nav:hover,
.image-gallery__lightbox-nav:focus-visible,
.image-gallery__close:hover,
.image-gallery__close:focus-visible {
  color: #fff;
  background: var(--gallery-control);
  transform: scale(1.06);
}

.image-gallery__carousel {
  position: relative;
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) 2.5rem;
  gap: .5rem;
  align-items: center;
  margin-top: 1.25rem;
}

.image-gallery__viewport {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  scroll-behavior: smooth;
  padding-top:3px;
}

.image-gallery__viewport::-webkit-scrollbar {
  display: none;
}

.image-gallery__track {
  display: flex;
  justify-content: center;
  width: max-content;
  min-width: 100%;
  gap: .75rem;
}

.image-gallery__thumbnail {
  flex: 0 0 7rem;
  height: 5rem;
  padding: .25rem;
  cursor: pointer;
  background: #fff;
  border: 2px solid transparent;
  transition: border-color 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.image-gallery__thumbnail:hover,
.image-gallery__thumbnail:focus-visible {
  transform: translateY(-.15rem);
}

.image-gallery__thumbnail.is-active {
  border-color: var(--gallery-accent);
}

#maincontent .image-gallery__thumbnail img {
  display: block;
  width: auto;
  height: 100%;
  max-height:60px;
  margin:0 auto;
}

.image-gallery__scroll {
  width: 2.25rem;
  height: 2.25rem;
  visibility: hidden;
  opacity: 0;
  font-size: 1.5rem;
}

.image-gallery__carousel.is-scrollable .image-gallery__scroll {
  visibility: visible;
  opacity: 1;
  animation: gallery-control-in 220ms ease both;
}

.image-gallery__lightbox {
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100dvh;
  max-height: 100%;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
}

.image-gallery__lightbox::backdrop {
  background: rgb(0 0 0 / 82%);
  backdrop-filter: blur(3px);
}

.image-gallery__lightbox[open] {
  animation: gallery-lightbox-in 200ms ease both;
}

.image-gallery__lightbox-inner {
  position: relative;
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) 3.5rem;
  align-items: center;
  width: 100%;
  height: 100dvh;
  min-width: 0;
  min-height: 0;
  padding: 1.5rem;
  overflow: hidden;
  box-sizing: border-box;
}

.image-gallery__lightbox figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
}

.image-gallery__lightbox figure img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100dvh - 6rem);
  min-height: 0;
  margin: auto;
  object-fit: contain;
}

.image-gallery__lightbox figcaption {
  min-height: 2rem;
  padding-top: .75rem;
  color: #fff;
  text-align: center;
}

.image-gallery__lightbox figcaption:empty {
  display: none;
}

.image-gallery__lightbox-nav {
  width: 2.75rem;
  height: 2.75rem;
  font-size: 2rem;
}

.image-gallery__close {
  position: absolute;
  z-index: 2;
  top: 1rem;
  right: 1rem;
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.75rem;
}

@keyframes gallery-control-in {
  from { opacity: 0; transform: scale(.8); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes gallery-lightbox-in {
  from { opacity: 0; transform: scale(.98); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 47.99rem) {
  .image-gallery__stage {
    grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;
    height: 22rem;
  }

  .image-gallery__zoom {
    padding: .75rem;
  }

  .image-gallery__button {
    width: 2.25rem;
    height: 2.25rem;
  }

  .image-gallery__carousel {
    grid-template-columns: 2.25rem minmax(0, 1fr) 2.25rem;
    margin-top: .75rem;
  }

  .image-gallery__thumbnail {
    flex-basis: 5.5rem;
    height: 4rem;
  }

  .image-gallery__lightbox-inner {
    grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem;
    padding: .75rem;
  }

  .image-gallery__lightbox figure img {
    max-height: calc(100dvh - 4.5rem);
  }

  .image-gallery__lightbox-nav {
    width: 2.25rem;
    height: 2.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .image-gallery *,
  .image-gallery *::before,
  .image-gallery *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
