/* news-clusters.css — story-cluster UI. Uses news.css tokens (--mono, --rule,
 * --ink-*, --accent, --paper-*). Loaded after news.css so the vars resolve. */

.cluster-meta {
  margin: 6px 0 2px;
  padding: 7px 9px;
  border: 1px solid var(--rule);
  border-left: 2px solid var(--accent);
  background: var(--accent-wash);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cluster-meta.is-compact {
  padding: 4px 7px;
  background: transparent;
  border-left-width: 2px;
}

.cluster-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}
.cluster-covered {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.cluster-srclist {
  font-family: var(--serif, serif);
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 600;
}
/* Each "Covered by" name + each expanded-timeline source links to its profile.
   Inherit the surrounding cluster text colour; reveal as interactive on hover. */
.cluster-src-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.cluster-src-link:hover,
.cluster-src-link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.cluster-src-more { color: var(--ink-3); }
.cluster-badge {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 2px;
  white-space: nowrap;
}

.cluster-why {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px;
}
.cluster-shared-label {
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.cluster-shared-sep { color: var(--ink-4); }
.cluster-entity {
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px dotted var(--ink-4);
  cursor: pointer;
}
.cluster-entity:hover { color: var(--accent); border-bottom-color: var(--accent); }

.cluster-timeline-toggle {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-2);
  padding: 3px 8px;
  cursor: pointer;
  border-radius: 2px;
}
.cluster-timeline-toggle:hover { border-color: var(--accent); color: var(--accent); }

.cluster-timeline {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  border-top: 1px solid var(--rule-2, var(--rule));
}
.cluster-tl-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--rule-2, var(--rule));
  font-size: 12px;
}
.cluster-tl-row .src {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.cluster-tl-when {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-4);
  white-space: nowrap;
}
.cluster-tl-title { color: var(--ink); text-decoration: none; }
.cluster-tl-title:hover { color: var(--accent); }
.cluster-sim {
  grid-column: 3;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-4);
}
.cluster-shared {
  grid-column: 3;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-3);
}
.cluster-tl-loading, .cluster-tl-empty {
  padding: 6px 0;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
}

/* Mobile compact chip */
.mobile-cluster-chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 1px 6px;
  margin-top: 4px;
  /* now a <button> (taps open the story page) */
  background: transparent;
  cursor: pointer;
}

/* Story page (?story=) — extra bits on the shared topic-panel chassis */
.cluster-actions-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cluster-story-link {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-decoration: none;
  padding: 3px 2px;
}
.cluster-story-link:hover { color: var(--accent); }
.cluster-story-ents {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 0 10px;
}
.cluster-story-timeline { margin: 0; padding: 0; list-style: none; }

/* Topic overlay */
.cluster-topic-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, #000 62%, transparent);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 16px;
  z-index: 1000;
}
.cluster-topic-panel {
  background: var(--paper-2, #15171a);
  border: 1px solid var(--rule);
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}
.cluster-topic-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
}
.cluster-topic-title {
  font-family: var(--serif, serif);
  font-size: 17px;
  color: var(--ink);
  font-weight: 700;
}
.cluster-topic-close {
  background: transparent;
  border: none;
  color: var(--ink-3);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}
.cluster-topic-close:hover { color: var(--accent); }
.cluster-topic-body { overflow-y: auto; padding: 8px 14px 14px; }
.cluster-topic-count {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 4px 0 8px;
}
.cluster-topic-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule-2, var(--rule));
  text-decoration: none;
}
.cluster-topic-item .src {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
}
.cluster-topic-item-title { color: var(--ink); font-size: 14px; }
.cluster-topic-item:hover .cluster-topic-item-title { color: var(--accent); }
.cluster-topic-more {
  display: block;
  margin: 12px auto 4px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 7px 16px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: transparent;
  cursor: pointer;
}
.cluster-topic-more:hover { color: var(--accent); border-color: var(--accent); }
.cluster-topic-more:disabled { opacity: 0.6; cursor: default; }

