/* On-screen Keyboard */

$key_size:             1.2em;
$keyboard_bg_color:    if($variant == 'light', #d8dade, #1d1d1d);
$key_border_radius:    $base_radius + 3px;
$key_bg_color:         if($variant == 'light', white, #707070);
$default_key_bg_color: if($variant == 'light', #adb3bc, #4b4b4b);

// draw keys using button function
#keyboard {
  background-color: $keyboard_bg_color;
  box-shadow: none;

  .page-indicator {
    padding: $base_padding;

    .page-indicator-icon {
      width: 8px;
      height: 8px;
    }
  }
}

// the container for individual keys
.key-container,
.keyboard-layout {
  padding: $base_margin;
  spacing: $base_margin;
}

// the keys
.keyboard-key {
  @include fontsize($font_size + 5);
  font-weight: bold;
  min-height: $key_size;
  min-width: $key_size;
  padding: 0 !important;
  border-radius: $key_border_radius;
  border: none;
  color: $text-secondary;
  background-color: $key_bg_color;
  box-shadow: inset 0 -1px if($variant == 'light', rgba(black, 0.35), rgba(black, 0.85));

  &:focus, &:hover {
    color: $text;
    background-color: if($variant == 'light', darken($background, 5%), lighten($default_key_bg_color, 10%));
  }

  &:checked, &:active {
    color: $text;
    background-color: if($variant == 'light', darken($background, 10%), lighten($default_key_bg_color, 15%));
  }

  &:grayed { //FIXME
    background-color: $default_key_bg_color;
    color: $text-secondary;
  }

  &.default-key { // non-character keys
    background-color: $default_key_bg_color;
    box-shadow: inset 0 -1px if($variant == 'light', rgba(black, 0.2), rgba(black, 0.85));

    &:focus, &:hover {
      color: $text;
      background-color: if($variant == 'light', darken($default_key_bg_color, 5%), lighten($default_key_bg_color, 5%));
    }

    &:checked, &:active {
      color: $text;
      background-color: if($variant == 'light', darken($default_key_bg_color, 12%), lighten($default_key_bg_color, 12%));
    }
  }

  &.enter-key { // enter key is suggested-action
    color: on($primary);
    background-color: $primary;

    &:focus, &:hover { color: on($primary); background-color: lighten($primary, 5%); }
    &:checked, &:active { color: on($primary); background-color: darken($primary, 10%); }
  }

  &.shift-key-uppercase {
    &, &:focus, &:hover, &:checked, &:active {
      color: $primary;
    }
  }

  StIcon { icon-size: 1.125em; }
}

.keyboard-subkeys { //long press on a key popup
  color: inherit;
  -arrow-border-radius: $menu_radius;
  -arrow-background-color: mix($text, $keyboard_bg_color, 10%);
  -arrow-border-width: 0;
  -arrow-border-color: transparent;
  -arrow-base: 20px;
  -arrow-rise: 10px;
  -boxpointer-gap: $base_spacing;
  box-shadow: inset 0 -1px if($variant == 'light', rgba(black, 0.35), rgba(black, 0.85));
}

// emoji
.emoji-page {
  .keyboard-key {
    background-color: transparent;
    border: none;
    color: initial;
  }
}

.emoji-panel {
  .keyboard-key:latched {
    border: none;
    background-color: $primary;
  }
}

// On-screen Keyboard
.word-suggestions {
  font-size: 14pt;
  spacing: $base_spacing * 2;
  min-height: 20pt;
}
