/* =====================================================================
   Frame Minion — Video Prompt Vernacular (field guide)
   A full editor-tab webview. Sibling of the MVO Orchestrator panel:
   inherits its warm-dark surfaces, mono labels, pill vocabulary, and the
   flame brand accent (used SPARINGLY — mark, active pill, selected border,
   one hairline). Self-contained tokens so it renders standalone or inside
   the design-canvas review surface.
   ===================================================================== */

.fg {
  /* ---- Surfaces (warm near-black editor canvas → raised charcoal cards) ---- */
  --bg:          var(--vscode-editor-background, #1a140e);
  --panel:       var(--vscode-sideBar-background, #211810);
  --card:        var(--vscode-editorWidget-background, #261c12);
  --card-raise:  #2c2116;
  --field:       var(--vscode-input-background, #1f1610);
  --field-hover: var(--vscode-list-hoverBackground, rgba(255,255,255,0.045));

  /* ---- Borders ---- */
  --border:        var(--vscode-widget-border, #3a2c1d);
  --border-soft:   var(--vscode-editorWidget-border, #33271a);
  --border-strong: var(--vscode-input-border, #4a3825);

  /* ---- Text ---- */
  --text:       var(--vscode-foreground, #e8ddc9);
  --text-muted: var(--vscode-descriptionForeground, #a39581);
  --text-dim:   var(--vscode-disabledForeground, #6e6253);

  /* ---- Status (text+shape readable, not color-only) ---- */
  --ok:   var(--vscode-charts-green,  #5cae82);
  --warn: var(--vscode-charts-yellow, #d3a64a);
  --info: var(--vscode-charts-blue,   #6ea3d6);

  /* ---- Flame brand accent — the one sanctioned warm spark ---- */
  --flame-a: #e8893f;
  --flame-b: #d24a26;

  --mono: var(--vscode-editor-font-family, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
  --sans: var(--vscode-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif);

  box-sizing: border-box;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.fg *, .fg *::before, .fg *::after { box-sizing: border-box; }

/* The black editor canvas. Content column centered with breathing room. */
.fg-canvas {
  min-height: 100%;
  padding: 0 28px 120px;
  background: var(--bg);
}
/* Inside a design-canvas artboard the panel doesn't scroll, so it needs no
   footer breathing room; the tray flows at the natural bottom of content. */
.fg.in-board .fg-canvas { padding: 0 26px 22px; }
.fg.in-board .fg-tray.show { position: static; bottom: auto; }
.fg-panel {
  max-width: 820px;
  margin: 0 auto;
  position: relative;
}

/* =====================================================================
   Marquee header (mirrors the Orchestrator's "Branded marquee")
   ===================================================================== */
.fg-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in oklab, var(--text) 3%, var(--bg));
  padding: 22px 0 16px;
  margin-bottom: 18px;
}
.fg-header::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg,
    var(--flame-b) 0%, var(--flame-a) 16%,
    color-mix(in oklab, var(--flame-a) 28%, transparent) 44%, transparent 72%);
  opacity: 0.92;
}
.fg-lockup { display: flex; align-items: center; gap: 15px; }
.fg-mark {
  flex-shrink: 0;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(150deg, var(--flame-a), var(--flame-b));
  box-shadow: 0 2px 10px color-mix(in oklab, var(--flame-b) 38%, transparent),
              inset 0 1px 0 rgba(255,255,255,0.28);
}
.fg-titles { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.fg-eyebrow {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text-dim);
}
.fg-titles h1 {
  margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -0.015em;
  color: var(--text); line-height: 1.15;
}
.fg-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }

/* =====================================================================
   Category pills
   ===================================================================== */
.fg-pills {
  display: flex; flex-wrap: wrap; gap: 7px;
  margin-bottom: 18px;
}
.fg-pill {
  font: inherit;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  background: var(--field);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 100ms, color 100ms, border-color 100ms;
}
.fg-pill:hover { background: var(--field-hover); color: var(--text); }
.fg-pill .n {
  font-family: var(--mono); font-size: 10px; color: var(--text-dim);
}
.fg-pill.active {
  color: #fff;
  background: linear-gradient(150deg,
    color-mix(in oklab, var(--flame-a) 88%, #000),
    color-mix(in oklab, var(--flame-b) 92%, #000));
  border-color: color-mix(in oklab, var(--flame-b) 70%, transparent);
  box-shadow: 0 1px 8px color-mix(in oklab, var(--flame-b) 30%, transparent);
}
.fg-pill.active .n { color: rgba(255,255,255,0.7); }
.fg-pill:focus-visible { outline: 2px solid var(--flame-a); outline-offset: 1px; }

/* =====================================================================
   Transition-trap callout (In-shot effects)
   ===================================================================== */
.fg-callout {
  display: flex; gap: 14px;
  padding: 15px 17px;
  margin-bottom: 18px;
  background: color-mix(in oklab, var(--info) 7%, var(--card));
  border: 1px solid color-mix(in oklab, var(--info) 30%, var(--border-soft));
  border-radius: 8px;
}
.fg-callout .ci {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 999px;
  color: var(--info);
  background: color-mix(in oklab, var(--info) 16%, transparent);
}
.fg-callout .cbody { min-width: 0; }
.fg-callout h3 {
  margin: 0 0 4px;
  font-size: 13.5px; font-weight: 600; color: var(--text);
}
.fg-callout p { margin: 0; font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.fg-callout p b { color: var(--text); font-weight: 600; }
.fg-callout code {
  font-family: var(--mono); font-size: 11px;
  background: var(--field); border: 1px solid var(--border-soft);
  padding: 0 5px; border-radius: 4px; color: var(--text);
}
/* Tiny in-shot vs between-clip contrast diagram */
.fg-callout-diagram {
  display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap;
}
.fg-cd {
  flex: 1 1 180px;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
}
.fg-cd svg { flex-shrink: 0; }
.fg-cd .cd-txt { min-width: 0; }
.fg-cd .cd-tag {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.06em;
  text-transform: uppercase; display: flex; align-items: center; gap: 5px;
}
.fg-cd.yes .cd-tag { color: var(--ok); }
.fg-cd.no  .cd-tag { color: var(--warn); }
.fg-cd .cd-note { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* =====================================================================
   Term grid + blocks
   ===================================================================== */
.fg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 13px;
  align-items: start;
}

.fg-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 13px 14px 12px;
  cursor: pointer;
  transition: border-color 120ms, background 120ms, box-shadow 120ms, transform 120ms;
}
.fg-card:hover { background: var(--card-raise); border-color: var(--border-strong); }
.fg-card:focus-visible { outline: 2px solid var(--flame-a); outline-offset: 2px; }
.fg-card.selected {
  border-color: color-mix(in oklab, var(--flame-a) 65%, transparent);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--flame-a) 55%, transparent),
              0 6px 18px rgba(0,0,0,0.32);
  background: color-mix(in oklab, var(--flame-a) 5%, var(--card-raise));
}

/* Diagram area */
.fg-diagram {
  height: 62px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  background:
    repeating-linear-gradient(45deg,
      color-mix(in oklab, var(--bg) 55%, transparent) 0 7px,
      color-mix(in oklab, var(--bg) 80%, transparent) 7px 14px);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  margin-bottom: 11px;
}
.fg-card.selected .fg-diagram { color: color-mix(in oklab, var(--flame-a) 35%, var(--text)); }
.fg-diagram svg { display: block; }
.fg-diagram .vec { color: var(--text); }   /* the active motion vector */

/* Title row + reliability badge */
.fg-card-top {
  display: flex; align-items: flex-start; gap: 8px; justify-content: space-between;
}
.fg-card-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  letter-spacing: -0.005em; line-height: 1.3;
}
.fg-card-desc {
  font-size: 11.5px; color: var(--text-muted); line-height: 1.45;
  margin-top: 4px; text-wrap: pretty;
}
.fg-card-note {
  display: flex; gap: 6px; align-items: baseline;
  font-size: 11px; color: var(--warn);
  margin-top: 7px; line-height: 1.4;
}
.fg-card-note .nlabel {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em;
  text-transform: uppercase; flex-shrink: 0; opacity: 0.85;
}

/* Reliability badge — text + shape, color is reinforcement only */
.fg-badge {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.02em;
  padding: 2px 7px 2px 5px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.fg-badge svg { flex-shrink: 0; }
.fg-badge.good {
  color: var(--ok);
  background: color-mix(in oklab, var(--ok) 12%, transparent);
  border-color: color-mix(in oklab, var(--ok) 34%, transparent);
}
.fg-badge.mixed {
  color: var(--warn);
  background: color-mix(in oklab, var(--warn) 13%, transparent);
  border-color: color-mix(in oklab, var(--warn) 36%, transparent);
}

/* Select affordance (top-left check) */
.fg-check {
  position: absolute; top: -7px; left: -7px;
  width: 19px; height: 19px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--card-raise);
  border: 1px solid var(--border-strong);
  color: transparent;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 110ms, transform 110ms, background 110ms, border-color 110ms;
  pointer-events: none;
}
.fg-card:hover .fg-check { opacity: 1; transform: scale(1); }
.fg-card.selected .fg-check {
  opacity: 1; transform: scale(1);
  color: #fff;
  background: linear-gradient(150deg, var(--flame-a), var(--flame-b));
  border-color: color-mix(in oklab, var(--flame-b) 70%, transparent);
}

/* Actions — revealed on hover/focus-within */
.fg-actions {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 150ms ease, opacity 130ms, margin-top 150ms;
  opacity: 0;
  margin-top: 0;
}
.fg-card:hover .fg-actions,
.fg-card:focus-within .fg-actions,
.fg-card.selected .fg-actions {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 11px;
}
.fg-actions-inner {
  overflow: hidden;
  display: flex; gap: 7px;
  border-top: 1px solid var(--border-soft);
  padding-top: 11px;
}
.fg-act {
  font: inherit;
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11.5px; font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 100ms, color 100ms, border-color 100ms;
}
.fg-act svg { flex-shrink: 0; }
/* Insert — lightweight, neutral */
.fg-act.insert {
  background: var(--field);
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.fg-act.insert:hover { background: var(--field-hover); border-color: var(--text-dim); }
/* Send to wizard — carries the sparkle + a flame hint (spends credits) */
.fg-act.wizard {
  background: color-mix(in oklab, var(--flame-b) 12%, transparent);
  border: 1px solid color-mix(in oklab, var(--flame-a) 45%, transparent);
  color: color-mix(in oklab, var(--flame-a) 75%, var(--text));
}
.fg-act.wizard:hover {
  background: color-mix(in oklab, var(--flame-b) 22%, transparent);
  border-color: color-mix(in oklab, var(--flame-a) 70%, transparent);
  color: color-mix(in oklab, var(--flame-a) 90%, #fff);
}
.fg-act .spark { color: var(--flame-a); }

/* Toast on insert */
.fg-toast {
  position: fixed;
  left: 50%; bottom: 92px; transform: translateX(-50%);
  z-index: 60;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--card-raise);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  font-size: 12px; color: var(--text);
  animation: fg-toast 2.2s ease forwards;
  pointer-events: none;
}
.fg-toast .tk { color: var(--ok); display: inline-flex; }
.fg-toast.wiz .tk { color: var(--flame-a); }
@keyframes fg-toast {
  0% { opacity: 0; transform: translate(-50%, 8px); }
  12% { opacity: 1; transform: translate(-50%, 0); }
  85% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -6px); }
}

/* =====================================================================
   Selection tray (sticky bottom)
   ===================================================================== */
.fg-tray {
  position: sticky;
  bottom: 14px;
  z-index: 30;
  margin-top: 22px;
  display: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease;
  align-items: center; gap: 12px;
  padding: 10px 12px;
  background: color-mix(in oklab, var(--text) 9%, var(--card-raise));
  border: 1px solid color-mix(in oklab, var(--text) 16%, var(--border-strong));
  border-radius: 11px;
  box-shadow: 0 16px 44px rgba(0,0,0,0.62),
              0 2px 8px rgba(0,0,0,0.4),
              inset 0 1px 0 rgba(255,255,255,0.06);
}
.fg-tray.show { display: flex; opacity: 1; transform: none; }
.fg-tray-count {
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 1px;
  padding-right: 4px;
}
.fg-tray-count .num {
  font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--text);
  line-height: 1;
}
.fg-tray-count .lbl {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-dim);
}
.fg-tray-chips {
  flex: 1; min-width: 0;
  display: flex; gap: 6px; flex-wrap: wrap;
  align-content: center;
  max-height: 56px; overflow-y: auto;
}
.fg-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 4px 3px 9px;
  background: var(--field);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: 11px; color: var(--text);
  white-space: nowrap;
}
.fg-chip .cdot {
  width: 5px; height: 5px; border-radius: 999px; flex-shrink: 0;
}
.fg-chip .cdot.good { background: var(--ok); }
.fg-chip .cdot.mixed { background: var(--warn); }
.fg-chip .x {
  font: inherit; cursor: pointer;
  width: 16px; height: 16px;
  display: grid; place-items: center;
  border: none; background: transparent;
  color: var(--text-dim); border-radius: 999px;
}
.fg-chip .x:hover { color: var(--text); background: var(--field-hover); }
.fg-tray-actions { flex-shrink: 0; display: flex; align-items: center; gap: 7px; }
.fg-tray-actions .tbtn {
  font: inherit;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 100ms, border-color 100ms, color 100ms;
}
.fg-tray-actions .tbtn.ghost {
  background: transparent; border: 1px solid transparent; color: var(--text-muted);
}
.fg-tray-actions .tbtn.ghost:hover { color: var(--text); background: var(--field-hover); }
.fg-tray-actions .tbtn.insert {
  background: var(--field); border: 1px solid var(--border-strong); color: var(--text);
}
.fg-tray-actions .tbtn.insert:hover { background: var(--field-hover); border-color: var(--text-dim); }
.fg-tray-actions .tbtn.wizard {
  color: #fff; border: 1px solid transparent;
  background: linear-gradient(150deg, var(--flame-a), var(--flame-b));
  box-shadow: 0 2px 10px color-mix(in oklab, var(--flame-b) 35%, transparent);
}
.fg-tray-actions .tbtn.wizard:hover { filter: brightness(1.07); }
.fg-tray-actions .tbtn .spark { color: rgba(255,255,255,0.92); }

.fg-tray-chips::-webkit-scrollbar { width: 6px; }
.fg-tray-chips::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* =====================================================================
   Narrow / split reflow — the grid reflows by its own width via auto-fill,
   so no container query is needed (and none is used: container-type would
   break the sticky tray's positioning).
   ===================================================================== */
