/* ============================================================================
   BLOG — article, archive and search templates only.
   Enqueued conditionally by functions.php; a product page never downloads it.

   Shared components (breadcrumb, buttons, pills, inputs, utilities) live in
   global.css. Anything duplicated here would be a maintenance trap.
   ============================================================================ */

/* ---------------------------------------------------------------------------
   1. PAGE GRID

   Three columns, three rows. The key move: breadcrumb and hero occupy the
   CENTRE column only, in rows 1 and 2. The side columns are empty until
   row 3, so both sidebars begin below the hero instead of alongside it.

     ┌─────────┬──────────────────┬─────────┐
     │         │ breadcrumb       │         │  row 1
     │         ├──────────────────┤         │
     │ (empty) │ hero: h1, dek,   │ (empty) │  row 2  ← first viewport
     │         │ highlights, img  │         │
     ├─────────┼──────────────────┼─────────┤
     │  TOC    │ article body     │  rail   │  row 3  ← sidebars start here
     │ sticky  │                  │ sticky  │
     └─────────┴──────────────────┴─────────┘

   Sticky (not fixed) is what makes them scroll into place and then hold.
   The old `position: fixed; top: 60px` is why the TOC sat on top of the
   header and breadcrumb at scroll-zero.
   --------------------------------------------------------------------------- */
.blog-page {
  max-width: var(--page-max);
  margin-inline: auto;
  padding: var(--space-10) var(--page-pad) var(--space-20);
  display: grid;
  grid-template-columns: var(--col-toc) minmax(0, 1fr) var(--col-rail);
  column-gap: var(--gutter);
  align-items: start;
}

.blog-breadcrumb { grid-column: 2; grid-row: 1; }
.blog-hero       { grid-column: 2; grid-row: 2; }
.blog-toc        { grid-column: 1; grid-row: 3; }
.blog-body       { grid-column: 2; grid-row: 3; min-width: 0; }
.blog-rail       { grid-column: 3; grid-row: 3; }

/* Decorative curve behind the content column. */
.blog-page::after {
  content: "";
  position: absolute;
  top: 0; right: -5px;
  width: 425px; height: 18%;
  background: url("https://bongacode.com/wp-content/uploads/2026/07/Vector-22.png") top right / auto no-repeat;
  pointer-events: none;
  z-index: -1;
}
.blog-page { position: relative; z-index: 1; }

/* ---------------------------------------------------------------------------
   2. BREADCRUMB
   Styling lives in global.css (.bc-breadcrumb). Only the grid placement and
   bottom margin are blog-specific.
   --------------------------------------------------------------------------- */
.blog-breadcrumb ol { margin-bottom: var(--space-6); }

/* ---------------------------------------------------------------------------
   3. HERO — owns the first screen

   Generous vertical space after the dek is deliberate: it pushes the body
   copy below the fold so the headline and highlights are what land first.
   --------------------------------------------------------------------------- */
.blog-hero { padding-bottom: var(--space-14); }

.blog-title { margin-bottom: var(--space-4); max-width: 18ch; }

.blog-dek {
  font-size: var(--fs-lead);
  line-height: 1.6;
  color: var(--ink-muted);
  max-width: 56ch;
  margin-bottom: var(--space-6);
}

.blog-meta {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-2) var(--space-4);
  font-size: var(--fs-sm);
  color: var(--ink-faint);
  padding-bottom: var(--space-5);
}
.blog-meta .sep { color: var(--border-strong); }

/* --- "Explore with AI" row (optional) ------------------------------------- */
.blog-ai-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.blog-ai-row .ai-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-inline-end: auto;
}
.blog-ai-row a {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--ink-soft);
  transition: border-color var(--dur-fast), color var(--dur-fast);
}
.blog-ai-row a:hover { border-color: var(--ink); color: var(--ink); }

/* --- Highlights / key takeaways -------------------------------------------
   The second thing a reader sees. Also the passage most likely to be lifted
   into a featured snippet or an AI answer, so it gets real prominence.     */
.blog-highlights {
  margin-top: var(--space-8);
  padding: var(--space-6) var(--space-6) var(--space-5);
  background: var(--paper-cream);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ink);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.blog-highlights h2 {
  font-size: var(--fs-h4);
  margin-bottom: var(--space-3);
}
.blog-highlights ul { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-3); }
.blog-highlights li {
  display: flex; gap: var(--space-3);
  font-size: var(--fs-body);
  color: var(--ink-soft);
  line-height: 1.55;
}
.blog-highlights li::before {
  content: "";
  flex: none;
  width: 7px; height: 7px;
  margin-top: 0.6em;
  border-radius: 50%;
  background: var(--ink);
}

