/*dynamic tooltip */
[data-tooltip] {
  display: inline-block;
  position: relative;
}

/* Tooltip styling */
[data-tooltip]:before {
  content: attr(data-tooltip);
  white-space: pre;
  display: none;
  position: absolute;
  background: #111;
  color: #fefe;
  padding: 0.4rem 0.8rem;
  font-size: 1.2rem;
  line-height: 2rem;
  min-width: 10rem;
  text-align: center;
}

/* Dynamic horizontal centering */
[data-tooltip-position="top"]:before,
[data-tooltip-position="bottom"]:before {
  left: 50%;
  -ms-transform: translateX(-50%);
  -moz-transform: translateX(-50%);
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
}

/* Dynamic vertical centering */
[data-tooltip-position="right"]:before,
[data-tooltip-position="left"]:before,
[data-tooltip-position="15pLeft"]:before {
  top: 50%;
  -ms-transform: translateY(-50%);
  -moz-transform: translateY(-50%);
  -webkit-transform: translateY(-50%);
  transform: translateY(-50%);
}

[data-tooltip-position="top"]:before {
  bottom: 100%;
  margin-bottom: 0.6rem;
}

[data-tooltip-position="right"]:before {
  left: 100%;
  margin-left: 0.6rem;
}

[data-tooltip-position="bottom"]:before {
  top: 100%;
  margin-top: 0.6rem;
}

[data-tooltip-position="left"]:before {
  right: 100%;
  margin-right: 0.6rem;
}

[data-tooltip-position="15pLeft"]:before {
  right: 15%;
  margin-right: 0.6rem;
}

/* Tooltip arrow styling/placement */
[data-tooltip]:after {
  content: '';
  display: none;
  position: absolute;
  width: 0;
  height: 0;
  border-color: transparent;
  border-style: solid;
}

/* Dynamic horizontal centering for the tooltip */
[data-tooltip-position="top"]:after,
[data-tooltip-position="bottom"]:after {
  left: 50%;
  margin-left: -0.6rem;
}

/* Dynamic vertical centering for the tooltip */
[data-tooltip-position="right"]:after,
[data-tooltip-position="left"]:after,
[data-tooltip-position="15pLeft"]:after {
  top: 50%;
  margin-top: -0.6rem;
}

[data-tooltip-position="top"]:after {
  bottom: 100%;
  border-width: 0.6rem 0.6rem 0;
  border-top-color: #111;
  border-radius: 0 !important;
}

[data-tooltip-position="right"]:after {
  left: 100%;
  border-width: 0.6rem 0.6rem 0.6rem 0;
  border-right-color: #111;
  border-radius: 0 !important;
}

[data-tooltip-position="bottom"]:after {
  top: 100%;
  border-width: 0 0.6rem 0.6rem;
  border-bottom-color: #111;
  border-radius: 0 !important;
}

[data-tooltip-position="left"]:after {
  right: 100%;
  border-width: 0.6rem 0 0.6rem 0.6rem;
  border-left-color: #111;
  border-radius: 0 !important;
}

[data-tooltip-position="15pLeft"]:after {
  right: 15%;
  border-width: 0.6rem 0 0.6rem 0.6rem;
  border-left-color: #111;
  border-radius: 0 !important;
}

/* Show the tooltip when hovering */
[data-tooltip]:hover:before,
[data-tooltip]:hover:after {
  display: block;
  z-index: 2;
  border-radius: 0.9rem;
}
