[data-dumi-tooltip] {
  position: relative;

  &::before,
  &::after {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    display: inline-block;
    opacity: 0.7;
    pointer-events: none;
    transition: all 0.2s;
  }

  &::before {
    content: attr(data-dumi-tooltip);
    min-width: 30px;
    margin-bottom: 8px;
    padding: 5px 8px;
    color: #fff;
    font-size: 13px;
    line-height: 1.1;
    white-space: nowrap;
    background-color: #000;
    border-radius: 2px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;

    @{dark-selector} & {
      background-color: #222;
    }
  }

  &::after {
    content: '';
    width: 0;
    height: 0;
    border: 4px solid transparent;
    border-top-color: #000;

    @{dark-selector} & {
      border-top-color: #222;
    }
  }

  &:not(:hover) {
    &::before,
    &::after {
      visibility: hidden;
      opacity: 0;
    }
  }

  &[data-dumi-tooltip-bottom] {
    &::before,
    &::after {
      bottom: auto;
      top: 100%;
    }

    &::before {
      margin-top: 8px;
      margin-bottom: 0;
    }

    &::after {
      border-top-color: transparent;
      border-bottom-color: #000;

      @{dark-selector} & {
        border-bottom-color: #222;
      }
    }
  }
}
