/* cs-map.bamya.co - the customer success map (templates/cs-map.bamya.co/map.html).

   In the landing pages' palette (panel.css: charcoal ground, teal for "you", violet for the far end).
   Every rule is under .cm-app or a cm- class: panel.css styles bare `header`, `h1` and `.pulse`
   for the landing pages, and the map's old names would have met them. The page scrolls as one
   (the map's own scroll box would have put a second scrollbar beside the page's); the map's bar
   sticks under the site header instead. */

.cm-app {
  /* The landing palette (panel.css :root), named as the map's script reads it. */
  --bg: #090b0d;
  --panel: #141a1c;
  --panel2: #0f1315;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --ink: #eef2f3;
  --ink-dim: #98a4a8;
  --ink-faint: #77858a;
  --edge: rgba(255, 255, 255, 0.11);
  --edge-strong: rgba(255, 255, 255, 0.24);
  --accent: #38d9be;      /* panel.css --you */
  --accent-2: #45ecd0;    /* panel.css --live */
  --fwd: #38d9be;         /* downstream: teal, as the landing's "you" */
  --bwd: #a78bfa;         /* upstream: violet, as the landing's "them" */
  /* The kinds keep the map's own colours: nine of them have to stay told apart. */
  --k-source: #8a9aa8; --k-signal: #3fb6d6; --k-engine: #d4ab62;
  --k-dim: #9b7be6; --k-risk: #ef9a52; --k-score: #4fc983;
  --k-plan: #d86fbe; --k-ui: #5b9be8; --k-actor: #ee7f97;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

  position: relative;
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto 64px;
  color: var(--ink);
  font-family: var(--sans);
  background: color-mix(in srgb, var(--panel2) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: 18px;
}

/* ─────────────────────────────────────────────── the introduction */

.cm-wrap { width: min(1480px, calc(100% - 32px)); margin-inline: auto; }

.cm-intro { padding: 118px 0 30px; }

.cm-intro .kicker { margin-bottom: 18px; }

.cm-title {
  font-size: clamp(2.1rem, 4.4vw, 3.6rem);
  margin-bottom: 16px;
}

.cm-lede { margin-bottom: 0; max-width: 46em; }

/* ─────────────────────────────────────────────── the bar: legend and switches */

.cm-bar {
  position: sticky;
  top: var(--cm-top, 62px);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px 18px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.cm-lgd {
  display: flex;
  gap: 8px 16px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-dim);
}

.cm-lgd .cm-it { display: flex; align-items: center; gap: 6px; }

.cm-lgd svg { width: 34px; height: 12px; display: block; }

.cm-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.cm-tgl {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.cm-tgl:hover { border-color: var(--ink); color: var(--ink); }

.cm-tgl.mode-on { color: var(--accent); border-color: var(--accent); }

.cm-tgl:disabled,
.cm-tgl:disabled:hover {
  opacity: 0.4;
  cursor: not-allowed;
  color: var(--ink-faint);
  border-color: var(--line-strong);
  animation: none;
}

.cm-tgl:focus-visible,
.cm-tab:focus-visible,
.cm-sclose:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Copy link is the page's one call to action: panel.css's .cta.accent. */
.cm-copy {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

.cm-copy:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--bg); }

.cm-copy.is-done { background: transparent; color: var(--accent); }

@keyframes cmPulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
}

.cm-tgl.is-pulsing { color: var(--accent); border-color: var(--accent); animation: cmPulse 1.7s ease-out infinite; }

/* ─────────────────────────────────────────────── the graph */

.cm-stage { position: relative; }

.cm-scroll {
  position: relative;
  border-radius: 0 0 18px 18px;
  background: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.06) 1px, transparent 0) 0 0 / 26px 26px;
}

.cm-app svg#svg { display: block; font-family: var(--mono); }

.cm-app .band-rule { stroke: var(--line); stroke-width: 1; }
.cm-app .band-hit { fill: transparent; cursor: help; }
.cm-app .band-num { font-size: 11px; font-weight: 700; font-family: var(--mono); }
.cm-app .band-lab { font-size: 10px; letter-spacing: 0.16em; font-weight: 700; fill: var(--ink-dim); }
.cm-app .band-cnt { font-size: 9px; fill: var(--ink-faint); font-family: var(--mono); }

.cm-app .node { cursor: pointer; }
.cm-app .node .name { font-size: 10.5px; font-family: var(--sans); font-weight: 600; fill: var(--ink); }
.cm-app .node .badge { font-size: 9px; font-weight: 700; }
.cm-app .node.dim { opacity: 0.14; }
.cm-app .node:hover rect:first-child { filter: brightness(1.25); }
/* A box clicked into the path: a solid ring, so the route reads at a glance. */
.cm-app .node.pin rect { stroke-width: 2.6px; filter: drop-shadow(0 0 5px color-mix(in srgb, var(--fwd) 70%, transparent)); }

