.post-body {
  color: var(--color-text-secondary);
  font-size: 1.0625rem;
  line-height: 1.75;
}

.post-body > * + * { margin-top: 1.3em; }

/* --- headings --- */
.post-body h1 {
  color: var(--color-text);
  font-size: 2.0rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-top: 2.2em;
  margin-bottom: 0.7em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--color-border);
  scroll-margin-top: 6rem;
}

.post-body h2 {
  color: var(--color-text);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-top: 2.2em;
  margin-bottom: 0.7em;
  padding-bottom: 0.3em;
  scroll-margin-top: 6rem;
}

.post-body h3 {
  color: var(--color-text);
  font-size: 1.27rem;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 1.8em;
  margin-bottom: 0.5em;
  scroll-margin-top: 6rem;
}

.post-body h4 {
  color: var(--color-text);
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.5em;
  margin-bottom: 0.4em;
}

/* --- links --- */
.post-body a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: opacity 0.15s ease;
}
.post-body a:hover { opacity: 0.8; }

/* --- emphasis --- */
.post-body strong { color: var(--color-text); font-weight: 600; }
.post-body em { font-style: italic; }

/* --- lists --- */
.post-body ul,
.post-body ol {
  padding-left: 1.5em;
  margin-top: 1.3em;
  margin-bottom: 1.3em;
}
.post-body ul { list-style-type: disc; }
.post-body ol { list-style-type: decimal; }
.post-body li { margin-top: 0.5em; padding-left: 0.3em; }
.post-body li::marker { color: var(--color-border); }

.post-body li > ul,
.post-body li > ol { margin-top: 0.5em; margin-bottom: 0.5em; }

/* --- blockquote --- */
.post-body blockquote {
  border-left: 3px solid var(--color-link);
  padding: 0.2em 0 0.2em 1.1em;
  color: var(--color-text-secondary);
  font-style: italic;
}
.post-body blockquote p { margin-top: 0.6em; }
.post-body blockquote p:first-child { margin-top: 0; }

/* --- rule --- */
.post-body hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin-top: 2.75em;
  margin-bottom: 2.75em;
}

/* --- tables --- */
/* overflow-x is only a fallback for a table too wide even after its
   cells are kept short; the card layout below covers narrow screens. */
.post-body .table-wrap {
  overflow-x: auto;
  margin-top: 1.5em;
  margin-bottom: 1.5em;
}
.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
  line-height: 1.5;
}
.post-body th,
.post-body td {
  border: 1px solid var(--color-border);
  padding: 0.5em 0.65em;
  text-align: left;
}
.post-body th {
  background: var(--color-background-secondary);
  color: var(--color-text);
  font-weight: 600;
}
/* The first column names the row (a tool, a checkpoint), so it reads as a
   row header. */
.post-body td:first-child {
  color: var(--color-text);
  font-weight: 600;
}

/* Narrow screens: each row becomes a card of label/value pairs,
   using the data-label MarkdownRenderer copies from the header. */
@media (max-width: 820px) {
  .post-body thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .post-body table,
  .post-body tbody,
  .post-body tr,
  .post-body td {
    display: block;
  }
  .post-body tr {
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    overflow: hidden;
  }
  .post-body tr + tr { margin-top: 0.9em; }
  .post-body td {
    display: grid;
    grid-template-columns: 10rem 1fr;
    gap: 0.75em;
    border: 0;
    border-top: 1px solid var(--color-border);
    padding: 0.45em 0.8em;
  }
  .post-body td::before {
    content: attr(data-label);
    color: var(--color-text);
    font-weight: 600;
  }
  .post-body td:first-child {
    display: block;
    border-top: 0;
    background: var(--color-background-secondary);
    color: var(--color-text);
    font-weight: 600;
  }
  .post-body td:first-child::before { content: none; }
}

/* --- images --- */
.post-body img {
  border-radius: 0.5rem;
  border: 1px solid var(--color-border);
  margin-top: 1.6em;
  margin-bottom: 1.6em;
}

/* --- inline code (fenced blocks owned by rouge.css) --- */
.post-body :not(pre) > code {
  background: var(--color-background-secondary);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 0.12em 0.38em;
  border-radius: 0.3rem;
  font-size: 0.875em;
}

/* --- code block wrapper: spacing + frame only, colors from rouge.css --- */
.post-body pre {
  background: var(--color-background-secondary);
  border: 1px solid var(--color-border);
  margin-top: 1.6em;
  margin-bottom: 1.6em;
  padding: 1em 1.25em;
  border-radius: 1.0rem;
  overflow-x: auto;
  font-size: 0.92rem;
  line-height: 1.6;
}

/* --- code block line numbers (spans emitted by MarkdownRenderer) --- */
.post-body pre.highlight > code {
  counter-reset: rouge-line;
}

.post-body pre.highlight .line {
  display: block;
  counter-increment: rouge-line;
}

.post-body pre.highlight .line::before {
  content: counter(rouge-line);
  display: inline-block;
  width: 2.5ch;
  margin-right: 1.25em;
  text-align: right;
  color: var(--color-text-secondary);
  user-select: none;
}
