/* Chat-first demo page layout. Loaded after workstation.css and reuses its
   tokens (:root custom properties), result-card, solver, trace, and composer
   styles. Only the demo skeleton — single conversation column + deal-state
   rail — is defined here. */

.demo-topbar {
  grid-template-columns: minmax(240px, 1fr) minmax(320px, 560px) minmax(140px, 1fr);
}

/* Narrator picker sits beside the model select; premium rows are locked. */
.model-control #llm-select {
  width: min(190px, 100%);
  flex: 0 1 auto;
  font-size: 12px;
}

.demo-topbar-actions {
  display: flex;
  justify-content: flex-end;
}

.demo-rail-toggle[aria-expanded="true"] { color: var(--accent-dark); }

.demo-workspace {
  display: flex;
  min-height: 0;
  flex: 1;
}

.demo-conversation {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

/* min-height: 0 lets the feed shrink below its content so it scrolls
   internally; without it the composer dock gets pushed out of the viewport. */
.demo-activity {
  flex: 1;
  min-height: 0;
  padding: 28px clamp(16px, 5vw, 64px) 16px;
  overflow-y: auto;
}

.demo-welcome {
  max-width: 720px;
  margin: 0 auto 26px;
}

.demo-welcome h1 {
  margin: 10px 0 12px;
  font-family: var(--serif);
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 600;
  line-height: 1.15;
}

.demo-transcript {
  max-width: 860px;
  margin: 0 auto;
}

/* No separator rule above the composer (ChatGPT/Claude do without one): the
   pill itself is the boundary, held by an even border plus a soft shadow. */
.demo-composer-dock {
  padding: 8px clamp(16px, 4vw, 32px) 14px;
  background: var(--paper);
}

/* ChatGPT/Claude-style pill composer: one rounded row — growing textarea +
   a compact send key. No label row, no hints, no secondary actions. */
.demo-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 860px;
  margin: 0 auto;
  padding: 5px 5px 5px 16px;
  /* A crisp, even 1px rule on all four sides — no directional shadow: a
     downward offset made the top edge read as missing against the paper. */
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  transition: border-color .15s ease;
}

.demo-composer:focus-within { border-color: var(--accent); }

.demo-composer .composer-input-wrap {
  flex: 1;
  min-width: 0;
  align-self: center;
}

.demo-composer textarea {
  padding: 7px 0;
  border-bottom: 0;
}

.demo-composer .composer-suggestion { padding: 7px 0; }

.demo-send-button {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  cursor: pointer;
  transition: background .15s ease, opacity .15s ease;
}

.demo-send-button:hover { background: var(--accent-dark); }
.demo-send-button:disabled { opacity: .35; cursor: not-allowed; }

/* Slim footer: one quiet line, not a second bar. */
.demo-shell .site-footer { padding: 6px 24px; }

/* Lives inside the welcome section: initial screen only. It leaves with the
   welcome copy the moment the conversation starts; afterwards the composer's
   grey Tab hint carries the next askable question. */
.demo-preset-panel {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.demo-preset-kicker { margin: 0 0 8px; }

.demo-preset-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.demo-preset-button {
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  text-align: left;
  transition: border-color .15s ease, color .15s ease, padding .15s ease;
}

.demo-preset-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-dark);
}

/* Deal-state rail — the invariant beside the stream. */
.demo-deal-rail {
  display: flex;
  width: 300px;
  flex-direction: column;
  flex-shrink: 0;
  border-left: 1px solid var(--line-strong);
  background: var(--paper-deep);
  transition: width .25s cubic-bezier(.23, 1, .32, 1);
}

.demo-deal-rail[data-collapsed="true"] { width: 52px; }

.demo-deal-rail[data-collapsed="true"] .demo-rail-header .eyebrow {
  display: none;
}

.demo-rail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
}

.demo-rail-header .eyebrow { margin: 0; }

.demo-deal-rail[data-collapsed="true"] .icon-button span[aria-hidden] {
  display: inline-block;
  transform: rotate(180deg);
}

