$selectionColor: #b4d5fe

@mixin textShadowToCropUnderline($color)
  text-shadow: 0 .03em $color, 0 -.03em $color, .03em 0 $color, -.03em 0 $color, .06em 0 $color, -.06em 0 $color, .09em 0 $color, -.09em 0 $color, .12em 0 $color, -.12em 0 $color, .15em 0 $color, -.15em 0 $color

@mixin linkUnderlines($backgroundColor, $color)
  color: $color
  text-decoration: none
  @include textShadowToCropUnderline($backgroundColor)
  background-image: linear-gradient($backgroundColor, $backgroundColor), linear-gradient($backgroundColor, $backgroundColor), linear-gradient($color, $color)
  background-size: .05em 1px, .05em 1px, 1px 1px
  background-repeat: no-repeat, no-repeat, repeat-x
  background-position: 0% 90%, 100% 90%, 0% 90%

  &::selection
    background: $selectionColor
    text-shadow: none

  &:before, &:after, *, *:before, *:after
    text-shadow: none

  &:visited
    color: $color

$selectionColor: #b4d5fe

@mixin textShadowToCropUnderline($color, $fixCommas: false)
  @if $fixCommas
    $shadows: ()
  @else
    $shadows: 0 0.03em $color, 0 -0.03em $color

  @for $stop from 1 through 5
    $stop: 0.03em * $stop
    $shadows: append($shadows, $stop 0 $color, comma)
    $shadows: append($shadows, (-1 * $stop) 0 $color, comma)

    @if $fixCommas
      $shadows: append($shadows, $stop 0.03em $color, comma)
      $shadows: append($shadows, (-1 * $stop) 0.03em $color, comma)

  text-shadow: $shadows

@mixin linkUnderlines($backgroundColor, $color)
  color: $color
  text-decoration: none
  @include textShadowToCropUnderline($backgroundColor, false)
  background-image: linear-gradient($backgroundColor, $backgroundColor), linear-gradient($backgroundColor, $backgroundColor), linear-gradient($color, $color)
  background-size: .05em 1px, .05em 1px, 1px 1px
  background-repeat: no-repeat, no-repeat, repeat-x
  background-position: 0% 90%, 100% 90%, 0% 90%

  &::selection
    background: $selectionColor
    text-shadow: none

  &:before, &:after, *, *:before, *:after
    text-shadow: none

  &:visited
    color: $color

Add logic to kind of handle better comma underlines
Add logic to kind of handle better comma underlines
