/* ==========================================================================
   mission-graph.css — a mission's plan as a map, and its list of steps (G4 B045, 3 Nov 2026).

   The grammar: docs/design/B045-kernel-and-graph.md. Only the Office's tokens
   (--o-*), so the light sheet, the dark side and the classic look each take it
   as they take every other part of the stage (mode-switch.css flips them; no
   hand-written colour here for tools/dark-side.mjs to answer).

   A GRAPH IS NOT ATMOSPHERE: no lime (lime is the globe's light and the one
   action), no glow, no gradient, no texture behind it, nothing travelling. The
   edges and the quiet loops hold 3:1 on the card (WCAG 1.4.11); the words 4.5:1.
   ========================================================================== */

/* ---------- the map ---------- */
#office .mg {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "w" "map" "long" "foot";
  margin: 0 0 0.75rem;
  min-width: 0;
}
#office .mg__w { grid-area: w; height: 0; min-width: 0; }
#office .mg__map { grid-area: map; position: relative; max-width: 100%; }
#office .mg__map[hidden] { display: none; }
#office .mg__svg { display: block; overflow: visible; }
#office .mg__note { margin: 0 0 0.75rem; color: var(--o-dim); font-size: var(--o-t-sm); line-height: 1.45; }
#office .mg__note--long { grid-area: long; margin: 0; }
#office .mg__note[hidden] { display: none; }
/* The caption, and in its place the step under the pointer or in focus: they share one place, so nothing below moves. */
#office :is(.mg__cap, .mg__read) {
  grid-area: foot;
  margin: 4px 0 0;
  min-width: 0;
  font-size: var(--o-t-xs);
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#office .mg__cap { color: var(--o-faint); white-space: normal; overflow: visible; }
#office .mg__read { color: var(--o-dim); font-weight: 550; opacity: 0; }
#office .mg.is-reading .mg__read { opacity: 1; }
#office .mg.is-reading .mg__cap { opacity: 0; }

/* A STEP'S TARGET: the node's own tile (the globe's tiles are hairline rounded squares; a graph's is a control),
   26px, transparent until it is pointed at, open, or in focus. */
#office .mg-hit {
  position: absolute;
  box-sizing: border-box;
  width: 26px;
  height: 26px;
  min-height: 26px;  /* app.css gives every <button> 56px; a node's target is its 26px tile (WCAG 2.5.8: 24) */
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--tk-r-md);
  background: transparent;
  cursor: pointer;
}
#office .mg-hit:is(:hover, .is-lit) { border-color: var(--o-line-2); }
#office .mg-hit.is-open { border-color: var(--o-line-3); background: var(--o-hover); }
#office .mg-hit:focus-visible { outline: 1px solid var(--focus-edge); outline-offset: 1px; }  /* the lit edge (owner rule 6) */

/* ---------- the vocabulary: one ink a tone, one shape a meaning (mission-graph.mjs glyphOf) ---------- */
#office .mg-n { --mg-ink: var(--o-text); }
#office .mg-n--ink { --mg-ink: var(--o-text); }
#office .mg-n--quiet { --mg-ink: var(--o-line-3); }
#office .mg-n--attn { --mg-ink: var(--o-warn-ink); --mg-wash: var(--o-warn-bg); }
#office .mg-n--wait { --mg-ink: var(--o-dim); }
#office .mg-n--bad { --mg-ink: var(--o-bad); }
#office .mg-n--faint { --mg-ink: var(--o-faint); }
#office .mg-ring { fill: var(--mg-wash, none); stroke: var(--mg-ink); }
#office .mg-fill { fill: var(--mg-ink); stroke: none; }
#office .mg-bar { stroke: var(--mg-ink); stroke-linecap: butt; }
#office .mg-knock { stroke: var(--o-plane, var(--o-panel)); stroke-linecap: butt; }
/* An edge is a dependency, and nothing else: darker once what it stands on has happened. */
#office .mg-e { stroke: var(--o-line-3); fill: none; }
#office .mg-e[data-met="true"] { stroke: var(--o-dim); }
#office .mg-j { fill: var(--o-line-3); }
#office .mg-j[data-met="true"] { fill: var(--o-dim); }

