
// Mixin to convert provided font size in pt to em units
@mixin fontsize($size, $base: 16px, $unit: pt) {
  // if pt, convert into unitless value with the assumption: 1pt = 1.091px
  $adjusted_size: if($unit == pt, $size * 1.091, $size) * 1000;
  $rounded_size: round($adjusted_size / $base) / 1000;
  font-size: $rounded_size * 1em;
  // font-size: round($size) + pt;
}

@mixin entry($t, $fc: $primary, $tc: $text, $bc: $fill) {
//
// entry
//

  @if $t == normal {
    color: $tc;
    background-color: $bc;
    border: 2px solid transparent !important;
    box-shadow: none !important;
  }

  @if $t == hover {
    color: $tc;
    background-color: $bc;
    border: 2px solid $track !important;
    box-shadow: none !important;
  }

  @if $t == focus {
    color: $tc;
    background-color: $bc;
    border: 2px solid $fc !important;
    box-shadow: none !important;
  }

  @if $t == insensitive {
    background-color: $bc;
    color: rgba($tc, 0.35);
  }

  @if $t == flat-normal {
    background-color: $bc;
    border-radius: 0;
    border: none !important;
    box-shadow: inset 0 -1px rgba($tc, 0.15) !important;
    color: $tc;
  }

  @if $t == flat-hover {
    border: none !important;
    background-color: $bc;
    box-shadow: inset 0 -1px rgba($tc, 0.35) !important;
    color: $tc;
  }

  @if $t == flat-focus {
    border: none !important;
    background-color: $bc;
    box-shadow: inset 0 -2px $fc !important;
    color: $tc;
  }

  @if $t == flat-insensitive {
    border: none !important;
    box-shadow: none !important;
    background-color: $bc;
    color: rgba($tc, 0.35);
  }
}

@mixin button($t, $fc: $primary, $tc: $text, $bc: $base) {
//
// button
//

  @if $t == normal {
    color: $tc;
    background-color: rgba($tc, 0.05);
    box-shadow: none !important;
  }

  @if $t == focus {
    color: $tc;
    box-shadow: none !important;
    background-color: if($bc == $primary, rgba(white, 0.08), rgba($tc, 0.08));
  }

  @if $t == hover {
    color: $tc;
    box-shadow: none !important;
    background-color: if($bc == $primary, rgba(white, 0.1), rgba($tc, 0.1));
  }

  @if $t == active {
    color: $tc;
    box-shadow: none !important;
    background-color: if($bc == $primary, rgba(white, 0.18), rgba($tc, 0.18));
  }

  @if $t == checked {
    color: if($fc == $primary, white, on($fc));
    background-color: $fc;
    box-shadow: none !important;
  }

  @if $t == insensitive {
    color: rgba($tc, 0.35);
    background-color: rgba($tc, 0.02);
    box-shadow: none !important;
  }

  @if $t == flat-normal {
    color: $tc;
    background-color: transparent;
    box-shadow: none !important;
  }

  @if $t == flat-focus {
    color: $tc;
    background-color: rgba($tc, 0.08);
    box-shadow: none !important;
  }

  @if $t == flat-hover {
    color: $tc;
    background-color: rgba($tc, 0.1);
  }

  @if $t == flat-active {
    color: $tc;
    background-color: rgba($tc, 0.18);
    box-shadow: none !important;
  }

  @if $t == flat-insensitive {
    background-color: transparent;
    color: rgba($tc, 0.35);
    box-shadow: none !important;
  }
}
