/* ── Reading progress bar ── */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #5e5ce6);
  z-index: 200;
  transition: width 0.1s linear;
}

/* ── Post Hero ── */
.post-hero {
  position: relative;
  min-height: 480px;
  display: flex;
  align-items: flex-end;
  padding-top: 52px;
  overflow: hidden;
}

.post-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
  transition: background 0.3s;
}

.post-hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
}

.post-hero-content {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
  padding: 48px 24px 56px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 28px;
  transition: color 0.2s;
}
.back-link:hover { color: #fff; }

.post-meta-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.post-tag-hero {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 980px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.post-read-time {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}

.post-title {
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -1px;
  color: #fff;
  margin-bottom: 28px;
}

.post-author-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.post-author-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0071e3, #5e5ce6);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.post-author-name {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
}

.post-author-date {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}

/* ── Layout ── */
.post-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 64px 24px 80px;
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 64px;
  align-items: start;
}

/* ── TOC ── */
.post-toc {
  position: sticky;
  top: 80px;
  order: 2;
}

.toc-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

#tocNav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-link {
  display: block;
  font-size: 13px;
  color: var(--text-3);
  text-decoration: none;
  padding: 5px 10px;
  border-left: 2px solid var(--border);
  transition: all 0.2s;
  line-height: 1.4;
}
.toc-link:hover { color: var(--text-2); border-left-color: rgba(255,255,255,0.2); }
.toc-link.active { color: var(--accent); border-left-color: var(--accent); }
.toc-link.toc-h3 { padding-left: 20px; font-size: 12px; }

/* ── Article content ── */
.post-content {
  order: 1;
  min-width: 0;
  color: var(--text-2);
  font-size: 17px;
  line-height: 1.8;
}

.post-content h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  margin: 48px 0 16px;
  padding-top: 8px;
}

.post-content h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 32px 0 12px;
}

.post-content p {
  margin-bottom: 20px;
}

.post-content a {
  color: var(--accent);
  text-decoration: none;
}
.post-content a:hover { text-decoration: underline; }

.post-content strong { color: var(--text); font-weight: 600; }

.post-content ul, .post-content ol {
  margin: 0 0 20px 24px;
}
.post-content li { margin-bottom: 8px; }

.post-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 28px 0;
  padding: 16px 24px;
  background: rgba(0,113,227,0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-2);
  font-style: italic;
}

.post-content pre {
  background: #111;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  overflow-x: auto;
  margin: 24px 0;
  font-size: 14px;
  line-height: 1.6;
}

.post-content code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.9em;
}

.post-content p code, .post-content li code {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 5px;
  color: #e8c97e;
  font-size: 14px;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

.post-content img {
  width: 100%;
  border-radius: var(--radius);
  margin: 24px 0;
}

/* Callout box */
.callout {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin: 24px 0;
  font-size: 15px;
  line-height: 1.6;
}
.callout-info { background: rgba(0,113,227,0.1); border: 1px solid rgba(0,113,227,0.2); }
.callout-tip  { background: rgba(48,209,88,0.08); border: 1px solid rgba(48,209,88,0.2); }
.callout-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

/* ── Related posts ── */
.related-posts {
  padding: 64px 0 100px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}

.related-posts .section-label { margin-bottom: 8px; }
.related-posts h2 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 36px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .post-layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 40px 24px 60px;
  }
  .post-toc { display: none; }
  .related-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .post-hero { min-height: 320px; }
  .post-hero-content { padding: 32px 16px 40px; }
  .post-title { font-size: 24px; letter-spacing: -0.5px; }
  .post-content { font-size: 16px; }
  .post-layout { padding: 24px 16px 48px; }
  .related-grid { grid-template-columns: 1fr; }
  .related-posts { padding: 40px 0 60px; }
  .post-content pre { padding: 14px 16px; font-size: 13px; }
  .post-content blockquote { padding: 12px 16px; }
}
