
/* FINAL PASS — living intelligence polish on Legacy Evolved DNA */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --fp-bg: #050508;
  --fp-purple: #8b5cf6;
  --fp-cyan: #22d3ee;
  --fp-ink: #e8e6f0;
  --fp-muted: #a8a3b8;
  --fp-live: #22d3ee;
  --fp-updating: #a78bfa;
  --fp-stale: #94a3b8;
  --fp-refresh: #fbbf24;
  --fp-display: "Space Grotesk", "IBM Plex Sans", sans-serif;
  --fp-section: "Space Grotesk", "IBM Plex Sans", sans-serif;
  --fp-body: "IBM Plex Sans", sans-serif;
  --fp-tele: "JetBrains Mono", ui-monospace, monospace;
  --fp-content-max: 1180px;
}

body.home-alive, body.home-alive p, body.home-alive li, body.home-alive .muted, body.home-alive .alive-section-lead {
  font-family: var(--fp-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--fp-ink);
}
body.home-alive h1, body.home-alive .hero h1, #alive-hero-heading {
  font-family: var(--fp-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: clamp(2.2rem, 4.2vw, 3.4rem);
  line-height: 1.08;
}
body.home-alive h2, .section-head h2 {
  font-family: var(--fp-section);
  font-weight: 600;
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
}
.metrics-ticker-text, .alive-live-sync, .alive-export-cycle, .rm-meta, .le-plane,
.alive-freshness-badge, .nexus-truth-badge, .fp-state-chip {
  font-family: var(--fp-tele) !important;
}
.metrics-ticker-text { font-size: 13px !important; letter-spacing: .04em; }
.alive-live-sync, .alive-export-cycle { font-size: 13px !important; }
body.home-alive .small, body.home-alive .muted.small { font-size: 14px !important; }
body.home-alive .alive-entity { font-size: 0.78rem !important; }
body.home-alive .alive-insight,
body.home-alive .alive-story-lead,
body.home-alive .alive-reason,
body.home-alive .alive-why { font-size: 14px; line-height: 1.5; }

/* Hide staging banner on production build marker */
body[data-fp-prod="1"] .le-staging-banner, body[data-fp-prod="1"] #recovery-max-banner { display: none !important; }

/* Product nav */
.fp-nav a { font-size: 14px; letter-spacing: .02em; }
.fp-nav { gap: 1rem !important; }

/* Width token alignment */
.container,
#fp-execution-truth,
#fp-market-pulse,
.fp-arch-shell,
.le-truth-stack {
  max-width: var(--fp-content-max) !important;
}

/* Move plane rail out of hero budget — compact under header */
.le-planes-rail {
  position: relative !important;
  top: auto !important;
  justify-content: flex-start;
  padding-left: max(1rem, calc((100vw - var(--fp-content-max)) / 2));
  opacity: .92;
}

/* Hero machine layout */
#hero.fp-hero-machine {
  position: relative;
  min-height: min(88vh, 820px);
  display: grid;
  align-items: center;
  overflow: hidden;
}
#hero .fp-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, .95fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: center;
  max-width: var(--fp-content-max);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
}
@media (max-width: 900px) {
  #hero .fp-hero-grid { grid-template-columns: 1fr; }
}
#fp-hero-machine {
  position: relative;
  min-height: 360px;
  border: 1px solid rgba(139,92,246,.35);
  background:
    radial-gradient(420px 220px at 40% 30%, rgba(139,92,246,.28), transparent 70%),
    radial-gradient(320px 180px at 70% 70%, rgba(34,211,238,.12), transparent 65%),
    linear-gradient(165deg, rgba(12,8,24,.92), rgba(5,5,8,.98));
  box-shadow: inset 0 0 60px rgba(139,92,246,.08);
}
#fp-hero-machine canvas { width: 100%; height: 100%; display: block; min-height: 360px; }
.fp-hero-machine-caption {
  position: absolute; left: .75rem; bottom: .65rem; right: .75rem;
  font: 500 12px/1.35 var(--fp-tele);
  color: #c4b5fd;
  pointer-events: none;
}

