.article {
  max-width: 760px;
  margin: 0 auto;
  padding: 60px 32px 80px;
  position: relative;
  z-index: 2;
}

.back {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  display: inline-block;
  margin-bottom: 56px;
  letter-spacing: .01em;
}
.back:hover { color: var(--accent); }

.article-head {
  margin-bottom: 56px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border-soft);
}
.article-head .post-meta { margin-bottom: 24px; }
.meta-sep { color: var(--text-muted); }
.reading-time {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .02em;
}

.article-head h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(44px, 6.5vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #F4F1EB;
  margin-bottom: 24px;
}

.subtitle {
  font-family: var(--serif);
  font-style: normal;
  font-size: 22px;
  line-height: 1.5;
  color: var(--text-dim);
  max-width: 600px;
}

.article-body {
  font-family: 'Literata', Georgia, serif;
  font-weight: 400;
  font-size: 17.5px;
  line-height: 1.78;
  color: var(--text);
}
.article-body p {
  margin-bottom: 28px;
}
.article-body h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #F4F1EB;
  margin: 56px 0 24px;
}
.article-body em { color: inherit; font-weight: inherit; font-style: italic; }
.article-body strong,
.article-body b { color: inherit; }
.article-body a {
  color: var(--text);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
}
.article-body a:hover {
  color: #F4F1EB;
  border-bottom-color: var(--accent-soft);
}

.dropcap .first-letter {
  font-family: var(--serif);
  font-size: 64px;
  line-height: 0.85;
  float: left;
  padding: 8px 12px 0 0;
  color: var(--accent);
  font-weight: 500;
}

blockquote {
  border-left: 3px solid var(--accent);
  background: #16161a;       /* very subtle lift from the #101012 bg */
  border-radius: 0 8px 8px 0;  /* square left (red spine), rounded right */
  padding: 18px 24px;
  margin: 38px 0;
  font-style: normal;
  font-family: 'Literata', Georgia, serif;
  font-weight: 400;
  font-size: 18.5px;         /* ~5% above the 17.5px body */
  line-height: 1.68;
  line-height: 1.65;         /* airier leading */
  color: var(--text);        /* same as body */
}
/* kill the Substack <p>'s paragraph margin so the card is symmetric */
blockquote p { margin: 0 0 14px; }
blockquote p:last-child { margin-bottom: 0; }

.rule {
  border: none;
  height: 1px;
  background: var(--border-soft);
  margin: 56px auto;
  width: 80px;
}

.endnote p {
  font-size: 17px;
  color: var(--text-dim);
  text-align: center;
}

.article-footer {
  margin-top: 72px;
  padding-top: 48px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

@media (max-width: 640px) {
  .article { padding: 32px 22px 60px; }
  .article-body { font-size: 18px; }
  .article-body h2 { font-size: 26px; }
  .subtitle { font-size: 19px; }
  .dropcap .first-letter { font-size: 52px; }
  blockquote { font-size: 17.5px; line-height: 1.62; padding: 15px 18px; margin: 30px 0; }
}

/* ---------- Inline footnote popovers ---------- */
.fn { position: relative; }
.fn-ref {
  font-family: var(--sans);
  font-size: 0.72em;
  vertical-align: super;
  line-height: 0;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0 1px;
  transition: color .15s ease;
}
.fn-ref:hover,
.fn.open .fn-ref { color: var(--accent-soft); }
.fn.open .fn-ref::after {
  content: '';
  position: absolute;
  inset: -3px -3px;
  border-radius: 3px;
  background: rgba(255,255,255,0.08);
  z-index: -1;
}

.fn-popup {
  position: fixed;
  z-index: 200;
  display: none;
  width: max-content;
  max-width: 340px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  text-align: left;
  box-shadow: 0 18px 40px -12px rgba(0,0,0,0.7);
}
.fn-popup.show { display: block; animation: fnpop .12s ease-out; }
@keyframes fnpop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.fn-popup p { margin: 0 0 8px; }
.fn-popup p:last-child { margin-bottom: 0; }
.fn-popup-num {
  color: var(--text-dim);
  font-weight: 600;
  font-family: var(--sans);
  font-size: 12px;
  margin-right: 6px;
}
.fn-popup a {
  color: var(--text);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
}
.fn-popup a:hover {
  color: #F4F1EB;
  border-bottom-color: var(--accent-soft);
}

/* ---------- Figures ---------- */
.post-figure {
  margin: 40px 0;
  max-width: 100%;
}
.post-figure img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  display: block;
}
.post-figure figcaption {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.5;
}

