/* ─────────────────────────────────────────────────────────────────
   Knowledge — post grid + post cards
   Cards are rendered by knowledge.js from /assets/data/posts.json
   ─────────────────────────────────────────────────────────── */

/* The posts section grows with content (11+ cards exceed one viewport) and
   anchors to the top so the first row clears the fixed navbar. */
#posts {
  height: auto;
  min-height: 100vh;
  align-items: flex-start;
  padding-top: calc(var(--nav-height) + 48px);
  padding-bottom: 64px;
}

/* Mandatory snap fights with the tall posts section: scrolling down
   inside it would yank the viewport back up to the hero, leaving the
   first row of cards covered. Proximity keeps clean section snapping
   while letting users free-scroll through the full grid. */
#scrollContainer { scroll-snap-type: y proximity; }

.posts-stack {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
}

.posts-intro { margin-bottom: 36px; }

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.post-grid-empty,
.post-grid-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 16px;
  color: var(--text-secondary);
  font-size: 14px;
}
.post-grid-error { color: #b94a48; }

/* ─── Card ─────────────────────────────────────────────────── */
.post-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-paper);
  border: 1px solid rgba(76, 78, 100, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(76, 78, 100, 0.16);
}

.post-card-cover {
  aspect-ratio: 16 / 9;
  background-color: var(--primary-a8);
  background-size: cover;
  background-position: center;
}

/* Default cover used when a post has no image. Brand gradient with a
   tag-relevant icon centered. Set up in knowledge.js. */
.post-card-cover--default {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,0.6), transparent 55%),
    linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 60%, var(--primary-dark) 100%);
  color: rgba(255, 255, 255, 0.92);
}
.post-card-cover--default iconify-icon {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.post-card-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.post-card-tag {
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--primary);
  background: var(--primary-a8);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 10px;
}

.post-card-date::before {
  content: '';
  display: inline-block;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 8px;
  vertical-align: middle;
  opacity: 0.5;
}

.post-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  /* Clamp to 3 lines to keep card heights balanced */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-excerpt {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(76, 78, 100, 0.08);
  font-size: 12px;
  color: var(--text-secondary);
}

.post-card-author { font-weight: 500; }

.post-card-arrow {
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  transition: transform 0.2s;
}
.post-card:hover .post-card-arrow { transform: translate(2px, -2px); }


/* ─────────────────────────────────────────────────────────────
   RESPONSIVE
   ─────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .post-grid     { grid-template-columns: 1fr; gap: 16px; }
  .posts-intro   { margin-bottom: 28px; }
  .post-card-body { padding: 16px; }
}
