/* News — the /news list, the "latest news" section and a post's page. */

/* The grid: one card on a phone, two from 640, three from 1024. */
.news-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

@media (min-width: 640px) {
  .news-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .news-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-8); }
}

/* A card: the image at 16:9 on top, the date, the title, the excerpt. The
   whole card is the link. */
.news-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: inherit;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}

.news-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--line-strong);
}

.news-card:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.news-card__media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-raised);
}

.news-card__media img,
.news-card__media > * {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.news-card__date {
  font-size: var(--text-xs);
  letter-spacing: var(--label-tracking);
  text-transform: var(--label-transform);
  color: var(--ink-muted);
}

.news-card__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: var(--leading-heading);
  overflow-wrap: anywhere;
}

.news-card:hover .news-card__title { color: var(--primary); }

.news-card__excerpt {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* A post's page: the date and the source under the title, the text at a
   reading width. */
.news-post {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: 46rem;
  margin-inline: auto;
  width: 100%;
}

.news-post__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

.news-post__source a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.news-post__image {
  overflow: hidden;
  border-radius: var(--radius-lg);
  aspect-ratio: 16 / 9;
  background: var(--surface-raised);
}

.news-post__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.news-post__lead {
  margin: 0;
  font-size: var(--text-lg);
  line-height: var(--leading-body);
  color: var(--ink-soft);
}