.cm-app .edge { fill: none; stroke: var(--edge); stroke-width: 1.1px; }
.cm-app .edge.strong { stroke: var(--edge-strong); }
.cm-app .edge.pot { stroke-dasharray: 4 4; }
.cm-app .edge.dim { opacity: 0.05; }
.cm-app .edge.fwd { stroke: var(--fwd); stroke-width: 2px; opacity: 1; }
.cm-app .edge.bwd { stroke: var(--bwd); stroke-width: 2px; opacity: 1; }
.cm-app .edge.cand { stroke: var(--fwd); stroke-width: 1.4px; opacity: 0.4; stroke-dasharray: 3 4; }

/* A wide clear stroke over each line, so a thin curve is easy to hover; live only in 1-level
   trace and only on a lit line, where a line explains itself. */
.cm-app .ehit { fill: none; stroke: transparent; stroke-width: 14px; pointer-events: none; }
.cm-app.trace-1 .ehit.lit { pointer-events: stroke; cursor: help; }

.cm-app #flow * { pointer-events: none; }
.cm-app #flow circle { filter: drop-shadow(0 0 2px currentColor); }

/* ─────────────────────────────────────────────── hover bubble and hint */

.cm-tip {
  position: absolute;
  z-index: 40;
  max-width: 340px;
  pointer-events: none;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 13px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.5);
  font-size: 12.5px;
  line-height: 1.5;
}

.cm-tip .et-head { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); margin-bottom: 5px; }
.cm-tip .et-sub { color: var(--ink-faint); font-weight: 400; }
.cm-tip .et-arw { color: var(--fwd); font-weight: 700; }
.cm-tip .et-body { color: var(--ink); }

.cm-hint {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 30;
  /* Centred from left: 50%, so without a width of its own it would wrap at half the window. */
  width: max-content;
  max-width: calc(100vw - 32px);
  font-family: var(--mono);
  font-size: 11px;
  text-align: center;
  color: var(--ink-dim);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  padding: 7px 14px;
  border-radius: 999px;
  pointer-events: none;
  transition: opacity 0.6s;
}

.cm-hint.is-gone { opacity: 0; }

/* ─────────────────────────────────────────────── a box's window: Streams and Description */

.cm-sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.cm-sheet-wrap.show { display: flex; }

.cm-sheet {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--panel2);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.6);
}

.cm-shd {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 24px 28px 16px;
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
}

/* The kind line keeps clear of Copy link and the cross; the title starts below them. */
.cm-sh-k { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 700; margin-right: 170px; min-height: 22px; }
.cm-sh-t { font-size: 23px; font-weight: 750; letter-spacing: -0.01em; margin-top: 10px; text-wrap: balance; }
.cm-sh-st { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); margin-top: 6px; }

.cm-sh-actions {
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cm-sclose {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.cm-sclose:hover { border-color: var(--ink); color: var(--ink); }

.cm-tabs { display: flex; gap: 8px; margin-top: 16px; }

.cm-tab {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
}

.cm-tab:hover { color: var(--ink); border-color: var(--ink); }
.cm-tab.on { color: var(--bg); background: var(--accent); border-color: var(--accent); font-weight: 600; }

.cm-sbd { padding: 20px 28px 28px; font-size: 15px; line-height: 1.65; color: var(--ink); }
.cm-sbd p { margin: 0 0 13px; }
.cm-sbd p:last-child { margin-bottom: 0; }
.cm-sbd strong { font-weight: 680; }
.cm-sbd .lead {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
  margin: 20px 0 7px;
}

.cm-grp {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
  margin: 22px 0 9px;
}

.cm-grp:first-child { margin-top: 0; }

.cm-app .erow { font-size: 15px; padding: 9px 0; line-height: 1.45; border-bottom: 1px dashed var(--line); }
.cm-app .erow .arw { font-family: var(--mono); font-weight: 700; }
.cm-app .erow .tgt { font-weight: 600; }
.cm-app .erow .meta { color: var(--ink-dim); font-family: var(--mono); font-size: 11.5px; margin-top: 2px; }

/* ─────────────────────────────────────────────── small screens and less motion */

@media (max-width: 720px) {
  .cm-intro { padding-top: 104px; }
  /* Here the bar is two rows of legend and two of buttons: stuck, it would hold a quarter of
     the screen, so it scrolls away with the page. */
  .cm-bar { position: static; }
  .cm-actions { margin-left: 0; }
  .cm-lgd { display: grid; grid-template-columns: 1fr 1fr; font-size: 10px; }
  .cm-sh-k { margin-right: 0; padding-top: 44px; }
  .cm-shd { padding: 20px 20px 14px; }
  .cm-sbd { padding: 18px 20px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .cm-tgl.is-pulsing { animation: none; }
  .cm-hint { transition: none; }
}
