/* ==========================================================================
   CONTEXT MAP (How Unlock works). 5 Nov (user: "too many lines, colours not
   good, match the use cases"): drawn in the Use cases drawings' language —
   a lifted backdrop; solid panels (heading 7% over the band, a grey edge,
   a title header over a hairline (no dot, 5 Nov), muted icons); grey wires with a
   Sage beam sliding along each; the result panel lit Sage; a quiet
   gates note in that panel's foot (5 Nov handoff). Three
   wires only: each input panel into the mark, the mark to the Output panel.
   The nodes rise in once (data-rise); beams by assets/js/beams.js (desktop,
   paused off screen, still tracks for reduced motion).
   Earlier rounds — the ring and 12s loop, the one-time run, the eleven
   gradient beams: web/versions/before-map-sequence/ and git history.
   Type (5 Nov, user): two sizes only — 12px for every label (headers,
   output eyebrows), 16px for everything else, except the gate's line and
   the line under the mark at 14px (13 and 15 Nov, user).
   Desktop (from 1200px): inputs | join | core | join | output.
   Below: one column, joined by short vertical lines.
   ========================================================================== */

.context-map {
  --map-edge: color-mix(in srgb, var(--heading) 34%, var(--ground));
  --map-surface: color-mix(in srgb, var(--heading) 9%, var(--ground));   /* fill separates the panels (5 Nov; was 7% under a 34% edge) */
  --map-panel-edge: color-mix(in srgb, var(--heading) 12%, var(--ground));
  --map-rule: color-mix(in srgb, var(--heading) 14%, var(--ground));
  --map-core: 96px;
  --map-join: 120px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--map-join) var(--map-core) var(--map-join) minmax(0, 1.1fr);
  align-items: center;
  margin-top: var(--space-8);
  padding: var(--space-8) var(--space-7);
  border-radius: var(--r-box, 6px);
  background: color-mix(in srgb, var(--heading) 3%, var(--ground));   /* the backdrop, as behind each use case drawing (12 Nov: the box back, plain, no gradient; user) */
}
.context-map > :not(.context-map__beams) { position: relative; z-index: 1; }

/* ---------------------------------------------------------------- PANELS */
.context-map__panel {
  border: var(--border-w) solid var(--map-panel-edge); border-radius: var(--r-box, 6px);
  background: var(--map-surface);
}
.context-map__label {
  display: flex; align-items: center; gap: var(--space-2);
  margin: 0; padding: var(--space-3) var(--space-5);
  border-bottom: var(--border-w) solid var(--map-rule);
  font: 500 var(--size-label)/1.4 var(--font-label); letter-spacing: var(--label-tracking); text-transform: uppercase;
  color: color-mix(in srgb, var(--heading) 86%, var(--ground));
}
.context-map__panel ul { display: grid; gap: var(--space-3); margin: 0; padding: var(--space-4) var(--space-5); list-style: none; }
.context-map__panel li { display: flex; align-items: center; gap: var(--space-3); font-size: var(--size-body); line-height: 1.4; color: var(--ink); }
.context-map__panel li .icon { --icon-size: 20px; flex: none; color: var(--ink-muted); }   /* 20px beside 16px text (13 Nov, user: icon sizes; 18 before) */   /* Phosphor duotone (5 Nov, user) */

.context-map__inputs { display: grid; gap: var(--space-5); }
/* The product's three parts, named as the hero names them (26 Nov, later,
   Rohit: "the hero names these 3 parts, and no drawing on the page shows
   them"): Context engine over Your software context, Playbooks over Your
   delivery process, each above its panel and outside it (the panel keeps
   its own header); Server-first harness under the mark, over the agents'
   line. A Sage DM Mono label, the site's way of naming a part; the agents'
   line in the body colour under it (Sage before, when it stood alone), so
   the Sage stays with the name. The wires still meet the panels
   (beams.js measures .context-map__group). */
.context-map__part { display: grid; gap: var(--space-3); }
.context-map .context-map__part-name {
  margin: 0; font: 500 var(--size-label)/1.4 var(--font-label); letter-spacing: var(--label-tracking); text-transform: uppercase;
  color: var(--accent-text);
}

