/* styles/pages/newsfeed.css — public News page articles + Home preview cards. */

.newsfeed-status {
  text-align: center;
  color: var(--color-text-muted);
}

/* ---------- Full articles (News page) — open, wide, compact ---------- */
.newsfeed-article {
  padding-bottom: var(--space-6);
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}
.newsfeed-article:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

/* Article layout: text on the left, image(s) on the right at native proportions,
   vertically aligned top / middle / bottom by the author's choice. */
.newsfeed-article-body-wrap.has-media {
  display: flex;
  gap: var(--space-6);
}
.newsfeed-article-body-wrap .newsfeed-body {
  flex: 1;
  min-width: 0;
}
.newsfeed-article-media {
  flex: 0 0 auto;
  max-width: min(40%, 360px); /* medium default */
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
/* Author-chosen image size — caps the right column so it's never too big/small. */
.newsfeed-article-body-wrap.size-small .newsfeed-article-media {
  max-width: min(28%, 230px);
}
.newsfeed-article-body-wrap.size-medium .newsfeed-article-media {
  max-width: min(40%, 360px);
}
.newsfeed-article-body-wrap.size-large .newsfeed-article-media {
  max-width: min(52%, 520px);
}
/* Never crop or stretch — keep the image's own proportions, just cap the width. */
.newsfeed-article-img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}
.newsfeed-article-body-wrap.pos-top .newsfeed-article-media {
  align-self: flex-start;
}
.newsfeed-article-body-wrap.pos-middle .newsfeed-article-media {
  align-self: center;
}
.newsfeed-article-body-wrap.pos-bottom .newsfeed-article-media {
  align-self: flex-end;
}
@media (max-width: 640px) {
  .newsfeed-article-body-wrap.has-media {
    flex-direction: column;
    gap: var(--space-4);
  }
  .newsfeed-article-media {
    max-width: 100%;
    align-self: stretch;
  }
}

.newsfeed-article-title {
  color: var(--color-primary);
  margin-bottom: var(--space-1);
}

.newsfeed-article-meta {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-bottom: var(--space-4);
}

.newsfeed-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.newsfeed-images.is-single {
  grid-template-columns: 1fr;
}

.newsfeed-images img {
  width: 100%;
  height: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: var(--radius-md);
  display: block;
}

.newsfeed-body {
  color: var(--color-text);
  line-height: 1.7;
}

.newsfeed-body p {
  margin-bottom: var(--space-4);
}

.newsfeed-body a {
  color: var(--color-primary);
  text-decoration: underline;
  word-break: break-word;
}

.newsfeed-body ul {
  margin: 0 0 var(--space-4) 1.3rem;
  padding-left: 0.4rem;
  list-style-type: disc;
}
.newsfeed-body ul ul {
  margin-bottom: 0;
  list-style-type: circle;
}
.newsfeed-body ul ul ul {
  list-style-type: square;
}
.newsfeed-body li {
  margin: 4px 0;
}

.newsfeed-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}
.newsfeed-link {
  margin-top: 0;
}

/* ---------- Home preview rows (Latest News) — big, full-width list ---------- */
.newsfeed-preview-rows {
  /* Fill the site content width (the .container already keeps a margin that
     clears the DNA/vine decor); no inner cap. */
  margin: var(--space-6) 0 0;
  max-width: none;
  border-top: 1px solid var(--color-border);
}

.newsfeed-row {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-2);
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  color: inherit;
  transition: background-color var(--transition-fast);
}
.newsfeed-row:hover {
  background-color: rgba(64, 114, 52, 0.06);
}

.newsfeed-row-thumb {
  flex-shrink: 0;
  /* Scales with the row width but keeps a locked 3:2 aspect ratio. */
  width: clamp(160px, 26%, 340px);
  aspect-ratio: 3 / 2;
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--color-bg);
}
.newsfeed-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.newsfeed-row-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.newsfeed-row-date {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
}
.newsfeed-row-title {
  color: var(--color-primary);
  font-weight: 800;
  font-size: 1.4rem;
  line-height: 1.2;
}
.newsfeed-row-snippet {
  color: var(--color-text-muted);
  font-size: 1rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* "View more news →" — hidden until the row is hovered/focused. */
.newsfeed-row-cue {
  flex-shrink: 0;
  color: var(--color-primary-dark);
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.newsfeed-row:hover .newsfeed-row-cue,
.newsfeed-row:focus-visible .newsfeed-row-cue {
  opacity: 1;
  transform: translateX(0);
}

@media (max-width: 620px) {
  .newsfeed-row {
    padding: var(--space-4);
    gap: var(--space-4);
  }
  .newsfeed-row-thumb {
    width: 110px;
    aspect-ratio: 3 / 2;
  }
  .newsfeed-row-title {
    font-size: 1.15rem;
  }
  .newsfeed-row-cue {
    display: none;
  }
}

/* ---------- Home preview cards ---------- */
.newsfeed-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.newsfeed-preview-card {
  display: flex;
  flex-direction: column;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.newsfeed-preview-card:hover {
  box-shadow: var(--shadow-md, 0 6px 18px rgba(0, 0, 0, 0.12));
  transform: translateY(-2px);
}

.newsfeed-preview-thumb {
  aspect-ratio: 16 / 9;
  background-color: var(--color-bg);
}

.newsfeed-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.newsfeed-preview-text {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.newsfeed-preview-date {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
}

.newsfeed-preview-title {
  color: var(--color-primary);
  font-size: 1.1rem;
  margin: 0;
}

.newsfeed-preview-snippet {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin: 0;
}
