body {
  --thumbnail-height: max(100px, 15svh);
}

.gallery {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gallery__wrapper{
  flex:1;
  max-width:100%;
}

.gallery__title {
  margin: 0;
}

.gallery__header,
.gallery__thumbnails,
.gallery__content {
  padding: 1rem;
}

.gallery__header {
  min-height: var(--thumbnail-height);
}

.gallery__thumbnails {
  overflow-y: hidden;
  overflow-x: auto;
  flex-wrap: wrap;
  gap: 1rem;
  max-width: 100%;
  white-space: nowrap;
  font-size: 0;
}

.gallery__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  width: 100%;
  height: 100svh;
  max-height: 100svh;
}

.gallery__caption {
  margin-top: 1rem;
  font-size: 1rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.gallery__title,
.gallery__description,
.gallery__caption {
  width: 100%;
  max-width: var(--container-width);
  padding: 0 1rem;
}

.gallery__photo {
  overflow: hidden;
  width: auto;
  height: 100%;
  display: inline-block;
  align-items: baseline;
  justify-content: center;
  align-content: center;
  margin-left: 1rem;
  filter: invert(1);
  transition: all 0.3s ease-in;
}

.gallery__photo:hover,
.gallery__photo:has(.il-item--active) {
  filter: invert(0);
  scale: 1.1;
  transition: all 0.3s ease-out;
}

.gallery__photo:first-child {
  margin-left: 0;
}

.gallery__thumbnails .il-item,
.gallery__content .il-item {
  overflow: hidden;
  position: relative;
  aspect-ratio: var(--il-aspect-ratio);
  background-color: var(--il-main-color);
}

.gallery__thumbnails .il-item {
  width: auto;
  height: 100%;
}

.gallery__content .il-item {
  width: auto;
  height: 100%;
  max-width: 100%;
}

.gallery__content .il-thumbnail{
  pointer-events: none;
}

.gallery__thumbnails .il-thumbnail,
.gallery__content .il-thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.gallery__thumbnails .il-img,
.gallery__content .il-img {
  max-height: 100%;
  max-width: 100%;
  margin: auto;
  position: relative;
  object-fit: contain;
}

.gallery__thumbnails .il-img {
  display: none;
}

.il-item {
  opacity: 0;
}

.gallery__content .il-item {
  transition: opacity 0.5s ease-out;
}

.gallery__thumbnails .il-item {
  transition: all 0.5s ease-out;
}

.il-item.il-item--initialized {
  opacity: 1;
}

.il-thumbnail {
  opacity: 0;
  transition: opacity 0.5s ease-out;
}

.il-item.il-item--thumbnail-loaded {
  background-color: transparent;
}

.il-item--thumbnail-loaded .il-thumbnail {
  opacity: 1;
  transition: opacity 0.5s ease-in;
}

.il-img {
  opacity: 0;
  transition: all 0.5s ease-out;
}

.gallery__content .il-item.il-item--img-loaded .il-img {
  opacity: 1;
  transition: all 0.5s ease-in;
}

.gallery__content .il-item.il-item--img-loaded .il-thumbnail {
  opacity: 0;
}

.gallery__content picture:empty {
  opacity: 0;
}

.gallery__thumbnails .il-item {
  cursor: pointer;
}

.gallery__thumbnails {
  height: var(--thumbnail-height);
}

.gallery__thumbnails:hover .il-item:not(:hover) {
  scale: 0.9;
}

.gallery__caption__text {
  font-size: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  flex: 1;
}

.gallery__caption__text p {
  margin: 0;
}

.gallery__caption__info {
  display: flex;
  gap: 1rem;
  font-size: 0.75em;
  color: #666;
  align-items: center;
  justify-content: center;
}

.gallery__caption__prev-button,
.gallery__caption__next-button {
  border: none;
  outline: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: color 0.3s ease-in-out;
  background-color: #fff;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery__caption__prev-button:hover,
.gallery__caption__next-button:hover {
  color: #000;
  background-color: #eee;
}
