@keyframes darken-background {
  from {
    background-color: rgba(0, 0, 0, 0);
  }

  to {
    background-color: rgba(0, 0, 0, 0.5);
  }
}

.mobileGallery {
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--Spacing-x2);
}

.closeButton {
  justify-content: flex-start;
  width: fit-content;
}
.closeButton .desktopCloseIcon {
  display: none;
}

.mobileGalleryContent {
  display: block;
}

.fullViewCloseButton {
  position: absolute;
  top: var(--Spacing-x-one-and-half);
  right: var(--Spacing-x-half);
  z-index: 1;
}

.fullViewCloseButton:hover .fullViewCloseIcon {
  background-color: var(--UI-Text-Medium-contrast);
  border-radius: 50%;
}

.leftTransformIcon {
  transform: scaleX(-1);
}

.content {
  width: 100%;
  height: 100%;
  border-radius: 0;
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: var(--lightbox-z-index);
}

.overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: var(--lightbox-z-index);
}

.overlay[data-entering] {
  animation: darken-background 0.2s;
}

.overlay[data-exiting] {
  animation: darken-background 0.2s reverse;
}

.galleryContainer {
  background-color: var(--Base-Background-Primary-Normal);
  padding: var(--Spacing-x2);
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-y: auto;
}

.galleryHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 1.71875rem;
}

.desktopGallery,
.desktopThumbnailGrid,
.navigationButton {
  display: none;
}

.imageCaption {
  background-color: var(--Base-Surface-Subtle-Normal);
  padding: var(--Spacing-x-half) var(--Spacing-x1);
  border-radius: var(--Corner-radius-Small);
}

.mainImageWrapper {
  position: relative;
  width: 100%;
}

.mainImageContainer {
  width: 100%;
  height: 100%;
  will-change: transform;
  overflow: hidden;
}

.mainImageContainer img,
.thumbnailContainer img {
  border-radius: var(--Corner-radius-Small);
  cursor: pointer;
  transition: opacity 0.3s ease-in-out;
}

.thumbnailGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--Spacing-x1);
  max-height: none;
}

.thumbnailContainer {
  position: relative;
  height: 242px;
}

.fullWidthImage {
  grid-column: 1 / -1;
  height: 240px;
}

.thumbnailContainer img {
  border-radius: var(--Corner-radius-Medium);
}

.fullViewContainer {
  background-color: var(--UI-Text-High-contrast);
  height: 100%;
  padding: var(--Spacing-x2);
  position: relative;
  align-items: center;
  justify-items: center;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 1fr;
  place-content: center;
  gap: var(--Spacing-x5);
}

.fullViewHeader {
  display: flex;
  justify-content: center;
  width: 100%;
}

.fullViewImageContainer {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 25rem;
  margin-bottom: var(--Spacing-x5);
}

.fullViewImage {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--Corner-radius-Medium);
}

.fullViewImageContainer img {
  border-radius: var(--Corner-radius-Medium);
  width: 100%;
  height: 100%;
}

.fullViewFooter {
  position: absolute;
  bottom: calc(-1 * var(--Spacing-x5));
}

.imagePosition {
  background-color: var(--UI-Grey-90);
  padding: var(--Spacing-x-quarter) var(--Spacing-x-half);
  border-radius: var(--Corner-radius-Small);
}

.portraitImage {
  max-width: 548px;
}

.image {
  object-fit: cover;
}
@media (min-width: 768px) and (max-width: 1367px) {
  .fullViewContainer {
    padding: var(--Spacing-x5);
  }

  .fullViewImageContainer {
    height: 100%;
    max-height: 35rem;
  }
}

@media (min-width: 1367px) {
  .mobileGallery,
  .thumbnailGrid {
    display: none;
  }

  .content {
    position: fixed;
    top: 50%;
    left: 50%;
    overflow: hidden;
  }

  .content:not(.fullViewContent) {
    border-radius: var(--Corner-radius-Large);
  }

  .galleryContent {
    width: 1090px;
    height: 725px;
  }

  .fullViewContent {
    width: 100vw;
    height: 100vh;
  }

  .galleryContainer {
    padding: var(--Spacing-x5) var(--Spacing-x6);
  }

  .desktopGallery {
    display: grid;
    grid-template-rows: 1.71875rem 1fr 7.8125rem;
    row-gap: var(--Spacing-x-one-and-half);
    background-color: var(--Base-Background-Primary-Normal);
    height: 100%;
    position: relative;
    overflow: hidden;
  }

  .closeButton {
    display: block;
    position: absolute;
    top: var(--Spacing-x-one-and-half);
    right: var(--Spacing-x1);
    z-index: 1;
  }

  .closeButton .mobileCloseIcon {
    display: none;
  }
  .closeButton .desktopCloseIcon {
    display: block;
  }

  .closeButton:hover .desktopCloseIcon {
    background-color: var(--Base-Surface-Primary-light-Hover-alt);
    border-radius: 50%;
  }

  .desktopThumbnailGrid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--Spacing-x1);
    max-height: 7.8125rem;
    overflow: hidden;
  }

  .thumbnailContainer {
    height: 125px;
  }

  .fullViewCloseButton {
    position: fixed;
    top: var(--Spacing-x-one-and-half);
    right: var(--Spacing-x-half);
  }

  .fullWidthImage {
    grid-column: auto;
    height: auto;
  }

  .thumbnailContainer img {
    border-radius: var(--Corner-radius-Small);
  }

  .fullViewContainer {
    margin-top: 0;
    padding: var(--Spacing-x5);
    grid-template-rows: auto 1fr auto;
    width: 100%;
    height: 100%;
  }

  .fullViewImageContainer {
    width: 70%;
    max-width: 90.875rem;
    max-height: 43.75rem;
  }

  .navigationButton {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--Base-Button-Inverted-Fill-Normal);
    border-radius: 50%;
    padding: var(--Spacing-x1);
    cursor: pointer;
    border: none;
    display: flex;
    z-index: 1;
  }

  .galleryPrevButton {
    left: var(--Spacing-x2);
  }

  .galleryNextButton {
    right: var(--Spacing-x2);
  }

  .fullViewNextButton {
    right: var(--Spacing-x5);
  }

  .fullViewPrevButton {
    left: var(--Spacing-x5);
  }

  .fullViewFooter {
    text-align: left;
  }
}
