.post { position: relative; }

/* Reading progress bar (2px, gradient-filled, scroll-linked via JS) */
.progress-bar {
  position: fixed;
  top: 57px; /* below header */
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent-gradient-h);
  z-index: 11;
  border-radius: 0 2px 2px 0;
  transition: width 100ms linear;
}

/* ARTICLE HEAD */
.article-head { padding: 80px var(--gutter) 40px; max-width: 760px; margin: 0 auto; }
.article-meta {
  display: flex; gap: 16px; font-family: var(--font-mono);
  font-size: 11px; color: var(--fg-2); letter-spacing: 3px; margin-bottom: 28px;
}
.article-head h1 {
  font-size: clamp(36px, 6vw, 54px);
  font-weight: 700; letter-spacing: -0.035em;
  line-height: 1.02; margin-bottom: 22px; color: var(--fg);
}
.article-head .dek {
  font-family: var(--font-serif); font-style: italic;
  font-size: 22px; color: var(--fg-2); line-height: 1.45;
  margin-bottom: 36px; max-width: 640px;
}
.byline {
  display: flex; align-items: center; gap: 14px;
  padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.1);
}
.byline-avatar, .author-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--bg); font-weight: 700; font-size: 15px;
}
.avatar-gradient { background: var(--accent-gradient); }
.byline-info { font-size: 13px; color: var(--fg-2); line-height: 1.5; }
.byline-name { color: var(--fg); font-weight: 600; }

/* ARTICLE BODY */
.article-body {
  max-width: var(--max-article); margin: 0 auto;
  padding: 40px var(--gutter) 80px;
  font-family: var(--font-serif);
  font-size: 19px; line-height: 1.72; color: #d8d8e0;
}
.article-body > p { margin-bottom: 26px; }
.article-body > p:first-of-type {
  font-size: 22px; color: #ececf0; line-height: 1.55; font-style: italic;
}
.article-body h2 {
  font-family: var(--font-sans);
  font-size: 30px; color: var(--fg); font-weight: 700; letter-spacing: -0.02em;
  margin: 60px 0 20px; line-height: 1.15;
}
.article-body h3 {
  font-family: var(--font-sans);
  font-size: 22px; color: var(--fg); font-weight: 600;
  margin: 40px 0 16px; line-height: 1.2;
}
.article-body a {
  color: var(--fg);
  border-bottom: 1px solid rgba(139, 91, 255, 0.6);
}
.article-body strong { color: var(--fg); font-weight: 700; }
.article-body em { color: #ececf0; }
.article-body blockquote {
  margin: 52px calc(var(--gutter) * -1);
  padding: 36px 44px;
  border-left: 3px solid transparent;
  border-image: var(--accent-gradient) 1 100%;
  background: rgba(20, 20, 30, 0.4);
  border-radius: 0 12px 12px 0;
  backdrop-filter: blur(20px);
  font-family: var(--font-serif); font-style: italic;
  font-size: 28px; color: var(--fg); font-weight: 500;
  letter-spacing: -0.01em; line-height: 1.3;
}
.article-body figure {
  margin: 40px calc(var(--gutter) * -1);
  border-radius: 12px; overflow: hidden;
  border: 1px solid var(--card-border);
}
.article-body figcaption {
  background: rgba(20, 20, 30, 0.6);
  padding: 10px 20px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--fg-2); letter-spacing: 1px;
}

/* PAYWALL */
.paywall {
  margin: 56px calc(var(--gutter) * -1) 40px;
  padding: 40px 44px;
  border-radius: 14px;
  border: 1px solid rgba(139, 91, 255, 0.3);
  background: rgba(30, 20, 45, 0.55);
  backdrop-filter: blur(24px);
  text-align: center;
  font-family: var(--font-sans);
}
.paywall-label {
  font-family: var(--font-mono); font-size: 10px;
  color: #b89dff; letter-spacing: 3px; margin-bottom: 16px;
}
.paywall h3 {
  font-size: 26px; color: var(--fg); margin-bottom: 10px;
  letter-spacing: -0.02em; font-weight: 700;
}
.paywall p { font-size: 14px; color: var(--fg-2); margin-bottom: 22px; }

