/* =====================================================================
   2nd Amendment Chat Room — "JUST UPDATED" indicator
   Owner's rule (2026-10-24): the case with the most recent update
   stays up AND carries an indicator that shows it moved.

   Markup (case card, fed by tac_cases_for_home in cases-admin.php):
     <article class="case-card">
       <span class="case-fresh" data-updated-at="2026-10-24T07:58:00Z">
         <span class="case-fresh-dot"></span> NEW UPDATE ·
         <span class="case-fresh-when">just now</span>
       </span>
       ...
     </article>
   Render .case-fresh ONLY on the first (freshest) card, and on any
   card whose latest update the signed-in member has not read yet
   (unread = case_updates.id > case_follows.last_read_update_id).
   The relative time ("12m ago") is filled by the small script below
   the styles — include it or compute the text server-side.
   ===================================================================== */

.case-fresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #c92a2a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
}
.case-fresh-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: tac-pulse 1.6s ease-in-out infinite;
}
@keyframes tac-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}
@media (prefers-reduced-motion: reduce) {
  .case-fresh-dot { animation: none; }
}

/* Relative-time filler (place once, anywhere after the list):
<script>
document.querySelectorAll('.case-fresh[data-updated-at]').forEach(function (el) {
  var t = new Date(el.getAttribute('data-updated-at'));
  if (isNaN(t)) return;
  var s = Math.max(0, (Date.now() - t.getTime()) / 1000);
  var txt = s < 90 ? 'just now'
    : s < 3600 ? Math.round(s / 60) + 'm ago'
    : s < 86400 ? Math.round(s / 3600) + 'h ago'
    : Math.round(s / 86400) + 'd ago';
  var w = el.querySelector('.case-fresh-when');
  if (w) w.textContent = txt;
});
</script>
*/
