/* cv-orb.css — Cassia Vitality talking orb (staged 2026-09-21 13:55 MDT; not shipped).
   Colors come from /brand.css tokens; every var() carries the brand.css value as its fallback.
   Loaded from any page that uses /js/cv-orb.js (popup via data-cv-talk, or inline via data-cv-orb-inline). */

:root { --cv-orb-size: min(72vw, 300px); }

/* ---- popup shell (<dialog id="cv-orb">) ---------------------------------------------------- */
dialog.cv-orb {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh; height: 100dvh;
  max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: transparent;
  display: none; align-items: center; justify-content: center;
  z-index: 1000;
  color: var(--ink, #16202A);
}
dialog.cv-orb[open] { display: flex; }
dialog.cv-orb::backdrop { background: rgba(22, 32, 42, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
/* browsers without HTMLDialogElement: the script toggles the open attribute itself and the backdrop is painted here */
dialog.cv-orb.cv-orb-nodialog[open] { background: rgba(22, 32, 42, .55); }
html.cv-orb-open { overflow: hidden; }

/* ---- the card (shared by popup and inline) ------------------------------------------------- */
.cv-orb-card {
  position: relative; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  width: 100%; height: 100%; overflow: auto;
  padding: 28px 22px 22px;
  background: var(--paper, #FFFFFF); color: var(--ink, #16202A);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* phones: the popup card fills the viewport */
dialog.cv-orb .cv-orb-card {
  padding-top: calc(28px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
}
/* desktop: a centered 560 x 640 card */
@media (min-width: 640px) and (min-height: 720px) {
  dialog.cv-orb .cv-orb-card {
    width: 560px; height: 640px;
    padding: 32px 36px 28px;
    border: 1px solid var(--line, #E4E9ED);
    border-radius: var(--r-lg, 26px);
    box-shadow: var(--shadow, 0 18px 50px -24px rgba(20, 40, 70, .30));
  }
}
/* inline: same card, sized by its container */
.cv-orb-inline .cv-orb-card {
  width: 100%; max-width: 560px; height: auto; margin: 0 auto;
  border: 1.5px solid var(--line-2, #D7DEE4);
  border-radius: var(--r-lg, 26px);
  box-shadow: var(--shadow-sm, 0 6px 20px -12px rgba(20, 40, 70, .25));
}

.cv-orb-close {
  position: absolute; top: 10px; right: 10px;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-soft, #4C5A67);
  font: 400 28px/1 'Plus Jakarta Sans', system-ui, sans-serif;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.cv-orb-close:hover { background: var(--mist, #F5F7F8); color: var(--ink, #16202A); }
dialog.cv-orb .cv-orb-close { top: calc(10px + env(safe-area-inset-top, 0px)); }

/* ---- the orb ------------------------------------------------------------------------------- */
.cv-orb-stage {
  position: relative; flex: 0 0 auto;
  width: var(--cv-orb-size); height: var(--cv-orb-size);
  min-width: 220px; min-height: 220px;
  margin: 6px auto 14px;
}
.cv-orb-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cv-orb-portrait {
  position: absolute; left: 50%; top: 50%;
  width: 50%; height: 50%; border-radius: 50%; object-fit: cover;
  transform: translate(-50%, -50%);
  pointer-events: none; user-select: none;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .55);
}
.cv-orb-portrait[hidden] { display: none; }
.is-muted .cv-orb-stage::after {
  content: "Mic off";
  position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%);
  font: 600 12px/1 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--paper, #FFFFFF); background: var(--ink, #16202A);
  padding: 6px 10px; border-radius: 100px;
}

/* ---- text ---------------------------------------------------------------------------------- */
.cv-orb-name { margin: 0; font-size: clamp(24px, 3.4vw, 30px); font-weight: 700; letter-spacing: -.02em; color: var(--ink, #16202A); }
.cv-orb-role { margin: 4px 0 0; font-size: 16px; color: var(--ink-soft, #4C5A67); }
.cv-orb-status { margin: 14px 0 0; min-height: 1.5em; font-size: 16px; font-weight: 600; color: var(--ink, #16202A); }
.cv-orb-status[data-kind="connecting"] { color: var(--ink-soft, #4C5A67); }
.cv-orb-status[data-kind="live"] { color: var(--sage-deep, #4E6B49); }
.cv-orb-status[data-kind="speaking"] { color: var(--orb-mid, var(--blue, #1F4E8F)); }
.cv-orb-status[data-kind="error"] { color: #9B3B2E; }
.cv-orb-note { margin: 6px 0 0; min-height: 1.3em; max-width: 46ch; font-size: 14px; line-height: 1.5; color: var(--ink-faint, #5E6B7A); }

/* ---- controls (brand.css .btn / .btn-primary / .btn-ghost do the styling) ----------------- */
.cv-orb-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
.cv-orb-actions .btn { min-height: 48px; }
.cv-orb-card button.btn { font-family: inherit; cursor: pointer; }
.cv-orb-talk { min-width: 200px; font-size: 17px; }
.cv-orb-talk[disabled] { opacity: .55; cursor: default; }
.cv-orb-mute[aria-pressed="true"] { background: var(--ink, #16202A); color: var(--paper, #FFFFFF); border-color: var(--ink, #16202A); }

.cv-orb-disclosure { margin: auto 0 0; padding-top: 18px; max-width: 54ch; font-size: 13px; line-height: 1.55; color: var(--ink-faint, #5E6B7A); }
.cv-orb-inline .cv-orb-disclosure { margin-top: 18px; }

/* ---- motion -------------------------------------------------------------------------------- */
/* brand.css already zeroes CSS animation and transition under reduced motion; the canvas loop in
   cv-orb.js checks the same media query and draws one still frame per state instead of animating. */
@media (prefers-reduced-motion: reduce) {
  .cv-orb-card, .cv-orb-card * { animation: none !important; transition: none !important; }
}
