the-gallery,
gallery-item,
gallery-btn {
  display: block;
}

gallery-btn {
  padding: 5px;
  transition: background-color 300ms linear;
}

gallery-btn:hover {
  background-color: var(--color-light-grey);
}

the-gallery {
  --gallery-main-spacing: 50px;
  z-index: 100;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--color-light);
  display: flex;
  flex-direction: column;
}

body.gallery-active {
  overflow-y: hidden;
}

.gallery-image-wrapper:not(.active),
body:not(.gallery-active) the-gallery {
  display: none;
}

.gallery-main {
  padding: var(--gallery-main-spacing) var(--gallery-main-spacing) 0;
  display: flex;
  gap: 20px;
  flex: 1 1 auto;
}

.gallery-images {
  flex: 1 1 auto;
}

.gallery-aside {
  flex: 0 1 35%;
  display: flex;
  gap: 4px;
}

.gallery-aside-btn-close {
  flex: 0 0 auto;
  align-self: center;
}

.gallery-aside-btn-open {
  display: none;
  position: absolute;
}

@media (min-width: 980px) {
  .gallery-aside-btn-open {
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
  }
}

.closed-aside .gallery-aside-btn-open {
  display: block;
}

.disabled-aside .gallery-aside,
.disabled-aside .gallery-aside-btn-open,
.closed-aside .gallery-aside {
  display: none;
}

.gallery-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  height: var(--gallery-main-spacing);
}

.gallery-footer gallery-btn {
  flex: 0 1 auto;
}

.gallery-footer gallery-btn svg {
  height: 100%;
  width: auto;
}

.gallery-image-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.gallery-image-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

the-gallery[single-image] gallery-btn[item-type="prev"],
the-gallery[single-image] gallery-btn[item-type="next"] {
  display: none;
}

the-gallery .gallery-counter {
  font-size: 3rem;
  position: absolute;
  left: 50%;
  top: calc(var(--gallery-main-spacing) / 2);
  transform: translate(-50%, -50%);
}

@media (max-width: 979px) {
  the-gallery {
    --gallery-main-spacing: 20px;
  }

  .gallery-main {
    position: relative;
    flex-direction: column-reverse;
  }

  .gallery-aside {
    flex-direction: column-reverse;
  }

  .gallery-aside {
    flex: 0 1 auto;
    padding-bottom: var(--gallery-main-spacing);
  }

  .gallery-aside-btn-close {
    transform: rotate(-90deg);
  }

  .gallery-aside-btn-open {
    left: 50%;
    bottom: 0;
    transform: translateX(-50%) rotate(-90deg);
  }

  .gallery-main {
    padding-top: 50px;
  }

  .gallery-footer {
    height: 50px;
  }

  the-gallery .gallery-counter {
    top: 25px;
  }
}