/* ─────────────────────────────────────────────────────────────────────────────
   Blog - Listing Page
───────────────────────────────────────────────────────────────────────────── */

/* Hero */
.blog-hero {
  padding: var(--space-20) 0 var(--space-12);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.blog-hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: var(--space-4);
  color: var(--text);
}

.blog-hero-sub {
  color: var(--text-muted);
  font-size: var(--text-lg);
  max-width: 560px;
  line-height: 1.6;
}

/* ── Tag filter bar ─────────────────────────────────────────────────────────── */
.tag-filter {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--nav-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10;
}

.tag-filter-inner {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
}

.tag-filter-inner .tag {
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

/* ── Featured post ─────────────────────────────────────────────────────────── */
.featured-post-section {
  padding: var(--space-12) 0 0;
  background: var(--bg);
}

.featured-post-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  background: var(--bg-surface);
  transition: box-shadow var(--transition), transform var(--transition);
}

.featured-post-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.featured-post-image {
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: cover;
}

.featured-post-image-placeholder {
  width: 100%;
  min-height: 280px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: var(--text-faint);
}

.featured-post-body {
  padding: var(--space-10) var(--space-10);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  justify-content: center;
}

.featured-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.featured-label::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

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

.featured-post-title {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--text);
  transition: color var(--transition);
}

.featured-post-card:hover .featured-post-title {
  color: var(--accent);
}

.featured-post-excerpt {
  color: var(--text-muted);
  font-size: var(--text-base);
  line-height: 1.65;
}

.featured-post-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.featured-read-more {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent);
}

.featured-read-more svg {
  transition: transform var(--transition);
}

.featured-post-card:hover .featured-read-more svg {
  transform: translateX(3px);
}

@media (max-width: 720px) {
  .featured-post-card {
    grid-template-columns: 1fr;
  }
  .featured-post-image,
  .featured-post-image-placeholder {
    min-height: 200px;
  }
  .featured-post-body {
    padding: var(--space-6);
  }
}

/* ── Posts grid ─────────────────────────────────────────────────────────────── */
.posts-section {
  padding: var(--space-10) 0 var(--space-20);
  background: var(--bg);
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-6);
}

/* ── Post card ─────────────────────────────────────────────────────────────── */
.post-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.post-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-3px);
  border-color: var(--accent);
}

.post-card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--bg-elevated);
}

.post-card-image-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: var(--text-3xl);
}

.post-card-body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex: 1;
}

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

.post-card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--text);
  transition: color var(--transition);
}

.post-card:hover .post-card-title {
  color: var(--accent);
}

.post-card-excerpt {
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.65;
  flex: 1;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-2);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.post-meta-dot {
  color: var(--border-light);
}

/* ── Skeleton loader ────────────────────────────────────────────────────────── */
.post-card-skeleton {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.post-card-skeleton .post-card-image-placeholder {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-surface) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-line {
  height: 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-surface) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Empty / error state ────────────────────────────────────────────────────── */
.blog-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-24) var(--space-6);
  color: var(--text-muted);
}

.blog-empty h3 {
  margin-bottom: var(--space-3);
  color: var(--text);
  font-size: var(--text-xl);
}

.blog-empty p {
  font-size: var(--text-base);
  line-height: 1.6;
  max-width: 400px;
  margin: 0 auto;
}

.blog-empty code {
  font-family: var(--font-mono, monospace);
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  border: 1px solid var(--border);
}

.blog-not-configured {
  grid-column: 1 / -1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-16) var(--space-10);
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}

.blog-not-configured .config-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

.blog-not-configured h3 {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-3);
  color: var(--text);
}

.blog-not-configured p {
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: var(--space-2);
}

.blog-not-configured code {
  font-family: var(--font-mono, monospace);
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.9em;
  border: 1px solid var(--border);
  color: var(--accent);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Blog - Single Post Page
───────────────────────────────────────────────────────────────────────────── */
.post-page {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-16) var(--space-6);
}

.post-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-10);
  text-decoration: none;
  transition: color var(--transition);
}

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

.post-back svg { transition: transform var(--transition); }
.post-back:hover svg { transform: translateX(-3px); }

.post-header {
  margin-bottom: var(--space-10);
}

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

.post-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: var(--space-5);
  color: var(--text);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-muted);
  flex-wrap: wrap;
}

.post-meta-dot { color: var(--border-light); }

.post-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-10);
  border: 1px solid var(--border);
}

/* Ghost rendered content styles */
.post-content {
  font-size: var(--text-lg);
  line-height: 1.8;
  color: var(--text);
}

.post-content h2 {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: var(--space-10) 0 var(--space-4);
  color: var(--text);
}

.post-content h3 {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: var(--space-8) 0 var(--space-3);
  color: var(--text);
}

.post-content p {
  margin-bottom: var(--space-5);
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(26, 86, 232, 0.35);
}

.post-content a:hover {
  text-decoration-color: var(--accent);
}

.post-content img {
  width: 100%;
  border-radius: var(--radius);
  margin: var(--space-8) 0;
  border: 1px solid var(--border);
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: var(--space-4) var(--space-6);
  margin: var(--space-8) 0;
  background: var(--bg-surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
  font-style: italic;
}

.post-content pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
  overflow-x: auto;
  margin: var(--space-6) 0;
  font-size: var(--text-sm);
  line-height: 1.6;
}

.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

.post-content ul,
.post-content ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-5);
}

.post-content ul { list-style: disc; }
.post-content ol { list-style: decimal; }

.post-content li {
  margin-bottom: var(--space-2);
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-10) 0;
}

/* Post skeleton */
.post-skeleton {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-16) var(--space-6);
}

.post-skeleton .skeleton-line + .skeleton-line { margin-top: var(--space-3); }

/* Post error */
.post-error {
  text-align: center;
  padding: var(--space-24) var(--space-6);
}

.post-error h2 {
  margin-bottom: var(--space-4);
  color: var(--text);
}

.post-error p {
  color: var(--text-muted);
  margin-bottom: var(--space-8);
}
