/* demo.css — demo-screen layout, loaded after style.css so it wins.
 *
 * Everything here is a consequence of one change: the rig stopped being a
 * transparent character and became a **scene**. v11's artboard was a blob on
 * nothing, so style.css sizes the canvas as a 360x360 square, pulls its
 * neighbours into it with negative margins, and paints a radial "halo" behind
 * it to ground the blob on the page. From v72 on the artboard is 2360x1640 and
 * draws its own background, so all three of those now fight the art: the scene
 * is letterboxed inside a square, its hard edges cut across the header, and the
 * halo sits behind an already-opaque background.
 *
 * So the canvas is treated as what it now is — a stage — and the rest of the
 * screen is arranged around it.
 */

:root {
  /* The artboard's own ratio; see ARTBOARD_ASPECT in rive-blob.ts. Keep the two
     in step, or Fit.Contain starts letterboxing again. */
  --stage-aspect: 2360 / 1640;
  --stage-max: 620px;
  --rail-right: 16px;
  --rail-gap: 10px;
}

/* ── The stage ─────────────────────────────────────────────────────────────── */

#conversation-stage {
  width: 100%;
  padding: 16px 20px 6px;
  gap: 12px;
}

#audio-panel {
  gap: 12px;
  width: 100%;
}

/* The toggle carried an 18px bottom margin on top of the panel gap, which read
   as a hole between it and the mic. */
.input-mode-toggle { margin-bottom: 6px; }

/* The rig, presented as a scene card rather than a floating rectangle.
 *
 * `aspect-ratio` is what removes the letterboxing: the canvas now has the
 * artboard's shape, so Contain fills it exactly. The rounded clip and the soft
 * edge are what turn the rig's own background from a stray hard-edged rectangle
 * into something that reads as deliberate. */
#rive-blob {
  display: block;
  /* Sized by *height*, because height is what the screen is short of: the
     stage, the mic and both panes have to share one window, and a
     width-driven stage pushed the panes off the bottom on a laptop. The
     aspect ratio derives the width, and the max-width keeps it from
     overwhelming a wide, short window. */
  height: clamp(190px, 34vh, 340px);
  width: auto;
  max-width: min(var(--stage-max), 100%);
  aspect-ratio: var(--stage-aspect);
  /* style.css pulls the neighbours into the art with -72px/-48px, tuned for a
     square artboard with transparent padding. This one has none, so those
     margins drag the scene up over the header border. */
  margin: 0 auto;
  border-radius: 22px;
  overflow: hidden;
  /* The rig paints its own background; the halo underneath it never showed. */
  background: none;
  box-shadow:
    0 1px 2px rgba(61, 58, 82, 0.05),
    0 12px 32px -12px rgba(61, 58, 82, 0.18);
}

/* The login screen's blob is the same wide artboard, so it needs the same
   shape — square would letterbox it exactly as the stage was. */
#rive-auth-blob {
  width: min(320px, 100%);
  height: auto;
  aspect-ratio: var(--stage-aspect);
  margin: 0 auto 4px;
  border-radius: 18px;
  overflow: hidden;
}

/* ── The top-right rail ────────────────────────────────────────────────────── */
/*
 * Three independently-positioned fixed layers used to stack up here — the
 * environment banner, the investor-demo control and the session card — each
 * with its own `top`, so they drifted apart, overlapped the stage on a short
 * window, and ran under the viewport edge on a narrow one. They are one rail
 * now: same right edge, same width, stacked in order.
 */

.session-panel {
  top: 124px;
  right: var(--rail-right);
  width: 248px;
  max-width: calc(100vw - (var(--rail-right) * 2));
}

.demo-floating-control {
  top: 74px;
  right: var(--rail-right);
}

/* Below this the rail would sit on top of the stage, so it rejoins the flow. */
@media (max-width: 1100px) {
  .session-panel {
    position: static;
    width: min(420px, 100%);
    margin: 0 auto 12px;
  }

  .demo-floating-control {
    position: static;
    display: flex;
    justify-content: center;
    margin: 8px auto 0;
  }
}

/* ── Conversation controls ─────────────────────────────────────────────────── */

.btn-mic {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.btn-mic:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.03);
}

.btn-mic:active:not(:disabled) {
  transform: scale(0.97);
}

/* ── The panes ─────────────────────────────────────────────────────────────── */
/*
 * They ran off the bottom of the window with no visible end, because nothing
 * bounded their height — so the page grew instead of the panes scrolling.
 */

#transcript,
.ws-log {
  max-height: min(42vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ── Narrow windows ────────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  :root { --stage-max: 100%; }

  #rive-blob {
    height: auto;
    width: 100%;
  }

  #conversation-stage {
    padding: 12px 12px 8px;
    gap: 12px;
  }

  #rive-blob { border-radius: 16px; }
}
