.hovercard {
  white-space: nowrap;
}

.hovercard-element {
  position: absolute;
  display: none;
  text-decoration: none;
  color: inherit;
  z-index: 15;
  padding-top: 1rem;
  .hovercard-card {
    background-color: #fff;
    width: 330px;
    padding: 15px 20px;
    border-radius: 5px;
    box-sizing: border-box;
    box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow: hidden;
    h3 {
      padding-top: 0;
      margin-top: 0;
    }
    p:last-child {
      margin-bottom: 0;
    }
  }
  &.visible {
    display: block;
  }
}

.hovercard-mobile {
  position: fixed;
  left: 0;
  right: 0;
  overflow: auto;
  bottom: 0;
  max-height: 100%;
  .hovercard-description::after {
    display: none;
  }
  .hovercard-card {
    border-radius: 0;
    max-height: none;
    width: 100%;
  }
}

.hovercard-card.hovercard-has-image {
  width: 400px;
}

.hovercard-arrow {
  position: absolute;
  z-index: 17;
  height: 20px;
  width: 330px;
  box-sizing: border-box;
  display: none;
}
.hovercard-card.hovercard-has-image + .hovercard-arrow {
  width: 400px;
}

.hovercard-arrow::before {
  position: absolute;
  bottom: 0;
  left: 50%;
  margin-left: -5px;
  content: "";
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid whitesmoke;
}

[x-placement="top"] + .hovercard-arrow::before {
  border-bottom: none !important;
  bottom: auto;
  top: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid whitesmoke;
}

.hovercard-element.hovercard-visible,
.hovercard-arrow.hovercard-visible {
  display: block;
}

.hovercard-close {
  position: absolute;
  right: 1rem;
  top: 1.5rem;
  font: inherit;
  line-height: 1;
  background: none;
  border: 0;
  padding: 0;
  appearance: none;
  font-size: 150%;
}

.hovercard-element .hovercard-title {
  margin-top: 0;
  margin-bottom: 1rem;
}
.hovercard-element .hovercard-description {
  margin-bottom: 0;
}
.hovercard-card.hovercard-has-image .hovercard-description {
  max-width: 210px;
}
.hovercard-element .hovercard-image {
  position: absolute;
  right: 0;
  top: 1rem;
  bottom: 0;
  width: 150px;
  background-size: cover;
  background-position: center;
}

.hovercard-element .hovercard-description::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 175px;
  height: 55px;
  background: linear-gradient(transparent, whitesmoke);
}
