/* News cards shared by the homepage and post listings. */

.news-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.news-card {
  display: flex;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  background: white;
  transition: border-color 200ms ease;
}

.news-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  padding: 2rem;
}

/* Flex items must shrink before long titles and URLs can wrap inside the card. */
.news-card-body > * {
  max-width: 100%;
}

.news-card :is(h3, p, a) {
  overflow-wrap: anywhere;
}

.news-card time {
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.69rem;
  font-variant-numeric: tabular-nums;
}

.news-card h3 {
  margin-bottom: 1rem;
}

.news-card h3 a {
  text-decoration: none;
}

.news-card h3 a:hover {
  text-decoration: underline;
}

.news-card-body > p {
  color: var(--muted);
  font-size: 0.85rem;
}

.news-card .text-link {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.74rem;
}

.news-card:is(:hover, :focus-within) {
  border-color: var(--border-hover);
}

.content-main .news-grid {
  margin-top: 2.5rem;
}

@media (max-width: 760px) {
  .news-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 400px) {
  .news-card-body {
    padding: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .news-card {
    transition: none;
  }
}

@media print {
  .news-card {
    color: black;
    background: white;
    break-inside: avoid;
  }
}
