$vl-spotlight-padding: .5rem;
$vl-spotlight-alt-padding: 1rem;

.vl-spotlight {
  display: block;
  text-decoration: none;
  position: relative;
  padding: .7rem $vl-spotlight-padding;

  // border-top
  &::before {
    display: block;
    content: "";
    height: .2rem;
    left: 0;
    right: 0;
    position: absolute;
    top: 0;
    background-color: $vl-border-color;
    z-index: 3;
  }

  &--alt {
    background-color: $vl-alt-bg;
    padding: .7rem $vl-spotlight-alt-padding;

    .vl-region--alt & {
      background-color: $vl-page-bg;
    }
  }

  &--inline {
    display: inline-block;
  }
}

a {
  &.vl-spotlight {
    color: $vl-action-color;

    &::before {
      background-color: $vl-action-color;
      mix-blend-mode: normal;
    }

    &:focus,
    &:hover {
      color: $vl-action-hover-color;

      &::before {
        background-color: $vl-action-hover-color;
      }

      .vl-spotlight__image__img {
        transform: scale(1.05);
      }

      .vl-spotlight__title {
        text-decoration: underline;
      }
    }
  }
}

.vl-spotlight__header {
  position: relative;
  overflow: hidden;
  margin-top: -.7rem;
  margin-left: -$vl-spotlight-padding;
  margin-right: -$vl-spotlight-padding;

  .vl-spotlight--alt & {
    margin-left: -$vl-spotlight-alt-padding;
    margin-right: -$vl-spotlight-alt-padding;
  }
}

.vl-spotlight__image {
  min-height: 13.8rem;
  padding-top: 45%;
  position: relative;
  overflow: hidden;
}

.vl-spotlight__image__img {
  @include object-fit;

  transition: transform .2s;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);

  .vl-spotlight__image--focus-center-right &,
  .vl-spotlight__image--focus-top-right &,
  .vl-spotlight__image--focus-bottom-right & {
    right: 0;
    left: auto;
    margin-left: 0;
    margin-right: 0;
  }

  .vl-spotlight__image--focus-center-left &,
  .vl-spotlight__image--focus-top-left &,
  .vl-spotlight__image--focus-bottom-left & {
    right: auto;
    left: 0;
    margin-left: 0;
    margin-right: 0;
  }

  .vl-spotlight__image--focus-top-right &,
  .vl-spotlight__image--focus-top-center &,
  .vl-spotlight__image--focus-top-left & {
    top: 0;
    bottom: auto;
    margin-top: 0;
    margin-bottom: 0;
  }

  .vl-spotlight__image--focus-bottom-right &,
  .vl-spotlight__image--focus-bottom-center &,
  .vl-spotlight__image--focus-bottom-left & {
    bottom: 0;
    top: auto;
    margin-top: 0;
    margin-bottom: 0;
  }
}

// special title to partially cover the img
.vl-spotlight__title-wrapper {
  position: relative;
  top: 0;
  margin-top: .7rem;
  margin-bottom: -2.5rem;
  padding-left: $vl-spotlight-padding;
  transform: translateY(-2.5rem);
  overflow: hidden;
  text-overflow: ellipsis;

  .vl-spotlight--alt &,
  .vl-region--alt & {
    .vl-spotlight__title,
    &::before {
      background-color: $vl-alt-bg;
    }
  }

  .vl-region--alt .vl-spotlight--alt & { // sass-lint:disable-line force-element-nesting
    .vl-spotlight__title,
    &::before {
      background-color: $vl-white;
    }
  }

  .vl-spotlight--alt & {
    padding-left: $vl-spotlight-alt-padding;
  }

  &::before {
    content: "";
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: $vl-spotlight-padding;
    background-color: $vl-white;

    .vl-spotlight--alt & {
      width: $vl-spotlight-alt-padding;
    }

  }

  .vl-spotlight__title {
    display: inline-flex;
    max-width: calc(100% - 1rem);
    white-space: pre-wrap;
    padding: 0.5rem 0.8rem 0.5rem 0;
    background-color: $vl-white;
    word-break: normal;
    hyphens: auto;

    @supports (overflow-wrap: break-word) {
      overflow-wrap: break-word;
    }

    &::after {
      content: "";
      position: absolute;
      top: -0.25em;
      right: 100%;
      bottom: -0.25em;
      width: 0.25em;
    }

    .vl-spotlight--alt & {
      padding-right: $vl-spotlight-alt-padding;
    }
  }

}

.vl-spotlight__title {
  line-height: 1.2;
  position: relative;
  font-size: 2rem;
  font-weight: 500;
  transition: color 0.2s;

  &.vl-link {
    font-weight: 500;
  }

  @include respond-to(small) {
    font-size: 1.6rem;
  }

  .vl-spotlight--s & {
    font-size: 1.6rem;

    @include respond-to(small) {
      font-size: 1.5rem;
    }
  }

  .vl-spotlight--l & {
    font-size: 2.4rem;
    font-family: $vl-accent-font;

    @include respond-to(small) {
      font-size: 1.8rem;
    }
  }
}

.vl-spotlight__subtitle {
  font-size: 1.6rem;

  @include respond-to(small) {
    font-size: 1.4rem;
  }
}

.vl-spotlight__content {
  .vl-document__type {
    padding: 3.6rem 0 0 2rem;
  }
}

.vl-spotlight__data {
  margin: .7rem 0;
  color: $vl-text-color;

  &__subvalue {
    color: $vl-sub-text-color;

    .vl-spotlight--alt &,
    .vl-region--alt & {
      color: $vl-alt-text-color;
    }
  }
}

.vl-spotlight__text {
  margin: 0.7rem 0;
  font-size: 1.6rem;
  line-height: 1.375;
  color: $vl-text-color;
  text-decoration: none;

  @include respond-to(small) {
    font-size: 1.4rem;
  }
}
