/* Blog: index, category listings and single posts. Uses the site design
   tokens from app.css (--text, --dim, --panel, --line, --sky/royal/magenta,
   --grad, --r, --wrap, --soft-shadow). Light-first, matches the marketing pages. */

/* ---- shared hero ---- */
.blog-hero { padding: 96px 0 20px; }
.blog-hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1.05; letter-spacing: -0.02em; margin: 14px 0 0; }
.blog-hero .lede { max-width: 44rem; margin-top: 18px; }
.blog-hero .eyebrow--brand a { color: inherit; text-decoration: none; }

/* ---- listing grid ---- */
.blog-list { padding: 28px 0 90px; }
.post-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 26px; }
.post-card { display: flex; }
.post-card-link {
  display: flex; flex-direction: column; width: 100%;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; text-decoration: none; color: inherit;
  box-shadow: var(--soft-shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.post-card-link:hover { transform: translateY(-3px); box-shadow: var(--soft-shadow-lg); }
.post-card-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--panel-2); }
.post-card-body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 8px; }
.post-card-cat { margin: 0; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-magenta); }
.post-card-title { margin: 0; font-size: 1.28rem; line-height: 1.22; letter-spacing: -0.01em; color: var(--text); }
.post-card-desc { margin: 0; color: var(--dim); font-size: .98rem; line-height: 1.5; }
.post-card-date { margin: 6px 0 0; color: var(--soft); font-size: .82rem; }

/* ---- single post ---- */
.post { padding: 96px 0 90px; }
.post-wrap { max-width: 46rem; }
.post-eyebrow { margin: 0 0 14px; font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.post-eyebrow a { color: var(--magenta); text-decoration: none; }
.post-title { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.08; letter-spacing: -0.02em; margin: 0; color: var(--text); }
.post-meta { margin: 16px 0 0; color: var(--soft); font-size: .9rem; }
.post-hero { width: 100%; height: auto; border-radius: var(--r); margin: 30px 0 8px; display: block; border: 1px solid var(--line); }

/* ---- prose body ----
   One article stylesheet for every post: the migrated WordPress guides and the
   Outrank-published ones alike, plus whatever the webhook sends next. Outrank
   markdown leans on wide comparison tables, bold-label callout quotes, inline
   screenshots and a generated Table of Contents; each of those has a rule
   here so a new post looks finished with no per-post work. Tables, figures and
   the contents block are wrapped/classed at build time by
   src/plugins/rehype-post-body.mjs. Token-only, so both themes follow. */
.post-body { margin-top: 30px; color: var(--text); font-size: 1.09rem; line-height: 1.72; }
.post-body > *:first-child { margin-top: 0; }
.post-body > *:last-child { margin-bottom: 0; }
.post-body p { margin: 0 0 1.25em; }
.post-body h2, .post-body h3, .post-body h4 { color: var(--text); text-wrap: pretty; scroll-margin-top: calc(var(--header-h, 72px) + 20px); }
.post-body h2 { font-size: 1.65rem; line-height: 1.2; letter-spacing: -0.015em; margin: 2.1em 0 .65em; }
.post-body h3 { font-size: 1.3rem; line-height: 1.28; letter-spacing: -0.01em; margin: 1.8em 0 .5em; }
.post-body h4 { font-size: 1.08rem; line-height: 1.35; margin: 1.5em 0 .4em; }
.post-body h2 + h3, .post-body h3 + h4 { margin-top: .9em; }
.post-body h2:first-child, .post-body h3:first-child { margin-top: 0; }
.post-body a { color: var(--ink-royal); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; text-decoration-color: rgba(73, 121, 239, .45); }
.post-body a:hover { color: var(--magenta); text-decoration-color: currentColor; }
.post-body strong { color: var(--text); font-weight: 650; }
.post-body em { font-style: italic; }
.post-body hr { border: 0; border-top: 1px solid var(--line-hi); margin: 2.4em 0; }
.post-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; padding: .12em .4em; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); }
.post-body pre { margin: 0 0 1.4em; padding: 16px 18px; border-radius: var(--r-sm); background: var(--panel-2); border: 1px solid var(--line); overflow-x: auto; font-size: .9rem; line-height: 1.55; }
.post-body pre code { padding: 0; border: 0; background: none; font-size: inherit; }

/* Lists. Coloured markers, breathing room between items, tighter nesting. */
.post-body ul, .post-body ol { margin: 0 0 1.35em; padding-left: 1.45em; }
.post-body li { margin: 0 0 .55em; padding-left: .15em; }
.post-body li > p { margin: 0 0 .55em; }
.post-body li > ul, .post-body li > ol { margin: .45em 0 .2em; }
.post-body ul > li::marker { color: var(--magenta); }
.post-body ol > li::marker { color: var(--royal); font-weight: 700; font-variant-numeric: tabular-nums; }

