/* =========================================================
   Bridge & River Digital — blog-styles.css
   Blog-specific component styles. Loaded alongside /styles.css
   on blog index and individual post pages.
   ========================================================= */

/* ─── Blog wrappers ────────────────────────────────────────────────── */
.blog-main { padding-top: calc(var(--nav-h) + 32px); padding-bottom: 96px; }
.post-main { padding-top: calc(var(--nav-h) + 32px); padding-bottom: 96px; }

/* ─── Blog hero ────────────────────────────────────────────────────── */
.blog-hero { margin-bottom: 56px; max-width: 920px; }
.blog-hero h1 { margin: 0 0 24px; color: var(--ink); text-wrap: balance; }
.blog-hero p  { margin: 0; color: var(--body); max-width: 720px; text-wrap: pretty; }

/* ─── 3-up grid ────────────────────────────────────────────────────── */
.blog-grid {
  display: grid; gap: 24px;
  grid-template-columns: 1fr;
}
@media (min-width: 620px) { .blog-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 960px) { .blog-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }

/* ─── Blog card (shared with 404's "while you're here") ────────────── */
.blog-card {
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
  padding: 32px; min-height: 280px;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  transition: border-color var(--dur-med) var(--ease-standard),
              transform var(--dur-med) var(--ease-standard),
              box-shadow var(--dur-med) var(--ease-standard);
  will-change: auto;
}
.blog-card:hover {
  border-color: #c8cdd5;
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,.05);
}
@media (prefers-reduced-motion: reduce) {
  .blog-card { transition: none !important; }
  .blog-card:hover { transform: none !important; }
}
.blog-card:focus-visible { box-shadow: var(--focus-ring); }

.post-tag {
  align-self: flex-start;
  display: inline-flex; align-items: center;
  background: var(--surface-strong); color: var(--ink);
  font-family: var(--f-sans); font-weight: 600; font-size: 12px;
  letter-spacing: 0; text-transform: uppercase;
  padding: 4px 12px; border-radius: var(--r-pill);
  margin-bottom: 24px;
}

.blog-card h2,
.blog-card h3 {
  margin: 0 0 12px;
  font-family: var(--f-sans); font-weight: 600; font-size: 18px;
  line-height: 1.33;
  color: var(--ink); text-wrap: balance;
}
.blog-card p {
  margin: 0 0 24px;
  font-family: var(--f-sans); font-weight: 400; font-size: 14px;
  line-height: 1.5; color: var(--body); flex-grow: 1; text-wrap: pretty;
}
.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto;
}
.card-read-time {
  font-family: var(--f-mono); font-weight: 500; font-size: 11px;
  letter-spacing: 0; text-transform: uppercase; color: var(--muted);
}
.card-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-sans); font-weight: 600; font-size: 14px;
  color: var(--primary);
  transition: gap var(--dur-fast) var(--ease-standard);
}
.blog-card:hover .card-link { gap: 10px; }

/* ─── Blog CTA section (blog index) ────────────────────────────────── */
.blog-cta-section {
  margin-top: 80px;
  padding: 48px clamp(24px, 6vw, 64px);
  background: var(--surface-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-xl);
  text-align: center;
}
.blog-cta-section h2 {
  margin: 0 0 12px;
  font-family: var(--f-sans); font-weight: 400;
  font-size: clamp(24px, 3vw, 32px); letter-spacing: -.4px;
  color: var(--ink); text-wrap: balance;
}
.blog-cta-section p {
  margin: 0 auto 24px; max-width: 560px;
  color: var(--body); font-size: 16px; line-height: 1.5;
}

/* ─── Blog post header ─────────────────────────────────────────────── */
.post-header {
  max-width: 780px; margin: 0 auto 48px;
  text-align: left;
}
.post-header .post-tag { margin-bottom: 16px; }
.post-header h1 {
  margin: 0 0 16px;
  color: var(--ink); text-wrap: balance;
  font-family: var(--f-sans); font-weight: 400;
  font-size: clamp(32px, 4.4vw, 48px); line-height: 1.1;
  letter-spacing: -1px;
}
.post-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  color: var(--muted); font-size: 14px;
}
.post-meta-dot { color: var(--muted-soft); }

/* ─── Post layout (sidebar TOC + content) ──────────────────────────── */
.post-layout {
  display: grid; gap: 48px;
  grid-template-columns: 1fr;
  max-width: var(--container-max); margin: 0 auto;
}
@media (min-width: 1024px) {
  .post-layout {
    grid-template-columns: 260px minmax(0, 780px);
    gap: 56px;
  }
}

