/* ═══ Blog — Jejo.ai ═══
   Extends base.css design language.
   Dark theme, system fonts, accent blue.
   Optimized for long-form reading (2000+ words).
*/

/* ═══ Blog Listing ═══ */
.blog-listing {
  max-width: 900px;
  margin: 0 auto;
  padding: 120px 22px 80px;
  position: relative;
  z-index: 1;
}

.blog-header {
  margin-bottom: 64px;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.8s var(--ease-out-expo) 0.2s forwards;
}

.blog-header h1 {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.blog-subtitle {
  font-size: 18px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  max-width: 520px;
}

/* ── Post cards ── */
.posts-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.post-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 16px;
  transition: background 0.3s var(--ease-out-expo);
  opacity: 0;
  transform: translateY(15px);
  animation: fadeUp 0.6s var(--ease-out-expo) forwards;
}

.post-card:nth-child(1) { animation-delay: 0.3s; }
.post-card:nth-child(2) { animation-delay: 0.4s; }
.post-card:nth-child(3) { animation-delay: 0.5s; }
.post-card:nth-child(4) { animation-delay: 0.55s; }
.post-card:nth-child(5) { animation-delay: 0.6s; }
.post-card:nth-child(n+6) { animation-delay: 0.65s; }

.post-card:hover {
  background: rgba(255, 255, 255, 0.03);
}

.post-card-inner {
  padding: 32px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.post-card:last-child .post-card-inner {
  border-bottom: none;
}

.post-pillar {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 12px;
}

.post-card-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 10px;
  transition: color 0.3s;
}

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

.post-card-excerpt {
  font-size: 16px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
  max-width: 640px;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-tertiary);
}

.meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-text-tertiary);
  flex-shrink: 0;
}

.blog-empty {
  padding: 80px 0;
  text-align: center;
  color: var(--color-text-tertiary);
  font-size: 17px;
}

/* ═══ Blog Post ═══ */
.blog-post {
  max-width: 720px;
  margin: 0 auto;
  padding: 100px 22px 80px;
  position: relative;
  z-index: 1;
}

/* ── Breadcrumbs ── */
.breadcrumbs {
  font-size: 13px;
  color: var(--color-text-tertiary);
  margin-bottom: 40px;
  opacity: 0;
  animation: fadeUp 0.5s var(--ease-out-expo) 0.15s forwards;
}

.breadcrumbs a {
  color: var(--color-text-tertiary);
  transition: color 0.2s;
}

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

.breadcrumb-sep {
  margin: 0 8px;
  opacity: 0.4;
}

.breadcrumb-current {
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
  display: inline-block;
  vertical-align: bottom;
}

/* ── Post header ── */
.post-header {
  margin-bottom: 48px;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.7s var(--ease-out-expo) 0.25s forwards;
}

.post-header h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 20px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--color-text-tertiary);
}

.post-author {
  color: var(--color-text-secondary);
  font-weight: 500;
}

/* ═══ Post Body — Article Typography ═══ */
.post-body {
  opacity: 0;
  animation: fadeUp 0.7s var(--ease-out-expo) 0.4s forwards;
}

.post-body h2 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 56px;
  margin-bottom: 20px;
  line-height: 1.25;
}

.post-body h3 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-top: 40px;
  margin-bottom: 16px;
  line-height: 1.3;
}

.post-body h4 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
}

.post-body p {
  font-size: 17px;
  line-height: 1.7;
  color: var(--color-text-secondary);
  margin-bottom: 20px;
}

.post-body p:first-child {
  font-size: 19px;
  line-height: 1.6;
  color: var(--color-text);
}

.post-body strong {
  color: var(--color-text);
  font-weight: 600;
}

.post-body a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-color: rgba(41, 151, 255, 0.3);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}

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

/* ── Lists ── */
.post-body ul,
.post-body ol {
  font-size: 17px;
  line-height: 1.7;
  color: var(--color-text-secondary);
  margin-bottom: 20px;
  padding-left: 24px;
}

.post-body li {
  margin-bottom: 8px;
}

.post-body li::marker {
  color: var(--color-text-tertiary);
}

/* ── Blockquotes ── */
.post-body blockquote {
  margin: 32px 0;
  padding: 20px 24px;
  border-left: 3px solid var(--color-accent);
  background: rgba(41, 151, 255, 0.04);
  border-radius: 0 8px 8px 0;
}

.post-body blockquote p {
  color: var(--color-text);
  font-size: 17px;
  margin-bottom: 0;
}

.post-body blockquote p + p {
  margin-top: 12px;
}

/* ── Tables ── */
.post-body table {
  width: 100%;
  margin: 28px 0;
  border-collapse: collapse;
  font-size: 15px;
}

.post-body thead th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text);
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.post-body tbody td {
  padding: 12px 16px;
  color: var(--color-text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: top;
}

.post-body tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ── Code ── */
.post-body code {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.88em;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--color-text);
}

.post-body pre {
  margin: 28px 0;
  padding: 20px 24px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.post-body pre code {
  background: none;
  padding: 0;
  font-size: 14px;
  line-height: 1.6;
}

/* ── Images ── */
.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 32px 0;
}

