/* Scrollable memory gallery opened from any memory photo. */
html body .app-shell .photo-lightbox:not(.video-mode) .photo-lightbox-frame {
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
  gap: 10px !important;
  overflow: hidden !important;
}

html body .app-shell .photo-lightbox-gallery {
  width: 100% !important;
  max-height: calc(100svh - 124px) !important;
  padding: 4px 6px 18px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  scroll-behavior: smooth !important;
  scroll-snap-type: y proximity !important;
  scrollbar-color: rgba(12, 113, 105, 0.62) rgba(9, 48, 56, 0.08) !important;
  scrollbar-width: thin !important;
  -webkit-overflow-scrolling: touch !important;
}

html body .app-shell .photo-lightbox-gallery[hidden],
html body .app-shell #photoLightboxImage[hidden],
html body .app-shell #photoLightboxVideo[hidden] {
  display: none !important;
}

html body .app-shell .photo-lightbox-gallery-item {
  position: relative !important;
  display: grid !important;
  width: 100% !important;
  height: min(76svh, 780px) !important;
  min-height: 360px !important;
  margin: 0 0 18px !important;
  place-items: center !important;
  overflow: hidden !important;
  scroll-snap-align: start !important;
  border: 1px solid rgba(31, 105, 103, 0.13) !important;
  border-radius: 22px !important;
  background: linear-gradient(145deg, #f7fbf8, #e7f2ef) !important;
  box-shadow: 0 16px 44px rgba(8, 52, 62, 0.12) !important;
}

html body .app-shell .photo-lightbox-gallery-item:last-child {
  margin-bottom: 0 !important;
}

html body .app-shell .photo-lightbox-gallery-item img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: min(82svh, 900px) !important;
  object-fit: contain !important;
  object-position: center !important;
  border: 0 !important;
  border-radius: 20px !important;
  background: transparent !important;
  box-shadow: none !important;
}

html body .app-shell .photo-lightbox-gallery-count {
  position: absolute !important;
  top: 14px !important;
  left: 14px !important;
  display: inline-grid !important;
  min-width: 54px !important;
  min-height: 32px !important;
  padding: 0 11px !important;
  place-items: center !important;
  border: 1px solid rgba(255, 255, 255, 0.54) !important;
  border-radius: 999px !important;
  color: #fff !important;
  font-size: 0.78rem !important;
  font-weight: 850 !important;
  background: rgba(5, 37, 45, 0.7) !important;
  box-shadow: 0 8px 20px rgba(4, 30, 37, 0.18) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
}

html body .app-shell .photo-lightbox:not(.video-mode) .photo-lightbox-close {
  position: absolute !important;
  top: 24px !important;
  right: 24px !important;
  z-index: 8 !important;
}

html body .app-shell .photo-lightbox:not(.video-mode) #photoLightboxCaption {
  width: 100% !important;
  max-width: none !important;
  padding: 2px 58px 4px 10px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

@media (max-width: 720px) {
  html body .app-shell .photo-lightbox-gallery {
    max-height: calc(100svh - 102px) !important;
    padding: 2px 2px 12px !important;
  }

  html body .app-shell .photo-lightbox-gallery-item {
    height: calc(100svh - 126px) !important;
    min-height: 300px !important;
    margin-bottom: 12px !important;
    border-radius: 18px !important;
  }

  html body .app-shell .photo-lightbox-gallery-item img {
    max-height: calc(100svh - 126px) !important;
    border-radius: 17px !important;
  }

  html body .app-shell .photo-lightbox:not(.video-mode) .photo-lightbox-close {
    top: 18px !important;
    right: 18px !important;
  }

  html body .app-shell .photo-lightbox:not(.video-mode) #photoLightboxCaption {
    padding-left: 6px !important;
    font-size: 0.82rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body .app-shell .photo-lightbox-gallery {
    scroll-behavior: auto !important;
  }
}
