/* AV - See it in action (va-demo). Signature moment "The seam".
   Ported from the approved concept (css/sections/04-demo.css). Night on the left is what the patient
   hears; paper on the right is what happens in the trust's systems; the D-orb rides the boundary.
   Every rule is scoped under .va.va-demo and uses the tokens from assets/css/voice-agents/va-kit.css.
   Citron budget (at most two per viewport): the voice thread with its dot, and the ledger highlighter.
   The stage is full bleed (outside the theme container); --edge lines its content up with the container's
   content edge: 1152px of content at Standard (1192px less the 20px gutters), 1400px at Wide (1440px). */

/* The transcript's top fade grows in only once the conversation outgrows the box. */
@property --vad-fade { syntax: "<length>"; inherits: false; initial-value: 0px; }
/* The phone tab strip's edge fades (start, end), shown only while there is more to swipe that way. */
@property --vad-fs { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --vad-fe { syntax: "<length>"; inherits: false; initial-value: 0px; }

.va.va-demo { --seam-clear: 72px; --orb-size: 64px; --strip-h: 104px; --stage-top: 72px; --vp-top: 26px; }
.va.va-demo { --vad-content: 1152px; }
.va.va-demo[data-va-width="wide"] { --vad-content: 1400px; }

/* ---------- Header and controls ---------- */
.va.va-demo .va-demo__head { margin-bottom: clamp(48px, 5vw, 72px); }
.va.va-demo .va-demo__head .va-lead { max-width: 40ch; }
/* .va-demo__body (the dock's sticky range) is only a wrapper: its children keep the stacking va-kit's
   .va-grain > * gave them as children of the section, so the dock stays above the tabs and the stage. */
.va.va-demo .va-demo__body > * { position: relative; z-index: 1; }
/* The controls row is the demo's anchor ([data-demo-anchor]): deep links and seeks land it under the nav. */
.va.va-demo .va-demo__controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; margin-bottom: 20px; }
.va.va-demo .va-demo__tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.va.va-demo .va-demo__tab {
  position: relative; display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 22px 0 18px;
  border-radius: 999px; overflow: hidden; isolation: isolate; white-space: nowrap;
  font-family: var(--font-body); font-weight: 700; font-size: 0.9375rem; line-height: 1; color: var(--ink-2);
  background: var(--bg-raised); box-shadow: inset 0 0 0 1px var(--line);
  transition: color var(--t-ui) var(--ease-out), background-color var(--t-ui) var(--ease-out), box-shadow var(--t-ui) var(--ease-out), transform var(--t-micro) var(--ease-out);
}
.va.va-demo .va-demo__tab .va-i { width: 18px; height: 18px; color: var(--ink-3); transition: color var(--t-ui); }
/* Hover only where there is a real pointer, so a tap leaves no ring behind on touch. A pressed Sound
   or Read steps from paper to mist, the Play wipe colour; a stepper arrow fills instead of ringing inside
   its pill; a resting arrow gets nothing. The block sits ahead of the selected, pressed and disabled
   states, so they still win at equal specificity. */
@media (hover: hover) {
  .va.va-demo .va-demo__tab:hover { color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 36%, transparent); }
  .va.va-demo .va-demo__btn:where(:not([aria-disabled="true"])):hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 70%, transparent); }
  .va.va-demo .va-demo__play:hover { box-shadow: none; }
  .va.va-demo .va-demo__play:hover::before { transform: scaleX(1); }
  .va.va-demo .va-demo__step:where(:not([aria-disabled="true"])):hover { box-shadow: none; background: color-mix(in srgb, var(--ink) 12%, transparent); }
  .va.va-demo :is(.va-demo__sound, .va-demo__read)[aria-pressed="true"]:hover { background: var(--mist); box-shadow: none; }
}
.va.va-demo .va-demo__tab:active { transform: scale(0.98); }
.va.va-demo .va-demo__tab[aria-selected="true"] { background: var(--paper); color: var(--night-900); box-shadow: none; }
.va.va-demo .va-demo__tab[aria-selected="true"] .va-i { color: var(--forest); }
.va.va-demo .va-demo__tab-bar {
  position: absolute; left: 20px; right: 20px; bottom: 7px; height: 2px; border-radius: 2px;
  background: var(--forest); transform: scaleX(0); transform-origin: left center; opacity: 0;
}
.va.va-demo .va-demo__tab[aria-selected="true"] .va-demo__tab-bar { opacity: 0.85; }
.va.va-demo .va-demo__tab:focus-visible { border-radius: 999px; }
.va.va-demo .va-demo__note { margin: 0; }

/* ---------- Stage: full bleed, split at the seam ----------
   Tabs, stage and transport fit one viewport under the nav (laptops included). The JS writes the
   measured controls row (--vad-ctl) and footer (--vad-foot) heights; the fallbacks match one-line rows. */
.va.va-demo .va-demo__stage {
  --stage-h: calc(100vh - var(--nav-h) - 16px - var(--vad-ctl, 68px) - var(--vad-foot, 64px) - 16px);
  position: relative; container-type: inline-size; height: clamp(460px, var(--stage-h), 740px);
  /* Without container units (Safari 15): 100% is the stage's width wherever --edge is used (the halves'
     padding and the voiceprint's insets all resolve against the stage), so the gutter stays. */
  --edge: max(1.25rem, (100% - var(--vad-content)) / 2);
  outline: none;
}
@supports (width: 1cqi) { .va.va-demo .va-demo__stage { --edge: max(1.25rem, (100cqw - var(--vad-content)) / 2); } }
@supports (height: 100svh) {
  .va.va-demo .va-demo__stage { --stage-h: calc(100svh - var(--nav-h) - 16px - var(--vad-ctl, 68px) - var(--vad-foot, 64px) - 16px); }
}
@media (min-width: 1024px) and (max-height: 820px) { .va.va-demo { --stage-top: 64px; --vp-top: 22px; --strip-h: 92px; } }

/* Focus: the halves are opaque, so the ring is its own layer above them. Citron on night, forest on paper. */
.va.va-demo .va-demo__stage:focus-visible { outline: none; }
.va.va-demo .va-demo__focus { position: absolute; inset: 0; z-index: 8; pointer-events: none; opacity: 0; }
.va.va-demo .va-demo__focus::before, .va.va-demo .va-demo__focus::after { content: ""; position: absolute; top: 0; bottom: 0; }
.va.va-demo .va-demo__focus::before { left: 0; width: 50%; box-shadow: inset 3px 0 0 var(--citron), inset 0 3px 0 var(--citron), inset 0 -3px 0 var(--citron); }
.va.va-demo .va-demo__focus::after { left: 50%; right: 0; box-shadow: inset -3px 0 0 var(--forest), inset 0 3px 0 var(--forest), inset 0 -3px 0 var(--forest); }
.va.va-demo .va-demo__stage:focus-visible > .va-demo__focus { opacity: 1; }

.va.va-demo .va-demo__night,
.va.va-demo .va-demo__paper { position: absolute; top: 0; bottom: 0; width: 50%; display: flex; flex-direction: column; padding-top: var(--stage-top); }
.va.va-demo .va-demo__night {
  left: 0; padding-left: var(--edge); padding-right: var(--seam-clear); padding-bottom: calc(var(--strip-h) + 4px);
  background: var(--bg); isolation: isolate;
}
.va.va-demo .va-demo__night::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background-image: var(--grain); background-size: 160px 160px; opacity: 0.04; mix-blend-mode: screen; }

/* The paper half is a nested data-surface="paper" (module.html), so its semantic tokens are the kit's
   paper surface. It holds no theme buttons, so the kit's button recolouring is untouched. */