/* ---------- the list: the same steps, the same glyphs, and no line between rows that the plan does not draw ---------- */
#office .ms-steps.mg-list { display: grid; gap: 2px; }
#office .ms-steps.mg-list .ms-step {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  column-gap: 8px;
  padding: 2px 0;
}
#office .ms-steps.mg-list .ms-step::before,
#office .ms-steps.mg-list .ms-step::after { content: none; display: none; }
#office .mg-mark { grid-column: 1; grid-row: 1; align-self: start; margin-top: 1px; line-height: 0; }
#office .mg-mark__svg { display: block; overflow: visible; }
#office .ms-step__open {
  grid-column: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 0.75rem;
  align-items: baseline;
  min-height: 32px;
  margin: 0 -8px;
  padding: 4px 8px;
  border: 0;
  border-radius: var(--tk-r-md);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
#office .ms-step__open:hover,
#office .ms-step.is-lit > .ms-step__open { background: var(--o-hover); }
#office .ms-step.is-open > .ms-step__open { background: var(--o-hover); }
#office .ms-step__open:focus-visible { outline: 1px solid var(--focus-edge); outline-offset: -1px; }  /* the lit edge (owner rule 6) */
#office .ms-steps.mg-list :is(.ms-step__t, .ms-step__after, .ms-step__more) { grid-column: 2; }
#office .ms-steps.mg-list .ms-step__t { margin-top: -4px; }
#office .ms-step__after { color: var(--o-faint); font-size: var(--o-t-xs); line-height: 1.45; }
#office .ms-step__t + .ms-step__after { margin-top: 0; }
#office .ms-step__t:empty + .ms-step__after { margin-top: -4px; }

/* A STEP OPENED: where it stands, what it waits for and leads to, its evidence. */
#office .ms-step__more { margin: 4px 0 8px; padding: 8px 12px; border: 1px solid var(--o-line-2); border-radius: var(--tk-r-md); font-size: var(--o-t-sm); line-height: 1.5; }
#office .ms-step__more[hidden] { display: none; }
#office .ms-step__now { margin: 0; color: var(--o-text); }
#office .ms-step__facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 8px 0 0; }
#office .ms-step__facts > dt { margin: 0; color: var(--o-faint); }
#office .ms-step__facts > dd { margin: 0; color: var(--o-text); overflow-wrap: anywhere; }
#office .ms-step__rc { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
#office .ms-step__own { margin: 8px 0 0; color: var(--o-dim); }
#office .ms-step__go { min-height: 28px; }
@media (max-width: 480px) {
  #office .ms-step__facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  #office .ms-step__facts > dt:not(:first-child) { margin-top: 8px; }
}

/* ---------- motion: only a step whose record changed, once (missions-steps.mjs) ---------- */
@media (prefers-reduced-motion: no-preference) {
  #office .mg-n.is-changed { animation: mg-settle 240ms var(--tk-ease) both; }
  #office .mg-n.is-changed .mg-bar { animation: mg-lift 280ms var(--tk-ease) both; }
}
@keyframes mg-settle { from { opacity: 0.25; } to { opacity: 1; } }
@keyframes mg-lift { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* ---------- forced colours: the shapes carry it, in the system's own inks ---------- */
@media (forced-colors: active) {
  #office :is(.mg-ring, .mg-bar, .mg-e) { stroke: CanvasText; }
  #office :is(.mg-fill, .mg-j) { fill: CanvasText; }
  #office .mg-knock { stroke: Canvas; }
  #office .mg-n--quiet .mg-ring, #office .mg-e[data-met="false"] { stroke: GrayText; }
  #office .mg-j[data-met="false"] { fill: GrayText; }
  #office .mg-hit:is(.is-open, :hover, .is-lit) { border-color: Highlight; }
}
