/* os/apps/signal.css — parent chrome for the Social Analytics demo.
 *
 * Deliberately small. The iframe keeps the product's own identity: nothing here
 * reaches inside it, and nothing here repaints it in the portfolio's blue. The
 * only job of this file is the strip above it, the guide, and the story panel.
 */

.app-signal {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--paper);
}

/* ------------------------------------------------------------------ strip */

.app-signal .sig-strip {
  flex: 0 0 44px;
  height: 44px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.app-signal .sig-strip-spacer { flex: 1 1 auto; }

.app-signal .sig-strip .btn {
  min-height: 32px;
  padding: 0 var(--space-3);
  white-space: nowrap;
}

/* ------------------------------------------------------------------- body */

.app-signal .sig-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: #17171e;
  display: flex;
}

.app-signal .sig-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1440px;
  height: 800px;
  max-width: none;
  flex: none;
  transform-origin: center;
  border: 0;
  display: block;
  background: var(--paper-2);
}

.app-signal .sig-status {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  text-align: center;
  padding: var(--space-6);
  background: var(--paper);
  color: var(--ink-3);
}

.app-signal .sig-status-error { color: var(--ink-2); }
.app-signal .sig-status-error strong { font-size: 18px; line-height: 1.3; color: var(--ink); }
.app-signal .sig-status p { max-width: 46ch; margin: 0; }

.app-signal .sig-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
}

/* ------------------------------------------------------------------ guide */

/* The guide is the parent's smallest possible claim on the window: the demo
 * is the point, not the caption around it. A SINGLE 44px row of three chips
 * (no cards, no body text on arrival) — strip(44) + guide(44) = 88px, the
 * audit pass's hard cap on the outer wrapper. It collapses to nothing the
 * moment a chip is chosen or dismissed; the "what to try" reading only
 * appears in the one-line .sig-guide-next bar below, once a chip has
 * actually navigated. */
.app-signal .sig-guide {
  flex: 0 0 44px;
  height: 44px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  overflow-x: auto;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}

.app-signal .sig-guide-label {
  flex: 0 0 auto;
  font-size: 12px;
  letter-spacing: .01em;
  color: var(--ink-3);
  white-space: nowrap;
}

.app-signal .sig-guide-chip {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 var(--space-3);
  white-space: nowrap;
}

/* The "what to try next" line: its own one-line bar directly under the strip,
 * present only after a card has actually navigated. Kept outside .sig-guide so
 * the 128px cap above is a cap on what the visitor sees on ARRIVAL, and this
 * line is the only thing a click can add. */
.app-signal .sig-guide-next {
  flex: 0 0 auto;
  margin: 0;
  padding: var(--space-2) var(--space-4);
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-2);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  /* WRAPS, up to three lines. The entrance row it replaces collapses the moment
   * a chip is chosen, so the height it costs is height that was just freed —
   * and a reading truncated mid-sentence with an ellipsis is not a reading. The
   * clamp is the ceiling, not the target: two of the three fit in two lines at
   * 1280px. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.app-signal .sig-guide-next strong { color: var(--ink); }

.app-signal .sig-guide-body {
  margin: 0;
  max-width: 78ch;
  color: var(--ink-2);
}

/* ------------------------------------------------------------------ panel */

.app-signal .sig-panel {
  position: absolute;
  inset: 44px 0 0 auto;
  width: min(560px, 100%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 48px rgba(9, 36, 110, .12);
}

.app-signal .sig-panel-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.app-signal .sig-panel-head h2 { flex: 1 1 auto; margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -.01em; }

.app-signal .sig-panel-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: var(--space-5) var(--space-4) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  color: var(--ink-2);
}

.app-signal .sig-panel-body h3 { margin: var(--space-2) 0 0; font-size: 18px; line-height: 1.3; color: var(--ink); }
.app-signal .sig-panel-body p { margin: 0; max-width: 62ch; }

.app-signal .sig-list { margin: 0; padding-left: 1.15em; display: flex; flex-direction: column; gap: var(--space-2); max-width: 62ch; }

/* ----------------------------------------------------------------- narrow
 * The Social Analytics renderer assumes a desktop canvas (its own smoke
 * harness declares a 900px minimum window). Below that the guide's chip row
 * scrolls horizontally rather than wrapping — it stays a single 44px row at
 * every width down to the ctx.mobile threshold, where the mobile strip below
 * takes over entirely.
 */
