/* The generated news feed (/articles/ and /articles/<slug>/).
   Loaded only by the build-generated pages; index.html and the legal pages keep
   their own styling. Everything here is composed from the tokens and components
   in site.css (same palette, radii, fonts) — no second design language. */

/* ── Feed list ─────────────────────────────────────────────────────────────── */
.news-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  text-decoration: none;
  color: inherit;
}
.news-row:last-child { border-bottom: none; }
.news-row:hover { background: var(--bg-subtle); text-decoration: none; }
.news-row .file-icon { padding-top: 1px; }
.news-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.news-row-title { color: var(--link); font-weight: 600; font-size: 0.92rem; line-height: 1.4; }
.news-row:hover .news-row-title { text-decoration: underline; }
.news-row-desc { color: var(--text-secondary); font-size: 0.84rem; line-height: 1.5; }
.news-row-meta { display: flex; align-items: center; gap: 10px; padding-top: 1px; }
.news-row-meta time {
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  white-space: nowrap;
}
.news-foot { margin-top: 14px; font-size: 0.8rem; color: var(--text-muted); }

/* Active item in the top navigation (the generated pages sit under News). */
.topnav-links a.active { background: var(--nav-dark-hover); color: #fff; }

/* ── Single entry ──────────────────────────────────────────────────────────── */
.entry-path {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entry-path a { color: var(--link); }

.article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 26px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.article-meta .dot { color: var(--border); }
.article-lead {
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 860px;
  margin: 2px 0 20px;
}

/* Markdown body. Scoped to .article-body so the landing page's README is not
   affected: index.html uses .readme-body on its own. */
.article-body h1 { margin-top: 12px; }
.article-body h2 { margin-top: 34px; }
.article-body h3 { margin-top: 24px; }
.article-body p { font-size: 0.95rem; line-height: 1.7; }
.article-body ul,
.article-body ol { margin: 0 0 16px; padding-left: 22px; max-width: 860px; }
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body li { font-size: 0.95rem; line-height: 1.65; margin-bottom: 5px; }
.article-body li::marker { color: var(--text-muted); }
.article-body strong { font-weight: 600; }
.article-body hr { border: 0; border-top: 1px solid var(--border-light); margin: 30px 0; }
.article-body blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 18px;
  margin: 20px 0;
  max-width: 860px;
  color: #274207;
}
.article-body blockquote p { margin: 0; color: inherit; font-size: 0.92rem; }

.article-body pre {
  background: var(--nav-dark);
  border: 1px solid #30363d;
  border-radius: var(--radius);
  padding: 14px 18px;
  overflow-x: auto;
  margin: 18px 0 20px;
  max-width: 860px;
}
.article-body pre code {
  background: transparent;
  padding: 0;
  color: #e6edf3;
  font-size: 0.84rem;
  line-height: 1.7;
  display: block;
  white-space: pre;
}

.article-body table {
  border-collapse: collapse;
  margin: 18px 0 22px;
  font-size: 0.88rem;
}
.article-body th,
.article-body td { border: 1px solid var(--border); padding: 6px 12px; text-align: left; }
.article-body th { background: var(--bg-subtle); font-weight: 600; }

/* Heading permalinks from markdown-it-anchor: hidden until the heading is hovered
   so the entry reads normally, but every section stays linkable. */
.article-body .header-anchor { color: var(--text-muted); opacity: 0; margin-left: 6px; text-decoration: none; font-weight: 400; }
.article-body h2:hover .header-anchor,
.article-body h3:hover .header-anchor,
.article-body .header-anchor:focus { opacity: 1; }

/* Figures: markdown title becomes the caption. */
.article-figure { margin: 22px 0; }
.article-figure img {
  display: block;
  max-width: 100%;
  max-height: 620px;
  width: auto;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
  cursor: zoom-in;
}
.article-figure figcaption {
  margin-top: 8px;
  font-size: 0.79rem;
  color: var(--text-muted);
  max-width: 860px;
}

/* Mermaid: rendered client-side into an SVG inside the same box. */
.mermaid {
  margin: 22px 0;
  padding: 16px;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  text-align: center;
}
.mermaid svg { max-width: 100%; height: auto; }
/* Unrendered source (mermaid blocked or syntax error) must stay readable. */
.mermaid:not([data-processed='true']) {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: left;
  white-space: pre-wrap;
}

/* Footnotes from markdown-it-footnote. */
.article-body .footnotes { margin-top: 30px; border-top: 1px solid var(--border-light); font-size: 0.85rem; }
.article-body .footnotes-sep { display: none; }
.article-body .footnotes-list { padding-left: 20px; }
.article-body .footnote-ref a { font-weight: 600; }

/* Pager between entries. */
.entry-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.pager-link {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  text-decoration: none;
}
.pager-link:hover { background: var(--bg-subtle); text-decoration: none; }
.pager-older { text-align: right; }
.pager-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.pager-title { font-size: 0.87rem; font-weight: 600; color: var(--link); }
.back-link { margin-top: 18px; font-size: 0.85rem; }

/* ── Mobile ────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .news-row { grid-template-columns: 18px minmax(0, 1fr); }
  .news-row-meta { grid-column: 2; padding-top: 2px; }
  .entry-pager { grid-template-columns: 1fr; }
  .pager-older { text-align: left; }
  .article-body { padding-left: 0; padding-right: 0; }
}
