/* ReMarx cards and grid */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

/* A lone card (e.g. while only one article exists) should not stretch full width */
.card-grid > .card:only-child { max-width: 400px; }

.card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.card:hover,
.card:focus-visible {
  transform: translateY(-5px);
  box-shadow: 0 14px 30px rgba(30, 30, 42, 0.15);
  border-color: rgba(198, 40, 40, 0.45);
  color: var(--text);
}

/* Image area: fixed 220px. The gradient shows when there is no image. */
.card__media {
  position: relative;
  height: 220px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--navy) 0%, #3b1f2c 55%, var(--red) 100%);
}
.card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.card:hover .card__media img,
.card:focus-visible .card__media img { transform: scale(1.06); }

.card__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 2.4rem;
  letter-spacing: 0.03em;
  color: var(--gold);
  opacity: 0.9;
}

.card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 22px 22px 20px;
}
.card__title {
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 10px;
  transition: color 0.2s ease;
}
.card:hover .card__title,
.card:focus-visible .card__title { color: var(--red); }

.card__excerpt {
  color: #3d3d4a;
  font-size: 0.97rem;
  line-height: 1.6;
  margin-bottom: 18px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}
.card__category { color: var(--red); font-weight: 500; }

@media (max-width: 768px) {
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .card-grid > .card:only-child { max-width: none; }
}
