// Doc: https://github.com/selimdoyranli/browser-hack-sass-mixins

@mixin only_ff($selector, $map) {
  @-moz-document url-prefix() {
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_ff2($selector, $map) {
  body:empty #{$selector} {
    @each $property, $value in ($map) {
      #{$property}: $value;
    }
  }
}

@mixin only_ff2_above($selector, $map) {
  @at-root {
    body:last-child & #{$selector},
    x:-moz-any-link,
    x:default {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_ff3_above($selector, $map) {
  @at-root {
    & #{$selector},
    x:-moz-any-link,
    x:default {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_ff6_above($selector, $map) {
  _::-moz-progress-bar,
  body:last-child #{$selector} {
    @each $property, $value in ($map) {
      #{$property}: $value;
    }
  }
}

@mixin only_ff16_above($selector, $map) {
  @supports (-moz-appearance: meterbar) {
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_ff21_above($selector, $map) {
  _::-moz-range-track,
  body:last-child #{$selector} {
    @each $property, $value in ($map) {
      #{$property}: $value;
    }
  }
}

@mixin only_ff24_above($selector, $map) {
  @supports (-moz-appearance: meterbar) and (cursor: zoom-in) {
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_ff25_above($selector, $map) {
  @supports (-moz-appearance: meterbar) and (background-attachment: local) {
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_ff26_above($selector, $map) {
  @supports (-moz-appearance: meterbar) and (image-orientation: 90deg) {
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_ff27_above($selector, $map) {
  @supports (-moz-appearance: meterbar) and (all: initial) {
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_ff28_above($selector, $map) {
  @supports (-moz-appearance: meterbar) and (list-style-type: japanese-formal) {
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_ff30_above($selector, $map) {
  @supports (-moz-appearance: meterbar) and (background-blend-mode: difference, normal) {
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_webkit($selector, $map) {
  .selector:not(*:root) {
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_chrome($selector, $map) {
  @media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) {
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_safari9($selector, $map) {
  @supports (overflow: -webkit-marquee) and (justify-content: inherit) {
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_ios($selector, $map) {
  @supports (-webkit-text-size-adjust: none) and (not (-ms-accelerator: true)) and (not (-moz-appearance: none)) {
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_safari_no_ios($selector, $map) {
  _:-webkit-full-screen:not(:root:root),
  #{$selector} {
    @each $property, $value in ($map) {
      #{$property}: $value;
    }
  }
}

@mixin only_opera9_safari2($selector, $map) {
  #{'html:first-child '} #{$selector} {
    @each $property, $value in ($map) {
      #{$property}: $value;
    }
  }
}

@mixin only_opera($selector, $map) {
  _:-o-prefocus,
  body:last-child #{$selector} {
    @each $property, $value in ($map) {
      #{$property}: $value;
    }
  }
}

@mixin only_opera11($selector, $map) {
  @media all and (-webkit-min-device-pixel-ratio: 10000), not all and (-webkit-min-device-pixel-ratio: 0) {
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_edge($selector, $map) {
  @supports (-ms-ime-align: auto) {
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_ie6($selector, $map) {
  #{$selector} {
    #{'* html '} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_ie7($selector, $map) {
  #{$selector} {
    #{'*+html '} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_ie7_below($selector, $map) {
  #{$selector} {
    #{'*'} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_ie8($selector, $map) {
  #{$selector} {
    @each $property, $value in ($map) {
      #{$property}: $value + \0#{'/'};
    }
  }
}

@mixin only_ie8_below($selector, $map) {
  #{$selector} {
    @each $property, $value in ($map) {
      #{$property}: $value +#{\9};
    }
  }
}

@mixin only_ie9($selector, $map) {
  #{$selector} {
    @each $property, $value in ($map) {
      #{$property}: $value#{\0 / IE9};
    }
  }
}

@mixin only_ie9_below($selector, $map) {
  html[lang='\en'] #{$selector} {
    @each $property, $value in ($map) {
      #{$property}: $value;
    }
  }
}

@mixin only_ie10_above($selector, $map) {
  @media all and (-ms-high-contrast: none) {
    *::-ms-backdrop,
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin only_ie11($selector, $map) {
  @media all and (-ms-high-contrast: none) {
    *::-ms-backdrop,
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value + \0;
      }
    }
  }
}

@mixin only_ie11_above($selector, $map) {
  #{'_:-ms-fullscreen, :root '} #{$selector} {
    @each $property, $value in ($map) {
      #{$property}: $value;
    }
  }
}

@mixin no_ie6($selector, $map) {
  #{'html>body '} #{$selector} {
    @each $property, $value in ($map) {
      #{$property}: $value;
    }
  }
}

@mixin only_ie9_saf4_above($selector, $map) {
  @media screen and (min-width: 0\0) {
    #{$selector} {
      @each $property, $value in ($map) {
        #{$property}: $value;
      }
    }
  }
}

@mixin no_ie_safari6($selector, $map) {
  @media screen {
    @media (min-width: 0) {
      #{$selector} {
        @each $property, $value in ($map) {
          #{$property}: $value;
        }
      }
    }
  }
}