.va.va-demo .va-demo__paper {
  left: 50%; padding-left: var(--seam-clear); padding-right: var(--edge); padding-bottom: 24px;
  background-color: var(--paper); color: var(--ink-2); color-scheme: light; isolation: isolate;
  overflow: hidden; overflow: clip; /* the glow rises from below and must not spill over the footer */
}
/* 6% halftone grid, densest at the seam and fading towards the page edge. */
.va.va-demo .va-demo__paper::before {
  content: ""; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background-image: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--night-900) 16%, transparent) 0 1.3px, transparent 1.8px);
  background-size: 16px 16px; background-position: 0 6px;
  -webkit-mask-image: linear-gradient(90deg, #000 0%, rgba(0, 0, 0, 0.38) 45%, rgba(0, 0, 0, 0.12) 100%);
          mask-image: linear-gradient(90deg, #000 0%, rgba(0, 0, 0, 0.38) 45%, rgba(0, 0, 0, 0.12) 100%);
  opacity: 0.6;
}
/* Tab 3 morning glow: rises on "Ready for the morning", capped at 40%. */
.va.va-demo .va-demo__glow {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(90% 70% at 72% 100%, var(--pink) 0%, color-mix(in srgb, var(--pink) 70%, transparent) 38%, transparent 78%),
    linear-gradient(0deg, color-mix(in srgb, var(--pink) 90%, transparent) 0%, transparent 62%);
  opacity: 0; transform: translateY(18%); transform-origin: 50% 100%;
  transition: opacity 1600ms var(--ease-voice), transform 2000ms var(--ease-voice);
}
.va.va-demo .va-demo__paper[data-morning="true"] .va-demo__glow { opacity: 0.4; transform: none; }
/* A new call starts before dawn: the glow resets at once instead of lingering over the next call. */
.va.va-demo .va-demo__stage.is-swapping .va-demo__glow { opacity: 0; transition: none; }

/* Column heads */
.va.va-demo .va-demo__colhead { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; min-height: 26px; margin-bottom: 14px; flex: none; }
.va.va-demo .va-demo__label { font-family: var(--font-body); font-weight: 700; font-size: 0.8125rem; line-height: 1.3; letter-spacing: 0.01em; color: var(--ink); }
/* Larger text: once the night half is under 14rem wide (never at the default text size, where it is 15rem
   or more from 320px), the call time wraps under the column label and a redaction chip wraps inside
   itself, so neither runs off the screen or widens the transcript past its column. At the default size
   the label never gives way to the call time beside it, as before. */
.va.va-demo .va-demo__night { container-type: inline-size; }
.va.va-demo .va-demo__night .va-demo__label { flex-shrink: 0; }
@container (max-width: 14rem) {
  .va.va-demo .va-demo__night .va-demo__colhead { flex-wrap: wrap; }
  .va.va-demo .va-demo__night .va-demo__label { flex-shrink: 1; }
  .va.va-demo .va-demo__say .va-redact { white-space: normal; }
}
.va.va-demo .va-demo__inbound { display: inline-flex; align-items: center; gap: 10px; margin: 0; white-space: nowrap; transition: opacity 200ms var(--ease-out); }
.va.va-demo .va-demo__inbound-tag { gap: 6px; padding: 0 10px 0 8px; }
.va.va-demo .va-demo__inbound-tag .va-i { width: 14px; height: 14px; }
.va.va-demo .va-demo__when { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.va.va-demo .va-demo__when .va-i { width: 14px; height: 14px; color: var(--ink-3); }
.va.va-demo .va-demo__illus { flex: none; }

/* ---------- Transcript: top-aligned like a conversation; past lines shrink and rise ---------- */
/* The wrapper carries the transcript's focus ring, because the transcript's own fade mask would clip it. */
.va.va-demo .va-demo__txwrap { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.va.va-demo .va-demo__txwrap::after { content: ""; position: absolute; inset: -6px -8px; border-radius: 10px; pointer-events: none; box-shadow: 0 0 0 3px var(--citron); opacity: 0; }
.va.va-demo .va-demo__txwrap:has(> .va-demo__tx:focus-visible)::after { opacity: 1; }
.va.va-demo .va-demo__tx:focus-visible { outline: none; }
@supports not selector(:has(*)) { .va.va-demo .va-demo__tx:focus-visible { outline: 3px solid var(--citron); outline-offset: -3px; } }
.va.va-demo .va-demo__tx {
  position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 var(--vad-fade));
          mask-image: linear-gradient(180deg, transparent 0, #000 var(--vad-fade));
  transition: opacity 200ms var(--ease-out), --vad-fade 480ms var(--ease-out);
}
.va.va-demo .va-demo__tx.is-over { --vad-fade: 64px; }
.va.va-demo .va-demo__lines { position: relative; height: 100%; }
.va.va-demo .va-demo__line {
  position: absolute; top: 0; left: 0; width: 100%; transform-origin: 0 0;
  font-size: clamp(1.125rem, 1.6vw, 1.5rem); line-height: 1.38; color: var(--ink); font-weight: 400;
  transition: transform 640ms var(--ease-voice), opacity 640ms var(--ease-voice);
}
.va.va-demo .va-demo__line[data-speaker="patient"] { color: var(--patient); font-style: italic; }
.va.va-demo .va-demo__line[data-state="future"] { opacity: 0; transition-duration: 0ms; }
.va.va-demo .va-demo__line[data-state="active"] { transition: transform 640ms var(--ease-voice), opacity 220ms var(--ease-out); }
/* Past lines at 60%: paper about 6.5:1 and pink about 5.5:1 on night-900. */
.va.va-demo .va-demo__line[data-state="past"] { opacity: 0.6; }
.va.va-demo .va-demo__who {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  font-family: var(--font-mono); font-style: normal; font-weight: 400; font-size: var(--fs-tag); line-height: 1.4546; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3);
  transition: opacity 320ms var(--ease-out);
}
.va.va-demo .va-demo__who::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.va.va-demo .va-demo__line[data-speaker="patient"] .va-demo__who { color: color-mix(in srgb, var(--pink) 72%, var(--night-900)); }
.va.va-demo .va-demo__line[data-state="past"] .va-demo__who { opacity: 0; }
.va.va-demo .va-demo__say { margin: 0; text-wrap: pretty; transition: opacity var(--t-ui) var(--ease-out); }
.va.va-demo .va-demo__say .w { opacity: 0; transition: opacity 220ms var(--ease-out); }
.va.va-demo .va-demo__say .w.is-on { opacity: 1; }
.va.va-demo .va-demo__say .va-redact { font-size: 0.78em; }
/* On a faded past line the kit's 22% hatch would take the chip's text under 4.5:1 (pink on night); 12%
   keeps it at 4.8:1 or better between the stripes. */
.va.va-demo .va-demo__line[data-state="past"] .va-redact { --redact-hatch: 12%; }

/* The ringing moment: before the agent picks up, the call arrives on the line. */
/* It sits at the optical centre of the night half, then lifts away as the agent picks up. */
.va.va-demo .va-demo__ringing {
  position: absolute; top: calc(42% - 24px); left: 14px; display: flex; align-items: center; gap: 14px; height: 48px;
  color: var(--ink); transition: opacity 320ms var(--ease-out), transform 640ms var(--ease-voice);
}
.va.va-demo .va-demo__ringing[data-on="false"] { opacity: 0; transform: translateY(-40px); }
.va.va-demo .va-demo__ring-ic {
  position: relative; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; flex: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--paper) 30%, transparent);
}
.va.va-demo .va-demo__ring-ic .va-i { width: 20px; height: 20px; }
.va.va-demo .va-demo__ring-ic::before, .va.va-demo .va-demo__ring-ic::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--paper) 64%, transparent); opacity: 0; }
.va.va-demo .va-demo__ring-txt { font-size: 13px; color: var(--ink); }
.va.va-demo .va-demo__ring-dots { display: inline-flex; gap: 5px; margin-left: -6px; }
.va.va-demo .va-demo__ring-dots > i { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-3); }
.va.va-demo .va-demo__stage[data-orb="ringing"] .va-demo__ring-ic::before { animation: vad-ring-ripple 640ms var(--ease-out) 2; }
.va.va-demo .va-demo__stage[data-orb="ringing"] .va-demo__ring-ic::after { animation: vad-ring-ripple 640ms var(--ease-out) 110ms 2; }
@keyframes vad-ring-ripple { 0% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.5); } }
.va.va-demo .va-demo__stage[data-orb="ringing"] .va-demo__ring-ic .va-i { animation: va-orb-ring 0.9s var(--ease-sym) 2; }
.va.va-demo .va-demo__stage[data-orb="ringing"] .va-demo__ring-dots > i { animation: vad-dot 640ms var(--ease-sym) 2; }
.va.va-demo .va-demo__stage[data-orb="ringing"] .va-demo__ring-dots > i:nth-child(2) { animation-delay: 110ms; }
.va.va-demo .va-demo__stage[data-orb="ringing"] .va-demo__ring-dots > i:nth-child(3) { animation-delay: 220ms; }
@keyframes vad-dot { 0%, 100% { background: var(--ink-3); } 40% { background: var(--paper); } }

/* Read the whole call (and reduced motion): every line, in order, all at full strength. The view has
   no step position, so no line is current (module.js). */
