/* ============================================================================
   23-news-feed.css  (v11.592)
   Editorial-dark styling for the News Activity sub-tab (#activity-news-feed).
   Twitter cadence + an Instagram-clean card: true blacks, single lavender
   accent, Söhne type, 0.03em tracking, hairline dividers, no chrome.
   Dark-mode only (the app is dark-only going forward).
   ========================================================================== */

#activity-news-feed { font-family: 'Sohne', 'DM Sans', sans-serif; }

/* v11.594: the "What are you watching?" composer belongs to the Activity Feed
   only — hide it on the News sub-tab (Shared Watch hides it the same way in
   css/08-watch-together.css). */
#community-view.activity-subtab-news #feed-composer { display: none !important; }

.news-feed {
  position: relative;
  color: #f8f4ff;
  padding: 6px 0 0;
  overflow: visible;
}
.news-feed-body {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

/* ---- Pull-to-refresh indicator (top) ---- */
.news-ptr {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  will-change: transform, opacity;
}
.news-ptr .news-spinner { width: 26px; height: 26px; }

/* ---- Circular loading spinner (lavender, app-consistent) ---- */
.news-spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid rgba(196, 181, 253, 0.22);
  border-top-color: #c4b5fd;
  box-sizing: border-box;
}
.news-spinner.is-spinning { animation: newsSpin 0.7s linear infinite; }
.news-ptr.is-ready .news-spinner { border-top-color: #ddd2ff; }
@keyframes newsSpin { to { transform: rotate(360deg); } }

/* ---- Category filter chips (horizontal scroll) ---- */
.news-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 14px;
  margin: 0 0 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  scrollbar-width: none;
}
.news-chips::-webkit-scrollbar { display: none; }
.news-chip {
  flex: 0 0 auto;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(216, 208, 233, 0.72);
  border-radius: 999px;
  padding: 7px 14px;
  font: 500 13px/1 'Sohne', 'DM Sans', sans-serif;
  letter-spacing: 0.03em;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.news-chip:active { transform: scale(0.96); }
.news-chip.active {
  background: rgba(167, 139, 250, 0.16);
  color: #ffffff;
  border-color: rgba(167, 139, 250, 0.42);
}

/* ---- Card list ---- */
.news-list { display: flex; flex-direction: column; }
/* virtual-scroll top spacer: reserves the height of pruned off-screen cards so
   the document height never changes during endless scroll (no scroll jump). */
.news-prune-spacer { flex: 0 0 auto; width: 100%; }

.news-card {
  display: block;
  padding: 22px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: newsCardIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.news-card:active { background: rgba(255, 255, 255, 0.02); }

.news-card-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.news-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 500 12.5px/1 'Sohne', 'DM Sans', sans-serif;
  letter-spacing: 0.03em;
  color: #9990b3;
  min-width: 0;
}
.news-card-cat {
  color: #c4b5fd;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
  font-weight: 600;
}
.news-card-source {
  color: #b8afd1;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.news-card-dot { color: rgba(216, 208, 233, 0.38); }
.news-card-time { color: rgba(255, 255, 255, 0.45); font-weight: 300; font-size: 12px; flex: 0 0 auto; }

.news-card-title {
  margin: 0;
  font: 500 16px/1.38 'Sohne', 'DM Sans', sans-serif;
  letter-spacing: 0;
  color: #ffffff;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-card-summary {
  margin: 0;
  font: 400 14.4px/1.5 'Sohne', 'DM Sans', sans-serif;
  letter-spacing: 0;
  color: #f4f1fb;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Per-card share button (sits at the right edge of the meta row, so the
   image stays the visually-last element of the card). The heart carries the
   margin-left:auto so the heart + share pair sits flush at the top-right. ---- */
.news-card-heart,
.news-card-share {
  flex: 0 0 auto;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  padding: 4px;
  border-radius: 50%;
  color: rgba(216, 208, 233, 0.55);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}
.news-card-heart { margin-left: auto; }
.news-card-share { margin-right: -4px; }
.news-card-share svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.news-card-share:active { transform: scale(0.9); color: #c4b5fd; background: rgba(196, 181, 253, 0.12); }

/* Heart / bookmark — outline by default, fills red when bookmarked, pops on tap. */
.news-card-heart svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transition: fill 160ms ease, stroke 160ms ease; }
.news-card-heart:active { transform: scale(0.9); }
.news-card-heart.is-bookmarked { color: #ff3040; }
.news-card-heart.is-bookmarked svg { fill: #ff3040; stroke: #ff3040; }
.news-card-heart.heart-pop svg { animation: newsHeartPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes newsHeartPop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.4); }
  55%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .news-card-heart.heart-pop svg { animation: none; }
}

/* ---- Card image — full width, UNDERNEATH the title + description (last in the
   card). Natural aspect ratio of the source (≈16:9 typical); only very tall
   portraits get capped + cover-cropped so one image can't dominate the feed. ---- */
.news-card-media {
  width: 100%;
  margin-top: 14px;
  border-radius: 14px;
  overflow: hidden;
  background: #15121f;
  line-height: 0;
}
.news-card-media img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: cover;
}

/* ---- Footer: infinite-scroll load spinner ---- */
.news-foot {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
  padding: 0 0 36px;
}
.news-foot-load {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 0 10px;
}
.news-foot-load .news-spinner { animation: newsSpin 0.7s linear infinite; }

/* ---- Empty / error state ---- */
.news-empty {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
  padding: 56px 18px;
}
.news-empty strong {
  color: #f8f4ff;
  font: 600 17px/1.3 'Sohne', 'DM Sans', sans-serif;
  letter-spacing: 0.03em;
}
.news-empty span {
  color: #9990b3;
  font: 400 14px/1.5 'Sohne', 'DM Sans', sans-serif;
  letter-spacing: 0.03em;
  max-width: 320px;
  margin: 0 auto;
}

/* ---- Loading skeletons (vertical: text lines, then a 16:9 media block) ---- */
.news-skel {
  display: block;
  padding: 18px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.news-skel-main { display: flex; flex-direction: column; gap: 9px; }
.news-skel-media { width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; margin-top: 14px; }
.news-skel-line { height: 12px; border-radius: 6px; }
.news-skel-line.short { width: 38%; height: 10px; }
.news-skel-line.mid { width: 64%; }
.news-skel-media,
.news-skel-line {
  background: linear-gradient(100deg, rgba(255,255,255,0.045) 30%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.045) 70%);
  background-size: 200% 100%;
  animation: newsSkelShimmer 1.25s ease-in-out infinite;
}

@keyframes newsCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes newsSkelShimmer {
  0%   { background-position: 180% 0; }
  100% { background-position: -80% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .news-card { animation: none; }
  .news-skel-media, .news-skel-line { animation: none; }
}

/* ---- Category swipe (anywhere-horizontal swipe between chips) ---- */
/* Clip the off-screen incoming/outgoing pages so they never trigger a horizontal
   scrollbar or bleed past the screen edges (mirrors body.discover-hub-swiping). */
/* `clip` (Safari 16+) clips horizontally WITHOUT turning <body> into a scroll
   container — so the window's vertical scroll model is untouched; `hidden` is the
   fallback for older WebKit. */
body.news-feed-swiping { overflow-x: hidden; overflow-x: clip; }
body.news-feed-swiping [data-news-list],
body.news-feed-swiping .news-swipe-incoming {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.news-swipe-incoming { -webkit-overflow-scrolling: touch; }
.news-swipe-incoming-list { display: flex; flex-direction: column; }
/* the incoming layer is appended to <body> (viewport-fixed), OUTSIDE .news-feed,
   so the blanket ".news-feed *" tracking reset below doesn't reach it — re-apply. */
.news-swipe-incoming,
.news-swipe-incoming * { letter-spacing: 0; }
.news-swipe-incoming .news-card { animation: none; }   /* no entrance pop on preview cards */

/* v11.602: uniform 0 letter-spacing across ALL News-page content. Placed last
   so it's the single source of truth for tracking (overrides the per-element
   values above by source order — no !important needed). */
.news-feed,
.news-feed * { letter-spacing: 0; }