@media (max-width: 900px) {
  .app-signal .sig-guide-label { display: none; }
  .app-signal .sig-guide-next { white-space: normal; }
  .app-signal .sig-strip { overflow-x: auto; }
  .app-signal .sig-panel { inset: 44px 0 0 0; width: 100%; }
}

/* ------------------------------------------------------------------ mobile
 * ctx.mobile (<=760px). The renderer itself assumes a >=900px canvas (its
 * own top nav collapses awkwardly below that) — a known limitation of the
 * child this file cannot fix. Below the threshold the parent presents that
 * honestly: a two-row compact strip (never the wrapped pill, never five
 * buttons fighting for space), a guide collapsed by default, and a one-time
 * note. Placed after the 900px block above so it wins on shared properties;
 * every selector here targets markup this file only builds on ctx.mobile, so
 * none of it can touch the desktop DOM or its behavior.
 */
@media (max-width: 760px) {
  .app-signal .sig-mstrip {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
  }

  .app-signal .sig-mstrip-row1 {
    flex: 0 0 44px;
    height: 44px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-4);
  }

  .app-signal .sig-mlabel { white-space: nowrap; }
  .app-signal .sig-mlabel span { white-space: nowrap; }

  .app-signal .sig-mopen {
    flex: 0 0 auto;
    margin-left: auto;
    min-height: 36px;
    padding: 0 var(--space-3);
    white-space: nowrap;
  }

  .app-signal .sig-mstrip-row2 {
    flex: 0 0 44px;
    height: 44px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-4);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-top: 1px solid var(--line);
  }
  .app-signal .sig-mstrip-row2::-webkit-scrollbar { display: none; }

  .app-signal .sig-mchip {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 var(--space-3);
    white-space: nowrap;
  }

  /* ── the mobile walkthrough ─────────────────────────────────────────── */

  .app-signal .sig-walk {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-4) var(--space-4) var(--space-6);
    background: var(--paper);
  }

  .app-signal .sig-walk-head { margin-bottom: var(--space-5); display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }
  .app-signal .sig-walk-label { margin: 0; }
  .app-signal .sig-walk-title {
    margin: 0 0 var(--space-2);
    font-size: 17px;
    line-height: 1.25;
  }
  .app-signal .sig-walk-lead {
    margin: 0;
    color: var(--ink-2);
    font-size: 13px;
    line-height: 1.5;
  }
  .app-signal .sig-walk-lead strong { color: var(--ink); }

  .app-signal .sig-walk-sec {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--line);
  }
  .app-signal .sig-walk-sec-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0 0 var(--space-1);
    font-size: 15px;
    line-height: 1.3;
  }
  .app-signal .sig-walk-num {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-2);
  }
  .app-signal .sig-walk-sec-lead {
    margin: 0 0 var(--space-3);
    color: var(--ink-3);
    font-size: 12px;
    line-height: 1.45;
  }

  .app-signal .sig-walk-step { margin: 0 0 var(--space-4); }
  .app-signal .sig-walk-inspect { display:block; width:100%; padding:0; border:0; border-radius:var(--radius-md); background:transparent; cursor:zoom-in; }
  .app-signal .sig-walk-inspect:focus-visible { outline:2px solid #1c5ae6; outline-offset:3px; }
  .app-signal .sig-walk-img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--paper-2);
  }
  .app-signal .sig-walk-cap {
    display: block;
    margin-top: var(--space-2);
    color: var(--ink-2);
    font-size: 12px;
    line-height: 1.5;
  }
  .app-signal .sig-walk-step-n {
    display: block;
    margin-bottom: 2px;
    color: var(--ink-3);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .app-signal .sig-walk-missing { margin: 0; }
  .app-signal .sig-walk-close {
    margin: 0;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.5;
  }

  .app-signal .sig-walk-foot {
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--line);
  }
  .app-signal .sig-walk-foot .btn { width: 100%; min-height: 44px; }
  .app-signal .sig-walk-foot-note {
    margin: var(--space-2) 0 0;
    color: var(--ink-3);
    font-size: 12px;
    line-height: 1.45;
  }

  .app-signal .sig-body { flex: 1 1 auto; min-height: 60vh; overflow: hidden; }
  .app-signal .sig-frame { width: 100%; height: 100%; }

  .app-signal .sig-panel { inset: 0; width: 100%; }
}
