/* ── Blog layout ─────────────────────────────────────────── */
.blog-wrap {
  padding-bottom: 80px;
}

.blog-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

.blog-inner-narrow {
  max-width: 780px;
}

/* ── Featured post ───────────────────────────────────────── */
.blog-featured {
  padding: 48px 0 0;
}

.bf-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-radius: 16px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s, box-shadow 0.18s;
}

.bf-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
}

.bf-img {
  min-height: 340px;
  background-size: cover;
  background-position: center;
}

.bf-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}

.bf-body {
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.bf-title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  margin: 0;
}

.bf-excerpt {
  font-size: 15px;
  color: var(--text-m);
  line-height: 1.6;
  margin: 0;
}

.bf-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-d);
}

.bf-author {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bf-dot {
  color: var(--text-d);
}

/* ── Topic tag pill ──────────────────────────────────────── */
.blog-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* ── Topics nav + search row ─────────────────────────────── */
.blog-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 32px 0 28px;
  flex-wrap: wrap;
}

.blog-topics-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.blog-topic-pill {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-m);
  background: var(--surface);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.blog-topic-pill:hover {
  background: var(--card);
  color: var(--text);
}

.blog-topic-pill.active {
  background: var(--pill-color, var(--accent));
  color: #fff;
  border-color: var(--pill-color, var(--accent));
}

/* ── Search ──────────────────────────────────────────────── */
.blog-search-wrap {
  position: relative;
  flex-shrink: 0;
}

.blog-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-d);
  pointer-events: none;
}

.blog-search-input {
  width: 220px;
  padding: 8px 14px 8px 34px;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.blog-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(79,124,255,0.15);
}

.blog-search-input::placeholder {
  color: var(--text-d);
}

.blog-search-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 340px;
  background: var(--card);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  overflow: hidden;
  z-index: 200;
}

.blog-search-results.open {
  display: block;
}

.bsr-item {
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.05));
  transition: background 0.12s;
}

.bsr-item:last-child {
  border-bottom: none;
}

.bsr-item:hover {
  background: var(--surface);
}

.bsr-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
}

.bsr-topic {
  font-size: 11px;
  color: var(--text-d);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.bsr-empty {
  padding: 16px;
  font-size: 13px;
  color: var(--text-d);
  text-align: center;
}

/* ── Post grid ───────────────────────────────────────────── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.blog-grid-sm {
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.blog-card {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s, box-shadow 0.18s;
}

.blog-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
}

.bc-img-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.bc-img {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: transform 0.3s;
}

.blog-card:hover .bc-img {
  transform: scale(1.03);
}

.bc-img-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
}

.bc-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.bc-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  margin: 0;
}

.bc-excerpt {
  font-size: 13px;
  color: var(--text-m);
  line-height: 1.5;
  margin: 0;
  flex: 1;
}

.bc-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-d);
  margin-top: auto;
  padding-top: 4px;
}

/* ── Pagination ──────────────────────────────────────────── */
.blog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 48px;
}

.blog-page-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}

.blog-page-btn:hover {
  background: var(--card);
}

.blog-page-info {
  font-size: 13px;
  color: var(--text-d);
}

/* ── Empty state ─────────────────────────────────────────── */
.blog-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 64px 0;
  color: var(--text-d);
  font-size: 14px;
}

/* ── Topic page header ───────────────────────────────────── */
.blog-topic-header {
  padding: 40px 0 0;
}

.bth-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  margin: 10px 0 8px;
}

.bth-desc {
  font-size: 15px;
  color: var(--text-m);
  margin: 0;
}

/* ── Single post ─────────────────────────────────────────── */
.blog-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 36px 0 20px;
  font-size: 13px;
  color: var(--text-d);
}

.blog-breadcrumb a {
  color: var(--text-m);
  text-decoration: none;
}

.blog-breadcrumb a:hover {
  color: var(--text);
}

.bp-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 28px;
}

.bp-title {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
  margin: 0;
}

