/* system-map.css v2 — strict hierarchy, layer separation, directional flow */

.sysmap {
  position: relative;
  width: 100%;
  min-height: 700px;
  background: radial-gradient(ellipse 60% 50% at 48% 44%, rgba(0,196,212,0.03), transparent 70%), #020406;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(122, 184, 255, 0.06);
}

.sysmap-canvas {
  position: relative;
  width: 100%;
  height: 700px;
}

/* ── Mesh layer (Tailscale) ── */
.sysmap-mesh {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.5s ease 0.2s;
}
.sysmap.active .sysmap-mesh { opacity: 1; }

/* ── Edges ── */
.sysmap-edges {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease 0.6s;
}
.sysmap.active .sysmap-edges { opacity: 1; }

/* ── Governance boundary ── */
.sysmap-governance {
  position: absolute;
  left: 5%;
  top: 5%;
  right: 5%;
  bottom: 5%;
  border: 1px dashed rgba(167, 139, 250, 0.1);
  border-radius: 40% 40% 50% 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease 1.8s;
  z-index: 0;
}
.sysmap.active .sysmap-governance { opacity: 1; }

/* ── Node base ── */
.sysmap-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.6s ease;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.5);
  z-index: 2;
}
.sysmap.active .sysmap-node {
  opacity: 1;
  transform: scale(1);
}
.sysmap-node:hover {
  transform: scale(1.12) !important;
  z-index: 10;
}

/* ── CORE: dominant, pulsing ── */
.sysmap-node.core {
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(0,196,212,0.18) 0%, rgba(0,196,212,0.02) 70%);
  border: 2.5px solid rgba(0,196,212,0.5);
  box-shadow:
    0 0 80px rgba(0,196,212,0.12),
    0 0 160px rgba(0,196,212,0.04),
    inset 0 0 40px rgba(0,196,212,0.06);
  animation: core-pulse 3s ease-in-out infinite;
}
.sysmap.active .sysmap-node.core { transition-delay: 0.4s; }

@keyframes core-pulse {
  0%, 100% { box-shadow: 0 0 80px rgba(0,196,212,0.12), 0 0 160px rgba(0,196,212,0.04), inset 0 0 40px rgba(0,196,212,0.06); }
  50%      { box-shadow: 0 0 100px rgba(0,196,212,0.2), 0 0 200px rgba(0,196,212,0.06), inset 0 0 60px rgba(0,196,212,0.1); }
}

/* ── Major nodes ── */
.sysmap-node.major {
  width: 80px;
  height: 80px;
  border-width: 1.5px;
}

/* ── Minor nodes ── */
.sysmap-node.minor {
  width: 48px;
  height: 48px;
  border-width: 1px;
}

/* ── Cluster (endpoints, tiny) ── */
.sysmap-node.cluster {
  width: 30px;
  height: 30px;
  border-width: 1px;
  opacity: 0;
}
.sysmap.active .sysmap-node.cluster { opacity: 0.7; }
.sysmap-node.cluster:hover { opacity: 1 !important; }

/* ── Semantic colors ── */
.sysmap-node.c-core     { border-color: rgba(0,196,212,0.5);   background: radial-gradient(circle, rgba(0,196,212,0.15), transparent 70%); }
.sysmap-node.c-detect   { border-color: rgba(59,143,217,0.45); background: radial-gradient(circle, rgba(59,143,217,0.1), transparent 70%); }
.sysmap-node.c-validate { border-color: rgba(74,222,128,0.45); background: radial-gradient(circle, rgba(74,222,128,0.1), transparent 70%); }
.sysmap-node.c-fail     { border-color: rgba(248,113,113,0.45);background: radial-gradient(circle, rgba(248,113,113,0.1), transparent 70%); }
.sysmap-node.c-govern   { border-color: rgba(167,139,250,0.4); background: radial-gradient(circle, rgba(167,139,250,0.08), transparent 70%); }
.sysmap-node.c-infra    { border-color: rgba(148,163,184,0.2); background: radial-gradient(circle, rgba(148,163,184,0.04), transparent 70%); }
.sysmap-node.c-edge     { border-color: rgba(251,191,36,0.3);  background: radial-gradient(circle, rgba(251,191,36,0.06), transparent 70%); }
.sysmap-node.c-siem     { border-color: rgba(56,189,248,0.4);  background: radial-gradient(circle, rgba(56,189,248,0.08), transparent 70%); }

