// inspired by https://github.com/nolimits4web/Framework7/blob/v2/src/less/mixins.less#L76
// but more powerful, both support viewport scale and not scale usage.

@import '../themes/default.less';

.scale-hairline-common() {
  position: relative;
  border: none;

  &::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 200%;
    height: 200%;
    transform-origin: 0 0;
    transform: scale(0.5);
    box-sizing: border-box;
    pointer-events: none;
  }
}

.hairline(@direction, @color: @border-color-base, @radius: 0)
  when
  (@direction = 'top') {
  &::before {
    border-top: 1px solid @color;
    border-radius: @radius * 2;
  }
}

.hairline(@direction, @color: @border-color-base, @radius: 0)
  when
  (@direction = 'right') {
  &::before {
    border-right: 1px solid @color;
    border-radius: @radius * 2;
  }
}

.hairline(@direction, @color: @border-color-base, @radius: 0)
  when
  (@direction = 'bottom') {
  &::before {
    border-bottom: 1px solid @color;
    border-radius: @radius * 2;
  }
}

.hairline(@direction, @color: @border-color-base, @radius: 0)
  when
  (@direction = 'left') {
  &::before {
    border-left: 1px solid @color;
    border-radius: @radius * 2;
  }
}

.hairline(@direction, @color: @border-color-base, @radius: 0)
  when
  (@direction = 'all') {
  &::before {
    border: 1px solid @color;
    border-radius: @radius * 2;
  }
}

.hairline-remove(@position) when (@position = 'left') {
  &:before {
    border-left: 0;
  }
}

.hairline-remove(@position) when (@position = 'right') {
  &:before {
    border-right: 0;
  }
}

.hairline-remove(@position) when (@position = 'top') {
  &:before {
    border-top: 0;
  }
}

.hairline-remove(@position) when (@position = 'bottom') {
  &:before {
    border-bottom: 0;
  }
}

.hairline-remove(@position) when (@position = 'all') {
  &:before {
    border: 0;
    display: none !important;
  }
}
