/* ══════════════════════════════════════════════════════════════
   Keln — the public blog.

   A reading page, not an app screen. One column, generous line
   height, and a measure that stops around 68 characters — past
   that the eye loses its place returning to the start of the next
   line, which is why every publication that cares sets a limit.

   This page is served to strangers with no login, so it loads
   theme.css for the palette and nothing else: no dashboard
   JavaScript, no canvas, no fonts that block the first paint.
   ══════════════════════════════════════════════════════════════ */

body.blog {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif, Georgia, 'Times New Roman', serif);
  -webkit-font-smoothing: antialiased;
}

/* ── Bar ───────────────────────────────────────────────────── */
.blog__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-8);
  padding: var(--s-8) var(--s-9);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(10, 14, 20, .86);
  backdrop-filter: blur(12px);
  z-index: 3;
}
.blog__home {
  font-family: var(--mono);
  font-size: var(--t-sm);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}
.blog__nav { display: flex; gap: var(--s-8); }
.blog__nav a {
  font-size: var(--t-sm);
  color: var(--muted);
  text-decoration: none;
}
.blog__nav a:hover { color: var(--accent2); }

/* ── Layout ────────────────────────────────────────────────── */
/* calc from --s-12 rather than a new --s-13: the space scale tops
   out at 32px because that is as much air as an app panel ever
   wants, and a reading page wants more. Deriving it here keeps the
   shared scale honest instead of growing it for one surface. */
.blog__wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--s-12) var(--s-9) calc(var(--s-12) * 1.5);
}
.blog__h1 {
  font-size: var(--t-3xl);
  letter-spacing: -.02em;
  margin: 0 0 var(--s-6);
}
.blog__lede {
  color: var(--muted);
  font-size: var(--t-lg);
  line-height: 1.6;
  margin: 0 0 var(--s-12);
}

/* ── Index ─────────────────────────────────────────────────── */
.blog-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4); }

.blog-card__link {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: var(--s-9) var(--s-9) var(--s-8);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: border-color .16s ease, background .16s ease;
}
.blog-card__link:hover {
  border-color: var(--border);
  background: rgba(91, 140, 255, .05);
}
.blog-card__title { font-size: var(--t-xl); letter-spacing: -.015em; margin: 0 0 var(--s-5); }
.blog-card__excerpt { color: var(--muted); line-height: 1.66; margin: 0 0 var(--s-6); }
.blog-card__meta {
  font-family: var(--mono);
  font-size: var(--t-xs);
  color: var(--dim);
  letter-spacing: .05em;
  margin: 0;
}
.blog-empty {
  color: var(--dim);
  text-align: center;
  padding: calc(var(--s-12) * 1.5) var(--s-8);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
}

/* ── A post ────────────────────────────────────────────────── */
.blog-post__title {
  font-size: var(--t-3xl);
  line-height: 1.16;
  letter-spacing: -.025em;
  margin: 0 0 var(--s-7);
}
.blog-post__meta {
  font-family: var(--mono);
  font-size: var(--t-xs);
  color: var(--dim);
  letter-spacing: .05em;
  margin: 0 0 var(--s-12);
  padding-bottom: var(--s-9);
  border-bottom: 1px solid var(--border);
}

/* The body's rules mirror .ble__doc in blog-editor.css on purpose:
   the author has to be able to trust that what they saw while
   writing is what a reader gets. When one changes, change both. */
.blog-post__body { font-size: var(--t-lg); line-height: 1.78; }
.blog-post__body > * { margin: 0 0 var(--s-9); }
.blog-post__body h2 { font-size: var(--t-2xl); letter-spacing: -.018em; margin-top: var(--s-12); line-height: 1.24; }
.blog-post__body h3 { font-size: var(--t-xl); letter-spacing: -.012em; margin-top: var(--s-11); }
.blog-post__body h4 {
  font-family: var(--mono);
  font-size: var(--t-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-top: var(--s-10);
}
.blog-post__body blockquote {
  border-left: 2px solid var(--border-hi);
  padding-left: var(--s-9);
  margin-left: 0;
  color: var(--muted);
  font-style: italic;
}
.blog-post__body pre {
  font-family: var(--mono);
  font-size: var(--t-sm);
  background: rgba(0, 0, 0, .42);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--s-8);
  overflow-x: auto;
  white-space: pre-wrap;
  line-height: 1.6;
}
.blog-post__body code {
  font-family: var(--mono);
  font-size: .9em;
  background: rgba(0, 0, 0, .35);
  padding: 1px var(--s-3);
  border-radius: var(--r-xs);
}
.blog-post__body ul,
.blog-post__body ol { padding-left: var(--s-10); }
.blog-post__body li { margin-bottom: var(--s-5); }
.blog-post__body a { color: var(--accent2); text-underline-offset: 3px; }
.blog-post__body hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-12) 0; }
.blog-post__body mark { border-radius: var(--r-xs); padding: 0 var(--s-2); color: #10141a; }

.bl-serif { font-family: var(--serif, Georgia, 'Times New Roman', serif); }
.bl-sans { font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
.bl-mono { font-family: var(--mono); font-size: .94em; }

.blog-post__back { margin-top: calc(var(--s-12) * 1.5); }
.blog-post__back a { color: var(--muted); text-decoration: none; font-size: var(--t-sm); }
.blog-post__back a:hover { color: var(--accent2); }

/* ── Foot ──────────────────────────────────────────────────── */
.blog__foot {
  border-top: 1px solid var(--border);
  padding: var(--s-10) var(--s-9);
  text-align: center;
  color: var(--dim);
  font-size: var(--t-xs);
  font-family: var(--mono);
  letter-spacing: .05em;
}
.blog__foot a { color: var(--muted); text-decoration: none; }
.blog__foot a:hover { color: var(--accent2); }

@media (max-width: 720px) {
  .blog__wrap { padding: var(--s-10) var(--s-8) var(--s-12); }
  .blog-post__title, .blog__h1 { font-size: var(--t-2xl); }
  .blog-post__body { font-size: var(--t-md); }
}

@media print {
  .blog__bar, .blog__foot, .blog-post__back { display: none; }
  body.blog { background: #fff; color: #111; }
}

/* ══ Footnotes ══════════════════════════════════════════════════
   Rendered by the server from the post's stored source list, never
   from markup in the body — so the claim, the publication and the
   link are exactly what was verified when the fact was cited. */
.blog-notes {
  margin-top: calc(var(--s-12) * 1.5);
  padding-top: var(--s-10);
  border-top: 1px solid var(--border);
}
.blog-notes__h {
  font-family: var(--mono);
  font-size: var(--t-xs);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--s-8);
  font-weight: 600;
}
.blog-notes__list {
  margin: 0;
  padding-left: var(--s-10);
  display: grid;
  gap: var(--s-7);
  font-size: var(--t-sm);
  line-height: 1.6;
  color: var(--muted);
}
.blog-notes__claim { display: block; color: var(--ink); margin-bottom: var(--s-2); }
.blog-notes__link { font-family: var(--mono); font-size: var(--t-xs); color: var(--accent2); text-decoration: none; }
.blog-notes__link:hover { text-decoration: underline; }

.blog-post__body sup { font-size: .7em; color: var(--accent2); font-weight: 600; }