/* --- Featured image --------------------------------------------------------
   A real <img>, not a div with a background-image. Background images have no
   alt text, are invisible to Google Images, and cannot take fetchpriority.  */
.blog-featured {
  margin-top: var(--space-10);
}
.blog-featured img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--tan);      /* reserves the box before the file lands */
}
.blog-featured figcaption {
  margin-top: var(--space-3);
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  text-align: center;
}

/* ---------------------------------------------------------------------------
   4. LEFT SIDEBAR — table of contents
   --------------------------------------------------------------------------- */
.blog-toc {
  position: sticky;
  top: var(--sticky-top);
  align-self: start;                          /* required for sticky in grid */
  max-height: calc(100vh - var(--sticky-top) - var(--space-6));
  display: flex;
  flex-direction: column;
}
.blog-toc .toc-label {
  flex: none;
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--ink);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}
.blog-toc nav {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding-inline-end: var(--space-2);
  display: flex; flex-direction: column; gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  /* Fade the overflow edge so a clipped list reads as scrollable. */
  mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent 100%);
}
.blog-toc nav::-webkit-scrollbar { width: 5px; }
.blog-toc nav::-webkit-scrollbar-track { background: transparent; }
.blog-toc nav::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-pill); }

.blog-toc nav a {
  display: block;
  padding: var(--space-2) var(--space-1) var(--space-2) var(--space-3);
  border-left: 2px solid transparent;
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--ink-muted);
  transition: color var(--dur-fast), border-color var(--dur-fast);
}
.blog-toc nav a:hover { color: var(--ink); }
.blog-toc nav a.is-active {
  color: var(--ink);
  font-weight: var(--fw-semi);
  border-left-color: var(--accent);
}

/* Yoast prints its own TOC inside the content; we render it in the rail. */
.yoast-table-of-contents { display: none !important; }

/* ---------------------------------------------------------------------------
   5. RIGHT RAIL
   --------------------------------------------------------------------------- */
.blog-rail {
  position: sticky;
  top: var(--sticky-top);
  align-self: start;
  display: grid;
  gap: var(--space-5);
}

/* --- Share ---------------------------------------------------------------- */
.blog-share { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.blog-share .share-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--ink-faint);
}
.blog-share .share-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--paper-cream);
  color: var(--ink-muted);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.blog-share .share-btn:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* --- Reading progress ----------------------------------------------------- */
.rail-progress {
  padding: var(--space-5);
  background: var(--paper);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.rail-progress .rp-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: var(--space-3);
}
.rail-progress .rp-track { height: 6px; border-radius: var(--radius-pill); background: var(--border); }
.rail-progress .rp-fill  { height: 6px; border-radius: var(--radius-pill); background: var(--ink); width: 0; transition: width var(--dur) linear; }
.rail-progress .rp-pct   { display: block; margin-top: var(--space-2); font-size: var(--fs-xs); font-weight: var(--fw-bold); }

