// RESET


// Highly elaborate hack for reset to show up at top of the stylesheet

%global-reset {
  font: inherit;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
}

%document-reset {
  position: relative;
  min-height: 100%;
  font-size: 100%;
  line-height: 1;
}

%box-module-reset {
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
}

%boxsizing-reset {
  box-sizing: border-box;
}

%boxsizing-inheritance-reset {
  box-sizing: inherit;
}

%font-size-reset {
  font: inherit;
  vertical-align: baseline;
}

%font-style-reset {
  font-family: initial;
  font-weight: initial;
  text-transform: initial;
  font-variant: initial;
  letter-spacing: initial;
}

%antialiased-reset {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

%quotes-reset {
  quotes: none;
  content: '';
  content: none;
}

%link-reset {
  text-decoration: none;
  color: inherit;
  p & {
    display: inline-block;
  }
}

%list-reset {
  list-style: none;
}

%form-reset {
  @extend %font-size-reset;
  @extend %box-module-reset;
  color: inherit;
  background: none;
  line-height: inherit;
  cursor: pointer
}

%input-appearance-reset {
  appearance: none;
}

%placeholder-reset {
  &::placeholder { @extend %color-inherit; }
}

%checkbox-radio-reset {
  @extend %box-module-reset;
  height: 1em;
  width: 1em;
  line-height: 1;
  vertical-align: middle;
  margin-right: 1em;
}

%table-reset {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}


@mixin reset(
  $global: true,
  $block: true,
  $quotes: true,
  $document: true,
  $antialiased: true,
  $box-sizing: true,
  $img: true,
  $link: true,
  $list: true,
  $form: true,
  $table: true,
  $hr: true
) {

  @if $global {
    html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p,
    blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em,
    img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u,
    i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table,
    caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details,
    embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby,
    section, summary, time, mark, audio, video {
      @extend %global-reset;
    }
  }

  @if $quotes {
    blockquote, q {
      &:before, &:after {
        @extend %quotes-reset;
      }
    }
  }

  @if $document {
    html, body { @extend %document-reset; }
  }

  @if $box-sizing {
    html, body {
      @extend %boxsizing-reset;
    }
    *, *:before, *:after {
      @extend %boxsizing-inheritance-reset;
    }
  }

  @if $antialiased {
    html, body {
      @extend %antialiased-reset;
    }
  }

  @if $link {
    a {
      @extend %link-reset;
    }
  }

  @if $list {
    ul, ol {
      @extend %list-reset;
    }
  }

  @if $form {
    form, input, textarea, select, button, fieldset, label {
      @extend %form-reset;
    }
    fieldset {
      @extend %global-reset;
    }
    input, textarea {
      @extend %placeholder-reset;
    }
    input[type="checkbox"], input[type="radio"] {
      @extend %checkbox-radio-reset;
    }
    select, input[type="checkbox"], input[type="radio"],  {
      @extend %input-appearance-reset;
    }
  }

  @if $table {
    table {
      @extend %table-reset;
    }
  }

  @if $hr {
    hr {
      @extend %box-module-reset;
    }
  }

}
