/* ==========================================================================
   blog.css — Blog index, article layout, TOC, share, related
   Levii Portal · Blog / Phase 4
   ========================================================================== */

/* ---- Breadcrumb ------------------------------------------------------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}
.breadcrumb a {
  color: var(--text-muted);
}
.breadcrumb a:hover {
  color: var(--brand-blue-500);
}
.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
}
.breadcrumb li + li::before {
  content: '/';
  color: var(--border-strong);
}
.breadcrumb [aria-current='page'] {
  color: var(--text);
}

/* ---- Blog index ------------------------------------------------------- */
.blog-hero {
  padding-block: var(--space-2xl) var(--space-xl);
}

.blog-grid {
  display: grid;
  gap: var(--space-xl);
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
}

.post-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out),
    border-color var(--dur-base);
}
.post-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--brand-blue-500) 35%, var(--border));
}
.post-card__media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-3);
}
.post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out);
}
.post-card:hover .post-card__media img {
  transform: scale(1.05);
}
.post-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  padding: var(--space-lg);
  flex: 1;
}
.post-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.post-card h2,
.post-card h3 {
  font-size: var(--text-xl);
  line-height: 1.25;
}
.post-card p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.post-card__foot {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  margin-top: auto;
  padding-top: var(--space-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--brand-blue-500);
}

/* Featured (first) post spans full width on large screens. */
.post-card--featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
}
.post-card--featured .post-card__media {
  aspect-ratio: auto;
  min-height: 320px;
}
@media (max-width: 860px) {
  .post-card--featured {
    grid-template-columns: 1fr;
  }
  .post-card--featured .post-card__media {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }
}

/* ---- Category chips --------------------------------------------------- */
.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin-bottom: var(--space-xl);
}

/* ---- Article layout --------------------------------------------------- */
.article {
  display: grid;
  grid-template-columns: 1fr min(var(--container-prose), 100%) 1fr;
  column-gap: var(--space-xl);
}
.article > * {
  grid-column: 2;
}

.article-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}
.article-header .breadcrumb {
  justify-content: center;
}
.article-header h1 {
  font-size: var(--text-4xl);
  margin-block: var(--space-sm);
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-top: var(--space-md);
}
.article-author {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.article-author img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
}
.article-meta .dot-sep::before {
  content: '·';
  margin-right: var(--space-sm);
}

.article-cover {
  grid-column: 1 / -1;
  margin-block: var(--space-lg) var(--space-2xl);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  max-width: var(--container-wide);
  margin-inline: auto;
}
.article-cover img {
  width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
}

/* ---- Reading progress bar -------------------------------------------- */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--gradient-brand);
  z-index: var(--z-nav);
  transition: width 80ms linear;
}

/* ---- Table of contents (sticky sidebar on wide) ---------------------- */
.toc {
  position: sticky;
  top: calc(var(--nav-height) + 1.5rem);
  align-self: start;
  grid-column: 3;
  grid-row: 3 / span 40;
  padding-left: var(--space-md);
  font-size: var(--text-sm);
  max-height: calc(100dvh - var(--nav-height) - 3rem);
  overflow-y: auto;
}
.toc h2 {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}
.toc ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-left: 2px solid var(--border);
}
.toc a {
  display: block;
  padding-left: var(--space-sm);
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  line-height: 1.35;
}
.toc a:hover {
  color: var(--text);
}
.toc a.is-active {
  color: var(--brand-blue-500);
  border-left-color: var(--brand-blue-500);
  font-weight: 600;
}
@media (max-width: 1100px) {
  .toc {
    display: none;
  }
}

/* ---- Share & tags ----------------------------------------------------- */
.article-share {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  flex-wrap: wrap;
  margin-block: var(--space-2xl);
  padding-block: var(--space-lg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.article-share span {
  font-weight: 600;
  margin-right: var(--space-2xs);
}
.article-share a,
.article-share button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: transform var(--dur-fast), color var(--dur-fast), background var(--dur-fast);
}
.article-share a:hover,
.article-share button:hover {
  transform: translateY(-2px);
  color: #fff;
  background: var(--brand-blue-500);
}
.article-share svg {
  width: 18px;
  height: 18px;
}

/* ---- Author bio ------------------------------------------------------- */
.author-bio {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-radius: var(--radius-xl);
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-block: var(--space-xl);
}
.author-bio img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  flex: none;
  object-fit: cover;
  background: var(--surface-3);
}
.author-bio strong {
  font-size: var(--text-lg);
}
.author-bio p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-top: 0.2rem;
}

/* ---- Related & comments ---------------------------------------------- */
.related {
  grid-column: 1 / -1;
  max-width: var(--container-wide);
  margin-inline: auto;
  width: 100%;
  margin-top: var(--space-2xl);
}
.related h2 {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.comments-placeholder {
  grid-column: 1 / -1;
  max-width: var(--container-prose);
  margin-inline: auto;
  text-align: center;
  padding: var(--space-2xl);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  color: var(--text-muted);
  margin-top: var(--space-2xl);
}
