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

/* Remove default margin */
body,
h1,
h2,
h3,
h4,
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 */
ul[role="list"],
ol[role="list"] {
  list-style: none;
}

/* Set core root defaults */
html:focus-within {
  scroll-behavior: smooth;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  text-rendering: optimizeSpeed;
  line-height: 1.5;
}

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

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

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font: inherit;
}

/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
@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;
  }
}

/* Design tokens  */

:root {
  --bg: #fcfcf1;
  --accent-1: #0b324d;
  --accent-2: #c55937;
}

/* Layout */

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 5vh clamp(1rem, 5vw, 3rem) 1rem;
  font-family: system-ui, sans-serif;
  line-height: 1.5;
  color: #222;
}

body > * {
  --layout-spacing: max(8vh, 3rem);
  --max-width: 70ch;
  width: min(100%, var(--max-width));
  margin-left: auto;
  margin-right: auto;
}

header,
main,
main > * + * {
  margin-top: var(--layout-spacing);
}

body > footer {
  margin-top: auto;
  padding-top: var(--layout-spacing);
}

body > footer div {
  border-top: 1px solid #ccc;
  padding-top: 0.5em;
  font-size: 0.9rem;
  color: #767676;
}

article * + * {
  margin-top: 1em;
}

/* Typography */
:is(h1, h2, h3) {
  line-height: 1.2;
}

:is(h1, h2) {
  max-width: 40ch;
}

:is(h2, h3):not(:first-child) {
  margin-top: 2em;
}

a {
  color: navy;
  text-underline-offset: 0.08em;
}

a:focus {
  outline: 1px solid currentColor;
  outline-offset: 0.2em;
}

/* Media */

article img {
  display: block;
  width: 100%;
  min-height: 20rem;
  max-height: 40vh;
  object-fit: cover;
  margin: 2rem auto;
}

@supports (aspect-ratio: 1) {
  article img {
    max-height: unset;
    aspect-ratio: 3/2;
  }
}

/* Supporting Content */

code:not([class*="language"]) {
  font-family: Consolas, Monaco, Andale Mono, Ubuntu Mono, monospace;
  font-size: 1.75ex;
  color: #444;
  background-color: rgba(0, 0, 0, 0.1);
  padding-right: 0.15em;
  padding-left: 0.15em;
}

blockquote {
  margin: 2rem 0;
  padding: 0.5em 1rem;
  border-left: 3px solid rgba(0, 0, 0, 0.35);
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 0 0.25rem 0.25rem 0;
}