.post-body figure {
  margin: 32px 0;
}

.post-body figcaption {
  font-size: 13px;
  color: var(--color-text-tertiary);
  text-align: center;
  margin-top: 10px;
}

/* ── Horizontal rule ── */
.post-body hr {
  border: none;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 48px 0;
}

/* ═══ In-content callout ═══ */
.post-body .callout {
  margin: 32px 0;
  padding: 20px 24px;
  background: rgba(191, 90, 242, 0.06);
  border: 1px solid rgba(191, 90, 242, 0.12);
  border-radius: 12px;
}

.post-body .callout p {
  color: var(--color-text);
  margin-bottom: 0;
  font-size: 16px;
}

.post-body .callout a {
  color: var(--color-accent-purple);
}

/* ═══ Author Bio ═══ */
.author-bio {
  margin: 48px 0 0;
  padding-top: 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.author-bio-inner {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-accent), rgba(191, 90, 242, 0.8));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.author-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
}

.author-role {
  font-size: 13px;
  color: var(--color-text-tertiary);
  margin-bottom: 8px;
}

.author-desc {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ═══ Mid-Article CTA ═══ */
.mid-cta {
  margin: 40px 0;
}

.mid-cta-inner {
  padding: 24px;
  border-radius: 12px;
  background: rgba(41, 151, 255, 0.05);
  border: 1px solid rgba(41, 151, 255, 0.1);
}

.mid-cta-text {
  font-size: 16px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.mid-cta-text strong {
  color: var(--color-text);
}

.mid-cta-link {
  display: inline-block;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-accent);
  text-decoration: none;
  transition: opacity 0.2s;
}

.mid-cta-link:hover {
  opacity: 0.85;
}

/* ═══ Post CTA ═══ */
.post-cta {
  margin: 64px 0 48px;
}

.cta-inner {
  padding: 40px 32px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(41, 151, 255, 0.08), rgba(191, 90, 242, 0.08));
  border: 1px solid rgba(41, 151, 255, 0.12);
  text-align: center;
}

.cta-headline {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  color: var(--color-text);
}

.cta-sub {
  font-size: 16px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.cta-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.cta-primary {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  border-radius: 980px;
  background: var(--color-accent);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.3s, transform 0.2s;
}

.cta-primary:hover {
  background: #40a9ff;
  color: #fff;
  transform: translateY(-1px);
}

.cta-secondary {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  border-radius: 980px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.3s, border-color 0.3s;
}

.cta-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--color-text);
}

/* ═══ Related Posts ═══ */
.related-posts {
  margin-top: 64px;
  padding-top: 48px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.related-posts h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 24px;
  color: var(--color-text);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.related-card {
  display: block;
  padding: 20px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-decoration: none;
  color: inherit;
  transition: background 0.3s, border-color 0.3s;
}

.related-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

.related-card h3 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 6px;
  color: var(--color-text);
  transition: color 0.2s;
}

.related-card:hover h3 {
  color: var(--color-accent);
}

.related-card p {
  font-size: 14px;
  color: var(--color-text-tertiary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-card-cta {
  border-color: rgba(41, 151, 255, 0.15);
  background: rgba(41, 151, 255, 0.04);
}

.related-card-cta:hover {
  border-color: rgba(41, 151, 255, 0.3);
  background: rgba(41, 151, 255, 0.08);
}

.related-arrow {
  display: inline-block;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-accent);
}

/* ═══ Focus States (Accessibility) ═══ */
.post-card:focus-visible,
.related-card:focus-visible,
.cta-primary:focus-visible,
.cta-secondary:focus-visible,
.breadcrumbs a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
  .blog-listing {
    padding: 100px 16px 60px;
  }

  .blog-header {
    margin-bottom: 40px;
  }

  .blog-header h1 {
    font-size: 32px;
  }

  .post-card-inner {
    padding: 24px 16px;
  }

  .post-card-title {
    font-size: 20px;
  }

  .blog-post {
    padding: 84px 16px 60px;
  }

  .post-header h1 {
    font-size: 28px;
  }

  .post-body h2 {
    font-size: 22px;
    margin-top: 40px;
  }

  .post-body h3 {
    font-size: 18px;
  }

  .post-body p,
  .post-body ul,
  .post-body ol {
    font-size: 16px;
  }

  .post-body p:first-child {
    font-size: 17px;
  }

  .post-meta {
    flex-wrap: wrap;
  }

  .cta-inner {
    padding: 28px 20px;
  }

  .cta-headline {
    font-size: 20px;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .post-body table {
    font-size: 14px;
  }

  .post-body thead th,
  .post-body tbody td {
    padding: 10px 12px;
  }

  .breadcrumb-current {
    max-width: 160px;
  }
}

@media (max-width: 480px) {
  .blog-header h1 {
    font-size: 28px;
  }

  .post-header h1 {
    font-size: 24px;
  }

  .cta-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .cta-primary,
  .cta-secondary {
    justify-content: center;
  }
}
