:root {
  --grid: 24px;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1.125rem; /* 18px */
  line-height: calc(4 / 3); /* 24px = 1 grid unit */
  color: white;
  background-color: #db2442;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.15) 1px, transparent 1px);
  background-size: var(--grid) var(--grid);
  background-position: calc(var(--grid) / 2) calc(var(--grid) / 2);
  padding: calc(2 * var(--grid));
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

::selection {
  color: white;
  background-color: black;
  text-shadow: none;
}

h1 {
  margin: 0 0 calc(2 * var(--grid)) 0;
  font-weight: 300;
}

p {
  margin: 0 0 var(--grid) 0;
}

a {
  color: white;
  text-decoration-color: rgba(255, 255, 255, 0.5);
  transition: all 100ms ease-in;
}

a:hover {
  text-decoration-color: white;
}

/* Logo */

.site-logo {
  width: calc(4 * var(--grid)); /* 96px */
  margin-bottom: calc(2 * var(--grid));
}

/* Layout */

.intro {
  font-size: calc(1.5 * var(--grid)); /* 36px, line-height = 48px = 2 grid units */
}

.content {
  max-width: calc(23 * var(--grid)); /* 552px */
}

.back {
  display: inline-block;
  margin-bottom: calc(2 * var(--grid));
  font-size: 1rem;
  text-decoration: none;
}

.back span {
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.5);
  transition: all 100ms ease-in;
}

.back:hover span {
  text-decoration-color: white;
}

/* Thoughts list */

.thought-list {
  list-style: none;
  padding: 0;
  margin: 0 0 calc(3 * var(--grid)) 0; /* 72px */
}

.thought-list li {
  margin-bottom: var(--grid);
}

.thought-list .date {
  font-size: 0.875rem;
  opacity: 0.65;
  text-shadow: none;
  display: block;
  margin-top: calc(var(--grid) / 4); /* 6px */
}

/* Thought content */

.thought-body {
  max-width: calc(35 * var(--grid)); /* 840px */
}

.thought-content {
  max-width: calc(25 * var(--grid)); /* 600px */
}

.thought-meta {
  margin-bottom: calc(2 * var(--grid));
}

.thought-meta h1 {
  font-size: calc(3 * var(--grid)); /* 72px, line-height = 96px = 4 grid units */
  margin: 0;
  line-height: calc(4 / 3);
  letter-spacing: -0.02em;
  font-family: var(--font-prata);
  max-width: min(calc(50 * var(--grid)), calc(100vw - calc(3 * var(--grid))));
  text-wrap: balance;
}

.thought-meta .date {
  font-size: 0.875rem;
}

.thought-content h1,
.thought-content h2,
.thought-content h3 {
  margin-top: calc(2 * var(--grid));
  margin-bottom: calc(0.5 * var(--grid));
  font-weight: 600;
  letter-spacing: -0.01em;
}

.thought-content h2 {
  font-size: 1.375rem;
}

.thought-content h3 {
  font-size: 1.125rem;
}

.thought-content p {
  margin: 0 0 var(--grid) 0;
}

.thought-content a {
  color: white;
}

.thought-content pre {
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: 0.25rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.5;
  text-shadow: none;
}

.thought-content code {
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.125rem 0.3125rem;
  border-radius: 0.1875rem;
  text-shadow: none;
}

.thought-content pre code {
  background: none;
  padding: 0;
}

.thought-content blockquote {
  border-left: 0.1875rem solid rgba(255, 255, 255, 0.5);
  margin: calc(1.5 * var(--grid)) 0; /* 36px = 1.5 grid units */
  padding: 0 0 0 var(--grid);
  opacity: 0.8;
}

.thought-content img {
  max-width: min(50rem, calc(100vw - 3.75rem));
}

.thought-content ul,
.thought-content ol {
  padding-left: var(--grid);
  margin: 0 0 var(--grid) 0;
}

.thought-content li {
  margin-bottom: calc(0.5 * var(--grid));
}

hr {
  border: none;
  border-top: 0.0625rem solid rgba(255, 255, 255, 0.25);
  margin: calc(2 * var(--grid)) 0;
}

.signature {
  max-width: calc(2 * var(--grid)); /* 48px */
  margin-top: var(--grid);
}

@media (max-width: 768px) {
  body {
    padding: var(--grid);
  }

  .thought-meta h1 {
    font-size: calc(2 * var(--grid)); /* 48px = 2 grid units */
    max-width: min(calc(50 * var(--grid)), calc(100vw - calc(2 * var(--grid))));
  }

  .thought-content img {
    max-width: min(calc(50 * var(--grid)), calc(100vw - calc(2 * var(--grid))));
  }
}
