/**
 * @file
 * Video
 *
 * Contains styles for inline video objects.
 */

.vid-inline {
  border: 2px solid $color-green;
  border-radius: 8px;
  position: relative;
  margin: 3rem 0;

  @media (min-width: $break-large) {
    border: 3px solid $color-green;
    margin: 5rem 0;
  }

  &:after {
    content: '';
    position: absolute;
    left: -3px;
    bottom: -13px;
    width: 10px;
    height: 10px;
    border: 2px solid $color-green;
    border-radius: 100%;
    z-index: 2;
    background-color: $color-white;

    @media (min-width: $break-medium) {
      left: -3px;
      bottom: -23px;
      width: 15px;
      height: 15px;
    }

    @media (min-width: $break-large) {
      border: 3px solid $color-green;
      width: 18px;
      height: 18px;
      bottom: -27px;
    }
  }

  &__container {
    position: relative;

    &:focus {
      outline-offset: -4px;
    }

    &:before,
    &:after {
      content: '';
      display: block;
      position: absolute;
    }
  }

  &__cover {
    position: relative;
    z-index: 2;
    cursor: pointer;
    opacity: 1;
    aspect-ratio: 772/430;
    transition: 0.3s ease;
    display: flex;
    flex-direction: column;

    &:before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: linear-gradient(360deg, rgba(0, 0, 0, 0.65) 15.4%, rgba(0, 0, 0, 0) 47.55%);
      z-index: 0;
      border-radius: 8px;
    }

    img {
      object-fit: cover;
      width: 100%;
      position: absolute;
      aspect-ratio: 772/430;
      z-index: -1;
      border-radius: 5px;
    }

    &.js-loading {
      &:hover {
        &:before {
          opacity: 1;
        }
      }

      &:before {
        margin: 0;
        height: 60px;
        width: 60px;
        background-image: url('data:image/svg+xml;charset=UTF-8,%3csvg xmlns:svg=\'http://www.w3.org/2000/svg\' xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\' version=\'1.0\' width=\'60px\' height=\'60px\' viewBox=\'0 0 128 128\' xml:space=\'preserve\'%3e%3cg%3e%3cpath d=\'M78.75 16.18V1.56a64.1 64.1 0 0 1 47.7 47.7H111.8a49.98 49.98 0 0 0-33.07-33.08zM16.43 49.25H1.8a64.1 64.1 0 0 1 47.7-47.7V16.2a49.98 49.98 0 0 0-33.07 33.07zm33.07 62.32v14.62A64.1 64.1 0 0 1 1.8 78.5h14.63a49.98 49.98 0 0 0 33.07 33.07zm62.32-33.07h14.62a64.1 64.1 0 0 1-47.7 47.7v-14.63a49.98 49.98 0 0 0 33.08-33.07z\' fill=\'%23000000\' fill-opacity=\'1\'/%3e%3canimateTransform attributeName=\'transform\' type=\'rotate\' from=\'0 64 64\' to=\'-90 64 64\' dur=\'800ms\' repeatCount=\'indefinite\'%3e%3c/animateTransform%3e%3c/g%3e%3c/svg%3e');
        background-position: center;
        background-size: contain;
        border: 0;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        z-index: 9;
      }

      &:after {
        display: none;
      }
    }

    &.js-hide {
      display: block;
      z-index: 1;
      opacity: 0;
    }

    .play-btn {
      color: $color-green;
      position: absolute;
      left: -2px;
      bottom: -9px;
      width: 47px;
      height: 46px;
      clip: unset;
      border-top: 2px solid $color-green;
      border-right: 2px solid $color-green;
      border-bottom: 2px solid $color-green;
      border-left: 3px solid white;
      border-radius: 0 8px 8px 0;
      background: $color-white;
      transition: background-color .3s ease;

      @media screen and (min-width: $break-medium) {
        bottom: -15px;
        left: -2px;
        width: 96px;
        height: 98px;
      }

      @media screen and (min-width: $break-large) {
        bottom: -15px;
        left: -4px;
        width: 125px;
        height: 120px;
        border-top: 3px solid $color-green;
        border-right: 3px solid $color-green;
        border-bottom: 3px solid $color-green;
      }

      svg {
        position: absolute;
        left: 14px;
        bottom: 12px;
        width: 16px;
        height: 17px;
        z-index: 3;
        transition: all .3s ease;

        @media screen and (min-width: $break-medium) {
          left: 30px;
          bottom: 25px;
          width: 36px;
          height: 40px;
        }

        @media screen and (min-width: $break-large) {
          left: 35px;
          bottom: 28px;
          width: 55px;
          height: 61px;
        }
      }
    }

    &:hover {
      .play-btn {
        background-color: $color-green;
        color: $color-white;
      }
    }
  }


  &.js-show {
    border: 0;
    .vid-inline__embed {
      z-index: 3;
      opacity: 1;

      iframe {
        visibility: visible;
      }
  
    }

    &:after {
      opacity: 0;
    }

  }

  &__embed {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 1;
    height: 100%;
    width: 100%;
    opacity: 0;
    transition: 0.5s ease;

  }

  iframe {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    border: 0;
    visibility: hidden;
  }

  &__caption {
    @extend figcaption;
    left: 0;
    bottom: 0;
    color: $color-white;
    z-index: 2;
    @include fontsize(14px);
    line-height: 1.2;
    margin: auto 0 14px 60px;

    @media (min-width: $break-medium) {
      padding: 0 16px 25px 115px;
      margin: auto 0 0;
    }

    @media (min-width: $break-large) {
      padding: 0 16px 12px 105px;
      margin: auto 0 14px 60px;
    }
  }
}
