/* Blog-specific styles. Reuses variables from styles.css. */

.blog-content {
  max-width: 680px;
  margin: 0 auto;
  min-height: calc(100vh - 4em); /* body has padding: 2em on top and bottom */
  display: flex;
  flex-direction: column;
}

.blog-content > footer {
  margin-top: auto;
}

.blog-header {
  margin-bottom: 2.5em;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1em;
  justify-content: space-between;
}

.blog-header h1 {
  margin-bottom: 0;
}

.blog-brand {
  font-weight: 600;
  text-decoration: none;
  color: inherit;
}

.blog-brand:hover {
  text-decoration: underline;
}

.blog-nav {
  display: flex;
  gap: 0.75em;
  font-size: 0.95em;
}

.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  margin-bottom: 1.25em;
  line-height: 150%;
  display: grid;
  grid-template-columns: 6em 1fr;
  column-gap: 0.5em;
  align-items: baseline;
}

.post-date {
  color: var(--secondary-text);
  font-variant-numeric: tabular-nums;
  font-size: 0.9em;
}

.post-title {
  font-weight: 500;
}

.post-dek {
  grid-column: 2;
  color: var(--secondary-text);
  margin-top: 0.15em;
  font-size: 0.95em;
}

@media screen and (max-width: 600px) {
  .post-list li {
    grid-template-columns: 1fr;
  }
  .post-dek {
    grid-column: 1;
  }
}

/* Single post */

article.post {
  font-size: 1.05em;
  line-height: 1.65;
}

article.post h1 {
  font-size: 2.4em;
  line-height: 1.1;
  margin-bottom: 0.3em;
  letter-spacing: -0.02em;
}

article.post .post-meta {
  color: var(--secondary-text);
  font-size: 0.95em;
  margin-bottom: 2em;
}

article.post h2 {
  font-size: 1.5em;
  margin-top: 2em;
  margin-bottom: 0.4em;
}

article.post h3 {
  font-size: 1.15em;
  margin-top: 1.5em;
  margin-bottom: 0.3em;
}

article.post p {
  margin-bottom: 1em;
}

article.post ul,
article.post ol {
  margin-bottom: 1em;
  padding-inline-start: 1.4em;
}

article.post li {
  margin-bottom: 0.4em;
}

article.post blockquote {
  border-left: 3px solid var(--secondary-text);
  margin: 1.5em 0;
  padding: 0.2em 0 0.2em 1em;
  color: var(--secondary-text);
  font-style: italic;
}

article.post code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--highlight);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

article.post pre {
  background: var(--highlight);
  padding: 1em;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1em;
  font-size: 0.9em;
  line-height: 1.5;
}

article.post pre code {
  background: none;
  padding: 0;
}

article.post img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5em auto;
  border-radius: 4px;
}

article.post figure {
  margin: 1.5em 0;
}

article.post figure figcaption {
  font-size: 0.85em;
  color: var(--secondary-text);
  text-align: center;
  margin-top: 0.4em;
}

/* Pandoc puts {.foo} on the <img>, not the wrapping <figure>. */
article.post figure img.phone {
  max-width: 320px;
}

article.post figure.evolution-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1em;
  flex-wrap: wrap;
  /* Break out of the 680px article column. */
  width: min(1100px, calc(100vw - 4em));
  margin-left: 50%;
  transform: translateX(-50%);
  margin-top: 2em;
  margin-bottom: 2em;
}

article.post figure.evolution-pair img {
  margin: 0;
  height: clamp(320px, 40vw, 480px);
  width: auto;
  flex: 0 0 auto;
  min-width: 0;
}

article.post figure.evolution-pair figcaption {
  flex-basis: 100%;
}

@media (max-width: 700px) {
  article.post figure.evolution-pair {
    width: 100%;
    margin-left: 0;
    transform: none;
  }
  article.post figure.evolution-pair img:not(.mobile) {
    display: none;
  }
  article.post figure.evolution-pair img.mobile {
    max-height: none;
    max-width: 100%;
  }
}

article.post table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95em;
}

article.post th,
article.post td {
  text-align: left;
  padding: 0.5em 0.75em;
  border-bottom: 1px solid var(--secondary-text);
}

article.post th {
  font-weight: 600;
}

article.post hr {
  border: none;
  border-top: 1px solid var(--secondary-text);
  margin: 2.5em auto;
  width: 40%;
  opacity: 0.4;
}

.post-footer {
  margin-top: 3em;
  padding-top: 1.5em;
  border-top: 1px solid var(--secondary-text);
  color: var(--secondary-text);
  font-size: 0.95em;
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
  justify-content: space-between;
}
