/* ============================================================
   Blog posts, system hubs and their indexes. A reading layout:
   one serif column, quiet chrome, figures allowed to break wide.
   Loaded after base.css, which holds the tokens and the reset.
   ============================================================ */

/* Everything sits in one centred column unless it opts out. */
.title-block, .index-header, .prose, .tags, .after-section, .after-link, .list, .draft-banner,
.page > .cards, .page > .empty {
  width: min(var(--column), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

/* ---------- chrome ---------- */
.topbar { border-bottom: 1px solid var(--rule); }
.topbar-inner {
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin: 0 auto; padding: 0 var(--gutter); height: 57px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; text-decoration: none; }
.topbar-link { font-size: 0.92rem; color: var(--muted); text-decoration: none; }
.topbar-link:hover, .topbar-name:hover { color: var(--text); }

.page { padding: 3.5rem 0 5rem; }

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 2rem var(--gutter); text-align: center;
  font-size: 0.85rem; color: var(--muted);
}
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--text); }

.draft-banner {
  font-size: 0.85rem; color: var(--warn); margin-bottom: 2rem;
  border-left: 3px solid var(--warn); padding-left: 0.75rem;
}

/* ---------- title block ---------- */
.title-block { margin-bottom: 2.5rem; }
.kicker {
  display: inline-block; margin-bottom: 0.9rem;
  font-size: 0.78rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent); text-decoration: none;
}
.kicker:hover { text-decoration: underline; text-underline-offset: 3px; }
.title-block h1, .index-header h1 {
  font-family: var(--sans); font-weight: 700;
  font-size: clamp(2rem, 5vw, 2.75rem); line-height: 1.15; letter-spacing: -0.022em;
}
.subtitle {
  font-family: var(--sans); font-size: clamp(1.15rem, 2.6vw, 1.375rem); line-height: 1.4;
  color: var(--muted); margin-top: 0.75rem;
}
.subtitle a { color: inherit; }

.byline { display: flex; align-items: center; gap: 0.75rem; margin-top: 1.75rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--rule); }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.byline-name { font-size: 0.95rem; font-weight: 500; }
.byline-meta { font-size: 0.875rem; color: var(--muted); }

.stack { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin-top: 1.25rem; }
.stack li, .tags li {
  font-size: 0.8rem; color: var(--muted);
  background: var(--surface); border-radius: 100px; padding: 0.3rem 0.8rem;
}

/* ---------- prose ---------- */
.prose {
  font-family: var(--serif); font-size: 1.25rem; line-height: 1.6; letter-spacing: -0.003em;
}
.prose > * + * { margin-top: 1.4em; }
.prose h2, .prose h3 {
  position: relative; font-family: var(--sans); font-weight: 700; letter-spacing: -0.016em; line-height: 1.25;
  scroll-margin-top: 1.5rem;
}
.prose h2 { font-size: 1.6rem; margin-top: 2.2em; }
.prose h3 { font-size: 1.3rem; margin-top: 1.8em; }
.prose h2 + *, .prose h3 + * { margin-top: 0.6em; }
.prose .anchor {
  position: absolute; left: -1em; width: 1em; color: var(--muted);
  text-decoration: none; opacity: 0; transition: opacity 0.15s ease;
}
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose .anchor:focus { opacity: 1; }
.prose a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { color: var(--accent); }
.prose strong { font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.6em; }
.prose li + li { margin-top: 0.5em; }
.prose li::marker { color: var(--muted); }
.prose hr { border: 0; text-align: center; margin: 2.5em 0; }
.prose hr::after { content: '· · ·'; color: var(--muted); letter-spacing: 0.6em; }
.prose img { max-width: 100%; height: auto; display: block; margin-inline: auto; }

/* ---------- figures ---------- */
.figure { margin-top: 2.2em; margin-bottom: 2.2em; }
.figure > svg { display: block; width: 100%; height: auto; color: var(--text); }
.figure figcaption {
  font-family: var(--sans); font-size: 0.875rem; line-height: 1.4; color: var(--muted);
  text-align: center; margin-top: 0.75rem;
}
.figure-wide {
  width: min(var(--wide), 100vw - 2 * var(--gutter));
  position: relative; left: 50%; transform: translateX(-50%);
}