/* --- Subscribe ------------------------------------------------------------ */
.rail-subscribe {
  padding: var(--space-5);
  background: var(--ink);
  border-radius: var(--radius);
  color: var(--paper);
}
.rail-subscribe .rs-title {
  font-family: var(--font-display);
  font-size: var(--fs-h4);
  font-weight: var(--fw-black);
  line-height: 1.3;
  color: var(--paper);
  margin-bottom: var(--space-4);
}
.rail-subscribe .bc-input {
  margin-bottom: var(--space-3);
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.22);
  border-radius: var(--radius-sm);
  color: var(--paper);
  font-size: var(--fs-sm);
}
.rail-subscribe .bc-input::placeholder { color: rgba(255,255,255,0.45); }
.rail-subscribe .bc-input:focus-visible { outline-color: var(--paper); }
.rail-subscribe button {
  width: 100%;
  min-height: 44px;
  background: var(--tan);
  color: var(--ink);
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: var(--fw-black);
  font-size: var(--fs-sm);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.rail-subscribe button:hover { background: var(--paper); }

/* ---------------------------------------------------------------------------
   6. .blog-content — WordPress editor output

   Sizes and weights come from the design system. This block only sets
   rhythm and the few decorative treatments specific to article prose.
   --------------------------------------------------------------------------- */
.blog-content {
  max-width: var(--content-max);
  font-size: var(--fs-body);
  line-height: var(--lh-loose);
  color: var(--ink-soft);
}

.blog-content h2 { margin: var(--space-12) 0 var(--space-4); }
.blog-content h3 { margin: var(--space-8)  0 var(--space-3); }
.blog-content h4 { margin: var(--space-6)  0 var(--space-2); }
.blog-content h2:first-child,
.blog-content h3:first-child { margin-top: 0; }

.blog-content h2::after {
  content: "";
  display: block;
  width: 48px; height: 3px;
  margin-top: var(--space-3);
  border-radius: 2px;
  background: linear-gradient(90deg, var(--ink), transparent);
}

.blog-content p { margin-bottom: var(--space-5); color: var(--ink-muted); }
.blog-content > p:last-child { margin-bottom: 0; }

.blog-content ul,
.blog-content ol {
  list-style: none;
  padding: 0;
  margin: var(--space-2) 0 var(--space-6);
  display: flex; flex-direction: column; gap: var(--space-3);
}
.blog-content li { display: flex; gap: var(--space-3); color: var(--ink-muted); line-height: 1.6; }

.blog-content ul li::before {
  content: "✓";
  flex: none;
  width: 22px; height: 22px; margin-top: 3px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--ink); color: var(--paper);
  font-size: 0.68rem; font-weight: var(--fw-black);
}
.blog-content ol { counter-reset: ol-counter; }
.blog-content ol li { counter-increment: ol-counter; align-items: baseline; }
.blog-content ol li::before {
  content: counter(ol-counter);
  flex: none;
  width: 22px; height: 22px; margin-top: 3px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--tan); color: var(--ink);
  border: 1.5px solid var(--border-strong);
  font-size: 0.72rem; font-weight: var(--fw-black);
}

.blog-content a {
  color: var(--ink);
  font-weight: var(--fw-semi);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-fast);
}
.blog-content a:hover { text-decoration-color: var(--ink); }

.blog-content strong { font-weight: var(--fw-semi); color: var(--ink); }
.blog-content em { font-style: italic; color: var(--ink-soft); }
.blog-content hr { border: 0; border-top: 1.5px solid var(--border); margin: var(--space-10) 0; }

/* --- Code ----------------------------------------------------------------- */
.blog-content :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 7px;
  background: var(--tan);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  white-space: nowrap;
}
.blog-content pre {
  position: relative;
  margin: var(--space-8) 0;
  padding: var(--space-6) var(--space-8);
  background: var(--ink);
  border: 1.5px solid #2a2a2a;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow-x: auto;
}
.blog-content pre::before {
  content: "Code";
  position: absolute; top: 10px; right: 14px;
  font-family: var(--font-display);
  font-size: 0.68rem; font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: #666;
}
.blog-content pre code {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.75;
  color: #d4ddc4;
  background: none; border: 0; padding: 0;
  white-space: pre;
}