/* Public state chip */
.fp-state-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid rgba(139,92,246,.4);
  padding: .35rem .65rem;
  background: rgba(8,6,16,.72);
  color: #e9e5ff;
  font-size: 12px !important;
}
.fp-state-chip[data-state="LIVE"] { border-color: rgba(34,211,238,.55); color: var(--fp-live); }
.fp-state-chip[data-state="SYNCING"] { border-color: rgba(167,139,250,.55); color: var(--fp-updating); }
.fp-state-chip[data-state="AWAITING"] { border-color: rgba(148,163,184,.5); color: var(--fp-stale); }
.fp-state-chip[data-state="UNKNOWN"] { border-color: rgba(148,163,184,.45); color: #94a3b8; }
.fp-state-chip[data-state="UPDATING"] { border-color: rgba(167,139,250,.55); color: var(--fp-updating); }
.fp-state-chip[data-state="STALE_SNAPSHOT"] { border-color: rgba(148,163,184,.5); color: var(--fp-stale); }
.fp-state-chip[data-state="RECENT"] { border-color: rgba(34,211,238,.4); color: #67e8f9; }
.fp-state-chip[data-state="RESEARCH_REFRESHING"] { border-color: rgba(251,191,36,.5); color: var(--fp-refresh); }
.fp-state-dot { width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }

/* P0 credibility — hero epistemic layer + domain status strip */
.fp-hero-epistemic {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .35rem 0 .85rem;
}
.fp-trust-badge {
  display: inline-block;
  font: 600 10px/1.3 var(--fp-tele);
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .28rem .5rem;
  border: 1px solid rgba(148,163,184,.35);
  color: #cbd5e1;
  background: rgba(8,6,16,.55);
}
.fp-trust-badge.fp-trust-edge { border-color: rgba(251,191,36,.5); color: #fbbf24; }
.fp-trust-badge.fp-trust-influence { border-color: rgba(139,92,246,.45); color: #c4b5fd; }
.fp-trust-badge.fp-trust-exec { border-color: rgba(34,211,238,.35); color: #67e8f9; }
.fp-trust-affordance { font-size: 0.88rem; opacity: 0.92; }

.fp-hero-status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .45rem;
  margin: .75rem 0 .65rem;
  width: 100%;
}
@media (max-width: 720px) {
  .fp-hero-status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 390px) {
  .fp-hero-status-strip { grid-template-columns: 1fr; }
}
.fp-status-cell {
  border: 1px solid rgba(139,92,246,.28);
  background: rgba(8,6,16,.65);
  padding: .45rem .55rem;
  min-width: 0;
}
.fp-status-key {
  display: block;
  font: 600 9px/1.2 var(--fp-tele);
  letter-spacing: .08em;
  color: #94a3b8;
  margin-bottom: .2rem;
}
.fp-status-val {
  display: block;
  font: 600 11px/1.25 var(--fp-tele);
  color: #e9e5ff;
  word-break: break-word;
}
.fp-status-val[data-state="SYNCING"] { color: #a78bfa; }
.fp-status-val[data-state="AWAITING"],
.fp-status-val[data-state="UNKNOWN"] { color: #94a3b8; }
.fp-status-val[data-state="SYNCED"] { color: #22d3ee; }
.fp-status-val[data-state="BLOCKED"],
.fp-status-val[data-state="DEGRADED"] { color: #fbbf24; }

.fp-domain-ticker-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .5rem;
  margin-top: .25rem;
  font-family: var(--fp-tele) !important;
  font-size: 12px !important;
}
.fp-domain-key { color: #94a3b8; letter-spacing: .04em; }
.fp-domain-val { font-weight: 600; color: #c4b5fd; }
.fp-domain-val[data-state="SYNCED"] { color: #22d3ee; }
.fp-domain-val[data-state="SYNCING"] { color: #a78bfa; }
.fp-domain-val[data-state="AWAITING"],
.fp-domain-val[data-state="UNKNOWN"] { color: #94a3b8; }
.fp-domain-val[data-state="BLOCKED"],
.fp-domain-val[data-state="DEGRADED"] { color: #fbbf24; }
.fp-domain-val[data-state="OFF"] { color: #cbd5e1; }
.fp-domain-sep { color: rgba(148,163,184,.45); }

/* Market Pulse charts */
#fp-market-pulse {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  margin-inline: auto;
  width: 100%;
}
@media (max-width: 720px) { #fp-market-pulse { grid-template-columns: 1fr; } }
.fp-chart-card {
  border: 1px solid rgba(139,92,246,.32);
  background: linear-gradient(160deg, rgba(139,92,246,.12), rgba(8,8,14,.85));
  padding: .85rem 1rem 1rem;
  min-height: 210px;
}
.fp-chart-card h3 { margin: 0 0 .35rem; font-size: 1rem; font-family: var(--fp-section); }
.fp-chart-meta { font: 500 12px var(--fp-tele); color: var(--fp-muted); margin-bottom: .5rem; }
.fp-chart-card canvas { width: 100%; height: 140px; display: block; }

/* Architecture: graph ~70% + single detail rail ~30% */
#architecture.fp-arch-promoted {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
  background:
    radial-gradient(ellipse 70% 50% at 50% 20%, rgba(139,92,246,.16), transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(34,211,238,.06), transparent 55%);
  overflow-x: visible;
}
.fp-arch-shell {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(280px, 3fr);
  gap: 1rem;
  max-width: var(--fp-content-max);
  margin: 0 auto;
  padding: 0 1rem;
  align-items: start;
}
@media (max-width: 960px) { .fp-arch-shell { grid-template-columns: 1fr; } }
#alive-architecture-map.nexus-arch-v22-canvas-host,
#alive-architecture-map.nexus-system-map-host,
.fp-arch-shell #alive-architecture-map {
  width: 100% !important;
  max-width: none !important;
  min-height: 640px;
  margin-inline: 0;
  padding-inline: 0;
  min-width: 0;
}
#fp-arch-side-rail {
  border: 1px solid rgba(139,92,246,.35);
  background: rgba(10,8,18,.88);
  padding: 1rem;
  min-height: 320px;
  min-width: 0;
  position: sticky; top: 5.5rem;
  overflow: auto;
  max-height: calc(100vh - 6.5rem);
}
#fp-arch-side-rail h3 { margin: .25rem 0 .5rem; font-family: var(--fp-section); }
.fp-rail-meta { font: 500 12px var(--fp-tele); color: #c4b5fd; margin-bottom: .75rem; }
.fp-rail-stack {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  margin-top: .85rem;
}
.fp-rail-stack .le-card,
.fp-rail-stack .fp-truth-card {
  min-height: 0;
  padding: .75rem .85rem;
}
.fp-rail-stack .le-card h3 { font-size: .95rem; }

/* Truth stack must NEVER share the 30% rail column — full-width below shell */
.fp-arch-shell > #le-truth-stack,
.fp-arch-shell > .le-truth-stack {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none !important;
  margin: .5rem 0 0;
}
#architecture > #le-truth-stack,
#architecture > .le-truth-stack {
  max-width: var(--fp-content-max);
  margin: 1rem auto 0;
  padding: 0 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 960px) {
  #architecture > #le-truth-stack,
  #architecture > .le-truth-stack { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  #architecture > #le-truth-stack,
  #architecture > .le-truth-stack { grid-template-columns: 1fr; }
}
body.fp-final-pass .le-card { min-height: 0; }
body.fp-final-pass .nexus-cluster-desc,
body.fp-final-pass .nexus-cluster-meta,
body.fp-final-pass .nexus-arch-node-btn {
  font-size: 12px !important;
  line-height: 1.35;
}
body.fp-final-pass .nexus-cluster {
  width: min(14rem, 42%) !important;
  min-width: 9.5rem;
}

/* Evidence packet interactive */
#helix-relay.fp-evidence {
  border-top: 1px solid rgba(139,92,246,.25);
  overflow: visible;
}
.fp-evidence-controls {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  margin: .75rem 0 1rem;
}
.fp-evidence-controls button {
  font: 600 12px var(--fp-tele);
  color: #e9e5ff;
  background: rgba(139,92,246,.2);
  border: 1px solid rgba(139,92,246,.45);
  padding: .4rem .7rem;
  cursor: pointer;
}
.fp-evidence-controls button.is-active {
  border-color: var(--fp-cyan);
  color: var(--fp-cyan);
  box-shadow: 0 0 0 1px rgba(34,211,238,.35), 0 0 18px rgba(34,211,238,.18);
}
#fp-decision-trace {
  border: 1px solid rgba(34,211,238,.25);
  background: rgba(8,12,20,.7);
  padding: .85rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 14px;
}
#fp-decision-trace ol { margin: .4rem 0 0; padding-left: 1.1rem; color: #cbd5e1; }
#fp-decision-trace li.is-active,
#fp-decision-trace li[data-active="1"] {
  color: var(--fp-cyan);
  font-weight: 600;
}
.legacy-helix-wrap { padding-top: .5rem; }

/* Streams not grids — activity/feed layout (NO auto/1fr/auto on card children) */
#alive-daily-discoveries.fp-activity-stream,
.fp-activity-stream {
  display: flex !important;
  flex-direction: column;
  gap: .65rem;
  width: 100%;
  max-width: 100%;
}
.fp-activity-stream .alive-discovery-card,
.fp-activity-stream .alive-intel-card {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  gap: .2rem;
  padding: .7rem 1rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  grid-template-columns: none !important;
  box-sizing: border-box;
}
.fp-activity-stream .fp-feed-card {
  gap: .45rem;
}
.fp-activity-stream .fp-feed-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .75rem;
  width: 100%;
}
.fp-activity-stream .fp-feed-head h3 {
  flex: 1 1 auto;
  margin: 0;
  min-width: 12rem;
  font-size: 1.05rem;
  line-height: 1.3;
}
.fp-activity-stream .fp-feed-head .alive-metric {
  margin: 0;
  font-size: 1.05rem;
  margin-left: auto;
}
.fp-activity-stream .fp-feed-body {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
  width: 100%;
}
.fp-activity-stream .fp-feed-body p {
  margin: 0;
}
.fp-activity-stream .alive-intel-card > * {
  min-width: 0;
  max-width: 100%;
  width: auto;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}
.fp-activity-stream .alive-intel-card h3 {
  margin: .15rem 0;
  font-size: 1.05rem;
  line-height: 1.3;
}
.fp-activity-stream .alive-metric {
  font-size: 1.05rem;
}
.fp-activity-stream .alive-entity {
  display: inline-block;
  width: auto;
}
#alive-watchlist.fp-watchboard {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .85rem;
}
.fp-watchboard .alive-watch-card {
  border-left: 3px solid rgba(34,211,238,.45);
  min-height: 0;
  padding: 1rem 1.1rem;
  font-size: 14px;
}
#alive-intelligence-timeline.fp-temporal {
  position: relative;
  display: flex !important;
  flex-direction: column;
  gap: .15rem;
  padding-left: 1.25rem;
}
#alive-intelligence-timeline.fp-temporal::before {
  content: "";
  position: absolute; left: .35rem; top: .25rem; bottom: .25rem;
  width: 2px; background: linear-gradient(180deg, var(--fp-cyan), var(--fp-purple), transparent);
}
.fp-temporal .alive-timeline-item {
  position: relative;
  margin: .45rem 0;
  padding: .85rem 1rem;
  animation: fp-timeline-in .55s ease both;
}
.fp-temporal .alive-timeline-item::before {
  content: "";
  position: absolute; left: -1.05rem; top: 1.1rem;
  width: .55rem; height: .55rem; border-radius: 50%;
  background: var(--fp-cyan); box-shadow: 0 0 10px rgba(34,211,238,.55);
}
@keyframes fp-timeline-in {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: none; }
}

/* Missed winners compact archive + full-width panels */
#missed-winners.fp-missed-compact #alive-missed-grid .alive-missed-card:nth-child(n+6) { display: none; }
#missed-winners .fp-archive-note {
  font: 500 12px var(--fp-tele); color: var(--fp-muted); margin-top: .5rem;
}
#missed-winners .alive-missed-gate-harm,
#missed-winners .alive-missed-gate-panel,
#missed-winners .alive-missed-symbols-panel,
#missed-winners .alive-missed-timeline {
  width: 100%;
  max-width: 100%;
}
#missed-winners .alive-missed-timeline-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
#missed-winners .alive-missed-timeline-grid > :only-child {
  grid-column: 1 / -1;
  max-width: 100%;
}