.post-sidebar { align-self: start; }
@media (min-width: 1024px) {
  .post-sidebar { position: sticky; top: calc(var(--nav-h) + 16px); }
}

.table-of-contents {
  padding: 24px;
  background: var(--surface-soft);
  border-left: 3px solid var(--primary);
  border-radius: var(--r-md);
}
.table-of-contents h3 {
  margin: 0 0 16px;
  font-family: var(--f-sans); font-weight: 600; font-size: 13px;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted);
}
.table-of-contents ol {
  list-style: none; counter-reset: toc; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.table-of-contents li { counter-increment: toc; position: relative; padding-left: 28px; }
.table-of-contents li::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute; left: 0; top: 2px;
  font-family: var(--f-mono); font-weight: 500; font-size: 11px;
  color: var(--muted-soft);
}
.table-of-contents a {
  font-family: var(--f-sans); font-weight: 500; font-size: 14px;
  color: var(--body); line-height: 1.4;
  transition: color var(--dur-fast) var(--ease-standard);
}
.table-of-contents a:hover { color: var(--primary); }

/* Prev / next post nav (above footer on post pages) */
.post-pager {
  margin: 64px auto 0;
  padding-top: 32px;
  border-top: 1px solid var(--hairline);
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .post-pager { grid-template-columns: 1fr 1fr; } }
.post-pager a {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 20px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--canvas);
  transition: border-color var(--dur-fast) var(--ease-standard);
}
.post-pager a:hover { border-color: var(--primary); }
.post-pager .pager-label {
  font-family: var(--f-mono); font-weight: 500; font-size: 11px;
  letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.post-pager .pager-title {
  font-family: var(--f-sans); font-weight: 600; font-size: 15px;
  color: var(--ink); line-height: 1.35;
}
.post-pager .pager-next { text-align: right; }

/* ─── Post article typography ──────────────────────────────────────── */
.post-article {
  font-family: var(--f-sans); color: var(--ink);
  font-size: 17px; line-height: 1.65;
}
.post-article p { margin: 0 0 1.25em; color: var(--ink); }
.post-article p.intro {
  font-size: 19px; line-height: 1.55; color: var(--ink); margin-bottom: 1.5em;
}
.post-article p.intro strong { color: var(--ink); font-weight: 700; }
.post-article a {
  color: var(--primary);
  text-decoration: underline; text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.post-article a:hover { color: var(--primary-active); }
.post-article h2 {
  margin: 2.25em 0 0.75em;
  padding-left: 16px;
  border-left: 3px solid var(--primary);
  font-family: var(--f-sans); font-weight: 600;
  font-size: clamp(22px, 2.4vw, 28px); line-height: 1.2;
  letter-spacing: -.4px; color: var(--ink);
  scroll-margin-top: calc(var(--nav-h) + 16px);
}
.post-article h3 {
  margin: 1.75em 0 0.5em;
  font-family: var(--f-sans); font-weight: 600;
  font-size: 20px; line-height: 1.3; color: var(--ink);
  scroll-margin-top: calc(var(--nav-h) + 16px);
}
.post-article ul,
.post-article ol {
  margin: 0 0 1.25em; padding-left: 1.5em;
  color: var(--ink);
}
.post-article ul li, .post-article ol li { margin-bottom: 0.5em; }
.post-article strong { color: var(--ink); font-weight: 700; }

/* Inline mid-post CTA block */
.cta-box-inline {
  margin: 2em 0;
  padding: 28px 32px;
  background: var(--surface-soft);
  border: 1px solid var(--hairline);
  border-left: 4px solid var(--primary);
  border-radius: var(--r-md);
}
.cta-box-inline h3 {
  margin: 0 0 8px;
  border-left: 0; padding-left: 0;
  font-family: var(--f-sans); font-weight: 600; font-size: 18px;
  color: var(--ink);
}
.cta-box-inline p {
  margin: 0 0 16px; color: var(--body); font-size: 15px;
}

/* details/summary FAQ blocks */
.post-article details {
  border-bottom: 1px solid var(--hairline);
  padding: 16px 0;
}
.post-article details:first-of-type { border-top: 1px solid var(--hairline); }
.post-article summary {
  cursor: pointer;
  font-family: var(--f-sans); font-weight: 600; font-size: 16px;
  color: var(--ink);
  list-style: none;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding-right: 4px;
}
.post-article summary::-webkit-details-marker { display: none; }
.post-article summary::after {
  content: ''; display: inline-block;
  width: 10px; height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform var(--dur-med) var(--ease-standard);
  flex-shrink: 0;
}
.post-article details[open] summary::after { transform: rotate(-135deg); }
.post-article details p {
  margin: 12px 0 4px; color: var(--body); font-size: 15px; line-height: 1.6;
}
@media (prefers-reduced-motion: reduce) {
  .post-article summary::after { transition: none; }
}

/* Standalone .btn-primary in posts (matches the system) */
.post-article .btn-primary,
.cta-box-inline .btn-primary,
.final-cta .btn-primary,
.final-cta .btn-primary-large {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-sans); font-weight: 600; font-size: 16px;
  text-decoration: none;
  padding: 12px 24px; height: 44px;
  border-radius: var(--r-pill);
  background: var(--primary); color: var(--on-primary);
  border: 0; cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard);
}
.post-article .btn-primary:hover,
.cta-box-inline .btn-primary:hover,
.final-cta .btn-primary:hover,
.final-cta .btn-primary-large:hover { background: var(--primary-active); }
.final-cta .btn-primary-large { height: 56px; padding: 16px 32px; }