/* --- Blockquote ----------------------------------------------------------- */
.blog-content blockquote {
  margin: var(--space-8) 0;
  padding: var(--space-5) var(--space-6);
  background: var(--paper-cream);
  border-left: 4px solid var(--ink);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--fs-lead);
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.6;
}
.blog-content blockquote p { color: var(--ink-soft); margin-bottom: 0; }
.blog-content blockquote cite {
  display: block;
  margin-top: var(--space-3);
  font-style: normal;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* --- Tables --------------------------------------------------------------- */
.blog-content table {
  width: 100%;
  margin: var(--space-8) 0;
  border-collapse: collapse;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.blog-content thead tr { background: var(--ink); }
.blog-content thead th {
  padding: var(--space-4) var(--space-5);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: left;
  color: var(--paper);
  border: 0;
}
.blog-content tbody tr { background: var(--paper); border-bottom: 1px solid var(--border); }
.blog-content tbody tr:last-child { border-bottom: 0; }
/* Editor tables with no <thead> use the first row as a pseudo-header. */
.blog-content table:not(:has(thead)) tbody tr:first-child { background: var(--tan); font-weight: var(--fw-semi); }
.blog-content tbody td,
.blog-content tbody th {
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--ink-muted);
  vertical-align: top;
  text-align: left;
}
.blog-content tbody td:first-child { font-weight: var(--fw-medium); color: var(--ink); }

/* --- Media ---------------------------------------------------------------- */
.blog-content img {
  width: 100%;
  margin: var(--space-8) 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.blog-content figure { margin: var(--space-8) 0; }
.blog-content figure img { margin: 0 0 var(--space-3); }
.blog-content figcaption {
  text-align: center;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--ink-muted);
}

/* --- Yoast FAQ accordion -------------------------------------------------- */
.schema-faq-section { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.schema-faq-question {
  position: relative;
  padding-right: 32px;
  margin: 0;
  font-size: var(--fs-h4);
  cursor: pointer;
}
.schema-faq-question::after {
  content: "+";
  position: absolute; right: 0; top: 0;
  font-size: 20px;
  transition: transform var(--dur) var(--ease);
}
.schema-faq-section.is-open .schema-faq-question::after { content: "−"; }
.schema-faq-answer {
  max-height: 0; opacity: 0; margin: 0;
  overflow: hidden;
  font-size: var(--fs-sm);
  transition: max-height var(--dur) var(--ease), opacity var(--dur) var(--ease), margin var(--dur) var(--ease);
}
.schema-faq-section.is-open .schema-faq-answer { max-height: 800px; opacity: 1; margin-top: var(--space-2); }

/* ---------------------------------------------------------------------------
   7. AUTHOR CARD
   --------------------------------------------------------------------------- */
.blog-author-card {
  display: flex; align-items: flex-start; gap: var(--space-8);
  max-width: var(--content-max);
  margin-top: var(--space-14);
  padding: var(--space-8);
  background: var(--paper-tint);
  border: 1px solid rgba(0,18,51,0.08);
  border-radius: 16px;
}
.author-avatar-wrap { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.author-avatar-img { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; }
.author-badge {
  position: absolute; top: 74px; left: 74px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: var(--linkedin);
  border: 3px solid var(--paper-tint);
  border-radius: 50%;
}
.author-readbio-btn {
  padding: var(--space-2) var(--space-4);
  background: var(--paper);
  border: 1px solid #cfcfd8;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  transition: background var(--dur-fast);
}
.author-readbio-btn:hover { background: #eaeaf0; }
.author-content { flex: 1; min-width: 0; }
.author-eyebrow {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--success);
  margin-bottom: var(--space-1);
}
.author-name { font-size: var(--fs-h3); margin-bottom: var(--space-1); }
.author-role { font-size: var(--fs-sm); color: var(--ink-soft); margin-bottom: var(--space-3); }
.author-bio  { font-size: var(--fs-sm); color: var(--ink-soft); line-height: 1.6; }

/* ---------------------------------------------------------------------------
   8. CTA BANNER
   --------------------------------------------------------------------------- */
.blog-start-banner {
  position: relative;
  max-width: var(--content-max);
  margin-top: var(--space-10);
  padding: var(--space-10) var(--space-8);
  background: var(--paper-cream);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  overflow: hidden;
}
.blog-start-banner::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, var(--border-strong) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.4;
  pointer-events: none;
}
.blog-start-banner > * { position: relative; }
.banner-title { font-size: var(--fs-h3); font-weight: var(--fw-black); margin-bottom: var(--space-2); }
.banner-sub   { font-size: var(--fs-sm); color: var(--ink-muted); margin-bottom: var(--space-6); }
.banner-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); margin-bottom: var(--space-6); }
/* .banner-pill is .bc-pill in the markup — no extra rules needed. */
/* The banner CTA is .bc-btn in the markup; only the spacing differs here. */
.blog-start-banner .bc-btn { padding-inline: var(--space-10); }

@media (max-width: 900px) {
  .blog-page {
    grid-template-columns: 1fr;
    padding: var(--space-6) var(--page-pad) var(--space-16);
  }
  .blog-breadcrumb,
  .blog-hero,
  .blog-toc,
  .blog-body { grid-column: 1; grid-row: auto; }

  .blog-hero { padding-bottom: var(--space-8); }
  .blog-title { max-width: none; }

  /* TOC becomes an inline, collapsible block instead of a sticky rail. */
  .blog-toc {
    position: static;
    max-height: none;
    margin-bottom: var(--space-8);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .blog-toc nav { max-height: 280px; overflow-y: auto; }
  .blog-toc .toc-label { cursor: pointer; margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
  .blog-toc.is-collapsed nav { display: none; }

  .blog-author-card { flex-direction: column; align-items: center; text-align: center; gap: var(--space-4); padding: var(--space-6) var(--space-5); }
}

@media (max-width: 560px) {
  .blog-content pre { padding: var(--space-4) var(--space-5); }
  .blog-content table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .blog-start-banner { padding: var(--space-8) var(--space-5); }
  .blog-page::after { display: none; }
}
