/* ============================================================
   TheFinBaba — Blog post layout (fb-post-*)
   Structure ported from the crazygktrick.com blog reference,
   restyled with TheFinBaba's brand tokens from includes/styles.css.

   Layout: main column + sticky sidebar (auto table of contents,
   recommended course, related posts).
   ============================================================ */

/* ---------- LAYOUT ---------- */
.fb-post-wrap { padding: 34px 0 70px; background: #fff; }
.fb-post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 36px;
  align-items: start;            /* sticky sidebar ke liye zaroori */
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
}
.fb-post-main { min-width: 0; }  /* grid overflow guard */

/* ---------- HEAD ---------- */
.fb-post-breadcrumb { font-size: .82rem; color: var(--fb-muted, #64748b); margin-bottom: 14px; }
.fb-post-breadcrumb a { color: var(--fb-primary, #4f46e5); text-decoration: none; }
.fb-post-breadcrumb a:hover { text-decoration: underline; }
.fb-post-breadcrumb span { margin: 0 6px; color: #cbd5e1; }

.fb-post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.fb-post-tags a {
  background: var(--fb-primary-tint, #eef2ff); color: var(--fb-primary-dark, #4338ca);
  font-size: .72rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 6px; text-decoration: none;
}
.fb-post-tags a:hover { background: var(--fb-primary-tint2, #e0e7ff); }

.fb-post-title {
  font-size: clamp(1.5rem, 3.5vw, 2.3rem); line-height: 1.25;
  color: var(--fb-ink, #0f172a); margin: 0 0 14px; font-weight: 800; letter-spacing: -.02em;
}
.fb-post-meta-row {
  display: flex; flex-wrap: wrap; gap: 16px;
  font-size: .85rem; color: var(--fb-muted, #64748b); margin-bottom: 22px;
}
.fb-post-meta-row i { color: var(--fb-accent, #f59e0b); margin-right: 5px; }
.fb-post-meta-row a { color: var(--fb-primary, #4f46e5); text-decoration: none; font-weight: 600; }
.fb-post-meta-row a:hover { text-decoration: underline; }

/* Feature image (generated SVG cover ya uploaded photo) */
.fb-post-feature {
  width: 100%; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden;
  margin-bottom: 26px; box-shadow: var(--fb-shadow-md, 0 4px 10px rgba(15,23,42,.05));
}
.fb-post-feature svg,
.fb-post-feature.blog-img-svg svg { width: 100%; height: 100%; display: block; }
/* contain = feature image kabhi crop nahi hoti (upload par 16:9 letterbox ho chuki hoti hai).
   Side bars WHITE rakhe hain - blog covers white-background illustrations hain. */
.fb-post-feature.blog-img-photo {
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #ffffff;
}

/* ---------- BODY TYPOGRAPHY ---------- */
.fb-post-body { font-size: 1.02rem; line-height: 1.8; color: var(--fb-text, #1f2937); }
.fb-post-body > *:first-child { margin-top: 0; }
.fb-post-body h2 {
  color: var(--fb-primary, #4f46e5); margin: 36px 0 12px;
  font-size: 1.5rem; font-weight: 800; line-height: 1.3;
  padding-bottom: 10px; border-bottom: 2px solid var(--fb-border, #e2e8f0);
  scroll-margin-top: calc(var(--fb-nav-h, 72px) + 20px);   /* TOC anchor nav ke neeche rukе */
}
.fb-post-body h3 {
  color: var(--fb-ink, #0f172a); margin: 26px 0 10px; font-size: 1.2rem; font-weight: 700;
  scroll-margin-top: calc(var(--fb-nav-h, 72px) + 20px);
}
.fb-post-body h4 { color: var(--fb-ink, #0f172a); margin: 20px 0 8px; font-size: 1.02rem; font-weight: 700; }
.fb-post-body p { margin: 0 0 16px; }
.fb-post-body ul, .fb-post-body ol { margin: 0 0 18px; padding-left: 22px; }
.fb-post-body li { margin-bottom: 8px; }
.fb-post-body a { color: var(--fb-primary, #4f46e5); font-weight: 600; }
.fb-post-body strong { color: var(--fb-ink, #0f172a); font-weight: 700; }
.fb-post-body img { max-width: 100%; height: auto; border-radius: 12px; margin: 8px 0 18px; }
.fb-post-body .lead { font-size: 1.1rem; color: var(--fb-text, #1f2937); }

.fb-post-body blockquote {
  border-left: 4px solid var(--fb-primary, #4f46e5); background: var(--fb-bg, #f8fafc);
  padding: 14px 20px; margin: 0 0 20px; border-radius: 0 12px 12px 0;
}
.fb-post-body blockquote p:last-child { margin-bottom: 0; }

/* Code — broker API tutorials ke liye */
.fb-post-body code {
  background: #f1f5f9; color: #be123c; padding: 2px 6px; border-radius: 5px;
  font-size: .88em; font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
.fb-post-body pre {
  background: #0f172a; color: #e2e8f0; padding: 18px 20px; border-radius: 12px;
  overflow-x: auto; margin: 0 0 20px; font-size: .88rem; line-height: 1.65;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.fb-post-body pre code { background: none; color: inherit; padding: 0; font-size: inherit; }

/* Tables — reference jaisa: gradient header, striped, rounded, mobile scroll */
.fb-post-body table {
  width: 100%; border-collapse: separate; border-spacing: 0; margin: 24px 0 28px;
  font-size: .94rem; border: 1px solid var(--fb-border, #e2e8f0); border-radius: 12px;
  overflow: hidden; box-shadow: 0 2px 10px rgba(15,23,42,.05); background: #fff;
}
.fb-post-body thead th {
  background: linear-gradient(135deg, var(--fb-primary-ink, #312e81), var(--fb-primary, #4f46e5));
  color: #fff; text-align: left; padding: 13px 16px; font-size: .86rem; font-weight: 700; border: 0;
}
.fb-post-body tbody td, .fb-post-body tbody th {
  padding: 12px 16px; border-top: 1px solid #eef2f8; vertical-align: top; line-height: 1.6; color: var(--fb-text, #334155);
}
.fb-post-body tbody td:first-child { font-weight: 600; color: var(--fb-ink, #0f172a); }
.fb-post-body tbody tr:nth-child(2n) td { background: #f8fafd; }
.fb-post-body tbody tr:hover td { background: var(--fb-primary-tint, #eef2ff); }

/* ---------- STICKY SIDEBAR ---------- */
.fb-post-side {
  position: sticky;
  top: calc(var(--fb-nav-h, 72px) + 18px);
  align-self: start;
  display: flex; flex-direction: column; gap: 18px;
  padding-bottom: 10px;
}
.fb-side-card {
  background: #fff; border: 1px solid var(--fb-border, #e2e8f0); border-radius: 14px;
  padding: 18px 20px; box-shadow: 0 2px 10px rgba(15,23,42,.04);
}
.fb-side-card h4 {
  margin: 0 0 14px; font-size: .92rem; font-weight: 800; color: var(--fb-ink, #0f172a);
  text-transform: uppercase; letter-spacing: .04em;
  padding-bottom: 9px; border-bottom: 2px solid var(--fb-primary-tint, #eef2ff);
}
.fb-side-card ul { list-style: none; margin: 0; padding: 0; }
.fb-side-card li { margin-bottom: 9px; line-height: 1.5; }
.fb-side-card li:last-child { margin-bottom: 0; }
.fb-side-card a { color: var(--fb-text, #334155); text-decoration: none; font-size: .9rem; font-weight: 500; }
.fb-side-card a:hover { color: var(--fb-primary, #4f46e5); }

/* Table of contents */
.fb-side-toc { max-height: calc(100vh - var(--fb-nav-h, 72px) - 120px); overflow-y: auto; }
.fb-side-toc ol { list-style: none; counter-reset: toc; margin: 0; padding: 0; }
.fb-side-toc li { counter-increment: toc; padding: 7px 0; border-bottom: 1px dashed #e9eef7; }
.fb-side-toc li:last-child { border-bottom: 0; }
.fb-side-toc a { display: flex; gap: 9px; align-items: flex-start; font-size: .88rem; line-height: 1.45; }
.fb-side-toc a::before {
  content: counter(toc); flex: 0 0 auto;
  background: var(--fb-primary-tint, #eef2ff); color: var(--fb-primary-dark, #4338ca);
  font-size: .7rem; font-weight: 800; min-width: 19px; height: 19px;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; margin-top: 1px;
}
.fb-side-toc a.is-active { color: var(--fb-primary, #4f46e5); font-weight: 700; }
.fb-side-toc a.is-active::before { background: var(--fb-primary, #4f46e5); color: #fff; }

/* Recommended course card */
.fb-side-course { background: linear-gradient(160deg, #fffaf0, #fff); border-color: #ffe1a8; }
.fb-side-course h4 { color: #92400e; border-bottom-color: #ffeccd; }
.fb-side-course .price { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.fb-side-course .price .now { font-size: 1.45rem; font-weight: 800; color: var(--fb-ink, #0f172a); }
.fb-side-course .price .was { text-decoration: line-through; color: var(--fb-muted, #64748b); font-size: .9rem; }
.fb-side-course p { font-size: .87rem; line-height: 1.6; color: var(--fb-text, #334155); margin-bottom: 14px; }
.fb-side-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; padding: 11px 16px; border-radius: 9px; font-weight: 700; font-size: .9rem;
  text-decoration: none; border: 1px solid transparent; transition: transform .15s, background .2s;
}
.fb-side-btn:hover { transform: translateY(-1px); text-decoration: none; }
.fb-side-btn-primary { background: var(--fb-accent, #f59e0b); color: #431407; }
.fb-side-btn-primary:hover { background: var(--fb-accent-dark, #d97706); color: #431407; }
.fb-side-btn-wa { background: #25d366; color: #05310f; margin-top: 9px; }
.fb-side-btn-wa:hover { background: #1eb658; color: #05310f; }

/* Author mini-card */
.fb-side-author { text-align: center; }
.fb-side-author img {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--fb-primary-tint, #eef2ff); margin-bottom: 10px;
}
.fb-side-author .name { font-weight: 800; color: var(--fb-ink, #0f172a); font-size: .98rem; }
.fb-side-author .role { font-size: .8rem; color: var(--fb-muted, #64748b); margin-bottom: 8px; }
.fb-side-author .creds { font-size: .78rem; color: var(--fb-muted, #64748b); line-height: 1.55; }

/* Mobile-only inline related (desktop par sidebar me hai) */
.fb-inline-related {
  display: none;
  background: var(--fb-bg, #f8fafc);
  border: 1px solid var(--fb-border, #e2e8f0); border-left: 4px solid var(--fb-primary, #4f46e5);
  border-radius: 12px; padding: 18px 20px; margin: 26px 0;
}
.fb-inline-related h3 { margin: 0 0 12px; font-size: 1.02rem; color: var(--fb-ink, #0f172a); }
.fb-inline-related ul { list-style: none; padding: 0; margin: 0; }
.fb-inline-related li { padding: 8px 0; border-bottom: 1px dashed #e2e8f0; }
.fb-inline-related li:last-child { border-bottom: 0; }
.fb-inline-related a { color: var(--fb-text, #334155); text-decoration: none; font-size: .92rem; font-weight: 500; }
.fb-inline-related a:hover { color: var(--fb-primary, #4f46e5); }

/* Disclaimer */
.fb-post-disclaimer {
  margin-top: 30px; padding: 15px 18px; background: var(--fb-bg, #f8fafc);
  border: 1px solid var(--fb-border, #e2e8f0); border-radius: 12px;
  color: var(--fb-muted, #64748b); font-size: .84rem; line-height: 1.7;
}

/* ---------- RESPONSIVE (reference wala pattern) ---------- */
@media (max-width: 1024px) {
  .fb-post-layout { grid-template-columns: 1fr; gap: 26px; }
  .fb-post-side {
    position: static;
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  }
  .fb-side-toc, .fb-side-related { display: none; }   /* mobile par TOC nahi */
  .fb-side-course { grid-column: 1 / -1; order: -1; } /* course card sabse upar */
  .fb-inline-related { display: block; }              /* related yahan dikhega */
}
@media (max-width: 640px) {
  .fb-post-layout { padding: 0 14px; }
  .fb-post-side { grid-template-columns: 1fr; }
  .fb-side-card { padding: 16px 18px; }
  .fb-post-body { font-size: 1rem; }
  .fb-post-body h2 { font-size: 1.28rem; }
  .fb-post-body pre { padding: 14px; font-size: .82rem; }
}