/* Badge spacing fix (SNAPSHOT glue) */
.alive-freshness-badge, .alive-truth-badge, .alive-badge {
  display: inline-block;
  margin-right: .45rem;
  margin-bottom: .25rem;
  vertical-align: middle;
}

/* League maturity */
.fp-maturity {
  display: inline-block;
  margin-left: .35rem;
  font: 600 11px var(--fp-tele);
  padding: .15rem .35rem;
  border: 1px solid rgba(148,163,184,.45);
  color: #cbd5e1;
}
.fp-maturity.edge-none { border-color: rgba(251,191,36,.5); color: #fbbf24; }
.fp-nve-banner { margin: .5rem 0 1rem; }

/* Ways to use — balanced 2×2, existing personas full-width below */
#product-api .fp-ways-grid,
#alive-product-api.fp-ways-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  width: 100%;
}
@media (max-width: 720px) {
  #product-api .fp-ways-grid,
  #alive-product-api.fp-ways-grid { grid-template-columns: 1fr; }
}
.fp-way-card {
  border: 1px solid rgba(139,92,246,.3);
  background: linear-gradient(165deg, rgba(139,92,246,.1), rgba(8,8,14,.8));
  padding: 1.1rem 1.15rem;
  min-width: 0;
}
.fp-way-card h3 { margin: 0 0 .4rem; font-size: 1.05rem; }
.fp-ways-existing {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: .85rem;
  margin-top: .25rem;
  width: 100%;
}
.fp-ways-existing .alive-product-card {
  min-width: 0;
  padding: 1.15rem 1.25rem;
}

