:root {
  color-scheme: light dark;

  --dark-grey: hsl(0, 0%, 50%);
  --grey: hsl(0, 0%, calc(100% * 2 / 3));
  --light-grey: hsl(0, 0%, calc(100% * 5 / 6));

  --body-color: hsl(0, 0%, 20%);
  --body-bg: hsl(0, 0%, 100%);

  --heading-color: hsl(0, 0%, 0%);

  --link-color: hsl(200, 100%, 30%);
  --link-bg: hsl(200, 100%, 92.5%);

  --small-font-size: 0.85rem;

  --mode-transition: background-color 0.1s ease, color 0.1s ease;

  background: var(--body-bg);
  color: var(--body-color);

  transition: var(--mode-transition);

  font: 400 16px/1.5 Helvetica, Arial, sans-serif;

  -webkit-font-smoothing: antialiased;

  overflow-wrap: break-word;
  text-wrap: pretty;
}

@media (prefers-color-scheme: dark) {
  :root {
    --body-color: hsl(0, 0%, 80%);
    --body-bg: hsl(0, 0%, 0%);
    --heading-color: hsl(0, 0%, 100%);

    --link-color: hsl(200, 100%, 80%);
    --link-bg: hsl(200, 100%, 20%);

    --dark-grey: var(--grey);
    --light-grey: hsl(0, 0%, 25%);
  }
}

*:not(dialog) {
  margin: 0;
}

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

iframe {
  width: 100%;
}

/* Container */

body {
  max-width: 65ch;
  padding: 2rem;
  margin: 0 auto;
}

/* Links */

:not(.image-gallery, .image-gallery-grid) > a {
  text-decoration: none;
  color: var(--link-color);
  background-color: var(--link-bg);
  transition: var(--mode-transition);
  padding: 2px 1px 0 1px;

  &:hover {
    text-decoration: underline;
  }
}

/* Headings */

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  font-weight: lighter;
  transition: var(--mode-transition);
  color: var(--heading-color);
  text-transform: lowercase;
}

h1 {
  margin-top: 0;
  margin-bottom: 1.75rem;

  font-size: 1.875rem;

  text-align: center;
}

h2 {
  margin-top: 2rem;
  margin-bottom: 1rem;

  border-bottom: 1px dashed var(--grey);

  font-size: 1.5rem;
  line-height: 1.2;
}

h3 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;

  border-bottom: 1px dashed var(--grey);

  font-size: 1.25rem;
  line-height: 1.2;
}

/* Footer */

footer {
  border-top: 1px solid var(--light-grey);

  margin-top: 2.5rem;
  padding-top: 1.5rem;

  text-align: center;
  transition: var(--mode-transition);
  color: var(--grey);
}

/* Typography */

p {
  margin-bottom: 1rem;
  text-align: justify;
}

ul {
  list-style: circle;
  padding-left: 2rem;
}

:not(.grid-list) > li {
  padding-left: 0.5rem;
}

pre {
  white-space: break-spaces;
}

/* Grid lists */

aside, small {
  font-size: var(--small-font-size);
}

aside {
  transition: var(--mode-transition);
  color: var(--dark-grey);
}

.grid-list {
  list-style: none;
  padding: 0;

  li {
    display: grid;
    grid-template-columns: 8rem 1fr;
    column-gap: 1rem;

    time, div {
      padding: 0.5rem 0;
    }

    time {
      font-family: 'Courier New', monospace;
      font-size: var(--small-font-size);
      letter-spacing: 0.025em;
      text-transform: uppercase;
    }

    div {
      margin: 0;
    }
  }
}

@media (max-width: 30rem) {
  .grid-list li {
    grid-template-columns: 1fr;

    time {
      padding-bottom: 0;
      margin-bottom: -0.5rem;
    }
  }
}

/* Utilities */

.magenta {
  color: hsl(330, 100%, 50%);
}

.cols-2 {
  column-count: 2;
}

.view-all {
  margin-top: 1.5rem;
  text-align: center;
}

/* Multimedia */

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  margin-bottom: 1rem;
}

.image-gallery-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;

  margin-bottom: 1.5rem;
}

/* Other crap */

input, button, textarea, select {
  font: inherit;
}