/* Final-cta block at end of posts */
.final-cta {
  margin: 64px 0 0;
  padding: 48px 32px;
  background: var(--surface-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-xl);
  text-align: center;
}
.final-cta h2 {
  margin: 0 0 12px;
  border-left: 0; padding-left: 0;
  font-family: var(--f-sans); font-weight: 400;
  font-size: clamp(24px, 3vw, 32px); letter-spacing: -.4px;
  color: var(--ink); text-wrap: balance;
}
.final-cta p {
  margin: 0 auto 24px; max-width: 560px;
  color: var(--body); font-size: 16px;
}
.final-cta .cta-subtext {
  display: block; margin-top: 16px;
  font-size: 13px; color: var(--muted);
}

/* ─── Scroll progress bar (blog posts only) ────────────────────────── */
#scroll-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px; z-index: 31;
  background: transparent;
  pointer-events: none;
}
#scroll-progress::after {
  content: ''; display: block;
  width: var(--scroll-pct, 0%); height: 100%;
  background: var(--primary);
  transition: width 60ms linear;
}
@media (prefers-reduced-motion: reduce) {
  #scroll-progress::after { transition: none; }
}

/* ─── Mobile tightening (blog) ─────────────────────────────────────── */
@media (max-width: 720px) {
  .blog-main { padding-top: calc(var(--nav-h) + 18px); padding-bottom: 40px; }
  .post-main { padding-top: calc(var(--nav-h) + 18px); padding-bottom: 40px; }

  .blog-hero { margin-bottom: 28px; }
  .blog-hero h1 { margin-bottom: 14px; }

  .blog-grid { gap: 16px; }
  .blog-card { padding: 22px; min-height: 0; }
  .blog-card h2, .blog-card h3 { margin-bottom: 8px; }
  .blog-card p { margin-bottom: 16px; }
  .post-tag { margin-bottom: 16px; }

  .blog-cta-section { margin-top: 40px; padding: 28px 20px; }
  .blog-cta-section h2 { margin-bottom: 8px; }
  .blog-cta-section p { margin-bottom: 18px; }

  .post-header { margin-bottom: 28px; }
  .post-header .post-tag { margin-bottom: 12px; }
  .post-header h1 { margin-bottom: 12px; }

  .post-layout { gap: 28px; }
  .table-of-contents { padding: 18px; }
  .table-of-contents h3 { margin-bottom: 10px; }

  .post-article { font-size: 16px; line-height: 1.6; }
  .post-article p.intro { font-size: 17px; }
  .post-article h2 { margin: 1.6em 0 0.5em; padding-left: 12px; }
  .post-article h3 { margin: 1.25em 0 0.4em; }

  .cta-box-inline { margin: 1.5em 0; padding: 20px 22px; }
  .cta-box-inline p { margin-bottom: 12px; }

  .post-article details { padding: 14px 0; }
  .post-article summary { font-size: 15px; gap: 12px; }

  .final-cta { margin-top: 40px; padding: 28px 20px; }
  .final-cta h2 { margin-bottom: 8px; }
  .final-cta p { margin-bottom: 18px; }
  .final-cta .cta-subtext { margin-top: 12px; }

  .post-pager { margin-top: 40px; padding-top: 24px; gap: 12px; }
  .post-pager a { padding: 14px 16px; }
}