.va.va-demo .va-demo__stage[data-mode="full"] .va-demo__ringing { display: none; }
.va.va-demo .va-demo__stage[data-mode="full"] .va-demo__tx { -webkit-mask-image: none; mask-image: none; }
.va.va-demo .va-demo__stage[data-mode="full"] .va-demo__lines { height: auto; display: grid; gap: 18px; padding: 8px 4px 24px 0; }
.va.va-demo .va-demo__stage[data-mode="full"] .va-demo__line { position: relative; font-size: 1.0625rem; line-height: 1.5; opacity: 1; transform: none; transition: none; padding-left: 18px; }
.va.va-demo .va-demo__stage[data-mode="full"] .va-demo__line::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 1px; background: var(--line-night); }
.va.va-demo .va-demo__stage[data-mode="full"] .va-demo__who { opacity: 1; margin-bottom: 4px; }
.va.va-demo .va-demo__stage[data-mode="full"] .va-demo__say .w { opacity: 1; transition: none; }
@media (min-width: 1024px) {
  /* Split view: the transcript scrolls inside its half, fading at both edges (the ring is on the wrapper). */
  .va.va-demo .va-demo__stage[data-mode="full"] .va-demo__tx {
    overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-night) transparent;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 18px, #000 calc(100% - 22px), transparent 100%);
            mask-image: linear-gradient(180deg, transparent 0, #000 18px, #000 calc(100% - 22px), transparent 100%);
  }
  .va.va-demo .va-demo__stage[data-mode="full"] .va-demo__lines { padding-top: 24px; padding-bottom: 28px; }
  .va.va-demo .va-demo__stage[data-mode="full"] .va-demo__ledger-vp { overflow-y: auto; scrollbar-width: thin; outline-offset: 4px; border-radius: var(--r-sm); }
}

/* Field strip along the bottom of the night half, bleeding to the page edge and the seam.
   It fades in from the top so it reads as the field rising, not a band. */
.va.va-demo .va-demo__field {
  position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: var(--strip-h);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 24px); mask-image: linear-gradient(180deg, transparent 0, #000 24px);
}

/* ---------- Ledger: one row per system step ---------- */
.va.va-demo .va-demo__ledger-vp { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; transition: opacity 200ms var(--ease-out); }
.va.va-demo .va-demo__ledger-vp.is-scrolled { -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 36px); mask-image: linear-gradient(180deg, transparent 0, #000 36px); }
.va.va-demo .va-demo__ledger-vp.is-more { -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 44px), transparent 100%); mask-image: linear-gradient(180deg, #000 calc(100% - 44px), transparent 100%); }
.va.va-demo .va-demo__ledger-vp.is-scrolled.is-more { -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 36px, #000 calc(100% - 44px), transparent 100%); mask-image: linear-gradient(180deg, transparent 0, #000 36px, #000 calc(100% - 44px), transparent 100%); }
.va.va-demo .va-demo__ledger { position: relative; display: grid; gap: 0; transition: transform 420ms var(--ease-out); }
/* Rows size to their text (unitless line heights), with a rem floor that keeps the ledger's rhythm when a
   row has no detail and grows with the visitor's text size. The unitless line heights in this file are the
   old px over the font size, rounded up in the fourth place (14 / 11 is 1.2728), so the default lines stay
   whole pixels. */
.va.va-demo .va-demo__row { display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 14px; align-items: start; min-height: 2.75rem; padding: 3px 0 3px; }
/* Shorter calls (six steps) get more air between rows so the column still reads as one ledger. */
@media (min-width: 1024px) { .va.va-demo .va-demo__ledger[data-rows="6"] .va-demo__row { padding-block: clamp(3px, calc(1.3vh - 2px), 10px); } }
.va.va-demo .va-demo__row .va-glyph { margin-top: 0; }
.va.va-demo .va-demo__row .va-glyph[data-state="pending"] { opacity: 0.55; }
.va.va-demo .va-demo__row-txt { display: grid; gap: 1px; min-width: 0; justify-items: start; }
/* The step of How a call works (va-call-steps) a row belongs to: a quiet mono word above the first row
   of each run. It has its own grid row, so the glyph stays level with the title. */
.va.va-demo .va-demo__row { grid-template-areas: ". phase" "glyph txt"; }
.va.va-demo .va-demo__row > .va-glyph { grid-area: glyph; }
.va.va-demo .va-demo__row > .va-demo__row-txt { grid-area: txt; }
.va.va-demo .va-demo__phase { grid-area: phase; margin-bottom: 3px; font-family: var(--font-mono); font-size: var(--fs-tag); line-height: 1.2728; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.va.va-demo .va-demo__row[data-run="start"]:not(:first-child) { margin-top: 6px; }
.va.va-demo .va-demo__row-title {
  position: relative; z-index: 0; justify-self: start; font-weight: 700; font-size: 1rem; line-height: 1.375; color: var(--ink);
  transition: color var(--t-ui) var(--ease-out);
}
.va.va-demo .va-demo__row-title::before {
  content: ""; position: absolute; z-index: -1; inset: 0 -6px; border-radius: 4px; background: var(--citron);
  transform: scaleX(0); transform-origin: right center; transition: transform 240ms var(--ease-out);
}
.va.va-demo .va-demo__row-detail {
  font-family: var(--font-mono); font-size: var(--fs-mono); line-height: 1.3847; color: var(--ink-3); font-variant-numeric: tabular-nums;
  opacity: 0; transform: translateY(-4px); transition: opacity 400ms var(--ease-out) 80ms, transform 400ms var(--ease-out) 80ms;
}
/* Pending titles stay readable (ink-3 on paper 5.1:1); the scattered half-disc carries "not yet". */
.va.va-demo .va-demo__row[data-state="pending"] .va-demo__row-title { color: var(--ink-3); }
.va.va-demo .va-demo__row[data-state="done"] .va-demo__row-detail { opacity: 1; transform: none; }
.va.va-demo .va-demo__row.is-current .va-demo__row-title::before { transform: scaleX(1); transform-origin: left center; }
.va.va-demo .va-demo__row[data-kind="person"][data-state="done"] .va-demo__row-detail { color: var(--coral-ink); }
/* A person row's glyph holds a person, not a tick (module.js); it draws a little larger to carry the
   same weight as the tick in the done rows. */
.va.va-demo .va-demo__row[data-kind="person"] .va-glyph .va-i { width: 68%; height: 68%; }
.va.va-demo .va-demo__stage[data-mode="full"] .va-demo__ledger { transform: none !important; transition: none; }

/* ---------- Record strip: the record card and the Task inbox, pinned to the bottom ---------- */
.va.va-demo .va-demo__strip { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) 148px; gap: 12px; margin-top: 12px; transition: opacity 200ms var(--ease-out); }
.va.va-demo .va-demo__rec {
  position: relative; padding: 12px 14px 14px; border-radius: var(--r-md); background: var(--paper-card);
  border: 1px solid var(--line-paper); box-shadow: var(--shadow-sm); overflow: hidden;
  transition: box-shadow var(--t-ui) var(--ease-out), border-color var(--t-ui) var(--ease-out);
}
.va.va-demo .va-demo__rec[data-written="true"] { border-color: color-mix(in srgb, var(--forest) 40%, transparent); }
/* The record strip is an illustration (aria-hidden, told in words by the ledger): its type stays px, so its
   fixed rows hold at any text size. */
.va.va-demo .va-demo__rec-head { display: flex; align-items: center; gap: 8px; height: 18px; font-family: var(--font-mono); font-size: 11px; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.va.va-demo .va-demo__rec-name { color: var(--ink); font-weight: 700; }
.va.va-demo .va-demo__lock { position: relative; display: inline-block; flex: none; width: 14px; height: 14px; color: var(--ink); }
.va.va-demo .va-demo__lock .va-i { position: absolute; inset: 0; width: 14px; height: 14px; transition: opacity 200ms var(--ease-out), transform 260ms var(--ease-out); }
.va.va-demo .va-demo__lock-open { opacity: 0; transform: translateY(1px); }
.va.va-demo .va-demo__rec[data-open="true"] .va-demo__lock-shut { opacity: 0; }
.va.va-demo .va-demo__rec[data-open="true"] .va-demo__lock-open { opacity: 1; transform: none; color: var(--forest); }
.va.va-demo .va-demo__rec-status { position: relative; display: inline-grid; }
.va.va-demo .va-demo__rec-status > span { grid-area: 1 / 1; transition: opacity 200ms var(--ease-out); }
.va.va-demo .va-demo__st-open { opacity: 0; color: var(--forest); }
.va.va-demo .va-demo__rec[data-open="true"] .va-demo__st-shut { opacity: 0; }
.va.va-demo .va-demo__rec[data-open="true"] .va-demo__st-open { opacity: 1; }
/* The D band: each half-disc turns inside its own cell, so scattered Ds never merge into one shape. */
.va.va-demo .va-demo__band { margin-left: auto; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 14px; gap: 0; place-items: center; height: 14px; color: var(--forest); }
.va.va-demo .va-demo__band > i { width: 6px; height: 12px; border-radius: 0 6px 6px 0; transform-origin: 50% 50%; }
.va.va-demo .va-demo__band:not(.is-aligned) > i { opacity: 0.55; }

/* A narrow record card (1024 to 1150px, tablets, phones) stacks the slot row so the date never clips. */
.va.va-demo .va-demo__rec { container-type: inline-size; }
.va.va-demo .va-demo__rec-body { position: relative; display: grid; grid-template-columns: 1fr; gap: 9px; margin-top: 12px; color: var(--night-900); }
.va.va-demo .va-demo__sk { height: 8px; }
.va.va-demo .va-demo__sk--a { width: 62%; }
.va.va-demo .va-demo__sk--b { width: 38%; }
.va.va-demo .va-demo__slot, .va.va-demo .va-demo__rec-note {
  display: flex; align-items: center; gap: 8px; min-height: 22px; margin: 0; opacity: 0; transform: translateY(4px);
  transition: opacity 260ms var(--ease-out), transform 260ms var(--ease-out);
}
.va.va-demo .va-demo__rec-note { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; }
.va.va-demo .va-demo__rec-note-text { padding: 1px 6px; margin-left: -6px; border-radius: 4px; background: var(--paper-card); }
.va.va-demo .va-demo__slot .va-i, .va.va-demo .va-demo__rec-note .va-i { width: 16px; height: 16px; color: var(--forest); }
.va.va-demo .va-demo__slot-label { font-weight: 700; font-size: 14px; line-height: 1.2; color: var(--night-900); }
.va.va-demo .va-demo__rec-note-text { font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); }
.va.va-demo .va-demo__roll {
  position: relative; display: inline-block; height: 22px; overflow: hidden; margin-left: auto; padding: 0 6px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 13px; line-height: 22px; color: var(--night-900); font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1px transparent; transition: box-shadow var(--t-ui) var(--ease-out), background-color var(--t-ui) var(--ease-out);
}
.va.va-demo .va-demo__roll-in { display: grid; transition: transform 260ms var(--ease-out); }
.va.va-demo .va-demo__roll-in > span { display: block; height: 22px; white-space: nowrap; }
.va.va-demo .va-demo__roll-to { visibility: hidden; }
.va.va-demo .va-demo__rec[data-slot="true"] .va-demo__slot { opacity: 1; transform: none; }
.va.va-demo .va-demo__rec[data-note="true"] .va-demo__rec-note { opacity: 1; transform: none; }
.va.va-demo .va-demo__rec[data-hold="true"] .va-demo__roll { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--forest) 70%, transparent); background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--forest) 8%, transparent) 0 2px, transparent 2px 6px); }
.va.va-demo .va-demo__rec[data-written="true"] .va-demo__roll { background-color: color-mix(in srgb, var(--forest) 9%, transparent); }
.va.va-demo .va-demo__rec[data-written="true"] .va-demo__roll-in { transform: translateY(-22px); }
.va.va-demo .va-demo__rec[data-written="true"] .va-demo__roll-to { visibility: visible; }
.va.va-demo .va-demo__rec[data-hold="true"] .va-demo__roll-to,
.va.va-demo .va-demo__rec[data-written="true"] .va-demo__roll-from { visibility: visible; }
/* (Declared after the base slot rules so it wins on source order.) */
@container (max-width: 340px) {
  .va.va-demo .va-demo__slot { display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: 8px; row-gap: 2px; align-items: center; }
  .va.va-demo .va-demo__roll { grid-column: 1 / -1; justify-self: start; margin-left: -4px; padding: 0 4px; }
  .va.va-demo .va-demo__sk--b { display: none; }
  .va.va-demo .va-demo__rec-body { gap: 8px; margin-top: 10px; }
}
/* Locked: the record is hatched like a redaction until the caller is confirmed. */
.va.va-demo .va-demo__veil {
  position: absolute; inset: -4px -6px; border-radius: 6px; pointer-events: none;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--night-900) 7%, transparent) 0 2px, transparent 2px 7px), color-mix(in srgb, var(--paper-card) 55%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--night-900) 8%, transparent);
  transform-origin: right center; transition: transform 320ms var(--ease-out), opacity 320ms var(--ease-out);
}
.va.va-demo .va-demo__rec[data-open="true"] .va-demo__veil { transform: scaleX(0); opacity: 0; }

