/* ============================================================
   structam.sh demo: onboarding a Linux host (js/demos/onboard.js).
   A terminal running the install script (backend/internal/onboard/
   scripts/install.sh), then the Agents page (web/src/pages/Agents.tsx)
   and the new host's Overview (pages/HostDetail.tsx, host/Overview.tsx).
   The two windows share one grid cell, so the stage never changes
   height when the browser replaces the terminal.
   The terminal is site chrome, not the app: real px, Plex Mono, never
   under 11px, on Midnight with the kit's dark-theme text and status
   colours (tokens.css "1 · palette, dark"; contrast on #232836: text
   10.42, muted 8.35, success 8.86, info 7.99, warning 9.08, Stone 5.46).
   Inside the browser, sizes are the product's px and every caption
   size of 13px or less is max(<px>, var(--sx-fmin, 0px)).
   Phones (.is-phone, set by onboard.js under 520px of terminal) get a
   smaller terminal font and tighter padding; lines wrap.
   ============================================================ */

.ob-demo { max-width: 1120px; margin: 0 auto; }
.ob-stack { display: grid; }
.ob-stack > * { grid-area: 1 / 1; min-width: 0; }
.ob-web .stage-window { max-width: none; }
.ob-demo .app { --sx-h: 520px; }

/* ---------- The terminal ---------- */
/* margin 0 + width 100%: .stage-window's auto margins would make this grid item shrink to its content. */
.ob-term { display: flex; flex-direction: column; max-width: none; height: 100%; margin: 0; width: 100%; }
.ob-bar { justify-content: center; }
.ob-bar .stage-lights { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); }
.ob-bar::after { display: none; }
.ob-title {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 400 11.5px/1 var(--font-mono); color: var(--ink-subtle);
}
.ob-keys { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: flex; }
.ob-key {
  display: inline-block; padding: 3px 7px; border-radius: 5px;
  border: 1px solid var(--line); border-bottom-width: 2px; background: var(--bg);
  font: 500 11px/1.2 var(--font-mono); color: var(--ink-muted); white-space: nowrap;
}
/* The body fills the window; lines start at the top and, if they ever
   outgrow it, the newest stay in view (min-height + flex-end). */
.ob-term-body {
  flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end;
  overflow: hidden; padding: 14px 18px; background: #232836;
}
.ob-lines {
  flex: none; min-height: 100%;
  font: 400 13px/1.55 var(--font-mono); color: #c1c3ca;
  font-variant-ligatures: none;
}
.ob-l { min-height: 1.55em; white-space: pre-wrap; overflow-wrap: anywhere; }
.ob-ps-u { color: #9bd6b2; }
.ob-ps-d { color: #acbfec; }
.ob-cmd { color: #e2d8c7; }
.ob-pre { color: #a19d98; }
.ob-warn { color: #f2c47d; }
.ob-cursor { display: inline-block; vertical-align: text-bottom; width: 0.6em; height: 1.2em; background: #e2d8c7; }
.ob-cursor.is-off { background: transparent; }

/* ---------- Browser: Agents page ---------- */
.ob-demo .ob-filters { gap: 10px 12px; }
.ob-demo .ob-search { width: 300px; max-width: 100%; }
.ob-demo .ob-total { font-size: max(13px, var(--sx-fmin, 0px)); }
.ob-demo .ob-new { display: contents; }
.ob-demo .ob-host-a { position: relative; display: inline-flex; max-width: 100%; }
.ob-demo .ob-host-a.is-pressed .sx-link { text-decoration: underline; }

/* ---------- Browser: host page ---------- */
.ob-demo .ob-viewport { height: 100%; overflow: hidden; }
.ob-demo .ob-host { will-change: transform; }
.ob-demo .ob-host-sub { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: max(13px, var(--sx-fmin, 0px)); }
.ob-demo .ob-pending:empty { display: none; }
.ob-demo .ob-kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ob-demo .ob-kpis .sx-kpi { gap: 4px; padding: 12px 16px; }
.ob-demo .ob-kpis .sx-k-value { font-variant-numeric: tabular-nums; }
.ob-demo .ob-empty { display: flex; flex-direction: column; gap: 4px; padding: 8px 0 4px; font-size: max(13px, var(--sx-fmin, 0px)); }
.ob-demo .ob-empty-t { font-weight: 600; color: var(--sx-ink); }
.ob-demo .ob-fresh-head { padding: 14px 16px 10px; }
.ob-demo .ob-sec-t { font-size: max(13px, var(--sx-fmin, 0px)); }
.ob-demo .ob-sec-t .sx-th, .ob-demo .ob-sec-t .sx-td { padding-top: 7px; padding-bottom: 7px; }

/* Narrow app (the kit's T4): KPI tiles two or three across, the sections table without its two date columns. */
@container sxapp (max-width: 799px) {
  .ob-demo .app { --sx-h: 520px; }
  .ob-demo .ob-kpis { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
  .ob-demo .ob-kpis .sx-kpi { padding: 10px 12px; }
  .ob-demo .ob-kpis .sx-k-value { font-size: 20px !important; }
  .ob-demo .ob-sec-t { --sx-cols: minmax(0, 1fr) max-content max-content !important; }
  .ob-demo .ob-sec-t .is-skip-sm { display: none; }
  .ob-demo .ob-sec-t .sx-th:nth-child(n + 4) { display: none; }
  .ob-demo .ob-search { width: 100%; }
  .ob-demo .ob-filters .sx-grow { display: none; }
  /* Phone cards: two equal columns, so a long host name never runs over the status badge. */
  .ob-demo .ob-agents .sx-t.sx-stack-sm .sx-tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@container sxapp (max-width: 559px) {
  /* The product hides its sidebar on phones (app.css, under 720px); so does this demo, for the width.
     Its header then shows the menu button, the symbol and the page title, as the product's does. */
  .ob-demo .sx-frame { grid-template-columns: minmax(0, 1fr); }
  .ob-demo .sx-side { display: none; }
  .ob-demo .sx-hdr-sm { display: contents; }
  .ob-demo .ob-host .sx-h1 { font-size: 22px; line-height: 28px; white-space: normal; overflow-wrap: anywhere; }
  .ob-demo .ob-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ob-demo .ob-kpis .sx-eyebrow { letter-spacing: .06em; }
}

/* ---------- Phones ---------- */
.ob-demo.is-phone .ob-term-body { padding: 10px 10px 12px; }
.ob-demo.is-phone .ob-lines { font-size: 11.5px; line-height: 1.5; }
.ob-demo.is-phone .ob-l { min-height: 1.5em; }
.ob-demo.is-phone .ob-title { font-size: 11px; }
@media (max-width: 760px) {
  .ob-bar { height: 30px; }
  .ob-bar .stage-lights i { width: 8px; height: 8px; }
  .ob-key { padding: 2px 6px; }
}
