/* ─── Blog Styles ─────────────────────────────────────────────────────────────
   Applies to blog index (home.php), single posts (single.php), and archives.
   Covers rich-text post content and pagination chrome.
   ─────────────────────────────────────────────────────────────────────────── */

/* ── Post content prose ──────────────────────────────────────────────────── */

.blog-content {
  color: hsl(var(--foreground) / 0.85);
  font-size: 1rem;
  line-height: 1.85;
}

.blog-content > * + * {
  margin-top: 1.5rem;
}

.blog-content p {
  margin-bottom: 0;
}

.blog-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: hsl(var(--foreground));
  margin-top: 2.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
}

.blog-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.blog-content h4 {
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

/* ── Lists ───────────────────────────────────────────────────────────────── */

.blog-content ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 0;
}

.blog-content ul li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
  color: hsl(var(--foreground) / 0.82);
  font-size: 0.975rem;
}

.blog-content ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65rem;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: hsl(var(--accent));
}

.blog-content ol {
  padding-left: 1.5rem;
  margin-bottom: 0;
}

.blog-content ol li {
  margin-bottom: 0.5rem;
  color: hsl(var(--foreground) / 0.82);
  font-size: 0.975rem;
}

/* ── Blockquote ──────────────────────────────────────────────────────────── */

.blog-content blockquote {
  border-left: 2px solid hsl(var(--accent));
  margin: 2rem 0;
  padding: 1.125rem 1.5rem;
  background: hsl(var(--secondary) / 0.45);
  color: hsl(var(--foreground) / 0.8);
  font-size: 1.05rem;
  font-style: italic;
  line-height: 1.75;
}

.blog-content blockquote p {
  margin-bottom: 0;
  margin-top: 0;
}

/* ── Links ───────────────────────────────────────────────────────────────── */

.blog-content a {
  color: hsl(var(--accent));
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.2s ease;
}

.blog-content a:hover {
  color: hsl(var(--foreground));
}

/* ── Images ──────────────────────────────────────────────────────────────── */

.blog-content img,
.blog-content figure img {
  width: 100%;
  height: auto;
  border: 1px solid hsl(var(--border) / 0.4);
}

.blog-content figure {
  margin: 2rem 0;
}

.blog-content figcaption {
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
  text-align: center;
  margin-top: 0.625rem;
  letter-spacing: 0.05em;
}

/* WordPress alignment classes */
.blog-content .alignleft {
  float: left;
  margin: 0 1.5rem 1rem 0;
  max-width: 50%;
}

.blog-content .alignright {
  float: right;
  margin: 0 0 1rem 1.5rem;
  max-width: 50%;
}

.blog-content .aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* ── Code ────────────────────────────────────────────────────────────────── */

.blog-content code {
  background: hsl(var(--secondary));
  color: hsl(var(--accent));
  font-size: 0.83em;
  padding: 0.15em 0.4em;
  font-family: 'Courier New', Courier, monospace;
}

.blog-content pre {
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border) / 0.5);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.65;
}

.blog-content pre code {
  background: transparent;
  padding: 0;
  color: hsl(var(--foreground) / 0.9);
  font-size: inherit;
}

/* ── Horizontal rule ─────────────────────────────────────────────────────── */

.blog-content hr {
  border: none;
  border-top: 1px solid hsl(var(--border) / 0.5);
  margin: 2.5rem 0;
}

/* ── Tables ──────────────────────────────────────────────────────────────── */

.blog-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.blog-content thead th {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
}

.blog-content tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(var(--border) / 0.4);
  color: hsl(var(--foreground) / 0.82);
}

/* ── Posts grid — incomplete last row handling ───────────────────────────── */

@media (min-width: 1024px) {
  /* 1 card alone in last row: shift to center column */
  .sig-posts-grid > *:last-child:nth-child(3n + 1) {
    grid-column-start: 2;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  /* 1 card alone in last row on 2-col layout: center it */
  .sig-posts-grid > *:last-child:nth-child(2n + 1):not(:first-child) {
    grid-column: 1 / -1;
    max-width: 50%;
    margin-inline: auto;
  }
}

/* ── Pagination ──────────────────────────────────────────────────────────── */

.blog-pagination .nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  justify-content: center;
}

.blog-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.375rem;
  height: 2.375rem;
  padding: 0 0.625rem;
  border: 1px solid hsl(var(--border));
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.blog-pagination .page-numbers:hover {
  border-color: hsl(var(--accent) / 0.6);
  color: hsl(var(--accent));
}

.blog-pagination .page-numbers.current {
  border-color: hsl(var(--accent));
  color: hsl(var(--accent));
  background: hsl(var(--accent) / 0.08);
}

.blog-pagination .page-numbers.dots {
  border-color: transparent;
  pointer-events: none;
}
