/* =============================================================================
   SATQUERY — ANALYZE (mission)
   A scientific workstation, not an AI dashboard:
   light / warm / ochre, hairline structure, no rounded cards. Three readable
   columns (question · observation | imagery | answer · evidence · report)
   under a single execution trace. Every state here is real or honestly empty.
   ============================================================================= */

.analyze {
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 clamp(16px, 2.4vw, 40px) var(--band);
}

/* ── query bar ─────────────────────────────────────────────────────────── */
.qbar {
  display: flex;
  align-items: flex-end;
  gap: clamp(16px, 2vw, 34px);
  padding: 26px 0 20px;
  border-bottom: 1px solid var(--rule-2);
  flex-wrap: wrap;
}
.qbar__eyebrow { margin-bottom: 0; flex: none; padding-bottom: 9px; }
.qbar__q { flex: 1 1 360px; display: flex; align-items: flex-end; gap: 16px; }
.qbar__q .inp { flex: 1; }
.qbar__q .btn { flex: none; margin-bottom: 2px; }
.qbar__meta { flex: none; display: flex; flex-direction: column; gap: 4px; padding-bottom: 9px; }
.qbar__id { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.14em; color: var(--ink-500); }
.qbar__id b { color: var(--ink-900); font-weight: 500; }

/* ── three-column grid ─────────────────────────────────────────────────── */
.agrid {
  display: grid;
  grid-template-columns: minmax(248px, 0.82fr) minmax(0, 1.7fr) minmax(280px, 1fr);
  align-items: stretch;
}
.col { display: flex; flex-direction: column; min-width: 0; }
.col--l { border-right: 1px solid var(--rule); }
.col--r { border-left: 1px solid var(--rule); }
.col--c { padding: 0 clamp(14px, 1.4vw, 26px); }

/* blocks inherit the hairline rhythm from system .block; add side padding */
.col--l .block, .col--r .block { padding-left: clamp(12px, 1.2vw, 20px); padding-right: clamp(12px, 1.2vw, 20px); }
.block--last { border-bottom: 0; }
.block__bd--flush { padding-bottom: 4px; }

/* ── upload dropzone ───────────────────────────────────────────────────── */
.dropzone {
  display: block;
  border: 1px dashed var(--rule-3);
  padding: 16px 16px 14px;
  cursor: pointer;
  transition: border-color 0.25s var(--e-out), background 0.25s var(--e-out);
  margin-bottom: 12px;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--ochre-rule); background: var(--ochre-wash); }
.dropzone--sm { padding: 12px 14px; margin-bottom: 10px; }
.dropzone__a { display: block; margin-bottom: 6px; }
.dropzone__b { font-family: var(--f-ui); font-size: 12.5px; line-height: 1.5; color: var(--ink-500); }
.dropzone__note { margin-top: 0; }

/* ── router interpretation (Intent slots) ─────────────────────────────── */
.intent { display: flex; flex-wrap: wrap; gap: 7px; }
.intent__empty { padding: 4px 0 8px; }
.intent .chip { font-size: 8.5px; }
.intent .chip b { font-weight: 500; }
.intent .chip .k { color: var(--ink-400); margin-right: 5px; }

/* ── viewer / centre protagonist ──────────────────────────────────────── */
.viewer { flex: 1; display: flex; flex-direction: column; min-height: 0; padding-top: 16px; }
.viewer__bar { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
/* D-fix(B): the two mission viewers become a flex column so .platecap (a normal
   flex item) sits in flow *below* the image. The base rule makes .plate__img /
   .cmp__img absolute and inset:0 — that paints the caption under the image at
   the top of the stageplot (elementFromPoint at the caption's own centre
   returned #plateImg). Switching the image to position:relative + flex:1 inside
   this scoped flex-column lets the caption occupy its own row beneath it,
   with zero box overlap and zero z-index overlay. Atlas/run canvases are
   untouched (they use .stageplot directly, not .viewer__plate/.viewer__cmp). */
/* D-fix(D): at vw=390, the four .vbtn + #viewerState nowrap sum to ~405px and
   push the page past the fold (mission.html docW 458 -> 443 once .disclose is
   wrapped). Letting the bar wrap puts viewerState on its own line; the
   margin-left:auto still pushes it right within that line. */
.viewer__bar { flex-wrap: wrap; }
.viewer__plate, .viewer__cmp { display: flex; flex-direction: column; }
.viewer__plate .plate__img, .viewer__cmp .cmp__img {
  position: relative; inset: auto;
  flex: 1 1 0; min-height: 0;
}
.vbtns { display: flex; gap: 1px; }
.vbtn {
  font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--ink-500); background: none; border: 1px solid var(--rule);
  padding: 7px 12px; cursor: pointer;
  transition: color 0.25s var(--e-out), border-color 0.25s var(--e-out), background 0.25s var(--e-out);
}
.vbtn:hover { color: var(--ink-900); border-color: var(--rule-3); }
.vbtn.is-on { color: var(--ink-900); border-color: var(--ochre-rule); background: var(--ochre-wash); }
.viewer__st { margin-left: auto; }

.viewer__plate, .viewer__cmp { flex: 1; min-height: 56vh; margin-bottom: 0; }
.plate__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ev-layer { z-index: 5; }

/* honest evidence / mask overlay note */
.ev-note {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 22px 18px;
  background: linear-gradient(0deg, rgba(251,249,245,0.97) 40%, rgba(251,249,245,0.74));
  border-top: 1px solid var(--ochre-rule);
  pointer-events: none;
}
.ev-note__t { font-family: var(--f-ui); font-size: 13px; line-height: 1.5; color: var(--ink-600); max-width: 60ch; }