.va.va-demo .va-demo__inbox {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; padding: 12px; border-radius: var(--r-md);
  border: 1px dashed color-mix(in srgb, var(--ink-3) 45%, transparent); color: var(--ink-3); background: transparent;
  transition: background-color var(--t-ui) var(--ease-out), border-color var(--t-ui) var(--ease-out), color var(--t-ui) var(--ease-out);
}
.va.va-demo .va-demo__inbox-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; line-height: 1.2; }
.va.va-demo .va-demo__inbox-head .va-i { width: 18px; height: 18px; }
.va.va-demo .va-demo__task {
  display: grid; grid-template-columns: 7px minmax(0, 1fr); align-items: center; gap: 6px 8px; padding: 9px 10px; border-radius: var(--r-sm); background: var(--paper-card); color: var(--coral-ink);
  box-shadow: var(--shadow-sm);
  opacity: 0; transform: translateX(-36px); transition: opacity 260ms var(--ease-out), transform 300ms var(--ease-out);
}
/* The person cue is a coral dot, as on the end-to-end Task inbox rows, not a side stripe. */
.va.va-demo .va-demo__task::before { content: ""; grid-row: 1 / span 2; width: 7px; height: 7px; border-radius: 50%; background: var(--coral-ink); }
.va.va-demo .va-demo__task .va-skel { grid-column: 2; height: 6px; }
.va.va-demo .va-demo__task .va-skel:last-child { width: 60%; }
.va.va-demo .va-demo__inbox[data-lit="true"] { border-style: solid; border-color: color-mix(in srgb, var(--coral-ink) 55%, transparent); background: color-mix(in srgb, var(--coral) 14%, var(--paper-card)); color: var(--coral-ink); }
.va.va-demo .va-demo__inbox[data-lit="true"] .va-demo__task { opacity: 1; transform: none; }

/* ---------- Voiceprint: one segment per spoken line, across the top of the stage ----------
   Played segments are the done colour of each surface; the current one is the brightest ink, never citron. */
.va.va-demo .va-demo__vp { position: absolute; z-index: 3; top: var(--vp-top); left: var(--edge); right: var(--edge); height: 20px; transition: opacity 200ms var(--ease-out); }
.va.va-demo .va-demo__vp-row { position: absolute; inset: 0; display: flex; align-items: center; gap: 4px; }
.va.va-demo .va-demo__vp-row--night { clip-path: inset(0 50% 0 0); --seg-agent: color-mix(in srgb, var(--paper) 22%, transparent); --seg-patient: color-mix(in srgb, var(--pink) 42%, transparent); --seg-dot: var(--dim); --seg-played: var(--signal); --seg-now: var(--paper); }
.va.va-demo .va-demo__vp-row--paper { clip-path: inset(0 0 0 50%); --patient: var(--pink-ink); --seg-agent: color-mix(in srgb, var(--night-900) 13%, transparent); --seg-patient: color-mix(in srgb, var(--patient) 50%, transparent); --seg-dot: var(--ink-3-paper); --seg-played: color-mix(in srgb, var(--forest) 48%, var(--paper)); --seg-now: var(--forest); }
.va.va-demo .va-demo__seg { position: relative; flex: var(--w, 1) 1 0; min-width: 6px; height: 20px; cursor: pointer; }
.va.va-demo .va-demo__seg::before, .va.va-demo .va-demo__seg::after { content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 6px; border-radius: 3px; }
.va.va-demo .va-demo__seg::before { background: var(--seg-agent); transition: transform var(--t-micro) var(--ease-out); }
.va.va-demo .va-demo__seg::after { transition: transform 120ms linear; }
@media (hover: hover) {
  .va.va-demo .va-demo__seg:hover::before { transform: scaleY(1.67); }
  .va.va-demo .va-demo__seg:hover::after { transform: scaleX(var(--f, 0)) scaleY(1.67); }
}
.va.va-demo .va-demo__seg[data-speaker="patient"]::before { background: var(--seg-patient); }
.va.va-demo .va-demo__seg[data-ph="true"]::before { background: radial-gradient(circle, var(--seg-dot) 0 1.2px, transparent 1.6px) 0 50% / 6px 6px repeat-x; opacity: 0.9; }
.va.va-demo .va-demo__seg::after { background: var(--seg-played); transform: scaleX(var(--f, 0)); transform-origin: left center; }
.va.va-demo .va-demo__seg[data-state="current"]::after { background: var(--seg-now); }
.va.va-demo .va-demo__vp-row--paper .va-demo__seg[data-state="current"]::after { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--night-900) 28%, transparent); }
.va.va-demo .va-demo__seg[data-ph="true"][data-state="played"]::after { background: radial-gradient(circle, var(--seg-played) 0 1.6px, transparent 2px) 0 50% / 6px 6px repeat-x; }
.va.va-demo .va-demo__seg[data-ph="true"][data-state="current"]::after { background: radial-gradient(circle, var(--seg-now) 0 1.8px, transparent 2.2px) 0 50% / 6px 6px repeat-x; box-shadow: none; }

