/*
1. Prevent padding and border from affecting element width. 
2. Allow adding a border to an element by just adding a border-width.
*/
*,
*::before,
*::after {
  box-sizing: border-box;
  border-width: 0; /* 2 */
  border-style: solid; /* 2 */
  border-color: currentColor; /* 2 */
}

/*
1. Use a consistent sensible line-height in all browsers.
2. Prevent adjustments of font size after orientation changes in iOS.
3. Use a more readable tab size.
4. Use the user's configured `sans` font-family by default.
5. Use the user's configured `sans` font-feature-settings by default.
*/
html {
  line-height: 1.5; /* 1 */
  line-sizing: normal;
  -webkit-text-size-adjust: none; /* 2 */
  text-size-adjust: none;
  -moz-tab-size: 4; /* 3 */
  tab-size: 4; /* 3 */
  height: 100%;
}

/* Apply smooth scrolling to the entire document when focused (Andy Bell) */
html:focus-within {
  scroll-behavior: smooth;
}

/*
1. Set the minimum height of the body to fill the viewport (Andy Bell)
2. Inherit line-height from `html` so users can set as a class directly on the `html` element. (Tailwind)
3. Avoid potential performance issues caused by optimizeLegibility (Andy Bell)
*/
body {
  min-height: 100vh; /* 1 */
  line-height: inherit; /* 2 */
  text-rendering: optimizeSpeed; /* 3 */
}

/*
  Remove default margin (Andy Bell w/ additions)
*/
body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

/*
  Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed (Andy Bell)
*/
ul[role="list"],
ol[role="list"] {
  list-style: none;
}

/* A elements that don't have a class get default styles (Andy Bell) */
a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* Make images easier to work with */
img,
picture,
svg,
canvas,
embed,
object,
audio,
video,
iframe {
  display: block;
  max-width: 100%;
}

/* height: auto messes up embedded videos in iframes */
img, picture, svg, video, canvas {
  height: auto;
}

picture {
  display: contents;
}
source {
  display: none;
}

/**
1. Inherit fonts for inputs and buttons
2. Remove the margin in Firefox and Safari.
2. Don't allow form elements to extend beyond their container
*/
button,
input,
textarea,
select,
optgroup {
  font: inherit; /* 1 */
  margin: 0; /* 2 */
  max-width: 100%; /* 3 */
}

/*
1. Correct the inheritance of border color in Firefox.
*/
hr {
  color: inherit; /* 1 */
}

/**
1. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)
2. Correct the odd 'em' font sizing in all browsers.
*/
code,
kbd,
samp,
pre {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; /* 1 */
  font-size: 1em; /* 2 */
}

pre,
code {
  white-space: pre-wrap;
}

summary {
  cursor: pointer;
}

/* Add scroll margin to all elements that can be targeted */
[id],
[tabindex] {
  scroll-margin-top: 2ex;
}

/*
1. Maintain `hidden` behavior when overriding `display` values with any specificity greater than a class/attribute.
*/
[hidden] {
  display: none !important; /* 1 */
}

/*
  Remove all animations and transitions for people that prefer not to see them (Andy Bell)
*/
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