/* Images. Standalone images are wrapped in figure.post-figure at build time
   (no paragraph + image margin stacking); the bare rule covers inline ones. */
.post-body img { max-width: 100%; height: auto; display: block; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel-2); }
.post-body p img { margin: 1.4em 0; }
.post-body figure { margin: 2em 0; }
.post-body .post-figure img { width: 100%; margin: 0; }
.post-body figcaption { color: var(--soft); font-size: .86rem; line-height: 1.5; margin-top: .65em; text-align: center; }

/* Callouts. Outrank writes its pull-quotes as "**Label:** sentence", so a
   blockquote reads better as a card than as an italic aside. Same positive
   wash as the takeaways box, with the brand gradient as the rail. */
.post-body blockquote {
  position: relative;
  margin: 1.8em 0;
  padding: 18px 22px 18px 26px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: linear-gradient(168deg, rgba(60, 158, 255, 0.1), var(--panel) 52%);
  color: var(--text);
  font-style: normal;
  overflow: hidden;
}
.post-body blockquote::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--grad); }
.post-body blockquote p { margin: 0 0 .7em; }
.post-body blockquote p:last-child { margin-bottom: 0; }
.post-body blockquote strong:first-child { color: var(--magenta); }

/* Tables. Wrapped in div.post-table[data-cols] at build time. The wrapper is
   the scroll container (sideways on a phone, and on desktop for the 6 and 7
   column comparisons), the first column stays pinned so the row label is
   always readable while scrolling. Five or more columns break out of the
   46rem prose measure on wide screens so the cells get real width. */
.post-table {
  margin: 1.8em 0 2em;
  border: 1px solid var(--line-hi);
  border-radius: var(--r-sm);
  background: var(--panel);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.post-table table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .93rem;
  line-height: 1.5;
}
.post-table th, .post-table td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  min-width: 9rem;
}
.post-table th { background: var(--panel-2); color: var(--text); font-weight: 650; font-size: .82rem; letter-spacing: .02em; white-space: nowrap; border-bottom-color: var(--line-hi); }
.post-table thead th:first-child { border-top-left-radius: calc(var(--r-sm) - 1px); }
.post-table thead th:last-child { border-top-right-radius: calc(var(--r-sm) - 1px); }
.post-table tbody tr:last-child td { border-bottom: 0; }
.post-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--panel-2) 45%, var(--panel)); }
.post-table td:first-child { font-weight: 600; color: var(--text); }
.post-table th:first-child, .post-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--panel);
  box-shadow: inset -1px 0 0 var(--line);
}
.post-table thead th:first-child { background: var(--panel-2); }
.post-table tbody tr:nth-child(even) td:first-child { background: color-mix(in srgb, var(--panel-2) 45%, var(--panel)); }
.post-table td a { word-break: break-word; }
.post-table[data-cols="1"] th, .post-table[data-cols="1"] td,
.post-table[data-cols="2"] th, .post-table[data-cols="2"] td,
.post-table[data-cols="3"] th, .post-table[data-cols="3"] td { min-width: 0; }
.post-table[data-cols="2"] td:first-child, .post-table[data-cols="3"] td:first-child { position: static; box-shadow: none; }
@media (min-width: 1040px) {
  .post-table[data-cols="5"], .post-table[data-cols="6"], .post-table[data-cols="7"], .post-table[data-cols="8"] {
    --tw: min(calc(100vw - 64px), 66rem);
    width: var(--tw);
    margin-left: calc((100% - var(--tw)) / 2);
  }
  .post-table[data-cols="6"] th, .post-table[data-cols="6"] td,
  .post-table[data-cols="7"] th, .post-table[data-cols="7"] td,
  .post-table[data-cols="8"] th, .post-table[data-cols="8"] td { min-width: 8.5rem; }
}

/* Contents panel. Outrank emits "## Table of Contents" plus a nested list of
   anchors; the plugin classes both so it reads as one navigational block
   instead of a heading and a long bulleted list. */
.post-body .post-toc-h { font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-magenta); margin: 2em 0 0; padding: 18px 22px 0; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r-sm) var(--r-sm) 0 0; background: var(--panel); }
.post-body .post-toc { margin: 0 0 2em; padding: 10px 22px 18px; list-style: none; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r-sm) var(--r-sm); background: var(--panel); font-size: .98rem; line-height: 1.45; }
.post-body .post-toc li { margin: 0; padding: 0; }
.post-body .post-toc > li { padding: 7px 0; border-top: 1px solid var(--line); }
.post-body .post-toc > li:first-child { border-top: 0; }
.post-body .post-toc a { color: var(--text); text-decoration: none; font-weight: 600; }
.post-body .post-toc a:hover { color: var(--royal); }
.post-body .post-toc ul, .post-body .post-toc ol { list-style: none; margin: 4px 0 0; padding-left: 14px; }
.post-body .post-toc ul li { padding: 2px 0; }
.post-body .post-toc ul a { color: var(--dim); font-weight: 500; font-size: .92rem; }

