/* Blog pages (generated by web/vite-blog.ts). The homepage's palette: warm
   white paper and indigo ink in light mode, deep indigo with cream ink in
   dark. Engineering posts read in Literata, a serif made for long reading on
   screens; everything else is Inter, like the rest of the site. */

@import url("/site-chrome.css");

@font-face {
  font-family: "Literata";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/blog-fonts/Literata-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Literata";
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  src: url("/blog-fonts/Literata-Italic.woff2") format("woff2");
}

@font-face {
  font-family: "Literata";
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
  src: url("/blog-fonts/Literata-Bold.woff2") format("woff2");
}

/* ---- Blog index ---- */
.blog-index {
  margin: 0 auto;
  max-width: calc(var(--text) + var(--gutter) * 2);
  padding: 72px var(--gutter) 0;
}

.index-header h1 {
  font-size: clamp(44px, 7vw, 64px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0;
}

.index-lede {
  color: var(--copy);
  font-size: 19px;
  line-height: 1.55;
  margin: 18px 0 14px;
  max-width: 34em;
  text-wrap: pretty;
}

.index-header .text-link {
  font-size: 15px;
}

.index-lead {
  border-bottom: 1px solid var(--rule);
  border-top: 1px solid var(--rule-strong);
  margin-top: 56px;
  padding: 40px 0 44px;
}

.index-lead h2 {
  font-family: var(--serif);
  font-size: clamp(30px, 4.4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 10px 0 14px;
  text-wrap: balance;
}

.index-lead h2 a,
.log-entry h3 a {
  text-decoration: none;
}

.index-lead h2 a:hover,
.log-entry h3 a:hover {
  text-decoration: underline;
  text-decoration-color: var(--underline);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.index-lead > p:not(.log-meta) {
  color: var(--copy);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.6;
  margin: 0 0 22px;
  text-wrap: pretty;
}

.log-meta {
  color: var(--caption);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.index-section {
  margin-top: 72px;
}

.index-section > h2 {
  border-bottom: 1px solid var(--rule-strong);
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  padding-bottom: 12px;
}

.log,
.guide-list,
.keep-reading ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.log-entry {
  border-bottom: 1px solid var(--rule);
  padding: 28px 0 30px;
}

.log-entry h3 {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 8px 0 10px;
  text-wrap: balance;
}

.log-entry > p:last-child {
  color: var(--copy);
  font-size: 16px;
  line-height: 1.6;
  margin: 0;
  text-wrap: pretty;
}

.guide-list li {
  border-bottom: 1px solid var(--rule);
  padding: 20px 0;
}

.guide-list a,
.keep-reading a {
  color: var(--ink);
  font-size: 17px;
  font-weight: 650;
  text-decoration: none;
}

.guide-list a:hover,
.keep-reading a:hover {
  text-decoration: underline;
  text-decoration-color: var(--underline);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.guide-list p,
.keep-reading p {
  color: var(--copy);
  font-size: 15px;
  line-height: 1.55;
  margin: 6px 0 0;
  text-wrap: pretty;
}

/* ---- Posts: shared ---- */
.post {
  margin: 0 auto;
  padding: 64px var(--gutter) 0;
}

.post > * {
  margin-left: auto;
  margin-right: auto;
  max-width: var(--text);
}

.post-crumbs {
  color: var(--caption);
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 22px;
}

.post-crumbs a {
  color: var(--copy);
  text-decoration: none;
}

.post-crumbs a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-header h1 {
  font-size: clamp(34px, 5.2vw, 50px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.07;
  margin: 0;
  text-wrap: balance;
}

.post-lede {
  color: var(--copy);
  font-size: 20px;
  line-height: 1.55;
  margin: 22px 0 0;
  text-wrap: pretty;
}

.post-meta {
  border-bottom: 1px solid var(--rule);
  color: var(--caption);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  margin: 26px 0 0;
  padding-bottom: 28px;
}

.post-body {
  margin-top: 40px;
}

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

.post-body p,
.post-body ul,
.post-body ol {
  color: var(--body-ink);
  margin-top: 1.1em;
}

.post-body h2 {
  font-size: 27px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.22;
  margin-top: 2.1em;
  text-wrap: balance;
}

.post-body h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-top: 1.8em;
}

.post-body h2 + p,
.post-body h3 + p,
.post-body h2 + ul,
.post-body h3 + ul {
  margin-top: 0.6em;
}

.post-body li + li {
  margin-top: 0.45em;
}

.post-body ul,
.post-body ol {
  padding-left: 1.3em;
}

.post-body li::marker {
  color: var(--caption);
}

.post-body a {
  text-decoration: underline;
  text-decoration-color: var(--underline);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.post-body a:hover {
  text-decoration-thickness: 2.5px;
}

.post-body strong {
  color: var(--ink);
  font-weight: 700;
}

.post-body code {
  background: var(--tint);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 0.84em;
  padding: 0.12em 0.36em;
}

.post-body pre {
  background: var(--tint);
  border: 1px solid var(--rule);
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.55;
  margin-top: 1.6em;
  overflow-x: auto;
  padding: 16px 18px;
}

.post-body pre code {
  background: none;
  font-size: inherit;
  padding: 0;
}

.post-body blockquote {
  color: var(--copy);
  font-style: italic;
  margin: 1.6em 0 0;
  padding: 0 0 0 1.4em;
}

.post-body blockquote p {
  margin: 0;
}

.post-body hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.4em 0;
}

/* "In short": the post's summary box, near the top. */
.post-body .post-summary {
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: 14px;
  font-family: var(--sans);
  margin: 1.6em 0 2em;
  padding: 18px 22px 20px;
}

.post-body .post-summary h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 8px;
}

.post-body .post-summary p,
.post-body .post-summary ul {
  color: var(--body-ink);
  font-size: 17px;
  line-height: 1.55;
  margin: 0;
}

.post-body .post-summary li + li {
  margin-top: 6px;
}

/* Figures sit wider than the text when the screen allows. */
.post-body figure {
  --figure-width: min(var(--wide), calc(100vw - var(--gutter) * 2));
  margin: 2.2em 0 0 calc(50% - var(--figure-width) / 2);
  width: var(--figure-width);
}

.post-body figure img {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 10px;
  display: block;
  height: auto;
  margin: 0 auto;
  /* Tall images stop at 80% of the screen; width follows so nothing letterboxes. */
  max-height: 80vh;
  width: auto;
}

.post-body figcaption {
  color: var(--caption);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  margin: 12px auto 0;
  max-width: var(--text);
  text-wrap: pretty;
}

.figure-label {
  color: var(--ink);
  font-weight: 700;
}

/* Measurement tables: numbers line up, rules only between rows. */
.post-body .article-table {
  margin-top: 1.8em;
  overflow-x: auto;
}

.post-body table {
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
  min-width: 100%;
}

.post-body th,
.post-body td {
  border-bottom: 1px solid var(--rule);
  padding: 10px 14px 10px 0;
  text-align: left;
  vertical-align: top;
}

.post-body th {
  border-bottom-color: var(--rule-strong);
  color: var(--ink);
  font-weight: 700;
}

.post-body td {
  color: var(--body-ink);
}

/* ---- Engineering posts: long reads in Literata ---- */
.post--engineering .post-lede {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.5;
}

.post--engineering .post-body {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.72;
}

.post--engineering .post-body h2,
.post--engineering .post-body h3 {
  font-family: var(--sans);
}

.post--engineering .post-body li {
  line-height: 1.65;
}

/* ---- Guides: task first ---- */
.post--guide .post-body {
  font-size: 18px;
  line-height: 1.68;
}

.post-toc {
  background: var(--tint);
  border: 1px solid var(--rule);
  border-radius: 14px;
  margin-top: 36px;
  padding: 20px 24px 22px;
}

.post-toc h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 10px;
}

.post-toc ol {
  margin: 0;
  padding-left: 1.3em;
}

.post-toc li {
  color: var(--caption);
  font-size: 16px;
  line-height: 1.5;
  padding: 3px 0;
}

.post-toc a {
  color: var(--ink);
  text-decoration: none;
}

.post-toc a:hover {
  text-decoration: underline;
  text-decoration-color: var(--underline);
  text-underline-offset: 3px;
}

/* ---- Post endings: one block, then out ---- */
.post-end {
  border-top: 1px solid var(--rule-strong);
  margin-top: 72px;
  padding-top: 40px;
}

.keep-reading h2,
.post-task h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 6px;
}

.keep-reading li {
  border-bottom: 1px solid var(--rule);
  padding: 18px 0;
}

.post--engineering .keep-reading a {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.post-end-note {
  color: var(--copy);
  font-size: 15px;
  line-height: 1.6;
  margin: 28px 0 0;
}

.post-end-note a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--underline);
  text-underline-offset: 3px;
}

.post-task {
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: 16px;
  margin-bottom: 40px;
  padding: 24px 26px 26px;
}

.post-task h2 {
  color: var(--ink);
  font-size: 21px;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}

.post-task p {
  color: var(--copy);
  font-size: 16px;
  line-height: 1.55;
  margin: 0 0 18px;
}

.post-task-link {
  align-items: center;
  background: var(--button);
  border-radius: 10px;
  color: var(--button-ink);
  display: inline-flex;
  font-size: 16px;
  font-weight: 650;
  min-height: 44px;
  padding: 0 18px;
  text-decoration: none;
  transition: background-color 150ms ease;
}

.post-task-link:hover {
  background: var(--button-hover);
}

@media (max-width: 600px) {
  :root {
    --gutter: 20px;
  }

  .blog-index,
  .post {
    padding-top: 44px;
  }

  .post--engineering .post-body {
    font-size: 18.5px;
    line-height: 1.7;
  }

  .post--engineering .post-lede,
  .post-lede {
    font-size: 19px;
  }

  .post-body h2 {
    font-size: 24px;
  }

  .post-body figure img {
    border-radius: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
