// Drawing mixins

// generic drawing of more complex things

// provide font size in rem, with px fallback
@mixin fontsize($size: 24, $base: 16) {
  font-size: round($size) + pt;
  //font-size: ($size / $base) * 1rem;
}

// Entries

@mixin entry($t, $dark:false) {
//
// Entries drawing function
//
  //@extend %reset_style;

  @if $t==normal {
    color: $text_color;
    border: 1px solid $borders_color;
    background-color: $entry_bg;
  }

  @if $t==focus {
    color: $text_color;
    border: 1px solid $selection_mode_bg;
    background-color: $entry_bg;
    box-shadow: 0 0 0 2px $entry_highlight;
  }

  @if $t==insensitive {
    color: $insensitive_fg_color;
    border: 1px solid $entry_border;
    background-color: transparentize($entry_bg, 0.45);
  }

  @if $t==osd {
    color: $osd_fg_color;
    background-color: $osd_entry_bg;
    border: 1px solid $osd_entry_border;
    box-shadow: inset 0 2px 4px transparentize(black, 0.95);
  }

  @if $t==osd-focus {
    color: $selected_fg_color;
    background-color: $selected_bg_color;
    border: 1px solid $selected_bg_color;
    box-shadow: inset 0 2px 4px transparentize(black, 0.95);
  }

  @if $t==osd-insensitive {
    color: transparentize($osd_fg_color, 0.45);
    background-color: transparentize($osd_entry_bg, 0.15);
    border: 1px solid $osd_entry_border;
    box-shadow: inset 0 2px 4px transparentize(black, 0.95);
  }
}

// Buttons

@mixin button($t) {
//
// Button drawing function
//
  //@extend %reset_style;

  text-shadow: none;

  @if $t==normal {
    color: $fg_color;
    border: 1px solid $button_borders;
    background-color: $button_bg;
    box-shadow: inset 0 1px $button_highlight;
  }

  @else if $t==hover {
    color: if($variant == 'light', darken($fg_color, 10%), lighten($fg_color, 10%));
    border: 1px solid $button_borders;
    background-color: if($variant=='light', #ffffff, lighten($button_bg, 3%));
    box-shadow: inset 0 1px rgba($button_highlight, 0.12);
  }

  @else if $t==focus {
    color: $fg_color;
    background-color: $button_bg;
    border: 1px solid $selected_bg_color;
    box-shadow: inset 0 1px rgba($button_highlight, 0.12);
  }

  @else if $t==focus-hover {
    color: if($variant == 'light', darken($fg_color, 10%), lighten($fg_color, 10%));
    background-color: if($variant=='light', #ffffff, lighten($button_bg, 3%));
    border: 1px solid $selected_bg_color;
    box-shadow: inset 0 1px rgba($button_highlight, 0.12);
  }

  @else if $t==active {
    color: $selected_fg_color;
    background-color: $selected_bg_color;
    border: 1px solid $button_borders_active;
  }

  @else if $t==insensitive {
    color: $insensitive_fg_color;
    border: 1px solid if($variant == 'light', $button_border, $dark_borders_color);
    background-color: rgba($button_bg, 0.55);
  }

  @else if $t==osd {
    color: $osd_fg_color;
    background-color: $osd_button_bg;
  }

  @else if $t==osd-hover {
    color: $osd_fg_color;
    background-color: opacify(lighten($osd_button_bg, 7%), 0.1);
  }

  @else if $t==osd-active {
    color: $selected_fg_color;
    background-color: $selected_bg_color;
  }

  @else if $t==osd-insensitive {
    color: $osd_insensitive_fg_color;
    background-color: transparentize($osd_button_bg, 0.15);
  }
}
