/* Silence may be golden, but sometimes words paint the canvas of understanding. */
.linksy-tooltip {
  display: inline-block;
  padding-left: 0.3rem;
}

/* START TOOLTIP STYLES */
.linksy-tooltip [tooltip] {
  position: relative; /* opinion 1 */
  font-weight: 400;
}

/* Applies to all tooltips */
.linksy-tooltip [tooltip]::before,
.linksy-tooltip [tooltip]::after {
  text-transform: none; /* opinion 2 */
  font-size: 0.9rem !important; /* opinion 3 */
  line-height: 1;
  user-select: none;
  pointer-events: none;
  position: absolute;
  display: none;
  opacity: 0;
}

.linksy-tooltip [tooltip]::before {
  content: "";
  border: 5px solid transparent; /* opinion 4 */
  z-index: 1001; /* absurdity 1 */
}
.linksy-tooltip [tooltip]::after {
  content: attr(tooltip); /* magic! */
  line-height: 1.5;

  /*
    Let the content set the size of the tooltips 
    but this will also keep them from being obnoxious
*/
  min-width: 15em;
  max-width: 21em;
  padding: 1ch 1.5ch;
  border-radius: 0.3ch;
  box-shadow: 0 1em 2em -0.5em rgba(0, 0, 0, 0.35);
  background: #333;
  color: #fff;
  z-index: 1000; /* absurdity 2 */
}

/* Make the tooltips respond to hover */
.linksy-tooltip [tooltip]:hover::before,
.linksy-tooltip [tooltip]:hover::after {
  display: block;
}

/* don't show empty tooltips */
.linksy-tooltip [tooltip=""]::before,
.linksy-tooltip [tooltip=""]::after {
  display: none !important;
}

/* FLOW: UP */
.linksy-tooltip [tooltip]:not([flow])::before,
.linksy-tooltip [tooltip][flow^="up"]::before {
  bottom: 100%;
  border-bottom-width: 0;
  border-top-color: #333;
}
.linksy-tooltip [tooltip]:not([flow])::after,
.linksy-tooltip [tooltip][flow^="up"]::after {
  bottom: calc(100% + 5px);
}
.linksy-tooltip [tooltip]:not([flow])::before,
.linksy-tooltip [tooltip]:not([flow])::after,
.linksy-tooltip [tooltip][flow^="up"]::before,
.linksy-tooltip [tooltip][flow^="up"]::after {
  left: 50%;
  transform: translate(-50%, -0.5em);
}

/* FLOW: DOWN */
.linksy-tooltip [tooltip][flow^="down"]::before {
  top: 100%;
  border-top-width: 0;
  border-bottom-color: #333;
}
.linksy-tooltip [tooltip][flow^="down"]::after {
  top: calc(100% + 5px);
}
.linksy-tooltip [tooltip][flow^="down"]::before,
.linksy-tooltip [tooltip][flow^="down"]::after {
  left: 50%;
  transform: translate(-50%, 0.5em);
}

/* FLOW: LEFT */
.linksy-tooltip [tooltip][flow^="left"]::before {
  top: 50%;
  border-right-width: 0;
  border-left-color: #333;
  left: calc(0em - 5px);
  transform: translate(-0.5em, -50%);
}
.linksy-tooltip [tooltip][flow^="left"]::after {
  top: 50%;
  right: calc(100% + 5px);
  transform: translate(-0.5em, -50%);
}

/* FLOW: RIGHT */
.linksy-tooltip [tooltip][flow^="right"]::before {
  top: 50%;
  border-left-width: 0;
  border-right-color: #333;
  right: calc(0em - 5px);
  transform: translate(0.5em, -50%);
}
.linksy-tooltip [tooltip][flow^="right"]::after {
  top: 50%;
  left: calc(100% + 5px);
  transform: translate(0.5em, -50%);
}

/* KEYFRAMES */
@keyframes tooltips-vert {
  to {
    opacity: 0.9;
    transform: translate(-50%, 0);
  }
}

@keyframes tooltips-horz {
  to {
    opacity: 0.9;
    transform: translate(0, -50%);
  }
}

/* FX All The Things */
.linksy-tooltip [tooltip]:not([flow]):hover::before,
.linksy-tooltip [tooltip]:not([flow]):hover::after,
.linksy-tooltip [tooltip][flow^="up"]:hover::before,
.linksy-tooltip [tooltip][flow^="up"]:hover::after,
.linksy-tooltip [tooltip][flow^="down"]:hover::before,
.linksy-tooltip [tooltip][flow^="down"]:hover::after {
  animation: tooltips-vert 300ms ease-out forwards;
}

.linksy-tooltip [tooltip][flow^="left"]:hover::before,
.linksy-tooltip [tooltip][flow^="left"]:hover::after,
.linksy-tooltip [tooltip][flow^="right"]:hover::before,
.linksy-tooltip [tooltip][flow^="right"]:hover::after {
  animation: tooltips-horz 300ms ease-out forwards;
}