.bp-lead {
  font-size: 18px;
  color: var(--text-m);
  line-height: 1.6;
  margin: 0;
}

.bp-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-d);
}

.bp-cover {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 36px;
  background: var(--surface);
}

.bp-cover img {
  width: 100%;
  height: auto;
  display: block;
}

/* ── Article content (rendered markdown) ─────────────────── */
.bp-content {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-m);
}

.bp-content h1,
.bp-content h2,
.bp-content h3,
.bp-content h4 {
  color: var(--text);
  font-weight: 700;
  margin: 1.8em 0 0.6em;
  line-height: 1.3;
}

.bp-content h1 { font-size: 28px; }
.bp-content h2 { font-size: 22px; }
.bp-content h3 { font-size: 18px; }
.bp-content h4 { font-size: 15px; }

.bp-content p {
  margin: 0 0 1.2em;
}

.bp-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bp-content ul,
.bp-content ol {
  padding-left: 1.5em;
  margin: 0 0 1.2em;
}

.bp-content li {
  margin-bottom: 0.4em;
}

.bp-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.4em 0;
  padding: 10px 20px;
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text-m);
}

.bp-content code {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--green, #2DD4A0);
}

.bp-content pre {
  background: var(--surface);
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  border-radius: 8px;
  padding: 16px 20px;
  overflow-x: auto;
  margin: 1.4em 0;
}

.bp-content pre code {
  background: none;
  padding: 0;
  font-size: 13px;
}

.bp-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4em 0;
  font-size: 14px;
}

.bp-content th,
.bp-content td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.06));
}

.bp-content th {
  color: var(--text);
  font-weight: 600;
  background: var(--surface);
}

.bp-content img {
  max-width: 100%;
  border-radius: 8px;
  display: block;
  margin: 1.4em auto;
}

.bp-content hr {
  border: none;
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
  margin: 2em 0;
}

/* ── Post CTA box ────────────────────────────────────────── */
.bp-cta {
  margin: 48px 0;
}

.bp-cta-inner {
  background: linear-gradient(135deg, rgba(79,124,255,0.12) 0%, rgba(45,212,160,0.08) 100%);
  border: 1px solid rgba(79,124,255,0.2);
  border-radius: 14px;
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bp-cta-inner strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.bp-cta-inner p {
  font-size: 14px;
  color: var(--text-m);
  margin: 0;
}

/* ── Related posts ───────────────────────────────────────── */
.bp-related {
  padding-top: 12px;
  border-top: 1px solid var(--border, rgba(255,255,255,0.06));
  margin-top: 48px;
}

.bp-related-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 20px;
}

/* ── Back link ───────────────────────────────────────────── */
.bp-back {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border, rgba(255,255,255,0.06));
}

.bp-back a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-m);
  text-decoration: none;
  transition: color 0.15s;
}

.bp-back a:hover {
  color: var(--accent);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .bf-card {
    grid-template-columns: 1fr;
  }
  .bf-img {
    min-height: 220px;
  }
  .blog-grid,
  .blog-grid-sm {
    grid-template-columns: repeat(2, 1fr);
  }
  .bp-title {
    font-size: 28px;
  }
}

@media (max-width: 600px) {
  .blog-grid,
  .blog-grid-sm {
    grid-template-columns: 1fr;
  }
  .blog-nav-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .blog-search-input {
    width: 100%;
  }
  .blog-search-wrap {
    width: 100%;
  }
  .blog-search-results {
    width: 100%;
    right: auto;
    left: 0;
  }
  .bp-title {
    font-size: 24px;
  }
  .bf-body {
    padding: 24px 20px;
  }
  .bp-cta-inner {
    padding: 24px 20px;
  }
}

/* ── Light mode overrides ────────────────────────────────── */
.light .blog-search-input {
  border-color: rgba(0,0,0,0.1);
}

.light .blog-search-results {
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.light .blog-topic-pill {
  border-color: rgba(0,0,0,0.06);
}
