/* Blog pages: a single reading column layered on the homepage tokens in /styles.css.
   Posts are Chinese, so CJK glyphs fall through Outfit to Noto Sans SC. */

.blog-page {
  font-family: "Outfit", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.post-col {
  width: min(100% - 56px, 720px);
  margin-inline: auto;
}

.post-head {
  padding: calc(var(--nav-height) + 64px) 0 34px;
  border-bottom: 1px solid var(--line);
}

.post-kicker {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-head h1 {
  margin-top: 12px;
  font-size: clamp(28px, 4.4vw, 40px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.28;
  text-wrap: balance;
}

.post-dek {
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 16.5px;
  line-height: 1.8;
}

.post-meta {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 11px;
}

/* Blog index */
.blog-list {
  padding: 30px 0 72px;
}

.blog-list .notes-list a {
  grid-template-columns: 120px 1fr 85px;
}

.blog-list .notes-list em {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 13px;
  font-style: normal;
  font-weight: 400;
}

.blog-list .section-actions a::after {
  content: none;
}

/* Article */
.prose {
  padding: 36px 0 80px;
  font-size: 16px;
  line-height: 1.9;
}

.prose > * + * {
  margin-top: 1.05em;
}

.prose h2 {
  margin-top: 2.4em;
  font-size: 23px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.prose h2 + * {
  margin-top: 0.7em;
}

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

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

.prose strong {
  font-weight: 600;
}

.prose code {
  padding: 0.08em 0.35em;
  border-radius: 4px;
  background: var(--bg-strong);
  font-family: var(--mono);
  font-size: 0.84em;
}

.prose blockquote {
  padding: 2px 0 2px 18px;
  border-left: 2px solid var(--line);
  color: var(--ink-soft);
}

.tldr {
  padding: 18px 22px 18px 20px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--bg-soft);
}

.tldr-label {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tldr ul {
  margin-top: 8px;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

.prose th,
.prose td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--bg-soft);
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.prose td.num {
  white-space: nowrap;
}

.prose tr:last-child td {
  border-bottom: 0;
}

.table-note {
  color: var(--ink-faint);
  font-size: 13px;
}

.figure-plate .plate {
  overflow-x: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfbf9; /* the figure is rendered on a light ground in both themes */
}

.figure-plate img {
  width: 100%;
  height: auto;
}

.figure-plate figcaption {
  margin-top: 10px;
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1.7;
}

.post-foot {
  margin-top: 3em;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 13.5px;
}

@media (max-width: 820px) {
  .post-col {
    width: min(100% - 36px, 720px);
  }

  /* inside the mobile menu the switch keeps its own width instead of filling the row */
  .nav-links .lang-switch {
    justify-self: start;
    width: max-content;
    margin-top: 12px;
  }
}

@media (max-width: 620px) {
  .post-head {
    padding-top: calc(var(--nav-height) + 40px);
  }

  .blog-list .notes-list a {
    grid-template-columns: 1fr auto;
  }

  .prose {
    font-size: 15.5px;
  }

  .prose th,
  .prose td {
    padding: 9px 11px;
  }

  .prose td.num {
    white-space: normal;
  }

  /* keep the heatmap legible: let the plate scroll instead of shrinking it to nothing */
  .figure-plate img {
    min-width: 620px;
  }
}

/* Language switch: English is the default; Chinese blocks show only when chosen. */
:root[data-locale="zh"] .lang-en,
:root:not([data-locale="zh"]) .lang-zh {
  display: none !important;
}

.lang-switch {
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}

.lang-switch button {
  height: 24px;
  min-width: 34px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-faint);
  font-family: var(--font);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}

.lang-switch button:hover {
  color: var(--ink);
}

.lang-switch button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  cursor: default;
}

:root:not(.js) .lang-switch {
  display: none;
}

.blog-list .notes-list small {
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 400;
}