/* The Output panel: lit, like the use cases' result panels. */
.context-map__out { border-color: color-mix(in srgb, var(--accent-text) 55%, var(--ground)); }
.context-map__out ul { gap: var(--space-4); }
.context-map__out li { align-items: flex-start; }
.context-map__out li .icon { margin-top: 2px; color: var(--accent-text); }
.context-map__out li > span { display: grid; gap: 1px; min-width: 0; }
.context-map__out small { font: 500 var(--size-label)/1.4 var(--font-label); letter-spacing: var(--label-tracking); text-transform: uppercase; color: var(--ink-muted); }
.context-map__out strong { font-size: var(--size-body); font-weight: 500; line-height: 1.35; color: var(--heading); }
/* Its foot: where your team steps in (5 Nov, Rohit's final edits, after
   his diagram: "Your teams review the evidence and approve the next step."
   in an Ember-edged box with the gate diamond). Ember on the edge, tint and
   diamond only; the line stays in the heading colour. The quiet one-line
   note of the consolidated handoff is in versions/before-rohit-final. */
/* 26 Nov (Rohit: "Your policy decides who reviews the evidence and approves
   the next step: a person or an agent."): the box neutral, as the use cases'
   gates — Ember means a person, and who approves is the policy's choice. The
   gate's diamond stays as an outline in the heading colour, the edge and
   tint in the heading colour too. Ember until then. */
.context-map__gate {
  display: flex; align-items: center; gap: var(--space-3);
  margin: 0 var(--space-4) var(--space-4); padding: var(--space-3) var(--space-4);
  border: var(--border-w) solid color-mix(in srgb, var(--heading) 18%, var(--ground));
  border-radius: var(--r-box, 6px);
  background: color-mix(in srgb, var(--heading) 4%, var(--map-surface, var(--ground)));
}
.context-map__gate-mark { flex: none; width: 11px; height: 11px; margin: 0 4px; border: 1.5px solid color-mix(in srgb, var(--heading) 70%, transparent); border-radius: 2px; rotate: 45deg; }
.context-map__gate p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--heading); }   /* 14px (13 Nov, user; 16 before) */

/* ---------------------------------------------------------------- CORE */
.context-map__core { position: relative; display: grid; justify-items: center; text-align: center; }
.context-map__mark { width: 96px; height: auto; overflow: visible; }
.context-map__mark-loop { fill: none; stroke: var(--heading); stroke-width: 15; }
.context-map__mark-in { fill: var(--mint-green); }
.context-map__mark-gate { fill: var(--heading); }
.context-map__under {              /* hangs under the mark, so the mark stays on the row's middle where the wires meet it */
  position: absolute; top: calc(100% + var(--space-5)); left: 50%; translate: -50% 0; width: 240px;
  display: grid; gap: var(--space-2);
}
.context-map__core p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink); }   /* 14px (15 Nov, user; 16 before) */

/* ---------------------------------------------------------------- WIRES
   Desktop: an SVG over the map, drawn by beams.js: a grey track and a Sage
   beam per wire. The join columns are spacing. */
.context-map__beams { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.context-map__track { fill: none; stroke: var(--map-edge); stroke-width: 1.25; }
.context-map__beam { fill: none; stroke-width: 1.75; stroke-linecap: round; }
.context-map__beams stop { stop-color: var(--accent-text); }
.context-map__beams .is-clear { stop-opacity: 0; }
.context-map.is-armed .context-map__beams { transition: opacity 600ms var(--motion-ease) 300ms; }
.context-map.is-armed:not(.is-in) .context-map__beams { opacity: 0; }

/* -------------------------------------------------------------- STACKED */
@media (max-width: 1199px) {
  .context-map { grid-template-columns: minmax(0, 1fr); padding: var(--space-6) var(--space-5); }
  .context-map__inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .context-map__beams { display: none; }
  .context-map__join { height: var(--space-8); }
  .context-map__join::after { content: ''; position: absolute; inset: 0 auto 0 50%; border-left: var(--border-w) solid var(--map-edge); }
  .context-map__core { gap: var(--space-3); }
  .context-map__mark { width: 72px; }
  .context-map__under { position: static; translate: none; }
}
@media (max-width: 640px) {
  .context-map { padding: var(--space-5) var(--space-4); }
  .context-map__inputs { grid-template-columns: minmax(0, 1fr); }
}

/* The Supabase pass (28 Nov): the output's four icons muted; the panel's Sage
   edge and the wires carry the green */
.context-map__out li .icon { color: var(--ink-muted); }
