/* =====================================================
   Post header — centered title, subtitle, author row
   ===================================================== */

.intro-header .post-heading {
  text-align: center;
}

/* =====================================================
   Table of Contents sidebar
   ===================================================== */

/* align-self: flex-start lets position:sticky work inside a flex row */
.toc-col {
  align-self: flex-start;
}

.toc-sidebar {
  /* position driven by toc.js */
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 1.25rem 0 1.25rem 1.25rem;
  border-left: 2px solid #eee;
  scrollbar-width: none;
}
.toc-sidebar::-webkit-scrollbar { display: none; }

.toc-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #bbb;
  margin: 0 0 0.85rem;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-item { margin: 0; }

/* Level 1 — H2 */
.toc-item--h2 .toc-link {
  padding-left: 0.6rem;
  font-size: 0.82rem;
  color: #555;
}

/* Level 2 — H3 */
.toc-item--h3 .toc-link {
  padding-left: 1.4rem;
  font-size: 0.78rem;
  color: #777;
}

/* Level 3 — H4 */
.toc-item--h4 .toc-link {
  padding-left: 2.2rem;
  font-size: 0.74rem;
  color: #999;
}

.toc-link {
  display: block;
  padding-top: 0.28rem;
  padding-bottom: 0.28rem;
  text-decoration: none;
  line-height: 1.4;
  border-left: 2px solid transparent;
  margin-left: -2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toc-link:hover {
  color: #008AFF;
  text-decoration: none;
}

.toc-link--active {
  color: #008AFF !important;
  border-left-color: #008AFF;
  font-weight: 700;
}

/* =====================================================
   Post Card Grid — CockroachDB blog-style layout
   ===================================================== */

/* Grid container */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin: 2rem 0;
  padding: 0 0.5rem;
}

@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Individual card */
.card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid #eee;
}

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

/* Card thumbnail */
.card__image-wrap {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  flex-shrink: 0;
}

.card__image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card:hover .card__image-wrap img {
  transform: scale(1.03);
}

/* Card body */
.card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.25rem;
  gap: 0.5rem;
}

/* Tag pills wrapper */
.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* Tag pill */
.card__tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #008AFF;
  background: #e8f3ff;
  border-radius: 20px;
  padding: 0.2rem 0.65rem;
  align-self: flex-start;
}

/* Title */
.card__title-link {
  text-decoration: none;
  color: inherit;
}

.card__title-link:hover {
  text-decoration: none;
  color: inherit;
}

.card__title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  color: #222;
  margin: 0;
}

.card__title-link:hover .card__title {
  color: #008AFF;
}

/* Excerpt */
.card__excerpt {
  font-size: 0.88rem;
  color: #555;
  line-height: 1.6;
  margin: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Date / meta */
.card__meta {
  font-size: 0.78rem;
  color: #999;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid #f0f0f0;
}

/* Author row inside card */
.card__author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card__author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  flex-shrink: 0;
}

.card__author-info {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.card__author-name {
  font-weight: 600;
  color: #333;
  font-size: 0.875rem;
}

.card__author-date {
  font-size: 0.8rem;
  color: #aaa;
}

/* =====================================================
   Post header author row
   ===================================================== */

.post-author-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.85rem;
  width: 100%;
}

.post-author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  flex-shrink: 0;
}

.post-author-info {
  display: flex;
  flex-direction: column;
  line-height: 1.4;
}

.post-author-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.post-author-date {
  font-size: 0.85rem;
  opacity: 0.75;
}

.post-read-time {
  font-size: 0.85rem;
  opacity: 0.75;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* =====================================================
   Featured card — first post, full-width hero
   ===================================================== */

@media (min-width: 640px) {
  .card--featured {
    grid-column: 1 / -1;
    flex-direction: row;
  }

  .card--featured .card__image-wrap {
    width: 55%;
    aspect-ratio: unset;
    min-height: 260px;
    flex-shrink: 0;
  }

  .card--featured .card__body {
    padding: 2rem;
    justify-content: center;
    gap: 0.75rem;
  }

  .card--featured .card__title {
    font-size: 1.5rem;
    line-height: 1.3;
  }

  .card--featured .card__excerpt {
    font-size: 0.95rem;
    -webkit-line-clamp: 4;
  }

  .card--featured .card__tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
  }
}
