.popover {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transform: translateY(-$baseline * 0.5);
  transition: opacity $transition-duration--fast,
    visibility $transition-duration--fast, transform $transition-duration--fast;
  width: 100%;
  z-index: 3;

  &::before {
    border-radius: $border-radius;
    content: '';
    height: $baseline * 2.5;
    position: absolute;
    right: 60px;
    top: -$spacing--xxs;
    transform: rotate(45deg);
    transition: opacity $transition-duration--fast,
      visibility $transition-duration--fast,
      transform $transition-duration--fast;
    width: 25px;
  }

  &--arrow-right::before {
    right: 35px;
  }
  &--arrow-center::before {
    left: 47%;
  }
  &--arrow-left::before {
    left: 35px;
  }

  &__dialog {
    max-height: 0; // make sure dialog doesn't take up place when not visible
    overflow: hidden;
    padding: $spacing--s $baseline * 2.5 $spacing--m;
    transition: max-height 0s $transition-duration--fast;
  }

  &--active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);

    .popover__dialog {
      max-height: $baseline * 60;
      transition: max-height 0s 0s;
    }
  }

  &__title {
    @include font-style($popover-title-font-style, $popover-title-font-style);

    & + .body-copy {
      margin-top: $spacing--s;
    }
  }

  &__message {
    margin-top: $spacing--xs;

    p:last-child {
      margin: 0;
    }
  }

  &__description {
    &,
    p {
      margin-bottom: $spacing--s;
    }
  }

  &__action {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    margin-top: $spacing--m;

    &.divider {
      padding-bottom: $spacing--m;
    }

    .button {
      margin-left: 0;
      margin-right: 0;
    }

    .button + .button {
      margin-top: $spacing--xs;
    }
  }

  &__footer {
    margin-top: $spacing--s;

    p {
      margin-bottom: 0;
    }

    &--link {
      display: block;
      text-align: center;
    }
  }

  // form group
  .form-group {
    margin-top: $spacing--m;

    &__input + .form-group__input {
      margin-top: $spacing--xs;
    }
  }

  // person profile
  .person-profile {
    align-items: center;
    display: flex;
    flex-wrap: wrap;

    &__profile {
      margin-left: 15px;
      flex-grow: 2; // replaces calc(100% - exact pixel amouont old avatar)
    }

    &__eyebrow {
      @include font-style('body--xs');
      display: block;
    }
  }

  // link list
  .link-list {
    margin-top: $spacing--s;

    &.divider {
      padding-bottom: $spacing--m;
    }

    &__item {
      border: none;
      margin-top: $baseline * 1.5;
      width: 100%;

      &:first-child {
        border-top: none;
        margin-top: 0;
      }
    }

    &__link {
      @include font-style('body--l');
      // color: $popover-link-list-color;
      align-items: center;
      display: flex;
      padding: 0;

      .icon {
        margin-right: 15px;

        // svg {
        //   @include color-dark-shade-main;
        // }
      }
    }
  }
}

@media (min-width: 501px) and (max-width: 940px) {
  .popover::before {
    right: 80px;
  }
}

// viewport l
@include viewport--m {
  .popover {
    border-radius: $border-radius--l;
    width: $popover-width;

    &__dialog {
      border-radius: $border-radius--l;
      padding: $spacing--m;
    }
  }
}

// small version
.popover--s {
  @include font-style('body--m');
  display: flex;
  justify-content: flex-start;
  position: relative;

  .icon__toggler {
    height: $spacing--s;
  }

  .icon {
    cursor: pointer;
    display: inline-block;
    position: relative;
  }

  .popover {
    border-width: 1px;
    border-style: solid;
    max-width: 400px;
    min-width: 100px;
    position: absolute;
    text-align: left;
    top: $baseline * 2.5;
    width: auto;

    &::before {
      display: none;
    }

    .popover__dialog {
      padding: $spacing--xs 0;
    }

    .popover__dialog li a {
      @include text-ellipsis;
      color: $color-brand--one;
      display: block;
      padding: $spacing--xxs 15px;
      text-decoration: none;

      &:hover {
        background: $color--one-light;
      }
    }
  }

  &.align-center {
    justify-content: center;
    margin: 0 auto;
  }

  &.align-right {
    justify-content: flex-end;
  }
}

@include popover-background-mapping;
