.comment-popup {
  font-size: 1em / .857em; // // default font size / footer font size = 12px
  height: 6em;
  border-radius: 0.25em;
  border: 1px solid;
  border-color: @gray-light;
  background-color: @body-bg-color;
}

.comment-wrapper {
  position: relative;

  .comment-popup {
    position: absolute;
    top: 2.5em;
    left: -1.6em;
    z-index: 1;
    width: 50em;
    padding: 0 1em;
  }

  .comment-popup:before {
    content: '';
    position: absolute;
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    left: 1.5em;
    top: ~"calc(-0.75em - 1px)";
    border-left: 1px solid @gray-light;
    border-top: 1px solid @gray-light;
    background-color: @body-bg-color;
    z-index: -1;
    transform: rotate(45deg);
  }
}

ul.item-list li:nth-last-child(2):not(:first-child),
ul.item-list li:last-child:not(:first-child) {
  .comment-wrapper {
    .comment-popup {
      top: -7em;
    }

    .comment-popup:before {
      bottom: ~"calc(-0.75em - 1px)";
      top: unset;
      transform: rotate(225deg);
    }
  }
}

.comment-wrapper:not(:hover) .comment-popup {
  display: none;
}

#layout {
  &.twocols {
    .comment-popup {
      width: 35em;
    }

    &.poor-layout,
    &.compact-layout {
      .comment-popup {
        width: 25em;
      }
    }
  }

  &.poor-layout,
  &.minimal-layout {
    .comment-popup {
      width: 25em;
    }
  }
}
