//
// Copyright IBM Corp. 2018, 2023
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@use 'config';
@use 'type' as type;
@use './utilities/custom-property';

@mixin reset {
  /// http://meyerweb.com/eric/tools/css/reset/
  /// v2.0 | 20110126
  /// License: none (public domain)
  /// Start vendor reset
  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 {
    padding: 0;
    border: 0;
    margin: 0;
    font: inherit;
    font-feature-settings: 'liga' 1;
    font-size: 100%;
    vertical-align: baseline;
  }

  // Chrome 62 fix
  button,
  select,
  input,
  textarea {
    border-radius: 0;
    font-family: inherit;
  }

  :root {
    color-scheme: custom-property.get-var('color-scheme', light);
  }

  /* HTML5 display-role reset for older browsers */
  article,
  aside,
  details,
  figcaption,
  figure,
  footer,
  header,
  hgroup,
  menu,
  nav,
  section {
    display: block;
  }

  body {
    @if config.$css--body == true {
      background-color: custom-property.get-var('background', #ffffff);
      color: custom-property.get-var('text-primary', #161616);
    }

    line-height: 1;
  }

  ol,
  ul {
    list-style: none;
  }

  blockquote,
  q {
    quotes: none;
  }

  blockquote::before,
  blockquote::after,
  q::before,
  q::after {
    content: none;
  }

  table {
    border-collapse: collapse;
    border-spacing: 0;
  }

  /// End vendor reset
  html {
    box-sizing: border-box;
  }

  *,
  *::before,
  *::after {
    box-sizing: inherit;
  }

  @include type.reset();

  /// Makes SVGs accessible in high contrast mode, although it only works sporadically as other CSS selectors
  /// routinely override this one.
  /// @link https://github.com/IBM/carbon-elements/issues/345#issuecomment-466577293 Carbon-elements #345
  @media screen and (-ms-high-contrast: active) {
    svg {
      fill: ButtonText;
    }
  }
}

@if config.$css--reset == true {
  @include reset;
}

@if config.$css--default-type == true {
  @include type.default-type();
}
