/* === Grid and container === */
#stories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  align-items: start;
  width: 100%;
  box-sizing: border-box;
}

/* Ensure each card is same-height column so date can pin consistently */
.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  overflow: hidden;
}

/* === Media / image area === */
.media {
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 170px;
  overflow: hidden;
  background: #f2f2f2;
  display: block;
}
.media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* === Card body layout: column so date can be pinned === */
.card-body {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 0.9rem 1rem;
  box-sizing: border-box;
  min-height: 170px;
}
.card > .card-body { flex: 1 1 auto; }

/* === Section label (card-subtitle) === */
.card-subtitle {
  color: #000 !important;
  font-size: 1rem !important;
  font-weight: 400 !important;
  line-height: 1.25;
  margin: 0;
  text-transform: none;
  letter-spacing: normal;
}
.card-subtitle.text-muted { color: #000 !important; }

/* === Title and abstract === */
.card-title {
  margin: 0.15rem 0 0.35rem 0;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
  color: #000;
}
.card-text {
  margin: 0;
  color: #222;
  font-size: 1rem;
  line-height: 1.35;
  flex: 0 0 auto;
}

/* === Published date pinned and black === */
.published-date {
  margin-top: auto;
  color: #000 !important;
  font-size: 0.9rem;
  line-height: 1.2;
  opacity: 1 !important;
}

/* === Read More button alignment === */
.card .btn {
  align-self: flex-start;
  margin-top: 0.5rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
}

/* === Responsive tweaks === */
@media (max-width: 640px) {
  .card-body { min-height: 150px; padding: 0.75rem; }
  .card-title { font-size: 1rem; }
  .card-subtitle { font-size: 0.95rem; }
}

/* Defensive rules */
#stories .card-body, #stories .card-subtitle, #stories .published-date {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