/* ── Trending topics strip ──────────────────────────────────────────────
   Injected by injectTrendingStrip() after the category strip. Mirrors
   .cat-strip's sizing; hidden in mobile mode via news.css. */
.topics-strip {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.topics-strip-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 9px var(--gutter);
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.topics-strip .label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-4);
  flex: 0 0 auto;
  padding-right: 6px;
}
.topic-chip {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--ink-2);
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  flex: 0 0 auto;
}
.topic-chip:hover { color: var(--accent); border-color: var(--accent); }
.topic-chip.is-followed { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, var(--rule)); }

.cluster-topic-follow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 5px 10px;
  margin-left: auto;
  margin-right: 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}
.cluster-topic-follow:hover { color: var(--accent); border-color: var(--accent); }
.cluster-topic-follow[aria-pressed="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, var(--rule)); }
/* Long entity names must truncate, not push the follow/close buttons out */
.cluster-topic-head .cluster-topic-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Archive search (Wave 2) ───────────────────────────────────────────── */
.news-search-trigger {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-2);
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 2px;
  margin-top: 8px;
}
.news-search-trigger:hover { border-color: var(--accent); color: var(--accent); }
.news-search-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, #000 62%, transparent);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 16px;
  z-index: 1001;
}
.news-search-overlay[hidden] { display: none; }
.news-search-panel {
  background: var(--paper-2, #15171a);
  border: 1px solid var(--rule);
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}
.news-search-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
}
.news-search-input {
  flex: 1;
  background: var(--paper, #0d0e10);
  border: 1px solid var(--rule);
  color: var(--ink);
  font-family: var(--serif, serif);
  font-size: 16px;
  padding: 8px 10px;
  border-radius: 2px;
  outline: none;
}
.news-search-input:focus { border-color: var(--accent); }
.news-search-close {
  background: transparent;
  border: none;
  color: var(--ink-3);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}
.news-search-close:hover { color: var(--accent); }
.news-search-status {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 8px 14px 0;
}
.news-search-results { overflow-y: auto; padding: 6px 14px 14px; }
.news-search-item {
  display: block;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule-2, var(--rule));
  text-decoration: none;
}
.news-search-item-meta { display: flex; gap: 7px; align-items: baseline; }
.news-search-item-meta .src {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.news-search-when { font-family: var(--mono); font-size: 9px; color: var(--ink-4); }
.news-search-cluster { font-family: var(--mono); font-size: 9px; color: var(--accent); }
.news-search-item-title { color: var(--ink); font-size: 14px; margin-top: 2px; }
.news-search-item:hover .news-search-item-title { color: var(--accent); }

/* ── Save-for-later (Wave 2) ───────────────────────────────────────────── */
.saveBtn {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-2);
  padding: 4px 9px;
  cursor: pointer;
  border-radius: 2px;
}
.saveBtn:hover { border-color: var(--accent); color: var(--accent); }
.saveBtn[data-saved="1"] { color: var(--accent); border-color: var(--accent); }
.saved-trigger { margin-left: 8px; }
.saved-row { display: flex; align-items: center; gap: 8px; }
.saved-row .cluster-topic-item { flex: 1; }
.saved-remove {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: 11px;
  cursor: pointer;
  border-radius: 2px;
  padding: 2px 7px;
  line-height: 1;
}
.saved-remove:hover { border-color: var(--bad, #b0594a); color: var(--bad, #b0594a); }

/* ── Brief podcast subscribe (Wave 3) ──────────────────────────────────── */
.news-brief-subscribe {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  text-decoration: none;
  border: 1px solid var(--rule);
  padding: 3px 8px;
  border-radius: 2px;
  white-space: nowrap;
}
.news-brief-subscribe:hover { border-color: var(--accent); color: var(--accent); }

/* ── Footer feed links (Wave 4 SEO/discovery) ──────────────────────────── */
.feed-links { margin-top: 8px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em; color: var(--ink-3); }
.feed-links a { color: var(--ink-2); text-decoration: none; border-bottom: 1px dotted var(--ink-4); }
.feed-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Source health (Wave 4) ────────────────────────────────────────────── */
.source-health-link {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-2);
  padding: 4px 8px;
  border-radius: 2px;
  cursor: pointer;
}
.source-health-link:hover { border-color: var(--accent); color: var(--accent); }
.src-health-summary { display: flex; gap: 14px; font-family: var(--mono); font-size: 11px; padding: 2px 0 10px; }
.src-h-ok { color: var(--good, #6fa66c); }
.src-h-stale { color: #c79a3f; }
.src-h-dead { color: var(--bad, #b0594a); }
.src-health-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  gap: 9px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid var(--rule-2, var(--rule));
}
.src-health-row .src { font-family: var(--serif, serif); font-size: 13px; color: var(--ink); }
.src-h-age, .src-h-count { font-family: var(--mono); font-size: 9px; color: var(--ink-3); white-space: nowrap; }
.src-h-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-4); }
.src-health-row.src-h-ok .src-h-dot { background: var(--good, #6fa66c); }
.src-health-row.src-h-stale .src-h-dot { background: #c79a3f; }
.src-health-row.src-h-dead .src-h-dot { background: var(--bad, #b0594a); }
.src-health-row.src-h-dead .src { color: var(--bad, #b0594a); }

/* ── Read / unread (Wave 2) ────────────────────────────────────────────── */
.item.is-read .t,
.item.is-read .e,
.featured-story-card.is-read .featured-story-title { opacity: 0.5; }

/* ── Manage sources: follow / mute (Wave 2) ────────────────────────────── */
.manage-sources-link {
  font-family: var(--mono);
  font-size: 9px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-3);
  padding: 2px 7px;
  border-radius: 2px;
  cursor: pointer;
  margin-left: 8px;
}
.manage-sources-link:hover { border-color: var(--accent); color: var(--accent); }
.item.is-muted, .featured-story-card.is-muted { display: none !important; }
.item.is-followed { box-shadow: inset 2px 0 0 var(--accent); }
.ms-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule-2, var(--rule));
}
.ms-row .src { font-family: var(--serif, serif); font-size: 13px; color: var(--ink); }
.ms-btn {
  font-family: var(--mono);
  font-size: 9px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-3);
  padding: 3px 8px;
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
}
.ms-btn:hover { border-color: var(--accent); color: var(--accent); }
.ms-btn[data-on="1"].ms-follow { color: var(--accent); border-color: var(--accent); }
.ms-btn[data-on="1"].ms-mute { color: var(--bad, #b0594a); border-color: var(--bad, #b0594a); }
.digest-trigger { margin-left: 8px; }

/* ── Real-time "new stories" pill (Wave 4d) ──────────────────────────────
   Shown by news-live.js when /api/feed-version reports a newer feed. Sits
   below the full-screen overlays (z 1000-1001) but above page content. */
.news-live-pill {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--accent, #c0392b);
  background: var(--paper, #16181c);
  color: var(--ink, #f2f2f2);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.news-live-pill.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.news-live-pill:hover { filter: brightness(1.1); }
.news-live-pill:focus-visible { outline: 2px solid var(--accent, #c0392b); outline-offset: 2px; }
.news-live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent, #c0392b);
  box-shadow: 0 0 0 0 rgba(192, 57, 43, .55);
  animation: news-live-pulse 2.2s infinite;
}
.news-live-act { opacity: .65; }
@keyframes news-live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(192, 57, 43, .55); }
  70%  { box-shadow: 0 0 0 8px rgba(192, 57, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .news-live-dot { animation: none; }
  .news-live-pill,
  .news-live-pill.is-visible { transition: opacity .2s ease; transform: translateX(-50%); }
}