/* ---------- Thread overlay: line to orb (voice, fluid) and orb to row (systems, crisp) ---------- */
.va.va-demo .va-demo__thread { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; overflow: visible; pointer-events: none; transition: opacity 200ms var(--ease-out); }
.va.va-demo .va-demo__thread path { fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.va.va-demo .va-demo__t-voice { stroke: var(--citron); }
.va.va-demo .va-demo__t-sys { stroke: var(--forest); stroke-dasharray: 1 1; stroke-dashoffset: 0; }
.va.va-demo .va-demo__t-dot { fill: var(--citron); }
.va.va-demo .va-demo__t-sq { fill: var(--forest); }
/* While it rings, the line is a quiet dashed trace carrying the call to the orb. */
.va.va-demo .va-demo__thread.is-ring .va-demo__t-voice { stroke: color-mix(in srgb, var(--paper) 38%, transparent); stroke-dasharray: 2 6; animation: vad-dash 900ms linear infinite; }
@keyframes vad-dash { to { stroke-dashoffset: -16; } }
.va.va-demo .va-demo__stage[data-person="true"] .va-demo__t-voice { stroke: var(--coral); }
.va.va-demo .va-demo__stage[data-person="true"] .va-demo__t-dot { fill: var(--coral); }
.va.va-demo .va-demo__stage[data-person="true"] .va-demo__t-sys { stroke: var(--coral-ink); }
.va.va-demo .va-demo__stage[data-person="true"] .va-demo__t-sq { fill: var(--coral-ink); }
.va.va-demo .va-demo__thread.is-off { opacity: 0; }

/* ---------- The D-orb on the seam: paper half on night, night half on paper ---------- */
.va.va-demo .va-demo__orbpos { position: absolute; z-index: 4; top: 0; left: 0; width: var(--orb-size); height: var(--orb-size); transform: translate3d(calc(50cqw - var(--orb-size) / 2), 160px, 0); will-change: transform; pointer-events: none; }
/* A thin socket ring, split by the seam like everything else. */
.va.va-demo .va-demo__orbpos::before, .va.va-demo .va-demo__orbpos::after { content: ""; position: absolute; top: -11px; bottom: -11px; width: calc(50% + 11px); border: 1px solid; }
.va.va-demo .va-demo__orbpos::before { left: -11px; border-right: 0; border-radius: 999px 0 0 999px; border-color: var(--line-night); }
.va.va-demo .va-demo__orbpos::after { right: -11px; border-left: 0; border-radius: 0 999px 999px 0; border-color: color-mix(in srgb, var(--night-900) 16%, transparent); }
.va.va-demo .va-demo__orb { --orb: var(--orb-size); position: absolute; inset: 0; }
/* Ringing: two flat rings leave the orb before it picks up. Split at the seam like the socket. */
.va.va-demo .va-demo__ripple { position: absolute; inset: 0; pointer-events: none; }
.va.va-demo .va-demo__ripple > i { position: absolute; inset: 0; border-radius: 50%; opacity: 0; }
.va.va-demo .va-demo__ripple > i::before, .va.va-demo .va-demo__ripple > i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid; }
.va.va-demo .va-demo__ripple > i::before { border-color: color-mix(in srgb, var(--paper) 72%, transparent); clip-path: inset(0 50% 0 0); }
.va.va-demo .va-demo__ripple > i::after { border-color: color-mix(in srgb, var(--night-900) 50%, transparent); clip-path: inset(0 0 0 50%); }
.va.va-demo .va-demo__stage[data-orb="ringing"] .va-demo__ripple > i { animation: vad-ripple 640ms var(--ease-out) 2; }
.va.va-demo .va-demo__stage[data-orb="ringing"] .va-demo__ripple > i + i { animation-delay: 110ms; }
@keyframes vad-ripple { 0% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(2.1); } }
.va.va-demo .va-demo__orb .va-orb__l { background: var(--paper); opacity: 1; }
.va.va-demo .va-demo__orb .va-orb__r { background: var(--night-900); }
.va.va-demo .va-demo__orb[data-state="speaking"] .va-orb__l { opacity: 1; background: var(--paper); transform: translateX(calc(-6% - var(--amp) * 20%)) scaleY(calc(1 + var(--amp) * 0.1)); transition-duration: 90ms; }
.va.va-demo .va-demo__orb[data-state="speaking"] .va-orb__r { transform: translateX(6%); background: var(--night-900); transition-duration: 260ms; }
.va.va-demo .va-demo__orb[data-state="listening"] .va-orb__l { opacity: 1; background: var(--pink); }
.va.va-demo .va-demo__orb[data-state="acting"] .va-orb__l { transform: translateX(-6%); opacity: 1; }
.va.va-demo .va-demo__orb[data-state="acting"] .va-orb__r { background: var(--forest); transform: translateX(18%); }
.va.va-demo .va-demo__orb[data-state="done"] .va-orb__l { transform: translateX(-6%); opacity: 1; }
.va.va-demo .va-demo__orb[data-state="done"] .va-orb__r { background: var(--forest); }
.va.va-demo .va-demo__stage[data-person="true"] .va-demo__orb[data-state="acting"] .va-orb__r,
.va.va-demo .va-demo__stage[data-person="true"] .va-demo__orb[data-state="done"] .va-orb__r { background: var(--coral-ink); }
.va.va-demo .va-demo__stage.is-paused .va-demo__orb, .va.va-demo .va-demo__stage.is-paused .va-demo__orb *, .va.va-demo .va-demo__stage.is-paused .va-demo__ripple > i,
.va.va-demo .va-demo__stage.is-paused .va-demo__thread path, .va.va-demo .va-demo__stage.is-paused .va-demo__ringing *, .va.va-demo .va-demo__stage.is-paused .va-demo__ringing *::before, .va.va-demo .va-demo__stage.is-paused .va-demo__ringing *::after { animation-play-state: paused; }

/* Content swap between calls: a short fade, never a slide. */
.va.va-demo .va-demo__stage.is-swapping :is(.va-demo__tx, .va-demo__ledger-vp, .va-demo__strip, .va-demo__vp, .va-demo__thread, .va-demo__inbound) { opacity: 0; }

/* ---------- Stage footer: the transport, the stepper and Read the whole call ----------
   Two clusters on one row: playing the call (Play, with Sound and its optional voices note) on the left, and
   moving through it (the stepper, then Read) on the right. */
