$tooltip-arrow-height: 10px;
$tooltip-arrow-width: 7px;
$tooltip-background: greys(80%);

.tooltip-trigger {
  border-bottom: 1px dotted #aaa;
  cursor: help;
}

.filled.primary > .tooltip-trigger {
  border-bottom: 1px dotted #fff;
  cursor: help;
}

.tooltip-trigger-special {
  position: relative;
  &:after {
    border-bottom: 1px dotted #aaa;
    position: absolute;
    width: 100%;
    bottom: 0px;
  }
  cursor: help;
}


// Tooltip content
.tooltip {

  @include depth(tooltip);

  display: block;
  position: absolute;
  top:0;
  left:0;
  width:auto;
  white-space: nowrap;
  pointer-events: none;
  //
  padding: .8em 1.2em;
  border-radius: 0.3em;
  //
  line-height: 1.7;
  text-align: center;
  font-size: 1rem;
  background-color: $tooltip-background;
  color: greys(10%);
  @include shadow(4);
  //
  opacity: 0;
}

.tooltip.visible {
  opacity:1;
}


// Tooltip "arrow"
.tooltip::after {
  content: '';
  position: absolute;
  //
  width: 0;
  height: 0;
}

.tooltip.top::after {

  bottom: 0;
  left: 50%;

  // rectangle bottom
  border-top:$tooltip-arrow-height solid $tooltip-background;
  border-bottom:none;
  border-right:$tooltip-arrow-width solid transparent;
  border-left:$tooltip-arrow-width solid transparent;

  transform: translateX(-50%) translateY(100%);
}

// tooltip at bottom/center
.tooltip.bottom::after {

  top: 0;
  left: 50%;

  border-top:none;
  border-bottom:$tooltip-arrow-height solid $tooltip-background;
  border-right:$tooltip-arrow-width solid transparent;
  border-left:$tooltip-arrow-width solid transparent;

  transform: translateX(-50%) translateY(-100%);
}

// tooltip at left
.tooltip.left::after {
  top: 50%;
  right: 0;

  // rectangle right
  border-top:$tooltip-arrow-width solid transparent;
  border-bottom:$tooltip-arrow-width solid transparent;
  border-right:none;
  border-left:$tooltip-arrow-height solid $tooltip-background;

  transform: translateX(100%) translateY(-50%);
}

.tooltip.right::after {

  top: 50%;
  left: 0;

  // rectangle right
  border-top:$tooltip-arrow-width solid transparent;
  border-bottom:$tooltip-arrow-width solid transparent;
  border-left:none;
  border-right:$tooltip-arrow-height solid $tooltip-background;

  transform: translateX(-100%) translateY(-50%);
}
