/* https://piccalil.li/blog/a-more-modern-css-reset/ */
/* Box sizing rules */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Prevent font size inflation */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  font-size: 16px;
}

/* Remove default margin in favour of better control in authored CSS */
body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin-block-end: 0;
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role="list"],
ol[role="list"] {
  list-style: none;
}

ul li::marker,
ol li::marker {
  font-weight: bold;
}

body,
input,
select,
button {
  font-family: var(--esp-font-body);
}

/* Set core body defaults */
body {
  min-height: 100vh;
  line-height: var(--esp-size-medium);
  margin: 0;
  font-size: var(--esp-type-normal);
  color: var(--esp-color-text);
}

/* Set shorter line heights on headings and interactive elements */
h1,
h2,
h3,
h4,
button,
input,
label {
  line-height: 1.1;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
  font-weight: bold;
  color: var(--esp-color-link);
}

/* Make images easier to work with */
img,
picture {
  max-width: 100%;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select,
p,
ul,
li {
  font-family: var(--esp-font-body);
  color: var(--esp-color-text);
  font-size: inherit;
}

/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
  min-height: 10em;
}

/* Anything that has been anchored to should have extra scroll margin */
:target {
  scroll-margin-block: 5ex;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: var(--esp-font-headings);
  color: var(--esp-color-headings);
  margin: var(--esp-size-small-to-normal) 0 var(--esp-size-tiny-to-small);
}

h5 {
  font-size: var(--esp-type-small);
}

h4 {
  font-size: var(--esp-type-medium);
}

h3 {
  font-size: var(--esp-type-big);
}

h2 {
  font-size: var(--esp-type-large);
}

h1 {
  font-size: var(--esp-type-huge);
}

pre,
code {
  font-family: var(--esp-font-monospace);
}

code {
  font-size: var(--esp-type-small);
  background: var(--esp-color-alt-bg-2);
  border-radius: var(--esp-size-border-radius);
  padding: 0 0.35em;
  display: inline-block;
  border: 1px dotted var(--esp-color-alt-borders);
}

pre {
  background-color: var(--esp-color-alt-bg-2) !important;
  border-radius: var(--esp-size-border-radius);
  border: 1px dotted var(--esp-color-alt-borders);

  > code {
    font-size: var(--esp-type-tiny);
    display: block;
    background: none !important;
    border: none;
    hyphens: none;
    tab-size: 2;
    white-space: pre;
    padding: var(--esp-size-padding);
    overflow: auto;
    line-height: 1.8;
  }
}

a {
  text-decoration: underline;
  text-decoration-skip-ink: auto;
  color: var(--esp-color-link);

  &:hover {
    background-color: var(--esp-color-link-hover-bg);
    color: var(--esp-color-link-hover);
    text-decoration: none;
  }
}
