/* ─────────────────────────────────────────────────────────────────────────
   blog9.css — the blog index and post pages. Loads after site9.css and
   assumes its tokens, `.page-hero`, `.section`, `.prose` and `.btn`.

   The post body is the shared `.prose` block, not a private copy: a write-up
   here should set at the same measure and rhythm as the docs.
   ───────────────────────────────────────────────────────────────────────── */

/* ─────────────── listing ─────────────── */

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2.5vw, 26px);
}

.post-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: border-color .15s ease, transform .15s ease;
}
.post-card:hover { border-color: var(--border-2); transform: translateY(-2px); }
/* The card is one big anchor, so the hover colour `a:hover` sets globally would
   repaint every word inside it. */
.post-card:hover h2 { color: var(--accent-ink); }
.post-card, .post-card:hover { color: inherit; }

/* A fixed ratio rather than the image's own: covers arrive at whatever size an
   author uploaded, and a grid of cards whose images each set a different height
   is the thing that makes a listing look unfinished. */
.post-card-cover {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.post-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* `flex: 1` so every card's byline sits on the bottom edge regardless of how
   long its title and excerpt run. */
.post-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: clamp(20px, 2.4vw, 26px);
}
.post-card-body h2 {
  margin-bottom: 10px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.01em;
  transition: color .15s ease;
}
.post-card-body p {
  margin-bottom: 22px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--t2);
}
.post-card-body .byline { margin-top: auto; }

/* ─────────────── byline ─────────────── */

.byline { display: flex; align-items: center; gap: 10px; }

/* Square, matching every other face in the product. The design system reserves
   the pill radius for status dots, and a round avatar here was the single
   exception — which is exactly how it read. */
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--t2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.byline-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.byline-name { font-size: 13.5px; font-weight: 500; color: var(--t1); }
.byline-text time,
.byline-text span:not(.byline-name) {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--t3);
}

/* ─────────────── empty state ─────────────── */

.empty {
  max-width: 46ch;
  margin-inline: auto;
  padding: clamp(36px, 6vw, 56px) 28px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-2);
  border-radius: var(--r-lg);
}
.empty-title {
  display: block;
  margin-bottom: 10px;
  font-family: var(--display);
  font-size: 22px;
  color: var(--t1);
}
.empty p { font-size: 15px; line-height: 1.7; color: var(--t2); }
.empty a { color: var(--accent-ink); border-bottom: 1px solid var(--accent-deep); }

/* ─────────────── post ─────────────── */

/* One measure shared by the header, the cover and the body, so the three line
   up down the left edge instead of each finding its own width. */
.post-measure { max-width: 760px; margin-inline: auto; }

.post-hero h1 { max-width: none; font-size: clamp(30px, 5vw, 50px); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 22px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--t3);
}
.back-link:hover { color: var(--accent-ink); }

.post-hero .byline { margin-top: 26px; }

.post-cover {
  overflow: hidden;
  margin-bottom: clamp(28px, 4vw, 44px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.post-cover img { display: block; width: 100%; }

/* No `max-width` of its own. `.prose` sets 74ch in site9.css and `.post-measure`
   sets 760px here; both are one class, so the later sheet wins and the body
   lands on the same measure as the title and cover above it. An override here
   would beat `.post-measure` too — which is exactly what it did, stepping the
   column out to full width halfway down the page. */
.post-body img { border-radius: var(--r); }

.post-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 24px;
  margin-top: clamp(40px, 6vw, 64px);
  padding-top: clamp(28px, 4vw, 36px);
  border-top: 1px solid var(--border);
}
.post-foot p { font-size: 14.5px; line-height: 1.7; color: var(--t2); }
.post-foot a:not(.btn) { color: var(--accent-ink); border-bottom: 1px solid var(--accent-deep); }

/* ─────────────── responsive ─────────────── */

/* Stated counts, never auto-fit, and never two-into-three at a width where the
   third card would be left on a row of its own. */
@media (max-width: 1000px) {
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 660px) {
  .post-grid { grid-template-columns: minmax(0, 1fr); }
  .post-foot { flex-direction: column; align-items: flex-start; }
}
