/* Live voice demo page (views/demo/voice_call.ejs, chat_layout). Framed on basalix.ai/demo.
   Colours follow the marketing site (teal). Dark theme: html.vd-dark (?theme=dark). */

.vdemo {
  --accent: #0f766e; --accent-soft: rgba(15, 118, 110, .10); --bg: #ffffff; --card: #ffffff;
  --ink: #14201f; --soft: #5b6b69; --line: #dfe6e5; --sub: #f3f6f6;
  --danger: #b42318; --danger-bg: #fdecea; --ok: #067647; --ok-bg: #e8f6ee;
  /* Orb tokens = basalix-site colors.css: --color-accent, --color-accent-ink,
     --color-accent-soft, --neutral-500. (--accent above already equals the site's accent-ink.) */
  --accent-bright: #0d9488; --accent-ink: #0f766e; --accent-drift: #14b8a6; --accent-halo: #d7f0eb; --neutral: #667272;
  --orb-size: 176px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg); max-width: 860px;
}
html.vd-dark .vdemo {
  --accent: #2dd4bf; --accent-soft: rgba(45, 212, 191, .13); --bg: #0f1716; --card: #16201f;
  --ink: #e7efee; --soft: #97a8a6; --line: rgba(255, 255, 255, .12); --sub: #1c2827;
  --danger: #ff9b8f; --danger-bg: rgba(255, 90, 70, .13); --ok: #6fdba1; --ok-bg: rgba(60, 200, 120, .13);
  --accent-bright: #2dd4bf; --accent-ink: #0d9488; --accent-drift: #2dd4bf; --accent-halo: rgba(45, 212, 191, .18); --neutral: #8a9a98;
}
body { background: #ffffff; }
html.vd-dark body { background: #0f1716; }
.vdemo :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.vd-step { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--soft); margin-bottom: 6px; line-height: 1.4; }
.vd-card { width: 100%; height: 100%; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 12px; padding: 8px 14px; text-align: left; display: flex; flex-direction: column; gap: 1px; line-height: 1.35; }
.vd-card b, .vd-card span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.vd-card b { font-size: 13px; }
.vd-card span { font-size: 11.5px; color: var(--soft); }
.vd-card:hover { border-color: var(--accent); }
.vd-card.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.vd-card:disabled { opacity: .55; cursor: not-allowed; }
.vd-persona { font-size: 12.5px; line-height: 1.5; background: var(--sub); border-radius: 12px; padding: 8px 12px; }
.vd-persona b { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--soft); margin-bottom: 1px; }
.vd-hint { font-size: 12.5px; color: var(--soft); line-height: 1.45; }
.vdemo .form-label { font-size: 12px; font-weight: 600; color: var(--soft); margin-bottom: 3px; }
.vdemo .form-control { height: 38px; border-color: var(--line); border-radius: 10px; font-size: 14px; background: var(--card); color: var(--ink); }
.vdemo .form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.vdemo .form-check-label { font-size: 12.5px; color: var(--soft); line-height: 1.45; }
.vdemo .form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.vd-err { font-size: 12.5px; color: var(--danger); min-height: 18px; line-height: 18px; }

