/* Office-Ready Git · graph.css
   Commit graph ("a transit map for Git"), scene player, playground and challenge.
   Every colour comes from tokens.css; line colours travel through the --gv-c custom property. */
/* SPEC-GAP: remote-tracking pills sit on a --paper chip (dashed line-colour outline, line-colour text) so the text
   keeps >= 4.5:1 on both pane backgrounds; ghost dots/lines are 35% opacity, ghost labels 50% so they stay legible;
   the HEAD ring and HEAD pill get a thin --signal-ink edge so the mint marker also shows on the light ground. */

/* ---------- metro line colours (GraphView.colorFor -> class) ---------- */
.gv-c-main { --gv-c: var(--l-main); }
.gv-c-feature { --gv-c: var(--l-feature); }
.gv-c-team { --gv-c: var(--l-team); }
.gv-c-fix { --gv-c: var(--l-fix); }
.gv-c-release { --gv-c: var(--l-release); }
.gv-c-remote { --gv-c: var(--l-remote); }

/* ---------- the figure ---------- */
.gv {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--ink);
  overflow: hidden;
}
.gv-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent;
}
.gv-pane-local { --gv-bg: var(--panel); }
.gv-pane-origin { --gv-bg: var(--panel-2); }
div.gv-pane {
  width: max-content;
  min-width: 100%;
  background: var(--gv-bg);
}
div.gv-pane + div.gv-pane,
.gv-areas + div.gv-pane { border-top: 1px solid var(--rule-strong); }
.gv-band {
  position: sticky;
  left: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: max-content;
  padding: 8px 12px 0;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.gv-band-sub:empty { display: none; }
.gv-band-sub {
  padding: 1px 6px;
  border-radius: var(--r-sm);
  background: var(--warn-soft);
  color: var(--warn);
  letter-spacing: 0.02em;
  text-transform: none;
  font-weight: 700;
}
.gv-canvas { line-height: 0; }
.gv-svg {
  display: block;
  max-width: none;
  overflow: visible;
}
svg.gv-static { overflow: hidden; }

/* ---------- SVG marks ---------- */
.gv-svg text { font-size: 12px; }
.gv-edge {
  fill: none;
  stroke: var(--gv-c);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.gv-edge.is-dashed { stroke-dasharray: 8 6; stroke-linecap: butt; }
.gv-edge.is-stub { stroke-width: 3; stroke-dasharray: 1 6; stroke-linecap: round; }
.gv-ghosts { opacity: 0.35; }
.gv-ghosts .gv-edge { stroke-width: 3; stroke-dasharray: 6 5; stroke-linecap: butt; }

.gv-dot { fill: var(--gv-c); stroke: var(--gv-bg); stroke-width: 2.5; }
.gv-ring { fill: var(--gv-bg); stroke: var(--gv-c); stroke-width: 3.5; }
.gv-node.is-ghost .gv-dot,
.gv-node.is-ghost .gv-ring {
  fill: var(--gv-bg);
  stroke: var(--gv-c);
  stroke-width: 2.5;
  stroke-dasharray: 3 2.5;
}
/* "You are here": a mint ring with a thin --signal-ink edge so it also stands out on the light ground */
.gv-here-edge { fill: none; stroke: var(--signal-ink); stroke-width: 6; }
.gv-here { fill: none; stroke: var(--signal); stroke-width: 3.5; }
.gv-focus { fill: none; stroke: var(--accent-text); stroke-width: 2; stroke-dasharray: 4 3; }

.gv-lbl {
  paint-order: stroke;
  stroke: var(--gv-bg);
  stroke-width: 4px;
  stroke-linejoin: round;
}
.gv-id { font-family: var(--font-mono); font-size: 12px; fill: var(--muted); }
.gv-msg { font-family: var(--font-body); font-size: 12.5px; fill: var(--ink); }
.gv-lbl.is-ghost { opacity: 0.5; }
.gv-stub { font-family: var(--font-body); font-size: 12px; font-style: italic; fill: var(--muted); }
.gv-empty { font-family: var(--font-body); font-size: 13px; fill: var(--muted); }
.gv-stem { stroke: var(--gv-c); stroke-width: 2; }

.gv-pill text {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
}
/* Filled pills: the pure line colour with --on-line text (dark text in the dark theme, white in light). */
.gv-pill-branch .gv-pill-bg { fill: var(--gv-c); stroke: var(--gv-bg); stroke-width: 2; }
.gv-pill-tag .gv-pill-bg { fill: var(--l-release); stroke: var(--gv-bg); stroke-width: 2; }
.gv-pill-branch .gv-pill-t,
.gv-pill-tag .gv-pill-t { fill: var(--on-line); }
/* Remote-tracking pills: a dashed outline in the line colour on a --paper chip, so the line-coloured
   text keeps its contrast on either pane background. */
.gv-pill-remote .gv-pill-bg {
  fill: var(--paper);
  stroke: var(--gv-c);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}
.gv-pill-remote .gv-pill-t { fill: var(--gv-c); }
.gv-pill-here,
.gv-pill-detached .gv-pill-bg { fill: var(--signal); stroke: var(--signal-ink); stroke-width: 1.25; }
.gv-pill-here-t,
.gv-pill-detached .gv-pill-t { fill: var(--signal-ink); }
.gv-pill-stash .gv-pill-bg {
  fill: var(--paper);
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-dasharray: 2 3;
}
.gv-pill-stash .gv-pill-t { fill: var(--ink-2); font-family: var(--font-mono); font-weight: 600; }

/* static svg() output: bands are drawn inside the SVG */
.gv-band-bg { fill: var(--gv-bg); }
.gv-band-rule { stroke: var(--rule-strong); stroke-width: 1; }
.gv-band-text {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  fill: var(--ink-2);
}

/* ---------- areas panel: Working folder | Staging area | Last commit (HEAD) ---------- */
.gv-areas {
  position: sticky;
  left: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--panel);
  border-top: 1px solid var(--rule);
}
.gv-mode-v .gv-areas { grid-template-columns: minmax(0, 1fr); padding: var(--sp-2); }
.gv-area {
  min-width: 0;
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--paper);
}
.gv-areas .gv-area-h {
  margin: 0;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink);
}
.gv-areas .gv-area-sub {
  margin: 0 0 var(--sp-2);
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.gv-area-id { font-family: var(--font-mono); }
.gv-areas .gv-area-empty { margin: 0; font-size: 13px; color: var(--muted); }
.gv-areas .gv-areas-none { margin: 0; font-size: 14px; color: var(--muted); }
.gv-areas .gv-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.gv-file {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
  min-width: 0;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.4;
}
.gv-fname { min-width: 0; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); overflow-wrap: anywhere; }
.gv-ver {
  padding: 0 4px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
}
.gv-badge { margin-left: auto; font-size: 12px; font-weight: 700; }
.gv-file.is-changed,
.gv-file.is-deleted { background: var(--warn-soft); }
.gv-file.is-changed .gv-badge,
.gv-file.is-deleted .gv-badge { color: var(--warn); }
.gv-file.is-new { background: var(--info-soft); }
.gv-file.is-new .gv-badge { color: var(--info); }
.gv-file.is-staged,
.gv-file.is-removed { background: var(--ok-soft); }
.gv-file.is-staged .gv-badge,
.gv-file.is-removed .gv-badge { color: var(--ok); }
.gv-file.is-deleted .gv-fname,
.gv-file.is-removed .gv-fname { text-decoration: line-through; }
.gv-file.is-conflict { background: var(--bad-soft); box-shadow: inset 0 0 0 1px var(--bad); }
.gv-file.is-conflict .gv-badge { color: var(--bad); text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- shared: buttons, fields, terminal ---------- */
.sc-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
}
.sc-btn:hover:not([aria-disabled="true"]) { border-color: var(--accent-text); color: var(--accent-text); }
.sc-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.sc-btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.sc-btn-primary:hover:not([aria-disabled="true"]) { color: var(--accent-ink); box-shadow: var(--shadow-1); }
.sc-btn.is-playing { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.sc-btn.is-playing:hover { color: var(--signal-ink); border-color: var(--ink); }
.sc-btn-quiet { min-height: 36px; padding: 5px 10px; font-size: 13px; }
.sc-select:disabled { opacity: 0.55; }

.sc-field { display: inline-flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; min-width: 0; }
.sc-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.sc-select {
  min-height: 38px;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
}

.sc-term {
  min-width: 0;
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--term-bg);
  color: var(--term-fg);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.sc-term .t-line { margin: 0; white-space: pre-wrap; }
.sc-term .t-prompt { color: var(--term-prompt); }
.sc-term .t-cmd { color: var(--term-cmd); }
.sc-term .t-out { color: var(--term-fg); }
.sc-term .t-err { color: var(--term-err); }
.sc-term .t-hint { color: var(--term-hint); }
.sc-term .t-dim { color: var(--term-dim); }
.sc-term .t-ok { color: var(--term-ok); }
.sc-term .t-cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--term-fg);
  animation: t-blink 1.1s steps(2, start) infinite;
}
@keyframes t-blink { to { visibility: hidden; } }
.sc-term code {
  padding: 0;
  border: 0;
  background: none;
  color: var(--term-cmd);
  font-family: var(--font-mono);
  font-size: 0.95em;
}
.sc-term .t-cmdline { margin: 0; white-space: pre-wrap; }
.sc-term .t-action {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  max-width: 100%;
  padding: 3px 10px;
  border: 1px solid var(--term-hint);
  border-radius: var(--r-sm);
  color: var(--term-fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.4;
}
.sc-term .t-action-tag {
  color: var(--term-hint);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sc-term .t-outblock { margin-top: 6px; }
.sc-term .t-coach {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px dashed var(--term-dim);
  color: var(--term-fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
}
.sc-term .t-coach + .t-coach { border-top: 0; margin-top: 2px; padding-top: 0; }
.sc-term .t-coach-label {
  flex: none;
  margin-top: 1px;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  background: var(--signal);
  color: var(--signal-ink);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sc-term .t-coach + .t-coach .t-coach-label { visibility: hidden; }

/* ---------- scene player ---------- */
.sc {
  display: grid;
  gap: var(--sp-3);
  min-width: 0;
  max-width: 100%;
  padding: var(--sp-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--panel);
}
.sc-head { display: grid; gap: var(--sp-2); min-width: 0; }
.sc-headrow {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-1) var(--sp-4);
}
.sc .sc-kicker {
  margin: 0;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.sc .sc-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
}
.sc .sc-count {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}
.sc .sc-route { display: flex; align-items: center; margin: 0; padding: 0 2px; list-style: none; }
.sc .sc-route li { display: flex; flex: 1 1 0; align-items: center; min-width: 0; }
.sc .sc-route li::before { content: ""; flex: 1 1 auto; height: 3px; background: var(--rule-strong); }
.sc .sc-route li:first-child { flex: 0 0 auto; }
.sc .sc-route li:first-child::before { display: none; }
.sc-stop {
  flex: none;
  width: 12px;
  height: 12px;
  border: 2.5px solid var(--rule-strong);
  border-radius: 50%;
  background: var(--panel);
}
.sc .sc-route li.is-done::before { background: var(--accent); }
.sc .sc-route li.is-done .sc-stop { border-color: var(--accent); background: var(--accent); }
.sc .sc-route li.is-now::before { background: var(--accent); }
.sc .sc-route li.is-now .sc-stop { width: 16px; height: 16px; border-color: var(--ink); background: var(--signal); }
.sc-graph { min-width: 0; }
.sc-say {
  min-height: 3.2em;
  max-width: var(--measure);
  color: var(--ink);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
}
.sc-say p { margin: 0 0 0.5em; }
.sc-say p:last-child { margin-bottom: 0; }
.sc-say ul, .sc-say ol { margin: 0 0 0.5em; padding-left: 1.3em; }
.sc-controls { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.sc-error {
  margin: 0;
  padding: var(--sp-3);
  border: 1px solid var(--bad);
  border-radius: var(--r-sm);
  background: var(--bad-soft);
  color: var(--ink);
}

/* ---------- playground + challenge ---------- */
.pg, .ch {
  display: grid;
  gap: var(--sp-3);
  min-width: 0;
  max-width: 100%;
  padding: var(--sp-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--panel);
}
.pg-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.pg-team {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r-sm);
}
.pg-team-note { margin: 0; font-size: 13px; color: var(--muted); }
.pg-log {
  max-height: 340px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--term-dim) transparent;
}
.pg-entry + .pg-entry { margin-top: 12px; }
.pg-form {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--term-dim);
}
.pg-prompt { flex: none; color: var(--term-prompt); white-space: nowrap; }
.pg-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid var(--term-dim);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--term-cmd);
  font-family: var(--font-mono);
  font-size: 14px;
  caret-color: var(--term-cmd);
}
.pg-input::placeholder { color: var(--term-dim); }
.pg-input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.pg-run {
  flex: none;
  min-height: 38px;
  padding: 6px 12px;
  border: 1px solid var(--term-prompt);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--term-prompt);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.pg-run:hover { background: var(--term-prompt); color: var(--term-bg); }