.post-back { margin-top: 44px; }
.post-back a { color: var(--dim); text-decoration: none; font-weight: 600; }
.post-back a:hover { color: var(--magenta); }

/* Closing conversion card. Sits on the site's positive-surface wash (the same
   one .fork-card and .consult-pair use) so it reads as the answer to the piece
   rather than another paragraph of it. */
.post-cta {
  margin-top: 52px;
  padding: 28px 30px 30px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: linear-gradient(168deg, rgba(60, 158, 255, 0.11), var(--panel) 44%);
}
.post-cta-eyebrow {
  margin: 0;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--magenta);
}
.post-cta-h { margin: 10px 0 0; font-size: 1.42rem; line-height: 1.22; letter-spacing: -0.01em; color: var(--text); text-wrap: balance; }
.post-cta-h .nb { white-space: nowrap; }
.post-cta-body { margin: 10px 0 0; color: var(--dim); line-height: 1.6; }
.post-cta-actions { margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; }
.post-cta-link {
  display: inline-block;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--grad);
  background-origin: border-box;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.post-cta-link:hover { filter: brightness(1.06); }
.post-cta-alt { color: var(--dim); font-weight: 600; text-decoration: none; }
.post-cta-alt:hover { color: var(--magenta); }

/* Related posts. The library's only in-content path between articles, so it
   ships on every post including the ones published through the webhook. */
.post-related { margin-top: 52px; padding-top: 32px; border-top: 1px solid var(--line); }
.post-related-h { margin: 0 0 18px; font-size: 1.24rem; letter-spacing: -0.01em; color: var(--text); }
.post-related-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.post-related-link {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--panel);
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease;
}
.post-related-link:hover { transform: translateY(-2px); box-shadow: var(--soft-shadow); }
.post-related-cat {
  display: block;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-magenta);
}
.post-related-title { display: block; margin-top: 5px; color: var(--text); font-weight: 600; line-height: 1.35; }

@media (prefers-reduced-motion: reduce) {
  .post-related-link { transition: none; }
  .post-related-link:hover { transform: none; }
}

/* FAQ. Rendered from the post's optional `faq` frontmatter and mirrored as
   FAQPage JSON-LD, so the visible answer and the structured one are the same
   text. Questions come from the live People-also-ask block for the post's
   target query. Kept as a plain dl (no disclosure widget) so the answers are
   in the rendered text for extraction rather than hidden behind a click. */
.post-faq { margin-top: 52px; padding-top: 32px; border-top: 1px solid var(--line); }
.post-faq-h { margin: 0 0 20px; font-size: 1.24rem; letter-spacing: -0.01em; color: var(--text); }
.post-faq-list { margin: 0; padding: 0; display: grid; gap: 14px; }
.post-faq-item {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--panel);
}
.post-faq-q { margin: 0; color: var(--text); font-weight: 600; line-height: 1.4; }
.post-faq-a { margin: 8px 0 0; color: var(--dim); line-height: 1.62; }

/* Key takeaways. A summary box above the article body: the answer to the
   article's own question, before the reader (or an answer engine) has to mine
   the body for it. Driven by the post's optional `takeaways` frontmatter so
   the markdown file needs no raw HTML. */
.post-takeaways {
  margin: 0 0 30px;
  padding: 22px 24px 24px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: linear-gradient(168deg, rgba(60, 158, 255, 0.11), var(--panel) 44%);
}
.post-takeaways-h {
  margin: 0;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--magenta);
}
.post-takeaways-list { margin: 12px 0 0; padding: 0 0 0 20px; display: grid; gap: 8px; }
.post-takeaways-list li { color: var(--text); line-height: 1.58; }

@media (max-width: 640px) {
  .blog-hero { padding: 78px 0 12px; }
  .post { padding: 78px 0 70px; }
  .post-body { font-size: 1.04rem; }
  .post-body h2 { font-size: 1.45rem; }
  .post-body h3 { font-size: 1.2rem; }
  .post-body blockquote { padding: 16px 16px 16px 20px; }
  .post-table th, .post-table td { padding: 10px 12px; min-width: 8rem; }
  .post-table table { font-size: .9rem; }
  .post-table th:first-child, .post-table td:first-child { min-width: 6.5rem; max-width: 9rem; }
  .post-body .post-toc-h { padding: 16px 18px 0; }
  .post-body .post-toc { padding: 8px 18px 16px; }
  .post-cta { padding: 24px 20px 26px; }
  .post-cta-actions { gap: 14px; }
  .post-cta-link { width: 100%; text-align: center; }
  .post-faq-item { padding: 16px 18px; }
  .post-takeaways { padding: 18px 18px 20px; }
}