.va.va-demo .va-demo__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-top: 16px; }
.va.va-demo .va-demo__transport, .va.va-demo .va-demo__nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.va.va-demo .va-demo__nav { gap: 12px; margin-left: auto; }   /* wrapped (tall tablets), it keeps to the right */
.va.va-demo .va-demo__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 0 16px; border-radius: 999px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.875rem; line-height: 1; color: var(--ink); white-space: nowrap;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent);
  transition: box-shadow var(--t-ui) var(--ease-out), background-color var(--t-ui) var(--ease-out), color var(--t-ui) var(--ease-out), transform var(--t-micro) var(--ease-out), opacity var(--t-ui) var(--ease-out);
}
.va.va-demo .va-demo__btn .va-i { width: 18px; height: 18px; flex: none; }
.va.va-demo .va-demo__btn:active { transform: scale(0.98); }
/* A stepper arrow with nowhere to go, or in the whole-call view: still focusable (module.js ignores the press). */
.va.va-demo .va-demo__btn[aria-disabled="true"] { opacity: 0.4; cursor: default; transform: none; }
.va.va-demo .va-demo__btn:focus-visible { border-radius: 999px; }
.va.va-demo .va-demo__play { position: relative; overflow: hidden; isolation: isolate; height: 48px; padding: 0 22px 0 16px; background: var(--paper); color: var(--night-900); box-shadow: none; min-width: 120px; justify-content: flex-start; }
/* The hover and focus wipe is mist: citron is kept for the voice thread and the ledger highlighter. */
.va.va-demo .va-demo__play::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--mist); transform: scaleX(0); transform-origin: left; transition: transform 320ms var(--ease-out); }
.va.va-demo .va-demo__play:focus-visible::before { transform: scaleX(1); }
/* One icon at a time: Pause while playing, Play, or Replay once the call has finished (data-show). */
.va.va-demo .va-demo__play :is(.va-demo__ic-play, .va-demo__ic-replay) { display: none; }
.va.va-demo .va-demo__play[data-show="play"] .va-demo__ic-play,
.va.va-demo .va-demo__play[data-show="replay"] .va-demo__ic-replay { display: block; }
.va.va-demo .va-demo__play:not([data-show="pause"]) .va-demo__ic-pause { display: none; }

/* Sound (only rendered when a call has audio; module.js unhides it once a call's audio checks out, and
   the [hidden] rule beats the button's display). Its state is always in words: "Sound off", "Sound on".
   Off: an outline pill with speaker-slash. On: the pressed state shared with Read (below), with
   speaker-high. Loading or buffering (data-state="loading"): the icon pulses. */
.va.va-demo :is(.va-demo__sound, .va-demo__voices)[hidden] { display: none; }
.va.va-demo .va-demo__sound { padding: 0 18px 0 14px; }
.va.va-demo .va-demo__sound-state { margin-left: -3px; font-weight: 400; }
.va.va-demo .va-demo__sound :is(.va-demo__ic-sound, .va-demo__sound-on) { display: none; }
.va.va-demo .va-demo__sound[aria-pressed="true"] .va-demo__ic-sound { display: block; }
.va.va-demo .va-demo__sound[aria-pressed="true"] .va-demo__sound-on { display: inline; }
.va.va-demo .va-demo__sound[aria-pressed="true"] :is(.va-demo__ic-mute, .va-demo__sound-off) { display: none; }
.va.va-demo .va-demo__sound[data-state="loading"] .va-i { animation: vad-sound-pulse 900ms var(--ease-out) infinite alternate; }
@keyframes vad-sound-pulse { to { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .va.va-demo .va-demo__sound[data-state="loading"] .va-i { animation: none; opacity: 0.5; } }
/* The voices note (the toggle's description; optional and empty by default, so not rendered) and the
   audio status line, beside the toggle. The status line stays in the accessibility tree when empty, so
   the unavailable message is announced when it appears. */
.va.va-demo .va-demo__sound-info { display: grid; gap: 4px; min-width: 0; margin-left: 6px; }
.va.va-demo .va-demo__voices { margin: 0; color: var(--ink-3); white-space: nowrap; }
.va.va-demo .va-demo__sound-msg { max-width: 30ch; margin: 0; font-size: 0.875rem; line-height: 1.4; color: var(--ink-2); }
.va.va-demo .va-demo__sound-msg:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* The stepper: one pill, the arrows at its ends and the position between them. In the whole-call view
   (the stage's data-mode="full") it reads Whole call and the arrows rest. */
.va.va-demo .va-demo__stepper { display: inline-flex; align-items: center; flex: none; border-radius: 999px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent); }
.va.va-demo .va-demo__step { width: 44px; padding: 0; box-shadow: none; }
.va.va-demo .va-demo__step:focus-visible { outline-offset: -3px; }   /* inside the pill, clear of the count */
.va.va-demo .va-demo__count { margin: 0; padding: 0 6px; color: var(--ink-3); white-space: nowrap; }
.va.va-demo :is(.va-demo__count-now, .va-demo__count-all, .va-demo__count-whole) { color: var(--ink); }
.va.va-demo .va-demo__count-whole { display: none; }
.va.va-demo .va-demo__stage[data-mode="full"] ~ .va-demo__dock .va-demo__count-pos { display: none; }
.va.va-demo .va-demo__stage[data-mode="full"] ~ .va-demo__dock .va-demo__count-whole { display: inline; }
/* Pressed Sound and Read: the paper fill of the selected tab, with its forest icon and forest underline,
   so on never reads by colour alone (Sound also says it in words and swaps its speaker icon). No citron:
   the voice thread and the ledger highlighter stay the stage's only citron marks. */
.va.va-demo :is(.va-demo__sound, .va-demo__read)[aria-pressed="true"] { position: relative; background: var(--paper); color: var(--night-900); box-shadow: none; }
.va.va-demo :is(.va-demo__sound, .va-demo__read)[aria-pressed="true"] .va-i { color: var(--forest); }
.va.va-demo :is(.va-demo__sound, .va-demo__read)[aria-pressed="true"]::after {
  content: ""; position: absolute; left: 16px; right: 16px; bottom: 6px; height: 2px; border-radius: 2px; background: var(--forest); opacity: 0.85;
}

/* ---------- Up to 1023px: night above paper, the orb on the horizontal seam ---------- */
@media (max-width: 1023px) {
  .va.va-demo { --orb-size: 48px; --strip-h: 64px; --seam-clear: 0px; }
  .va.va-demo .va-demo__stage { height: auto; }
  .va.va-demo .va-demo__night, .va.va-demo .va-demo__paper { position: relative; left: auto; width: auto; top: auto; bottom: auto; }
  /* Heights in rem (340px and 380px at the default text size), so larger text gets a taller stage. */
  .va.va-demo .va-demo__night { height: 21.25rem; padding: 56px var(--edge) calc(var(--strip-h) + 6px); }
  .va.va-demo .va-demo__paper { height: 23.75rem; padding: 40px var(--edge) 16px; }
  .va.va-demo .va-demo__vp { top: 16px; }
  .va.va-demo .va-demo__vp-row--night { clip-path: none; }
  .va.va-demo .va-demo__vp-row--paper { display: none; }
  .va.va-demo .va-demo__row { padding-right: 52px; }
  .va.va-demo .va-demo__colhead { margin-bottom: 14px; }
  /* The systems thread runs down a clear lane on the right, so the Illustration tag sits by the label. */
  .va.va-demo .va-demo__paper .va-demo__colhead { flex-wrap: wrap; justify-content: flex-start; column-gap: 10px; padding-right: 30px; }
  .va.va-demo .va-demo__tx.is-over { --vad-fade: 36px; }
  /* Focus ring halves meet at the horizontal seam (the JS writes --seam-y). */
  .va.va-demo .va-demo__focus::before { left: 0; right: 0; width: auto; bottom: auto; height: var(--seam-y, 340px); box-shadow: inset 3px 0 0 var(--citron), inset -3px 0 0 var(--citron), inset 0 3px 0 var(--citron); }
  .va.va-demo .va-demo__focus::after { left: 0; right: 0; top: var(--seam-y, 340px); box-shadow: inset 3px 0 0 var(--forest), inset -3px 0 0 var(--forest), inset 0 -3px 0 var(--forest); }
  /* Read the whole call: the transcript and ledger lay out in the page flow, never in a nested scroller.
     The night half keeps a lane on its right for the thread down to the orb. */
  .va.va-demo .va-demo__stage[data-mode="full"] .va-demo__night,
  .va.va-demo .va-demo__stage[data-mode="full"] .va-demo__paper { height: auto; }
  .va.va-demo .va-demo__stage[data-mode="full"] .va-demo__night { padding-right: calc(var(--edge) + 40px); }
  .va.va-demo .va-demo__stage[data-mode="full"] .va-demo__txwrap,
  .va.va-demo .va-demo__stage[data-mode="full"] .va-demo__tx,
  .va.va-demo .va-demo__stage[data-mode="full"] .va-demo__ledger-vp { flex: none; overflow: visible; max-height: none; -webkit-mask-image: none; mask-image: none; }
}
/* Very narrow phones: the call time alone, so the column head never overflows. */
@media (max-width: 379px) { .va.va-demo .va-demo__inbound-tag { display: none; } }
@media (max-width: 767px) {
  .va.va-demo { --strip-h: 56px; }
  /* Phones: the tabs are one row of compact pills that scrolls sideways (native scrolling, snapping to
     each pill). It bleeds to the screen edges through the theme container's 1.25rem gutter, so pills
     slide out under the edge; the padding block holds the focus ring, which the scroller would clip.
     module.js sets data-more-start and data-more-end while there is more to swipe that way, and the
     mask fades that edge. Vertical swipes across it still scroll the page (it cannot scroll vertically). */
  .va.va-demo .va-demo__tabs {
    --vad-gutter: 1.25rem; --vad-fs: 0px; --vad-fe: 0px;
    flex: 1 1 auto; flex-wrap: nowrap; width: calc(100% + 2 * var(--vad-gutter)); min-width: 0;
    margin: -6px calc(-1 * var(--vad-gutter)); padding: 6px var(--vad-gutter);
    overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none;
    scroll-snap-type: x mandatory; scroll-padding-inline: 48px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--vad-fs), #000 calc(100% - var(--vad-fe)), transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 var(--vad-fs), #000 calc(100% - var(--vad-fe)), transparent 100%);
    transition: --vad-fs 200ms var(--ease-out), --vad-fe 200ms var(--ease-out);
  }
  .va.va-demo .va-demo__tabs::-webkit-scrollbar { display: none; }
  .va.va-demo .va-demo__tabs[data-more-start] { --vad-fs: 44px; }
  .va.va-demo .va-demo__tabs[data-more-end] { --vad-fe: 44px; }
  .va.va-demo .va-demo__tab { flex: none; height: 44px; gap: 8px; padding: 0 16px 0 14px; font-size: 0.875rem; scroll-snap-align: start; }
  .va.va-demo .va-demo__tab .va-i { width: 16px; height: 16px; }
  .va.va-demo .va-demo__tab-bar { left: 16px; right: 16px; bottom: 6px; }
  .va.va-demo .va-demo__controls { row-gap: 8px; margin-bottom: 12px; }
  .va.va-demo .va-demo__ringing { gap: 12px; height: 40px; }
  .va.va-demo .va-demo__ring-ic { width: 40px; height: 40px; }
  .va.va-demo .va-demo__strip { grid-template-columns: minmax(0, 1fr) 112px; gap: 8px; }
  .va.va-demo .va-demo__inbox { padding: 10px; }
  .va.va-demo .va-demo__inbox-head { font-size: 12px; gap: 6px; }
  .va.va-demo .va-demo__rec { padding: 10px 12px 12px; }
  .va.va-demo .va-demo__slot-label { font-size: 13px; }
  .va.va-demo .va-demo__roll { font-size: 12px; }
  /* The D band gives way first on a narrow card, so the lock, the status and the band never overflow the
     head: its cells narrow to 10px (a turned D still clears its neighbours), then it shows six Ds, then
     four (the record card's own width, from 360px and 320px phones). */
  .va.va-demo .va-demo__band { flex: 0 1 auto; min-width: 0; grid-auto-columns: minmax(10px, 12px); height: 12px; }
  @container (max-width: 191px) { .va.va-demo .va-demo__band > i:nth-child(n+7) { display: none; } }
  @container (max-width: 171px) { .va.va-demo .va-demo__band > i:nth-child(n+5) { display: none; } }
  .va.va-demo .va-demo__band > i { width: 5px; height: 10px; }
  .va.va-demo .va-demo__row-title { font-size: 0.9375rem; line-height: 1.3334; text-wrap: pretty; }
  .va.va-demo .va-demo__row-detail { font-size: 0.75rem; line-height: 1.5; text-wrap: pretty; }
}

