.s-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: stretch;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.s-gallery-lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

body.lightbox-open {
  overflow: hidden;
}

.s-gallery-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(33, 33, 33, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transform: translateZ(0);
  will-change: backdrop-filter, transform;
}

.s-gallery-lightbox__close {
  position: absolute;
  top: 20px;
  right: var(--grid-margin, 56px);
  z-index: 3;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms ease;
}

.s-gallery-lightbox__close:hover {
  background: var(--color-white);
}

.s-gallery-lightbox__close img {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
}

.s-gallery-lightbox button:focus,
.s-gallery-lightbox a:focus {
  outline: none;
}

.s-gallery-lightbox button:focus-visible,
.s-gallery-lightbox a:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}

.s-gallery-lightbox__viewport {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 56px 56px 56px;
  min-height: 0;
  overflow-y: auto;
}

.s-gallery-lightbox__figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  min-width: 0;
  max-width: 100%;
}

.s-gallery-lightbox__image-link {
  display: inline-block;
  line-height: 0;
  cursor: pointer;
  text-decoration: none;
}

.s-gallery-lightbox__image {
  display: block;
  border-radius: 0;
  max-width: 100%;
  max-height: calc(100vh - 240px);
  width: auto;
  height: auto;
  object-fit: contain;
  background: var(--color-coloring-dark-grey);
}

.s-gallery-lightbox__meta {
  width: 100%;
  max-width: 1108px;
  color: var(--color-white);
  font-size: var(--type-button-s);
  line-height: var(--type-button-s-lh);
  text-align: center;
}

.s-gallery-lightbox__caption,
.s-gallery-lightbox__author,
.s-gallery-lightbox__subtitle {
  display: block;
}

.s-gallery-lightbox__caption {
  color: var(--color-white);
}

.s-gallery-lightbox__author {
  color: rgba(255, 255, 255, 0.78);
}

.s-gallery-lightbox__author-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 180ms ease;
}

.s-gallery-lightbox__author-link:hover {
  opacity: 0.85;
}

.s-gallery-lightbox__subtitle {
  display: none;
}

.s-gallery-lightbox__thumbs {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 20px 0 32px var(--grid-margin, 56px);
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.s-gallery-lightbox__thumbs::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.s-gallery-lightbox__thumb {
  flex: 0 0 auto;
  width: 96px;
  height: 72px;
  border: 0;
  padding: 0;
  border-radius: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 200ms ease, width 360ms cubic-bezier(0.22, 1, 0.36, 1),
    height 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.s-gallery-lightbox__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0;
}

.s-gallery-lightbox__thumb:hover {
  opacity: 0.9;
}

.s-gallery-lightbox__thumb.is-current {
  opacity: 1;
  width: 120px;
  height: 90px;
}

@media (max-width: 767px) {
  .s-gallery-lightbox {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .s-gallery-lightbox__viewport {
    padding: 56px 12px 12px;
    order: 0;
  }

  .s-gallery-lightbox__image {
    max-width: 100%;
    max-height: calc(100vh - 220px);
  }

  .s-gallery-lightbox__meta {
    font-size: var(--type-button-s);
  }

  .s-gallery-lightbox__thumbs {
    order: 1;
    flex-direction: row;
    align-items: flex-start;
    min-height: 76px;
    padding: 8px 12px 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 12px;
  }

  .s-gallery-lightbox__thumb {
    width: 64px;
    height: 48px;
    scroll-snap-align: center;
  }

  .s-gallery-lightbox__thumb.is-current {
    width: 80px;
    height: 60px;
  }
}
