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

:root {
  --weight-text: 500;
  --weight-medium: 600;
  --weight-bold: 700;
  --weight-heavy: 800;
  --weight-black: 900;
}

/* Only WebKit knows -apple-system-body, and only WebKit has ui-rounded, so
   everywhere else falls back to system-ui, a step heavier. */
@supports not (font: -apple-system-body) {
  :root {
    --weight-text: 600;
    --weight-medium: 700;
    --weight-bold: 800;
    --weight-heavy: 860;
    --weight-black: 940;
  }
}

html {
  font-family: ui-rounded, system-ui, sans-serif;
  font-weight: var(--weight-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  color-scheme: light dark;
  letter-spacing: -0.04em;
}

body {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: max-content auto max-content;
  gap: 2rem;
  place-items: center;
  padding: 1rem;
  background-color: light-dark(#c6c3be, #201f1e);
  color: light-dark(#201f1e, #f0eee9);
  background-image: light-dark(
    url(/images/mold-grain-light.png),
    url(/images/mold-grain-dark.png)
  );
  background-repeat: repeat;
  background-size: 512px;

  > * {
    max-width: 768px;
  }
}

@media (min-resolution: 2dppx) {
  body {
    background-size: 256px;
  }
}
@media (min-resolution: 3dppx) {
  body {
    background-size: 170.667px;
  }
}

a {
  color: light-dark(#201f1e, #f0eee9);
  text-decoration: underline;
}

header {
  align-items: center;
  display: flex;
  height: 36px;
  justify-content: space-between;
  width: 100%;
  row-gap: 1rem;

  > a {
    display: flex;
    flex-direction: row;
    align-items: center;
    column-gap: 0.5rem;
    color: light-dark(#0c0a09, #f5f5f4);
  }

  picture {
    height: 36px;

    img {
      width: 36px;
      height: 36px;
    }
  }

  h4 {
    line-height: 1rem;
  }
}

nav {
  margin-left: auto;

  ul {
    display: flex;
    list-style: none;
    gap: 1rem;
  }
}

main {
  display: flex;
  flex-direction: column;
  align-self: flex-start;

  &.center {
    align-items: center;
  }
  &.not-found {
    margin-block-start: 5rem;
  }

  ul {
    margin-inline-start: 1rem;
    margin-block-end: 1rem;

    li {
      margin-block-end: 0.25rem;
    }
  }
}

h1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 3.5rem;
  font-weight: var(--weight-heavy);
  letter-spacing: -0.05em;
  text-align: center;
  line-height: 3rem;

  small {
    font-size: 1.4rem;
    font-weight: var(--weight-medium);
    text-wrap: balance;
    letter-spacing: -0.04em;
  }
}

h2 {
  font-size: 1.75rem;
  margin-block-end: 0.5rem;
  font-weight: var(--weight-bold);
  letter-spacing: -0.05em;
}

h3 {
  font-size: 1.5rem;
  margin-block-start: 1.5rem;
  margin-block-end: 0.5rem;
  font-weight: var(--weight-bold);
  letter-spacing: -0.05em;
}
h4 {
  font-size: 1.5rem;
  font-weight: var(--weight-heavy);
  letter-spacing: -0.05em;
}
h5 {
  font-size: 1.1rem;
  margin-block-start: 1.5rem;
  margin-block-end: 0.5rem;
}

p {
  margin-block-end: 1rem;
}

picture.icon {
  display: block;
  max-width: 96px;
  margin-inline: auto;
  margin-block: 2rem 3rem;

  img {
    width: 100%;
    height: auto;
  }
}

.last-updated {
  margin-block-start: 2rem;
}

/* The home page's pill, as a link. */
a.download {
  display: inline-flex;
  align-items: baseline;
  column-gap: 0.6rem;
  margin-block: 0.5rem 1rem;
  padding: 0.7rem 1.4rem;
  border-radius: 2rem;
  font-size: 1.2rem;
  font-weight: var(--weight-black);
  letter-spacing: -0.04em;
  text-decoration: none;
  background-color: light-dark(#201f1e, #f0eee9);
  color: light-dark(#f0eee9, #201f1e);
  box-shadow:
    inset 0 1px 0 light-dark(rgb(255 255 255 / 0.12), rgb(255 255 255 / 0.75)),
    inset 0 -1px 0 light-dark(rgb(0 0 0 / 0.35), rgb(0 0 0 / 0.08)),
    0 1px 2px rgb(0 0 0 / 0.12),
    0 0.75rem 2rem -1rem rgb(0 0 0 / 0.45);

  @supports (corner-shape: superellipse(1.1)) {
    corner-shape: superellipse(1.1);
    border-radius: 3rem;
  }

  small {
    font-size: 0.8rem;
    font-weight: var(--weight-medium);
    letter-spacing: 0;
    opacity: 0.7;
  }
}

@view-transition {
  navigation: auto;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}
