/* 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;
}

/* The feed — /news read as a list, month by month, at a reading width. */
.news-feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
  max-width: 52rem;
  width: 100%;
  margin-inline: auto;
}

.news-feed__month {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* The month's name, then a rule across the rest of the line, as a paper
   calendar divides its months: a thick stroke over a thin one. */
.news-feed__rule {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.2;
}

.news-feed__rule::after {
  content: "";
  flex: 1;
  height: 6px;
  border-top: 2px solid var(--primary);
  border-bottom: 1px solid var(--line-strong);
}

.news-feed__month-name { color: var(--primary); }
.news-feed__year { color: var(--ink-muted); font-weight: 500; }

.news-feed__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.news-feed__list > li + li { border-top: 1px solid var(--line); }

/* A row: the day, the text, the thumbnail. The whole row is the link. */
.news-feed__row {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-2);
  border-radius: var(--radius-md);
  color: inherit;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out);
}

.news-feed__row:hover { background: var(--stage-mid); }
.news-feed__row:hover .news-feed__title { color: var(--primary); }

.news-feed__day {
  font-family: var(--font-brand);
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  padding-top: 0.15em;
}

.news-feed__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.news-feed__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: var(--leading-heading);
  overflow-wrap: anywhere;
  transition: color var(--dur-fast) var(--ease-out);
}

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

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

.news-feed__thumb {
  display: block;
  width: 6rem;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}

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

/* A phone keeps the three columns, narrower; the excerpt goes, the title
   and the source carry the row. */
@media (max-width: 639px) {
  .news-feed { gap: var(--space-8); }
  .news-feed__row { grid-template-columns: 2.25rem minmax(0, 1fr) auto; gap: var(--space-3); padding-inline: 0; }
  .news-feed__day { font-size: var(--text-xl); }
  .news-feed__title { font-size: var(--text-base); }
  .news-feed__excerpt { display: none; }
  .news-feed__thumb { width: 4.5rem; }
}

/* 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; }
}
