/*
 * ProSocial Agency - Blog
 * 16-blog.css
 * Deferred tier. Loaded on the posts page, single posts and archives.
 *
 * This is where Source Serif 4 earns its place. Long form runs at 17px
 * on a controlled measure with a sticky contents rail beside it.
 *
 * Post lists reuse the ruled index from 03-layout rather than a card
 * grid, so the blog matches the rest of the site.
 */

/* -------- Featured image -------- */
/* The article header itself is the shared hero component in
   05-hero.css. Only the full width thumbnail lives here. */

.post-thumb {
  margin-top: var(--space-10);
  margin-bottom: var(--space-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.post-thumb img {
  width: 100%;
  height: auto;
  display: block;
}

/* -------- Layout -------- */

.post-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: var(--space-16);
  align-items: start;
}

/* -------- Prose -------- */
/* Serif at a short measure. The measure is the readability control,
   not the font size. */

.prose {
  max-width: 62ch;
  font-family: var(--font-text);
  font-size: var(--text-base);
  line-height: var(--leading-loose);
  color: var(--ink-body);
}

.prose > * + * { margin-top: var(--space-5); }

.prose h2 {
  font-size: var(--text-xl);
  max-width: 24ch;
  margin-top: var(--space-12);
  margin-bottom: var(--space-4);
}

.prose h3 {
  font-size: var(--text-lg);
  margin-top: var(--space-10);
  margin-bottom: var(--space-3);
}

.prose ul,
.prose ol {
  padding-left: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.prose li { padding-left: var(--space-2); }

.prose img {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  margin-block: var(--space-8);
}

.prose blockquote {
  font-family: var(--font-text);
  font-weight: var(--weight-light);
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  color: var(--ink);
  border-left: 2px solid var(--action);
  border-radius: 0;
  padding-left: var(--space-6);
  margin-block: var(--space-10);
}

.prose table {
  width: 100%;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  margin-block: var(--space-8);
}

.prose th,
.prose td {
  text-align: left;
  padding: var(--space-3) var(--space-4) var(--space-3) 0;
  border-bottom: 1px solid var(--rule);
}

.prose th {
  font-weight: var(--weight-medium);
  color: var(--ink);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--paper-sunk);
  padding: 2px 5px;
  border-radius: var(--radius-sm);
}

/* -------- Contents rail -------- */

.post-rail { position: sticky; top: calc(var(--nav-height) + var(--space-8)); }

.toc { border-top: 1px solid var(--rule); padding-top: var(--space-5); }

.toc__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
  list-style: none;
  padding: 0;
}

.toc__link {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  color: var(--ink-muted);
  border-left: 1px solid transparent;
  padding-left: var(--space-4);
  margin-left: calc(var(--space-4) * -1);
  transition: var(--transition-color);
  display: block;
}

.toc__link:hover { color: var(--ink); }

.toc__link.is-active {
  color: var(--ink);
  border-left-color: var(--action);
}

.toc__item--h3 .toc__link { padding-left: var(--space-6); font-size: var(--text-xs); }

.rail-cta {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--rule);
}

.rail-cta .btn { width: 100%; justify-content: center; margin-top: var(--space-4); }

/* -------- Byline and disclaimer -------- */

.post-byline {
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--rule);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-8);
}

/* -------- Featured post -------- */

.post-featured {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: var(--grid-gap);
  align-items: center;
  border-block: 1px solid var(--rule);
  padding-block: var(--space-10);
}

.post-featured__media {
  aspect-ratio: 3 / 2;
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.post-featured__media img { width: 100%; height: 100%; object-fit: cover; }

/* -------- Pagination -------- */

.pagination {
  margin-top: var(--space-12);
  display: flex;
  justify-content: center;
}

.pagination ul {
  display: flex;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding-inline: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink-body);
  transition: var(--transition-color);
}

.pagination a:hover { border-color: var(--rule-strong); color: var(--ink); }

.pagination .current {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* -------- 404 -------- */

.error-routes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-8);
  margin-top: var(--space-12);
  border-top: 1px solid var(--rule);
  padding-top: var(--space-10);
}

/* -------- Responsive -------- */

@media (max-width: 991px) {
  .post-grid { grid-template-columns: 1fr; gap: var(--space-10); }
  .post-rail { position: static; }
  .toc { display: none; }
  .post-featured { grid-template-columns: 1fr; }
  .error-routes { grid-template-columns: 1fr; gap: var(--space-6); }
}

@media (max-width: 767px) {
  .prose { max-width: 100%; }
  }