/* AUTHOR CARD */
.author-card {
  max-width: var(--max-article); margin: 60px auto 40px;
  padding: 32px; border-radius: 14px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  backdrop-filter: blur(var(--card-blur));
  display: grid; grid-template-columns: auto 1fr; gap: 24px;
  font-family: var(--font-sans);
}
.author-avatar {
  width: 72px; height: 72px; font-size: 26px; font-weight: 800;
}
.author-card h4 { margin-bottom: 6px; font-size: 17px; color: var(--fg); }
.author-role {
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-2);
  letter-spacing: 1px; margin-bottom: 12px;
}
.author-bio { font-size: 14px; color: var(--fg-2); line-height: 1.55; }

/* RELATED */
.related { max-width: var(--max-content); margin: 0 auto; padding: 40px var(--gutter); }
.related-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
@media (max-width: 640px) { .related-grid { grid-template-columns: 1fr; } }

/* Body class hook to dim background */
body.post-template .bg-blobs .blob { opacity: 0.18; }

/* ============================================================ */
/* POST LAYOUT WITH STICKY TOC SIDEBAR                          */
/* ============================================================ */

.post-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 64px;
  justify-content: center;
  align-items: stretch;
}

/* Inside the layout, the article internal blocks should stay readable widths */
.post-layout .article-head {
  max-width: 760px;
  margin: 0;
  padding: 80px 0 40px;
}
.post-layout .article-body {
  max-width: 680px;
  margin: 0;
  padding: 40px 0 80px;
}
.post-layout .author-card {
  max-width: 680px;
  margin: 60px 0 40px;
}

/* The TOC sidebar */
.post-toc {
  position: relative;
  font-family: var(--font-sans);
}
.post-toc[hidden] { display: none; }
.post-toc-inner {
  position: sticky;
  top: 100px;
  padding: 84px 0 40px;
}
.post-toc .toc-header {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 2px;
  color: var(--fg-3);
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 14px;
}
.post-toc .toc-remaining { color: var(--fg-2); letter-spacing: 1px; }
.post-toc .toc-list {
  list-style: none; padding: 0; margin: 0;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}
.post-toc .toc-list li { margin: 0; }
.post-toc .toc-list a {
  display: block;
  padding: 8px 0 8px 14px;
  font-size: 13px;
  color: var(--fg-3);
  border-left: 2px solid rgba(255,255,255,0.06);
  line-height: 1.4;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.post-toc .toc-list a:hover { color: var(--fg-2); }
.post-toc .toc-list a.active {
  color: var(--fg);
  font-weight: 600;
  border-left: 2px solid transparent;
  border-image: linear-gradient(180deg, #ff5ea8, #8b5bff, #35b8ff) 1 100%;
}

/* Below 1100px viewport, drop the sidebar entirely; show mobile collapse */
@media (max-width: 1099px) {
  .post-layout {
    grid-template-columns: 1fr;
    max-width: 760px;
  }
  .post-toc { display: none; }
}

/* MOBILE TOC: collapsible details element above the article */
.post-toc-mobile {
  display: none;
}
.post-toc-mobile[hidden] { display: none !important; }
@media (max-width: 1099px) {
  .post-toc-mobile {
    display: block;
    margin: 24px auto 0;
    max-width: 680px;
    padding: 0 var(--gutter);
  }
  .post-toc-mobile details {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px 16px;
    backdrop-filter: blur(var(--card-blur));
    font-family: var(--font-sans);
  }
  .post-toc-mobile summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--fg-2);
  }
  .post-toc-mobile summary::-webkit-details-marker { display: none; }
  .post-toc-mobile .toc-mobile-meta {
    color: var(--fg-3);
    font-size: 10px;
    letter-spacing: 1px;
  }
  .post-toc-mobile ol {
    list-style: none;
    margin: 12px 0 4px;
    padding: 0;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 10px;
  }
  .post-toc-mobile li { margin: 0; }
  .post-toc-mobile a {
    display: block;
    padding: 8px 0;
    font-size: 14px;
    color: var(--fg-2);
  }
  .post-toc-mobile a:hover { color: var(--fg); }
}


/* AI DISCLAIMER (in byline area, matches byline-role styling) */
.byline-disclaimer {
  font-size: 12px;
  color: var(--fg-3);
  margin-top: 6px;
  line-height: 1.5;
  font-family: var(--font-sans);
}
.byline-disclaimer a {
  color: var(--fg-2);
  border-bottom: 1px solid rgba(255,255,255,0.18);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.byline-disclaimer a:hover {
  color: var(--fg);
  border-bottom-color: rgba(255,255,255,0.6);
}
