@mixin switch() {
  switch {
    color: $fg_color;
    outline-offset: -4px;
    margin: 2px;
    border: 1px solid gtkshade($borders, 0.9);
    border-radius: $roundness - 1px;
    background-color: $bg_color;
    background-image: linear-gradient(to bottom, gtkshade($bg_color, 0.9), gtkshade($bg_color, 0.96));
    box-shadow: inset 0 1px gtkalpha($dark_shadow, 0.1);

    &:checked {
      color: $selected_fg_color;
      background-color: $selected_bg_color;
      background-image: linear-gradient(to bottom, gtkshade($selected_bg_color, 0.9), $selected_bg_color);
      border-color: gtkshade($selected_bg_color, 0.65);
      box-shadow: inset 0 0 0 1px gtkalpha($dark_shadow, 0.11);

      &:backdrop {
        box-shadow: none;
        color: $unfocused_selected_fg_color;
        background-color: $unfocused_selected_bg_color;
        background-image: none;
      }
    }

    &:disabled {
      color: $disabled_fg_color;
      border-color: gtkshade($borders, 1.01);
      background-color: $disabled_bg_color;
      background-image: linear-gradient(to bottom, gtkshade($disabled_bg_color, 0.9), gtkshade($disabled_bg_color, 0.96));

      &:backdrop {
        color: $unfocused_disabled_fg_color;
        border-color: gtkshade($unfocused_borders, 0.9);
        background-color: gtkshade($unfocused_disabled_bg_color, 0.9);
        background-image: none;
      }
    }

    &:backdrop {
      color: $unfocused_fg_color;
      border-color: $unfocused_borders;
      background-color: gtkshade($unfocused_bg_color, 0.9);
      background-image: none;
    }

    slider {
      min-width: 36px;
      min-height: 22px;
      margin: -1px;
      border: 1px solid gtkshade($borders, 0.8);
      border-radius: $roundness;
      color: $fg_color;
      background-color: $bg_color;
      background-image: linear-gradient(to bottom, gtkshade($bg_color, 1.2), gtkshade($bg_color, 0.98));
    }
    
    &:checked slider {
      border-color: gtkshade($selected_bg_color, 0.6);
    }

    &:checked:backdrop slider {
      border-color: gtkshade($unfocused_selected_bg_color, 0.8);
      background-image: none;
    }

    &:disabled {
      slider {
        border-color: gtkshade($borders, 0.95);
        background-color: $disabled_base_color;
      }

      &:backdrop slider {
        border-color: $unfocused_borders;
        background-color: $unfocused_bg_color;
        background-image: none;
      }
    }

    &:backdrop slider {
      border-color: gtkshade($unfocused_borders, 0.9);
      background-color: $unfocused_bg_color;
      background-image: none;
    }
  }
}
