@use '../../sass/abstracts' as *;

@mixin arrow-forward {
  &::after {
    @include unity-symbols('arrow-forward');
    position: relative;
    top: -2px;
    margin-left: 0.75rem;
    transition: transform 0.3s ease-out;
  }

  &:hover {
    &::after {
      transform: translateX(4px);
    }
  }
}

#{$component-prefix}teaser {
  @include flexbox;
  flex-direction: column;
  height: 100%;
  transition: all $transition-effect 0.3s;

  a {
    word-break: break-word;
    transition: all $transition-effect 0.3s;
  }

  &__inner {
    @include flexbox;
    @include flex(1 0 auto);
    flex-direction: column;
  }

  &__pre-heading {
    @include alt-label-small;
  }

  &__heading {
    @include headline-medium;
    margin-bottom: 0.25rem;
    display: block;
    word-break: break-word;
    color: $sodra-black;

    @include media-breakpoint-up(md) {
      @include headline-large;
    }

    &--large {
      @include display-small;

      @include media-breakpoint-up(md) {
        @include display-large;
      }
    }
  }

  &:is(a) &__heading {
    @include arrow-forward;
  }

  &__image {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;

    &--white {
      background-color: $white;
    }

    &--light-grey {
      background-color: $light-grey;
    }

    &--blue-25 {
      background-color: $blue-25;
    }

    &--full-width {
      img,
      figure {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
    }

    #{$component-prefix}teaser__image-container {
      width: 100%;
      height: 100%;
      position: absolute;
      align-items: center;
      @extend %flexbox;
      justify-content: center;

      img,
      figure {
        vertical-align: middle;
        display: inline-flex;
        max-width: 100%;
        margin-bottom: 0 !important;
      }
    }
  }

  &__video {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    overflow: hidden;

    &:before {
      position: absolute;
      content: '';
      left: 0;
      top: 0;
      right: 0;
      bottom: 0;
      background-color: rgba(0, 0, 0, 0.3);
      z-index: 1;
    }

    iframe,
    video {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
    }

    video {
      object-fit: cover;
    }

    #{$component-prefix}teaser__video-modal-trigger {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 2;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;

      #{$component-prefix}teaser__video-modal-trigger-icon {
        font-size: 3rem;
        color: $white;
        text-shadow: 0 0 rgba(0, 0, 0, 0.25);
      }

      &[data-video-type='youtube']
        #{$component-prefix}teaser__video-modal-trigger-icon {
        display: none;
      }
    }

    #{$component-prefix}teaser__image {
      + #{$component-prefix}teaser__video-modal-trigger[data-video-type='youtube'] {
        #{$component-prefix}teaser__video-modal-trigger-icon {
          display: inline-block;
        }
      }
    }
  }

  &__text {
    @include body-large;
    color: $sodra-black;
    p {
      @include body-large;
      color: $sodra-black;
    }
  }

  &__actions {
    @include headline-large;
    margin-bottom: 0.25rem;
    display: block;
    word-break: break-word;
    list-style: none;
    padding: 0;

    @include media-breakpoint-up(md) {
      @include headline-medium;
    }

    a {
      text-decoration: none !important;
      color: $sodra-black;

      @include arrow-forward;
    }
  }
}