.pg-chips { display: none; flex-wrap: wrap; gap: 6px; }
.pg-chip {
  min-height: 36px;
  padding: 5px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  background: var(--panel-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
}
.pg-chip:hover { border-color: var(--accent-text); }
.pg-help {
  max-height: 420px;
  overflow: auto;
  padding: var(--sp-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--paper);
}
.pg .pg-help-h {
  margin: 0 0 var(--sp-2);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}
.pg .pg-help-h + .pg-help-list { margin-bottom: var(--sp-4); }
.pg .pg-help-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pg-help-item { display: grid; gap: 2px; min-width: 0; }
.pg-help-cmd {
  justify-self: start;
  max-width: 100%;
  padding: 2px 6px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.pg-help-cmd:hover { border-color: var(--accent-text); }
.pg .pg-help-sum { margin: 0; font-size: 14px; color: var(--ink-2); }
.ch-goal {
  display: grid;
  gap: 2px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--ink);
}
.ch .ch-label {
  margin: 0;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.ch-goal-md p { margin: 0 0 0.4em; }
.ch-goal-md p:last-child { margin-bottom: 0; }
.ch-status { font-size: 14px; color: var(--muted); }
.ch-status:empty { display: none; }
.ch-success {
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--ok);
  border-radius: var(--r-sm);
  background: var(--ok-soft);
  color: var(--ink);
  font-size: var(--fs-md);
}
.ch-success b { color: var(--ok); }
.ch .ch-missing { margin: 4px 0 0; padding-left: 1.2em; }
.ch-controls { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.ch-reveal {
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--paper);
  font-size: var(--fs-md);
}
.ch-reveal p { margin: 0 0 0.4em; }
.ch-reveal p:last-child { margin-bottom: 0; }
.ch .ch-solution-list { margin: 0; padding-left: 1.4em; font-family: var(--font-mono); font-size: 14px; }
.ch .ch-solution-list code { background: none; border: 0; padding: 0; }

@media (max-width: 760px) {
  .pg-chips { display: flex; }
}
@media (max-width: 520px) {
  .sc, .pg, .ch { padding: var(--sp-2); gap: var(--sp-2); }
  .sc-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sc-controls .sc-btn { padding: 8px 4px; }
  .sc-term { padding: var(--sp-2) 10px; font-size: 12.5px; }
  .pg-prompt { display: none; }
  .gv-band { padding: 6px 10px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .t-cursor { animation: none; }
}