/* ---------- Port additions ---------- */
/* The record note's icon is swapped by module.js (file-text or question). */
.va.va-demo .va-demo__rec-note .va-i { flex: none; }
/* Theme preflight sets button line-height and colour inheritance; the tab label keeps the concept's metrics. */
.va.va-demo .va-demo__tab-label { line-height: 1; }
/* The theme container's gutter is 20px where the concept's was 16px at phone widths: tighten the systems
   column head by 4px so its Illustration tag (shown only with labels.show_labels) still sits beside the
   label at 390, clear of the thread lane. */
@media (max-width: 1023px) {
  .va.va-demo .va-demo__paper .va-demo__colhead { column-gap: 8px; padding-right: 28px; }
}
/* ---------- Phones: the stage, sized so the payoff lands in view ----------
   Below 768px module.js moves the record strip up under the seam, above the ledger, and the systems
   column head shares the seam's row with the orb (clear of its socket ring), so the record card is the
   first thing on the paper half. The halves are sized from the screen: --vad-avail is the room between
   the controls (landed just under the nav by VA.toDemo; --vad-ctl is their measured height, the row
   under the tabs with Read included) and the dock (56px plus the home indicator). The night half takes what is left once the
   paper half has room for the record and one lit ledger row with a peek of the next (250px), between 236px
   and 320px; where even 236px does not fit, it gives way, down to 214px, so the record alone still clears
   the dock (150px from the seam to the record's foot). So the tabs row, the current line and the record
   share the screen from 320 x 640 up, and the lit ledger row joins them from 360 x 740. The paper half
   takes the rest. Those lengths are the default text size: they are set in rem, so larger text gets
   taller halves rather than a transcript squeezed under its column head. */
