/**
 * BlackMoon Nexus P2 — Living System motion primitives
 * Classes: DATA_DRIVEN · STATE_DRIVEN · PROCESS_DRIVEN · AMBIENT
 */

:root {
  --ls-fresh: #22d3ee;
  --ls-recent: #a78bfa;
  --ls-stale: #64748b;
  --ls-unknown: #475569;
  --ls-updating: #c084fc;
  --ls-error: #fbbf24;
}

/* LIVE_DOT — export/sync indicator */
.ls-live-dot {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
}
.ls-freshness-fresh .ls-live-dot,
[data-freshness="FRESH"] .ls-live-dot { color: var(--ls-fresh); box-shadow: 0 0 8px var(--ls-fresh); }
[data-freshness="RECENT"] .ls-live-dot { color: var(--ls-recent); box-shadow: 0 0 6px var(--ls-recent); }
[data-freshness="STALE"] .ls-live-dot { color: var(--ls-stale); box-shadow: none; }
[data-freshness="UNKNOWN"] .ls-live-dot { color: var(--ls-unknown); }
[data-freshness="UPDATING"] .ls-live-dot { color: var(--ls-updating); animation: lsDotPulse 1.2s ease-in-out infinite; }
[data-freshness="ERROR"] .ls-live-dot { color: var(--ls-error); }

/* FRESHNESS_AGE */
.ls-freshness-age {
  font: 500 11px var(--fp-tele, "JetBrains Mono", monospace);
  letter-spacing: 0.03em;
  color: #94a3b8;
  text-transform: uppercase;
}
.ls-freshness-age[data-freshness="FRESH"] { color: #67e8f9; }
.ls-freshness-age[data-freshness="RECENT"] { color: #c4b5fd; }
.ls-freshness-age[data-freshness="STALE"] { color: #64748b; }
.ls-freshness-age[data-freshness="ERROR"] { color: #fcd34d; }

/* NEW_DATA_PULSE — real hash change only */
.ls-new-data-pulse {
  animation: lsNewData 0.85s ease-out;
}
@keyframes lsNewData {
  0% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(34, 211, 238, 0); }
  100% { box-shadow: none; }
}

/* STATE_TRANSITION — export health change */
.ls-state-transition {
  animation: lsStateShift 0.9s ease-out;
}
@keyframes lsStateShift {
  0% { filter: brightness(1.35); }
  100% { filter: brightness(1); }
}

/* REFRESH_PROGRESS — poll in-flight */
.ls-refresh-progress .ls-live-dot {
  animation: lsDotPulse 0.8s ease-in-out infinite;
}

/* RECOVERY_SWEEP — reconnect after error */
.ls-recovery-sweep {
  animation: lsRecovery 1.1s ease-out;
}
@keyframes lsRecovery {
  0% { background-position: -120% 0; }
  100% { background-position: 120% 0; }
}

/* STALE_DECAY */
.ls-stale-decay {
  opacity: 0.72;
  filter: saturate(0.65);
  transition: opacity 0.6s ease, filter 0.6s ease;
}

/* AMBIENT_BREATH */
.ls-ambient-breath {
  animation: lsAmbient 10s ease-in-out infinite;
}
@keyframes lsAmbient {
  0%, 100% { opacity: 0.35; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.02); }
}

@keyframes lsDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

/* Market Pulse P2 cards */
.ls-mp-card {
  border: 1px solid rgba(139, 92, 246, 0.32);
  background: linear-gradient(160deg, rgba(139, 92, 246, 0.1), rgba(5, 5, 8, 0.92));
  padding: 0.85rem 1rem 1rem;
  min-height: 220px;
  position: relative;
  transition: border-color 0.35s ease, opacity 0.4s ease;
}
.ls-mp-card[data-freshness="STALE"],
.ls-mp-card[data-freshness="ERROR"] {
  opacity: 0.78;
  filter: saturate(0.7);
}
.ls-mp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.35rem;
}
.ls-mp-head h3 {
  margin: 0;
  font-size: 1rem;
  font-family: var(--fp-section, inherit);
}
.ls-mp-price {
  font: 600 13px var(--fp-tele, monospace);
  color: #e2e8f0;
}
.ls-mp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  font: 500 11px var(--fp-tele, monospace);
  color: var(--fp-muted, #94a3b8);
  margin-bottom: 0.45rem;
}
.ls-mp-return[data-dir="up"] { color: #22d3ee; }
.ls-mp-return[data-dir="down"] { color: #c4b5fd; }
.ls-mp-source { color: #64748b; cursor: help; border-bottom: 1px dotted rgba(148, 163, 184, 0.45); }
.ls-mp-canvas-wrap { position: relative; }
.ls-mp-canvas-wrap canvas {
  width: 100%;
  height: 140px;
  display: block;
}
.ls-mp-point-pulse {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: lsPointPulse 0.75s ease-out forwards;
}
@keyframes lsPointPulse {
  0% { opacity: 0.9; transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 12px rgba(34, 211, 238, 0.8); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.2); box-shadow: 0 0 0 rgba(34, 211, 238, 0); }
}

/* Ticker strip semantics */
.rm-crypto-chip[data-freshness="FRESH"] { border-color: rgba(34, 211, 238, 0.35); }
.rm-crypto-chip[data-freshness="STALE"] { opacity: 0.7; }

/* Hero export dot enhancement */
.fp-state-dot.ls-live-dot { margin-right: 0.35rem; }
body[data-ls-export-pulse="1"] #fp-public-state .fp-state-dot {
  animation: lsNewData 0.85s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .ls-new-data-pulse,
  .ls-state-transition,
  .ls-recovery-sweep,
  .ls-ambient-breath,
  .ls-refresh-progress .ls-live-dot,
  [data-freshness="UPDATING"] .ls-live-dot,
  body[data-ls-export-pulse="1"] #fp-public-state .fp-state-dot,
  .ls-mp-point-pulse,
  .nsm-export-pulse {
    animation: none !important;
  }
  .ls-stale-decay,
  .ls-mp-card[data-freshness="STALE"] {
    transition: none;
  }
}

@media (max-width: 430px) {
  .ls-mp-head h3 { font-size: 0.92rem; }
  .ls-mp-meta { font-size: 10px; }
}
