/* Very Smol Reset */
* {
  box-sizing: border-box;
  margin: 0;
}

/* Layout */

body {
  min-height: 100vh;
  font-family: system-ui, sans-serif;
  line-height: 1.5;
  background-color: #f9f9f9;
  color: #222;
}

.home {
  display: grid;
  row-gap: 5vh;

  .sidebar {
    text-align: center;

    ol {
      justify-content: center;
      text-align: left;
    }
  }

  @media (min-width: 100ch) {
    grid-template-columns: auto minmax(0, 1fr);

    .sidebar {
      text-align: left;

      ol {
        position: sticky;
        top: 1rem;
        justify-content: start;
      }
    }

    main {
      margin-right: auto;
      margin-left: auto;
    }
  }
}

.sidebar,
.home main {
  padding: 2rem;
  width: min(100%, 100vw, 120ch);
}

.sidebar {
  .sitenav {
    margin-top: 2rem;
    height: calc(100% - 200px);

    h1 {
      white-space: nowrap;
    }

    h2 {
      color: hsl(0, 0%, 45%);
      font-size: 1.15rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    ol {
      display: grid;
      gap: 0.5rem;
      margin: 0 0 0 -0.5em;
      padding-bottom: 0.5em;
      padding-left: 1.85em;
      max-height: calc(100vh - 2rem);
      overflow-y: auto;

      ::marker {
        color: hsl(0, 0%, 45%);
      }

      a {
        text-decoration: none;

        &:hover {
          text-decoration: underline;
          text-decoration-style: wavy;
          text-underline-offset: 0.15em;
        }
      }
    }
  }

  header {
    display: grid;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed hsl(0, 0%, 60%);

    p {
      font-size: 0.9rem;
    }
  }
}

.page {
  header {
    display: grid;
    place-content: center;
    min-height: 20vh;
  }

  header,
  main {
    width: min(80ch, 100vw - 3rem);
    margin-right: auto;
    margin-left: auto;
  }
}

/* Typography */

:is(h1, h2:not(.anchor *), h3) {
  line-height: 1.2;
  margin-bottom: 0.65em;
}

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

.description {
  max-width: 80ch;
}

.description p {
  margin-top: 1em;
  font-size: 1.15rem;
}

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

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

[id] {
  scroll-margin-top: 2em;
}

.anchor {
  display: grid;
  grid-template-columns: min-content auto;

  &:not(:first-of-type) {
    margin-top: max(8vh, 4rem);
  }

  a {
    grid-row-start: 1;
    align-self: start;
    font-size: 1rem;
    line-height: 1;
    transform: translateX(-50%) translateY(25%);
    text-decoration: none;
    opacity: 0.75;
  }
}

.contributor {
  font-size: 0.8rem;
  color: hsl(0, 0%, 45%);
}

.hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* Media */

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Supporting Content */

blockquote {
  width: fit-content;
  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;
}