@media (max-width: 767px) {
  .va.va-demo {
    --strip-h: 48px;
    --vad-avail: calc(100vh - var(--nav-h, 82px) - 16px - var(--vad-ctl, 112px) - 56px - env(safe-area-inset-bottom) - 8px);
    --vad-night: clamp(13.375rem, max(var(--vad-avail) - 15.625rem, min(var(--vad-avail) - 9.375rem, 14.75rem)), 20rem);
  }
  @supports (height: 100svh) {
    .va.va-demo { --vad-avail: calc(100svh - var(--nav-h, 82px) - 16px - var(--vad-ctl, 112px) - 56px - env(safe-area-inset-bottom) - 8px); }
  }
  .va.va-demo .va-demo__night { height: var(--vad-night); padding-top: 46px; }
  .va.va-demo .va-demo__night .va-demo__colhead { margin-bottom: 10px; }
  .va.va-demo .va-demo__paper { height: max(15.625rem, var(--vad-avail) - var(--vad-night)); padding-top: 14px; padding-bottom: 8px; }
  .va.va-demo .va-demo__paper .va-demo__colhead { min-height: 22px; margin-bottom: 6px; padding-right: 68px; }
  .va.va-demo .va-demo__strip { margin: 0 0 12px; }
  /* A one-row ledger keeps the lit row clear of the fades: only the peek of the next row, and a previous
     row cut part-way, fade. */
  .va.va-demo .va-demo__ledger-vp.is-more { -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 20px), transparent 100%); mask-image: linear-gradient(180deg, #000 calc(100% - 20px), transparent 100%); }
  .va.va-demo .va-demo__ledger-vp.is-scrolled { -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 24px); mask-image: linear-gradient(180deg, transparent 0, #000 24px); }
  .va.va-demo .va-demo__ledger-vp.is-scrolled.is-more { -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 24px, #000 calc(100% - 20px), transparent 100%); mask-image: linear-gradient(180deg, transparent 0, #000 24px, #000 calc(100% - 20px), transparent 100%); }
}
/* ---------- Next step: the theme button row under the transport ----------
   Centred on the line of the seam (the stage splits at 50% on desktop) and set well clear of the
   player controls, so it reads as the page's next step rather than another control. */
.va.va-demo .va-demo__next { justify-content: center; margin-top: 56px; }
@media (max-width: 767px) { .va.va-demo .va-demo__next { margin-top: 40px; } }
/* ---------- Phones: Read (and the voices note, if set) in a row under the tabs ----------
   module.js moves the audio status line (with the voices note: optional, empty by default) and Read
   into .va-demo__aux, a row under the tab strip, so the dock holds only the transport and the stepper. Read keeps its words
   (alone, its list icon would read as a second menu beside the nav's), and a note, if one is set, wraps
   into the room beside it. */
@media (max-width: 767px) {
  .va.va-demo .va-demo__aux { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; width: 100%; min-width: 0; }
  /* The note's basis (8rem) is under its default share of the row, so it only wraps above Read once
     larger text leaves no room beside it. */
  .va.va-demo .va-demo__aux .va-demo__sound-info { flex: 1 1 8rem; margin-left: 0; }
  /* While the audio-unavailable line shows, it takes the whole row and Read wraps under it. */
  .va.va-demo .va-demo__aux .va-demo__sound-info:has(.va-demo__sound-msg:not(:empty)) { flex-basis: 100%; }
  .va.va-demo .va-demo__aux .va-demo__voices { white-space: normal; text-wrap: balance; font-size: 0.75rem; line-height: 1.1667; }
  .va.va-demo .va-demo__aux .va-demo__sound-msg { max-width: none; font-size: 0.8125rem; line-height: 1.35; }
  .va.va-demo .va-demo__aux .va-demo__read { flex: none; gap: 6px; margin-left: auto; padding: 0 14px 0 12px; }
}
/* ---------- The dock: the footer row on phones, and on short screens below 1024px ----------
   Keep this query in step with mqDock in module.js. One slim row: Play (a 44px icon, its label as its
   accessible name) with Sound, its state still in words, then the stepper. Larger text wraps the stepper
   under them rather than pushing it off the screen. On phones Read (with the voices note, if one is
   set) sits under the tabs (above); on short screens from 768px they stay in the row, which has room
   for them. The dock is the last child of .va-demo__body, so it sticks to the bottom of the screen while
   the tabs, stage and dock are in view, rests under the stage at the end of them, and leaves with them.
   Night fill, a hairline on top, and room for the home indicator. Tall tablets (820 x 1180, 768 x 1024)
   are left alone: landed, the tabs, stage and footer already share one screen there, so a bar would only
   cover the record strip while scrolling in. Screens 500px tall or less (a phone on its side, a small
   window) are left alone too: there the bar and the nav would cover a third of the screen or more, so the
   footer stays in the page flow under the stage (WCAG 1.4.10). */
@media (max-width: 767px) and (min-height: 501px), (max-width: 1023px) and (min-height: 501px) and (max-height: 1000px) {
  .va.va-demo .va-demo__dock {
    position: sticky; bottom: 0; z-index: 5; margin-top: 12px;
    padding-top: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom));
    background: var(--bg); box-shadow: inset 0 1px 0 var(--line);
  }
  .va.va-demo .va-demo__dock .va-demo__foot { flex-wrap: wrap; margin-top: 0; gap: 8px; }
  .va.va-demo .va-demo__dock :is(.va-demo__transport, .va-demo__nav) { flex-wrap: nowrap; gap: 8px; }
  /* Sized from nothing but never under its narrowest: the row breaks only when the words cannot fit. */
  .va.va-demo .va-demo__dock .va-demo__transport { flex: 1 1 0; min-width: min-content; }
  .va.va-demo .va-demo__dock .va-demo__play-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .va.va-demo .va-demo__dock .va-demo__play { width: 44px; min-width: 44px; height: 44px; padding: 0; gap: 0; justify-content: center; }
  .va.va-demo .va-demo__dock .va-demo__sound { flex: none; }
  .va.va-demo .va-demo__dock .va-demo__sound-info { flex: 1 1 0; margin-left: 0; }
  .va.va-demo .va-demo__dock .va-demo__voices { white-space: normal; font-size: 0.75rem; line-height: 1.1667; }
  .va.va-demo .va-demo__dock .va-demo__sound-msg { font-size: 0.8125rem; line-height: 1.35; }
  /* Keyboard focus above the bar is never left behind it. */
  .va.va-demo :is(.va-demo__tab, .va-demo__stage, .va-demo__tx, .va-demo__ledger-vp) { scroll-margin-bottom: calc(72px + env(safe-area-inset-bottom)); }
  /* Forced colours drop the hairline (a box shadow): draw it as a border. */
  @media (forced-colors: active) { .va.va-demo .va-demo__dock { border-top: 1px solid CanvasText; } }
}
@media (max-width: 767px) {
  /* Phones: Play and Sound at the start of the row, the stepper at its end. Larger text wraps the stepper
     under them rather than pushing it off the screen. */
  .va.va-demo .va-demo__dock .va-demo__foot { justify-content: space-between; flex-wrap: wrap; }
  .va.va-demo .va-demo__dock .va-demo__transport { flex: 0 1 auto; gap: 6px; min-width: 0; }
  .va.va-demo .va-demo__dock .va-demo__sound { gap: 6px; padding: 0 14px 0 12px; }
  .va.va-demo .va-demo__dock .va-demo__sound::after { left: 12px; right: 12px; }
  .va.va-demo .va-demo__dock .va-demo__count { font-size: 0.75rem; padding: 0 2px; }
}
/* Narrow phones: the row keeps its words by dropping the ones the arrows and the speaker already say.
   Below 390px the stepper shows its position alone ("3 of 9"), still read out as "Step 3 of 9". Sound
   always shows its name, so what it says starts with what it is called (WCAG 2.5.3): below 375px its
   speaker icon gives way (the state is in words), which leaves room for "Whole call". */
@media (max-width: 389px) {
  .va.va-demo .va-demo__dock .va-demo__count-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (max-width: 374px) {
  .va.va-demo .va-demo__dock .va-demo__sound .va-i { display: none; }
}
/* Under 360px "Whole call" sets on two short lines, so the stepper keeps its width, and Sound sets its
   state under its name ("Sound", then "off"). The buttons are at least 44px tall rather than exactly, so
   with larger text the stacked Sound grows to hold both lines; its padding keeps them clear of the pill's
   ends (at the default size the two lines still sit in 44px). */
@media (max-width: 359px) {
  .va.va-demo .va-demo__dock .va-demo__count { max-width: 7ch; white-space: normal; text-align: center; line-height: 1.1667; }
  .va.va-demo .va-demo__dock .va-demo__sound { flex-direction: column; justify-content: center; gap: 2px; padding: 6px 10px; }
  .va.va-demo .va-demo__dock .va-demo__sound-state { margin-left: 0; }
  .va.va-demo .va-demo__dock .va-demo__sound::after { left: 10px; right: 10px; bottom: 4px; }
}
/* Under 360px the row under the tabs has no room for Read's words beside the voices note: Read is a 44px
   icon too, a page rather than the list. */
.va.va-demo .va-demo__ic-page { display: none; }
@media (max-width: 359px) {
  .va.va-demo .va-demo__aux .va-demo__read { width: 44px; padding: 0; gap: 0; }
  .va.va-demo .va-demo__aux .va-demo__read > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .va.va-demo .va-demo__aux .va-demo__read .va-demo__ic-list { display: none; }
  .va.va-demo .va-demo__aux .va-demo__read .va-demo__ic-page { display: block; }
  /* A narrower Task inbox, so the record card keeps room for its head and the rolled slot. */
  .va.va-demo .va-demo__strip { grid-template-columns: minmax(0, 1fr) 96px; }
  .va.va-demo .va-demo__inbox { padding: 8px; }
}
/* A phone on its side: 500px tall or less, the night half shrinks so the tabs row and the transcript
   share the screen when the tabs row lands under the nav (the footer follows the stage in the page flow,
   with no dock). The current line then stays in view as the call plays; the paper half follows on scroll. */
@media (max-width: 1023px) and (max-height: 500px) {
  .va.va-demo .va-demo__controls { margin-bottom: 8px; }
  .va.va-demo .va-demo__night { height: 15.25rem; padding-top: 44px; }   /* 244px at the default text size */
  .va.va-demo .va-demo__vp { top: 12px; }
}
/* With script, va-core's VA.toDemo lands the tabs row for links to #demo (the hero's Watch a call).
   Without script, and for the browser's first jump on load, such a link lands the section clear of the
   theme's fixed nav, and with top spacing None, where it starts at its eyebrow, with a little more room. */
.va.va-demo[id] { scroll-margin-top: var(--nav-h, 82px); }
.va.va-demo.pt-0[id] { scroll-margin-top: calc(var(--nav-h, 82px) + 40px); }
/* Forced colours: keep the selected tab, the transport and the seam legible. */
@media (forced-colors: active) {
  .va.va-demo .va-demo__tab[aria-selected="true"] { outline: 2px solid CanvasText; }
  .va.va-demo .va-demo__btn { border: 1px solid ButtonText; }
  .va.va-demo .va-demo__task { border: 1px solid CanvasText; }
  .va.va-demo .va-demo__task::before { forced-color-adjust: none; background: CanvasText; }
  .va.va-demo .va-demo__row.is-current .va-demo__row-title { outline: 2px solid Highlight; }
  /* Sound or Read on: an outline as well as the icon, since the paper fill and underline are dropped. */
  .va.va-demo :is(.va-demo__sound, .va-demo__read)[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: 2px; }
  .va.va-demo .va-demo__sound:focus-visible { outline: 3px solid CanvasText; outline-offset: 3px; }
}