/* Data plane + execution truth band */
#fp-execution-truth {
  margin: 2rem auto;
  max-width: var(--fp-content-max);
  padding: 0 1.25rem;
}
.fp-truth-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: .75rem;
}
@media (max-width: 800px) { .fp-truth-grid { grid-template-columns: 1fr; } }
.fp-truth-card {
  border: 1px solid rgba(139,92,246,.32);
  background: rgba(10,8,18,.85);
  padding: 1rem;
  min-width: 0;
}
.fp-shadow-badge {
  font: 600 11px var(--fp-tele);
  color: #94a3b8;
  border: 1px solid rgba(148,163,184,.4);
  padding: .2rem .4rem;
}

/* Section rhythm */
.section.section-cockpit { padding-block: clamp(2rem, 4vw, 3.25rem); }
.section-alt { background: linear-gradient(180deg, rgba(12,12,20,.55), rgba(5,5,8,.2)); }

/* Mobile width tokens */
@media (max-width: 430px) {
  body.home-alive { font-size: 14px; }
  .fp-arch-shell, #fp-market-pulse, .container { padding-inline: .85rem; }
  .fp-activity-stream .alive-intel-card { padding: .75rem .85rem; }
}
@media (max-width: 390px) {
  #hero .fp-hero-grid { padding-inline: .75rem; }
  body.home-alive h1, #alive-hero-heading { font-size: clamp(1.75rem, 8vw, 2.2rem); }
}
@media (max-width: 360px) {
  .fp-nav { gap: .55rem !important; }
  .metrics-ticker-text { font-size: 12px !important; }
}

/* Motion rules — intentional only */
@media (prefers-reduced-motion: reduce) {
  .fp-temporal .alive-timeline-item, #fp-hero-machine canvas { animation: none !important; }
}