.viewer__disclose { margin-top: 12px; }

/* comparison slider */
.viewer__cmp { overflow: hidden; }
.cmp__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cmp__img--top { clip-path: inset(0 0 0 50%); }
.cmp__range {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  z-index: 7; width: 100%;
  -webkit-appearance: none; appearance: none;
  height: 1px; background: var(--ochre-rule); outline: none; cursor: ew-resize;
}
.cmp__range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 2px; height: 34px; background: var(--ochre); border: 0; border-radius: 0; cursor: ew-resize;
}
.cmp__range::-moz-range-thumb { width: 2px; height: 34px; background: var(--ochre); border: 0; border-radius: 0; cursor: ew-resize; }
.cmp__tags { position: absolute; left: 14px; right: 14px; top: 14px; z-index: 7; display: flex; justify-content: space-between; pointer-events: none; }

/* ── right column widgets ─────────────────────────────────────────────── */
.answer { font-family: var(--f-display); font-variation-settings: 'opsz' 60, 'SOFT' 20; font-size: 19px; line-height: 1.42; color: var(--ink-900); margin: 0 0 4px; }
.answer__empty { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-400); }

.evlist { list-style: none; margin: 0; padding: 0; }
.evlist .specs__idle { padding: 8px 0 12px; }
.evlist li {
  padding: 9px 2px; border-bottom: 1px solid var(--rule);
  display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: baseline;
}
.evlist li .id { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--ochre); }
.evlist li .lb { font-family: var(--f-mono); font-size: 10px; color: var(--ink-700); }
.evlist li .ar { font-family: var(--f-mono); font-size: 10px; color: var(--ink-500); text-align: right; }
.evlist li .sc { grid-column: 1 / -1; font-family: var(--f-mono); font-size: 9px; color: var(--ink-400); }
.evlist li:hover { background: var(--ochre-wash); }
.specs__idle { color: var(--ink-400); font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; }

.conf { display: flex; gap: 26px; margin-bottom: 4px; }
.conf__n { display: flex; flex-direction: column; gap: 3px; }
.conf__n b { font-family: var(--f-mono); font-size: 26px; font-weight: 400; color: var(--ochre); font-variant-numeric: tabular-nums; line-height: 1; }

.btn--block { width: 100%; justify-content: center; }

/* ── trace ────────────────────────────────────────────────────────────── */
.ctrace {
  margin-top: 30px;
  padding: 18px clamp(12px, 1.4vw, 22px) 20px;
  border-top: 1px solid var(--rule-2);
  border-bottom: 1px solid var(--rule);
  background: var(--surface-1);
}
.ctrace__hd { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 18px; }
.ctrace .trace { padding: 0 6px; }

/* D-fix(D): .trace holds 8 nodes with .nm { white-space: nowrap }, so its
   min-content is ~469px (RESULT_ASSEMBLED etc.) and forced mission.html's
   docW from 503 -> 458. Wrap it in a horizontal scroller — the same pattern
   the audit already accepts for journey's rail — so .trace keeps its full
   intrinsic width (the absolute .trace__line / .trace__fill span that width,
   not just the scrollport). */
.trace__scroll { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.trace { min-width: max-content; }

/* mock-driven nodes: ochre ring, never a green "success" fill */
.trace__node.is-mock .pt { border-color: var(--ochre); background: transparent; }
.trace__node.is-mock .nm { color: var(--ochre); }
.trace__node.is-mock .tm { opacity: 1; }

/* ── event drawer ─────────────────────────────────────────────────────── */
.drawer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: 44%;
  background: var(--surface-2);
  border-top: 1px solid var(--rule-2);
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.5s var(--e-out);
}
.drawer.on { transform: none; }
.drawer__hd { display: flex; align-items: center; gap: 14px; padding: 11px 16px; border-bottom: 1px solid var(--rule); }
.drawer__hd .btn { margin-left: auto; }
.drawer__hint { font-family: var(--f-display); font-style: italic; font-variation-settings: 'opsz' 30, 'SOFT' 30, 'WONK' 1; font-size: 12px; color: var(--ink-500); }
.drawer__bd { flex: 1; overflow: auto; padding: 12px 16px 20px; }
.drawer__bd pre { margin: 0; font-family: var(--f-mono); font-size: 10.5px; line-height: 1.75; color: var(--ink-700); white-space: pre-wrap; word-break: break-word; }
.drawer__bd pre .k { color: var(--ochre); }
.drawer__bd pre .n { color: var(--ink-400); }
.drawer__toggle { position: fixed; right: 18px; bottom: 16px; z-index: 39; }

/* ── responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1140px) {
  .agrid { grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.6fr) minmax(250px, 1.1fr); }
}
@media (max-width: 980px) {
  .agrid { grid-template-columns: 1fr; }
  .col--l, .col--r { border: 0; }
  .col--l { border-bottom: 1px solid var(--rule); }
  .col--r { border-top: 1px solid var(--rule); }
  .col--c { min-height: 60vh; }
  .viewer__plate, .viewer__cmp { min-height: 52vh; }
  .drawer { height: 60%; }
}
@media (max-width: 720px) {
  .qbar { gap: 12px; }
  .qbar__q { flex-basis: 100%; }
  .col--l .block, .col--r .block { padding-left: 0; padding-right: 0; }
}