/* ---------- code ---------- */
.prose :not(pre) > code {
  font-family: var(--mono); font-size: 0.8em;
  background: var(--code-bg); border-radius: 4px; padding: 0.12em 0.35em;
}
.prose pre, .prose pre.shiki {
  font-family: var(--mono); font-size: 0.9375rem; line-height: 1.6;
  background: var(--code-bg) !important;
  border-radius: 6px; padding: 1.1rem 1.25rem;
  overflow-x: auto; max-width: 100%;
}
.prose pre code { font-size: inherit; }
.code-block { margin-top: 1.4em; }
.code-file {
  font-family: var(--mono); font-size: 0.8rem; color: var(--muted);
  margin-bottom: 0.4rem;
}
@media (prefers-color-scheme: dark) {
  .shiki, .shiki span { color: var(--shiki-dark) !important; }
}

/* ---------- quotes and callouts ---------- */
.prose blockquote, .callout {
  border-left: 3px solid var(--text);
  padding-left: 1.25rem;
  font-style: italic;
}
.callout-note { border-left-color: var(--accent-2); }
.callout-warning { border-left-color: var(--warn); }
.callout-aside { border-left-color: var(--rule); color: var(--muted); }
.callout strong:first-child { font-style: normal; font-family: var(--sans); font-size: 0.85em; letter-spacing: 0.02em; }
.prose blockquote > * + *, .callout > * + * { margin-top: 0.8em; }

/* ---------- stats ---------- */
.stats { display: flex; flex-wrap: wrap; margin-top: 2em; margin-bottom: 2em; }
.stats > div { flex: 1 1 8rem; padding: 0.25rem 1.25rem; border-left: 1px solid var(--rule); }
.stats > div:first-child { border-left: 0; padding-left: 0; }
.stats b { display: block; font-family: var(--sans); font-weight: 700; font-size: 2.25rem; line-height: 1.1; letter-spacing: -0.02em; }
.stats span { display: block; font-family: var(--sans); font-size: 0.85rem; line-height: 1.35; color: var(--muted); margin-top: 0.35rem; }
@media (max-width: 560px) {
  .stats > div { flex-basis: 45%; border-left: 0; padding: 0.75rem 0; }
}

/* ---------- tables ---------- */
.prose table {
  display: block; overflow-x: auto; width: 100%;
  border-collapse: collapse; font-family: var(--sans); font-size: 0.95rem; line-height: 1.45;
}
.prose th, .prose td { text-align: left; vertical-align: top; padding: 0.6rem 1rem 0.6rem 0; border-bottom: 1px solid var(--rule); }
.prose th { font-weight: 500; color: var(--muted); border-bottom-color: var(--text); }

/* ---------- footnotes ---------- */
.prose .footnotes { font-size: 1rem; color: var(--muted); border-top: 1px solid var(--rule); padding-top: 1.25rem; margin-top: 3em; }
.prose .footnotes ol { padding-left: 1.2em; }
.prose sup a { text-decoration: none; font-family: var(--sans); font-size: 0.75em; }

/* ---------- after the article ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin-top: 3rem; }
.after-section { margin-top: 3.5rem; }
.after-heading { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.after-link { margin-top: 2rem; font-size: 0.95rem; }
.after-link a { color: var(--accent); text-decoration: none; }
.after-link a:hover { text-decoration: underline; text-underline-offset: 3px; }

.cards { list-style: none; display: grid; gap: 0.75rem; }
.card { background: var(--surface); border-radius: 8px; }
.card > a { display: block; padding: 1.1rem 1.25rem; text-decoration: none; }
.card-current { padding: 1.1rem 1.25rem; box-shadow: inset 3px 0 0 var(--accent); }
.card-title { font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.card > a:hover .card-title { text-decoration: underline; text-underline-offset: 3px; }
.card-summary { color: var(--muted); font-size: 0.95rem; margin-top: 0.3rem; }
.card-meta { color: var(--muted); font-size: 0.8rem; margin-top: 0.5rem; }

/* ---------- index list ---------- */
.index-header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--rule); }
.empty { color: var(--muted); }


