:root {
  --size-300: 0.75rem;
  --size-400: 1rem;
  --size-500: 1.33rem;
  --size-600: 1.77rem;
  --size-700: 2.36rem;
  --size-800: 3.15rem;
  --size-900: 4.2rem;
  --bg-color: #fafafa;
  --text-color: #333;
  --font-sans-serif: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
    "Segoe UI Symbol", "Noto Color Emoji";
  --font-serif: Charter, Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", "Menlo", "Consolas", "Ubuntu Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #333;
    --text-color: #fafafa;
  }
}

html {
  font-size: 100%;
  font-family: var(--font-sans-serif);
  scrollbar-color: var(--text-color) var(--bg-color);
  color-scheme: light dark;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  display: grid;
  row-gap: 4em;
  grid-template-columns: 1fr min(90vw, 100%) 1fr;
  grid-template-rows: auto 1fr auto;
  padding: var(--size-400);
  margin: 0;
}

header,
main,
footer {
  grid-column: 2;
}

header ul {
  list-style: none;
  margin: 0;
  display: flex;
  justify-content: flex-end;
  gap: 2rem;
}

footer {
  border-top: 2px solid;
  display: grid;
  --padding: 1.5rem 0;
  gap: 0.5rem;
}

footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

form {
  display: grid;
  place-items: start;
  gap: 1rem;
}

label {
  display: grid;
}

input,
textarea {
  padding: 0.5rem;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  background-color: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--text-color);
}

a:not([class]) {
  color: currentColor;
}

:focus {
  outline: 2px solid;
  outline-offset: 0.25rem;
}

[href]:hover {
  text-decoration: none;
}

::selection {
  color: var(--bg-color, #fff);
  background: var(--text-color, rgba(0, 0, 0, 0.99));
}

article {
  font-family: var(--font-serif);
}

article a {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-sans-serif);
  line-height: 1.3;
}

h1,
h2 {
  font-weight: 900;
}

h1 {
  font-size: var(--size-700);
}

h2 {
  font-size: var(--size-600);
}

h3 {
  font-size: var(--size-600);
}

figcaption {
  font-size: var(--size-300);
  font-style: italic;
  margin-top: 1rem;
}

blockquote {
  padding-left: var(--size-600);
  border-left: 5px solid;
  font-style: italic;
}

h1 {
  max-width: 15ch;
}

h2,
h3 {
  max-width: 25ch;
}

p,
li {
  max-width: 65ch;
}

pre {
  max-width: 100ch;
}

/* utils */
.flow > * + * {
  margin-top: var(--flow-space, 1em);
}

.stack {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.stack > * {
  margin-top: 0;
  margin-bottom: 0;
}

.stack > * + * {
  margin-top: var(--space, 1.5rem);
}

.box {
  padding: var(--padding, 1.5rem);
}

/* utils end */

.post {
  --flow-space: var(--size-700);
}

.post time {
  --flow-space: var(--size-400);
}

.post :is(h2, h3) {
  --flow-space: var(--size-900);
}

.post :is(h2, h3) + * {
  --flow-space: var(--size-400);
}

.post figure,
.post figure + * {
  --flow-space: var(--size-900);
}

@media (min-width: 45em) {
  h1 {
    font-size: var(--size-900);
  }

  h2 {
    font-size: var(--size-700);
  }

  p,
  li,
  th,
  td,
  time,
  pre {
    font-size: var(--size-500);
  }

  figcaption {
    font-size: var(--size-400);
  }

  blockquote p {
    font-size: var(--size-600);
    max-width: 40ch;
  }

  .post time {
    font-size: var(--size-600);
  }
}

.list {
  --space: 2.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.list > li {
  display: grid;
  gap: 0.5rem;
}