.vd-panel { border: 1px solid var(--line); border-radius: 18px; background: var(--card); padding: 16px 18px; text-align: center; }
.vd-stat { font-weight: 700; font-size: 16px; }
.vd-stat .tm { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--soft); font-size: 13.5px; margin-left: 6px; }
.vd-sub { font-size: 13px; color: var(--soft); line-height: 1.45; max-width: 34ch; margin-left: auto; margin-right: auto; }
.vd-say { font-size: 13px; background: var(--sub); border-radius: 12px; padding: 9px 12px; line-height: 1.45; }
.vd-say b { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--soft); display: block; }
.vd-alert { font-size: 13px; border-radius: 12px; padding: 9px 12px; background: var(--danger-bg); color: var(--danger); text-align: left; line-height: 1.45; }
.vd-done { display: flex; gap: 11px; text-align: left; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.vd-done .ok { width: 30px; height: 30px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; flex: none; }
.vd-done b { font-size: 14px; }
.vd-done p { margin: 2px 0 0; font-size: 12.5px; color: var(--soft); line-height: 1.45; }
.vd-note { font-size: 11.5px; color: var(--soft); line-height: 1.45; }

/* Buttons: pill-shaped, teal. */
.vdemo .btn-vd { height: 44px; border-radius: 24px; padding: 0 20px; font-weight: 700; font-size: 14.5px; display: inline-flex; align-items: center; gap: 8px; background: var(--accent); border: 0; color: #fff; }
html.vd-dark .vdemo .btn-vd { color: #06201d; }
.vdemo .btn-vd:hover { filter: brightness(1.05); color: #fff; }
.vdemo .btn-vd-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.vdemo .btn-vd-ghost:hover { color: var(--ink); border-color: var(--accent); }
.vdemo .btn-vd-end { background: #e5484d; color: #fff; }

/* Orb: port of basalix-site src/components/dc/VoiceOrb.astro (3 rings + 32 radial bars + core;
   bars are written by the EJS). App states (set by voice_demo.js) → site looks:
     idle → idle · connecting → idle, fast breath · listen → caller · agent → basalix.
   --amp (agent bar height) is also set live from the agent's audio level by voice_demo.js. */
.orb { --sz: var(--orb-size, 160px); --amp: 1; --cool: color-mix(in oklab, var(--neutral) 55%, var(--accent-bright) 45%); --bar: var(--accent-bright);
  position: relative; width: var(--sz); height: var(--sz); margin: 0 auto; }
.orb.dim { --accent-bright: #a3aab6; --accent-ink: #a3aab6; --accent-drift: #a3aab6; --accent-halo: #eceef1; --neutral: #a3aab6; }
html.vd-dark .orb.dim { --accent-bright: #5c6573; --accent-ink: #5c6573; --accent-drift: #5c6573; --accent-halo: rgba(255, 255, 255, .06); --neutral: #5c6573; }
.orb .ring { position: absolute; left: 50%; top: 50%; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.orb .r1 { width: 62%; height: 62%; background: color-mix(in srgb, var(--accent-bright) 18%, transparent); }
.orb .r2 { width: 80%; height: 80%; background: color-mix(in srgb, var(--accent-bright) 10%, transparent); }
.orb .r3 { width: 100%; height: 100%; background: color-mix(in srgb, var(--accent-bright) 5%, transparent); }
.orb[data-state="agent"] .r1, .orb[data-state="listen"] .r1 { animation: vd-ripple 2.2s ease-out infinite; }
.orb[data-state="agent"] .r2, .orb[data-state="listen"] .r2 { animation: vd-ripple 2.2s ease-out infinite .5s; }
.orb[data-state="agent"] .r3, .orb[data-state="listen"] .r3 { animation: vd-ripple 2.2s ease-out infinite 1s; }
.orb[data-state="listen"] { --bar: var(--cool); }

.orb .bars { position: absolute; inset: 0; pointer-events: none; }
.orb .bar { position: absolute; left: 50%; bottom: 50%; width: 2px; margin-left: -1px; height: calc(var(--sz) * .16); transform-origin: center bottom; }
.orb .bar i { display: block; width: 100%; height: 100%; border-radius: 1px; background: var(--bar); transform-origin: bottom; transform: scaleY(.12);
  transition: background .3s ease, opacity .3s ease; animation: none; animation-iteration-count: infinite; animation-direction: alternate; animation-timing-function: ease-in-out; }
.orb[data-state="agent"] .bar i { animation-name: vd-wave; }
.orb[data-state="listen"] .bar i { animation-name: vd-wave-caller; }
.orb.muted .bar i, .orb.dim .bar i { opacity: .25; }

.orb .core { position: absolute; left: 50%; top: 50%; width: 52%; height: 52%; transform: translate(-50%, -50%); border-radius: 50%; border: 0; padding: 0;
  color: #fff; font-size: 24px; display: grid; place-items: center; background: var(--accent-ink);
  transition: background .3s ease, box-shadow .3s ease; }
.orb .core.tap { cursor: pointer; }
.orb[data-state="idle"] .core, .orb[data-state="connecting"] .core { box-shadow: 0 0 0 7px var(--accent-halo); animation: vd-breath 1.6s ease-in-out infinite alternate; }
.orb[data-state="connecting"] .core { animation-duration: .8s; }
.orb .core.tap:hover { box-shadow: 0 0 0 11px var(--accent-halo); }
.orb[data-state="agent"] .core { animation: vd-drift 2.4s ease-in-out infinite alternate; }
.orb[data-state="listen"] .core { background: var(--cool); }
.orb.dim .core { animation: none; }
.orb .spin { width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: vd-spin .8s linear infinite; }
@keyframes vd-spin { to { transform: rotate(360deg); } }
@keyframes vd-wave { from { transform: scaleY(.2); } to { transform: scaleY(var(--amp, 1)); } }
@keyframes vd-wave-caller { from { transform: scaleY(.2); } to { transform: scaleY(.7); } }
@keyframes vd-drift { from { background: var(--accent-ink); } to { background: var(--accent-drift); } }
@keyframes vd-breath { from { transform: translate(-50%, -50%) scale(1); } to { transform: translate(-50%, -50%) scale(1.04); } }
@keyframes vd-ripple { 0% { opacity: 1; } 70% { transform: translate(-50%, -50%) scale(1.12); opacity: .2; } 100% { transform: translate(-50%, -50%) scale(1.12); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .orb .core, .orb .ring, .orb .bar i { animation: none !important; }
  .orb .bar i { transform: scaleY(.12); }
  .orb .spin { animation: vd-spin 2s linear infinite !important; }
}