/* ── Labels ── */
.sysmap-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(224,235,255,0.55);
  text-transform: uppercase;
  pointer-events: none;
}
.sysmap-node.core .sysmap-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(0,196,212,0.85);
  bottom: -28px;
  letter-spacing: 0.1em;
}
.sysmap-node:hover .sysmap-label {
  color: rgba(224,235,255,0.9);
}

/* ── Node icon text ── */
.sysmap-icon {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: rgba(224,235,255,0.6);
  font-size: 0.62rem;
  text-align: center;
  line-height: 1.15;
  white-space: pre-line;
}
.sysmap-node.core .sysmap-icon {
  font-size: 0.78rem;
  color: rgba(0,196,212,0.9);
}
.sysmap-node.major .sysmap-icon { font-size: 0.68rem; color: rgba(224,235,255,0.7); }
.sysmap-node.cluster .sysmap-icon { font-size: 0; } /* hide icon text on tiny nodes */

/* ── Particles ── */
.sysmap-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
}
.sysmap-particle.p-ingest  { background: rgba(251,191,36,0.9);  box-shadow: 0 0 8px rgba(251,191,36,0.5); }
.sysmap-particle.p-core    { background: rgba(0,196,212,0.9);   box-shadow: 0 0 8px rgba(0,196,212,0.5); }
.sysmap-particle.p-pass    { background: rgba(74,222,128,0.9);  box-shadow: 0 0 8px rgba(74,222,128,0.5); }
.sysmap-particle.p-fail    { background: rgba(248,113,113,0.9); box-shadow: 0 0 8px rgba(248,113,113,0.5); }
.sysmap-particle.p-detect  { background: rgba(59,143,217,0.9);  box-shadow: 0 0 8px rgba(59,143,217,0.5); }
.sysmap-particle.p-govern  { background: rgba(167,139,250,0.8); box-shadow: 0 0 8px rgba(167,139,250,0.4); }

/* ── Hover panel ── */
.sysmap-panel {
  position: absolute;
  z-index: 20;
  width: 280px;
  padding: 18px;
  background: rgba(6,10,18,0.96);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(122,184,255,0.12);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  font-size: 0.82rem;
  color: #d4e0ec;
  line-height: 1.6;
  display: none;
  pointer-events: none;
}
.sysmap-panel.visible { display: block; }
.sysmap-panel-title {
  font-family: 'Sora', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: #f0f6ff;
  margin-bottom: 6px;
}
.sysmap-panel-role {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(159,214,255,0.5);
  margin-bottom: 10px;
}
.sysmap-panel-metric {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.8rem;
}
.sysmap-panel-metric:last-child { border-bottom: 0; }
.sysmap-panel-val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}

/* ── Staggered reveal ── */
.sysmap-node[data-delay="1"] { transition-delay: 0.3s; }
.sysmap-node[data-delay="2"] { transition-delay: 0.6s; }
.sysmap-node[data-delay="3"] { transition-delay: 0.9s; }
.sysmap-node[data-delay="4"] { transition-delay: 1.2s; }
.sysmap-node[data-delay="5"] { transition-delay: 1.5s; }
.sysmap-node[data-delay="6"] { transition-delay: 1.8s; }
.sysmap-node[data-delay="7"] { transition-delay: 2.1s; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .sysmap { min-height: 500px; }
  .sysmap-canvas { height: 500px; }
  .sysmap-node.core { width: 110px; height: 110px; }
  .sysmap-node.major { width: 56px; height: 56px; }
  .sysmap-node.minor { width: 36px; height: 36px; }
  .sysmap-node.cluster { width: 22px; height: 22px; }
  .sysmap-label { font-size: 0.48rem; }
  .sysmap-node.core .sysmap-label { font-size: 0.58rem; }
  .sysmap-panel { width: 220px; font-size: 0.74rem; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .sysmap-node.core { animation: none; }
  .sysmap-particle { display: none; }
  .sysmap-node { transition-delay: 0s !important; }
}