.demo-rail-body {
  overflow-y: auto;
  padding: 14px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.demo-deal-section { display: grid; gap: 4px; }

.demo-deal-label {
  margin: 0;
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.demo-deal-value {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.demo-deal-count {
  font-family: var(--mono);
  font-size: 18px;
}

.demo-deal-meta {
  margin: 0;
  color: var(--ink-muted);
  font-size: 11px;
}

.demo-deal-overrides {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.demo-override-chip {
  padding: 2px 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 10px;
}

.demo-deal-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.demo-deal-metric {
  display: grid;
  gap: 2px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.demo-deal-metric-label {
  color: var(--ink-muted);
  font-size: 10px;
  line-height: 1.3;
}

.demo-deal-metric-value {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.demo-deal-metric-delta {
  font-family: var(--mono);
  font-size: 10px;
}

.demo-deal-empty {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--ink-muted);
  font-size: 11px;
}

.demo-deal-provenance {
  margin: 0;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 10px;
}

/* Instance layer (docs/INSTANCE_LAYER.md §5) — rail list of saved deal
   states for the current model. Compact rows: name + relative time open the
   frozen snapshot; rename and delete are quiet inline affordances. */
.demo-deal-instances {
  display: grid;
  gap: 4px;
  margin-top: 4px;
}

.instance-item {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.instance-open {
  flex: 1;
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 6px 8px;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}

.instance-open:hover { background: var(--accent-soft); }

.instance-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instance-updated {
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 10px;
}

.instance-action {
  flex: none;
  width: 26px;
  border: 0;
  border-left: 1px solid var(--line);
  background: none;
  color: var(--ink-muted);
  font-size: 11px;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}

.instance-action:hover { background: var(--accent-soft); color: var(--accent-dark); }
.instance-action-delete:hover { color: var(--negative); }

.instance-rename-input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
}

/* Save-instance actions on results cards: local browser actions, styled as
   quiet workstation controls — distinct from the prefill (ask-drafting)
   buttons. */
.instance-save-button,
.instance-export-button {
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .02em;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}

.instance-save-button:hover,
.instance-export-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.instance-export-button:disabled { opacity: .45; cursor: progress; }

/* Snapshot card chrome: the fingerprint pin reads as a provenance strip
   directly under the card header. */
.instance-pin-row {
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
}

.instance-pin {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  max-width: 100%;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-muted);
}

.instance-pin-kicker { flex: none; color: var(--accent-dark); }

.instance-pin-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.instance-pin-unpinned {
  font-style: italic;
  letter-spacing: .02em;
}

.instance-overrides { padding: 10px 18px 4px; }

.instance-section-label {
  margin: 0 0 6px;
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.instance-footer-note { font-style: italic; }

/* Boundary card: one ruled informational artifact in the stream — a
   gradient, not a wall. No controls, no sign-up prompt. */
.instance-boundary-card {
  padding: 14px 18px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  background: var(--paper-deep);
}

.instance-boundary-card .result-kicker { margin: 0 0 6px; }

.instance-boundary-copy {
  margin: 0 0 6px;
  max-width: 640px;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.5;
}

.instance-boundary-copy:last-child { margin-bottom: 0; }

/* Card action row — prefill-only follow-up buttons inside result cards. */
.demo-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}

.demo-prefill-button {
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  transition: border-color .15s ease, color .15s ease;
}

.demo-prefill-button:hover { border-color: var(--accent); color: var(--accent-dark); }

/* Inline ghost suggestion (Claude/ChatGPT-style): grey text sits directly in
   the input line where typed text would go, with a small Tab pill at the end.
   The overlay mirrors the textarea's metrics (padding 5px 0, line-height
   1.45) and only shows while the input is empty, so alignment is exact. It is
   non-interactive — Tab accepts, and accepting only prefills the input. */
.composer-input-wrap { position: relative; }

.composer-suggestion {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  overflow: hidden;
  color: var(--ink-muted);
  line-height: 1.45;
  white-space: nowrap;
  pointer-events: none;
}

#composer-suggestion-text {
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: .6;
}

.composer-suggestion-key {
  flex: none;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .75;
}

/* Boundary strip points are buttons on this page (prefill on click). */
.solver-boundary-strip button.solver-boundary-point {
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.solver-boundary-strip button.solver-boundary-point:hover {
  background: var(--accent-soft);
}

@media (max-width: 900px) {
  .demo-deal-rail {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    box-shadow: var(--shadow);
  }

  .demo-deal-rail[data-collapsed="true"] {
    width: 0;
    border-left: 0;
    overflow: hidden;
  }
}

/* Teaching cards (precomputed engine grids ported from /teach.html) */
.teach-console {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 16px;
  padding: 14px 16px;
}
.teach-dials { display: flex; flex-direction: column; gap: 10px; }
.teach-dial-row { display: flex; flex-direction: column; gap: 4px; }
.teach-dial-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.teach-seg { display: flex; flex-wrap: wrap; gap: 4px; }
.teach-seg-button {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink-muted);
  cursor: pointer;
}
.teach-seg-button.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.teach-seg-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.teach-readout {
  border-left: 1px solid var(--line);
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.teach-gp { font-family: var(--mono); font-size: 28px; font-weight: 600; }
.teach-gp.up { color: var(--positive); }
.teach-gp.down { color: var(--negative); }
.teach-delta { font-family: var(--mono); font-size: 11px; color: var(--ink-muted); }
.teach-sub {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
}
.teach-lamps { display: flex; flex-wrap: wrap; gap: 4px; }
.teach-lamp {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink-muted);
}
.teach-lamp.lit {
  border-color: var(--negative);
  background: color-mix(in oklab, var(--negative) 14%, var(--surface));
  color: var(--negative);
}
.teach-lamp.warn.lit {
  border-color: var(--warning);
  background: color-mix(in oklab, var(--warning) 16%, var(--surface));
  color: var(--warning);
}
.teach-verdict { font-style: italic; font-size: 12px; color: var(--ink); margin: 2px 0 0; }
.teach-foot {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-muted);
  margin: 4px 16px 12px;
}
.teach-console + .teach-foot, .teach-cloud + .teach-foot { margin-top: 0; }
.teach-cloud { display: block; margin: 10px 16px 0; max-width: calc(100% - 32px); }
@media (max-width: 720px) {
  .teach-console { grid-template-columns: 1fr; }
  .teach-readout { border-left: 0; padding-left: 0; }
}
