@use "sass:math";

.gallery-image {
  &:hover {
    cursor: pointer;
  }
}

.gallery-header {
  flex-basis: auto;
  margin-top: 30px;
}

#gallery-details-container {
  .tab-content {
    min-height: 15rem;
  }
}

.gallery-card {
  &.card {
    overflow: hidden;
    padding: 0;
    padding-bottom: 1rem;

    @media (max-width: 576px) {
      width: 100%;
    }
  }

  .card-section {
    margin-top: auto;

    a:hover {
      text-decoration: none;
    }
  }

  .card-popovers {
    margin-bottom: 0;
  }

  .card-section-title {
    color: $text-color;
  }

  &-image {
    object-fit: contain;
  }
}

.gallery-tabs {
  max-height: calc(100vh - 4rem);

  overflow: auto;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

$galleryTabWidth: 450px;

@media (min-width: 1200px) {
  .gallery-tabs {
    flex: 0 0 $galleryTabWidth;
    max-width: $galleryTabWidth;

    &.collapsed {
      display: none;
    }
  }

  .gallery-divider {
    flex: 0 0 15px;
    max-width: 15px;

    button {
      background-color: transparent;
      border: 0;
      color: $link-color;
      cursor: pointer;
      font-size: 10px;
      font-weight: 800;
      height: 100%;
      line-height: 100%;
      padding: 0;
      text-align: center;
      width: 100%;

      &:active:not(:hover),
      &:focus:not(:hover) {
        background-color: transparent;
        border: 0;
        box-shadow: none;
      }
    }
  }

  .gallery-container {
    flex: 0 0 calc(100% - #{$galleryTabWidth} - 15px);
    max-width: calc(100% - #{$galleryTabWidth} - 15px);

    &.expanded {
      flex: 0 0 calc(100% - 15px);
      max-width: calc(100% - 15px);
    }
  }
}

.gallery-tabs,
.gallery-container {
  padding-left: 15px;
  padding-right: 15px;
  position: relative;
  width: 100%;
}

.gallery-container {
  height: calc(100vh - 4rem);
  overflow: auto;
}

@media (min-width: 1200px), (max-width: 575px) {
  .gallery-performers {
    .performer-card {
      width: 15rem;

      &-gallery {
        height: 22.5rem;
      }

      &-image {
        height: 22.5rem;
        width: 15rem;
      }
    }
  }
}

#gallery-edit-details {
  .rating-stars {
    font-size: 1.3em;
    height: calc(1.5em + 0.75rem + 2px);
  }
}

.GalleryWall {
  display: flex;
  flex-wrap: wrap;
  margin: 0 auto;
  width: 96vw;

  /* Prevents last row from consuming all space and stretching images to oblivion */
  &::after {
    content: "";
    flex: auto;
    flex-grow: 9999;
  }
}

.GalleryWallCard {
  height: auto;
  padding: 2px;
  position: relative;

  $width: 96vw;

  &-landscape {
    flex-grow: 2;
    width: 96vw;
  }

  &-portrait {
    flex-grow: 1;
    width: 96vw;
  }

  @mixin galleryWidth($width) {
    height: math.div($width, 3) * 2;

    &-landscape {
      width: $width;
    }

    &-portrait {
      width: math.div($width, 2);
    }
  }

  @media (min-width: 576px) {
    @include galleryWidth(96vw);
  }
  @media (min-width: 768px) {
    @include galleryWidth(48vw);
  }
  @media (min-width: 1200px) {
    @include galleryWidth(32vw);
  }

  &-img {
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    width: 100%;
  }

  &-title {
    font-weight: bold;
  }

  &-footer {
    background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.3));
    bottom: 0;
    padding: 1rem;
    position: absolute;
    text-shadow: 1px 1px 3px black;
    transition: 0s opacity;
    width: 100%;

    @media (min-width: 768px) {
      opacity: 0;
    }

    &:hover {
      .GalleryWallCard-title {
        text-decoration: underline;
      }
    }

    a {
      color: white;
    }
  }

  &:hover &-footer {
    opacity: 1;
    transition: 1s opacity;
    transition-delay: 500ms;

    a {
      text-decoration: none;
    }
  }

  .rating-stars,
  .rating-number {
    position: absolute;
    right: 1rem;
    top: 1rem;
  }

  .rating-stars {
    .star-fill-0 .unfilled-star {
      display: none;
    }

    .star-fill-10 .unfilled-star,
    .star-fill-20 .unfilled-star,
    .star-fill-25 .unfilled-star,
    .star-fill-30 .unfilled-star,
    .star-fill-40 .unfilled-star,
    .star-fill-50 .unfilled-star,
    .star-fill-60 .unfilled-star,
    .star-fill-70 .unfilled-star,
    .star-fill-75 .unfilled-star,
    .star-fill-80 .unfilled-star,
    .star-fill-90 .unfilled-star {
      visibility: hidden;
    }

    .filled-star {
      filter: drop-shadow(1px 1px 1px #222);
    }
  }
}

.gallery-file-card.card {
  margin: 0;
  padding: 0;

  .card-header {
    cursor: pointer;
  }

  dl {
    margin-bottom: 0;
  }
}

.col-form-label {
  padding-right: 2px;
}