/* ---------- Callout blocks (from Substack) ---------- */
.callout-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 22px 26px;
  margin: 40px 0;
  line-height: 1.7;
}
.callout-block h3 { margin: 0 0 10px; font-size: 20px; color: #F4F1EB; }
.callout-block p:last-child { margin-bottom: 0; }
.callout-block ul, .callout-block ol { margin: 8px 0; padding-left: 1.4em; }

/* ---------- Lists / blockquotes in body ---------- */
.article-body ul,
.article-body ol { margin: 0 0 28px 0; padding-left: 1.4em; }
.article-body li { margin-bottom: 8px; padding-left: 0.25em; }
.article-body li::marker { color: var(--text-dim); }
/* Substack wraps each <li> text in a <p>; kill its paragraph spacing */
.article-body li p { margin: 0 0 6px; }
.article-body li p:last-child { margin-bottom: 0; }
.article-body h1 { font-size: 34px; font-weight: 700; color: #F4F1EB; margin: 48px 0 20px; line-height: 1.15; }
.article-body h3 { font-size: 24px; font-weight: 600; color: #F4F1EB; margin: 40px 0 16px; }
.article-body h4 { font-size: 19px; font-weight: 500; color: var(--text); margin: 32px 0 12px; }
.article-body img { max-width: 100%; height: auto; border-radius: 6px; }
/* Section dividers (Substack <hr>): short, centered, soft */
.article-body hr {
  border: none;
  height: 1px;
  width: 100%;
  margin: 48px auto;
  background: #34343b;
  position: relative;
  overflow: visible;
}
.article-body hr::after {
  content: '\25c6';            /* ◆ */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);       /* masks the line behind the glyph */
  color: #34343b;
  font-size: 11px;
  line-height: 1;
  padding: 0 16px;
}
.article-body div:has(> hr:only-child) { text-align: center; }


/* ---------- Minimap table of contents ---------- */
.toc {
  position: fixed;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
}
.toc-rail {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  padding: 10px 4px;
  cursor: pointer;
  transition: opacity .2s ease;
}
.toc-line {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: #565b62;
  transition: background .2s ease, width .2s ease;
}
.toc-line.lvl2 { width: 26px; }
.toc-line.lvl3 { width: 17px; }
.toc-line.lvl4 { width: 10px; }
.toc-line.active { background: var(--accent); }
.toc-panel {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  min-width: 270px;
  max-width: 360px;
  max-height: 76vh;
  overflow-y: auto;
  background: #1a1a1f;
  border: 1px solid #26262c;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 18px 50px -12px rgba(0,0,0,0.65);
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.toc.open .toc-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}
.toc.open .toc-rail { opacity: 0; pointer-events: none; }
.toc-link {
  display: block;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  padding: 6px 0;
  color: var(--text-dim);
}
.toc-num {
  display: inline-block;
  margin-right: 7px;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: .02em;
}
.toc-link.active .toc-num { color: var(--accent); }
.toc-link:hover { color: var(--text); }
.toc-link.active { color: var(--accent); }
.toc-link.lvl3 { padding-left: 14px; }
.toc-link.lvl4 { padding-left: 28px; }
@media (max-width: 1100px) {
  .toc { display: none; }
}


/* ---------- prev / next pager ---------- */
.pager { display: flex; gap: 14px; margin: 56px 0 0; padding-top: 26px; border-top: 1px solid var(--border-soft); }
.pg { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px;
      display: flex; flex-direction: column; gap: 4px; text-decoration: none;
      transition: border-color .15s ease, transform .15s ease; }
.pg:hover { border-color: #3a3a42; transform: translateY(-1px); }
.pg.next { text-align: right; }
.pg.empty { border: none; }
.pg-dir { font-family: var(--sans); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.pg-t { color: var(--text); font-size: 15px; line-height: 1.35; font-family: 'Literata', Georgia, serif; }
.pg:hover .pg-t { color: var(--accent); }
@media (max-width: 640px) { .pager { flex-direction: column; } .pg.next { text-align: left; } }


/* ---------- overflow guards ---------- */
html, body { max-width: 100%; }
img, svg, video, iframe, embed, object, canvas { max-width: 100%; height: auto; }
table { max-width: 100%; display: block; overflow-x: auto; }
pre, code { max-width: 100%; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
.article-body { overflow-wrap: anywhere; word-break: normal; }
.article-body a { overflow-wrap: anywhere; }
.article-body figure, .article-body .post-figure { max-width: 100%; margin-inline: 0; }
