// new mixin with alignment options
@mixin media-align($alignX: 'center', $alignY: 'center') {
  img {
    bottom: auto;
    max-height: none;
    max-width: none;
    min-height: 100%;
    min-width: 100%;
    position: absolute;
    top: 50%;
    // if supported, align image using object-fit
    @supports (object-fit: cover) {
      bottom: 0;
      left: 0;
      object-fit: cover;
      height: 100%;
      right: 0;
      transform: none;
      top: 0;
      width: 100%;
    }
    // center align
    @if ($alignX == 'center') {
      left: 50%;
      right: auto;
      transform: translate(-50%, -50%);
      // if supported, align image using object-fit
      @supports (object-fit: cover) {
        object-position: center center;
      }
    }
    // right align
    @if ($alignX == 'right') {
      left: auto;
      right: 0;
      transform: translateY(-50%);
      width: auto;
      // if supported, align image using object-fit
      @supports (object-fit: cover) {
        object-position: center right;
      }
    }
    // left align
    @if ($alignX == 'left') {
      left: 0;
      right: auto;
      transform: translateY(-50%);
      width: auto;
      // if supported, align image using object-fit
      @supports (object-fit: cover) {
        object-position: center left;
      }
    }
  }
}
