/* Home Speech-to-Ticket demo (#speech-to-ticket): copy beside one small stage.
   The markup at rest is the finished picture. js/home-voice.js adds .is-live and
   replays it: record, write up, draft with proof threads, ready to review. */

.voice__grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 56px; align-items: start; }
.voice { --voice-rec-rgb: 255 107 97; }
[data-theme='light'] .voice { --voice-rec-rgb: 190 50 44; }
.voice .section-heading { margin-bottom: 24px; }
.voice .eyebrow > span { padding: 1px 8px; border: 1px solid rgb(var(--signal-rgb) / .4); border-radius: 999px; letter-spacing: .04em; }

/* The copy narrates the stage (23 November 2026, the user's request: the text beside the stage read
   plain). The two buttons the lede names are drawn as buttons, sized so each takes the width its words
   took before (smaller type pays for the padding) and the lede breaks where it always did; Record call's
   light sits inside the key before its label, as on the stage's dock, and beats while the stage
   records; Create Ticket lights when the draft is ready. The light's 10px moves one line break at
   342-348px (the section is 24px taller there) and 742-754px (the section is not). */
.voice-key { position: relative; padding: 0 5px; border: 1px solid var(--line-2); border-radius: 5px; background: var(--surface); font-size: .86em; white-space: nowrap; transition: border-color .5s var(--ease), background-color .5s var(--ease); }
.voice-key--rec { padding-left: 15px; }
.voice-key--rec::before { content: ''; position: absolute; left: 6px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: rgb(var(--voice-rec-rgb)); }
.voice[data-voice-phase='rec'] .voice-key--rec { border-color: rgb(var(--voice-rec-rgb) / .5); }
.voice[data-voice-phase='rec'] .voice-key--rec::before { animation: voice-rec 1.1s ease-in-out infinite; }
/* Quietly: the stage's own Create Ticket button is the loud one. */
.voice[data-voice-phase='ready'] .voice-key:not(.voice-key--rec) { border-color: var(--teal-line, rgb(var(--signal-rgb) / .45)); background: var(--teal-wash, rgb(var(--signal-rgb) / .1)); }

/* The three facts are the call's three steps, in the stage's order: Record (the microphone), Write up
   (on your server), Draft (only words that were said). Each top hairline is a track that runs the
   full measure; js/home-voice.js fills it (--p) while that step plays and lights the step's icon.
   The icon hangs in a 20px gutter level with the first line, so every fact's text starts on one edge
   (23 November 2026, the user's request: cleaner and more aligned). Any gutter costs a fact a line
   at some widths; 20px costs the fewest (the section is 21px taller at 410-450, 820-900 and
   1040-1110px; 1120px and wider are unchanged). Lists under 340px, where it would cost two lines,
   drop the icons and the gutter. At rest, and without the script, every step is done: tracks full,
   icons in the signal colour. */
.voice__facts { list-style: none; max-width: 46ch; margin: 0 0 22px; padding: 0; container: voicefacts / inline-size; }
.voice__facts li { position: relative; padding: 11px 0 11px 20px; border-top: 1px solid transparent; font-size: 14px; line-height: 1.5; color: var(--muted); transition: color .5s var(--ease); }
.voice__facts li:last-child { border-bottom: 1px solid var(--line); }
.voice__facts li::before, .voice__facts li::after { content: ''; position: absolute; left: 0; right: 0; top: -1px; height: 1px; }
.voice__facts li::before { background: var(--line); }
.voice__facts li::after { background: linear-gradient(90deg, rgb(var(--signal-rgb) / .1), var(--signal)); transform: scaleX(var(--p, 1)); transform-origin: left; opacity: calc(.4 * var(--fade, 1)); transition: opacity .5s var(--ease); }
/* 11px padding, then centred on the 21px first line */
.voice__facts svg { position: absolute; left: 0; top: 14.5px; width: 14px; height: 14px; fill: none; stroke: var(--signal); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: .8; transition: stroke .4s var(--ease), filter .4s var(--ease), opacity .4s var(--ease); }
.voice__facts.is-live li:not(.is-on, .is-done) svg { stroke: var(--faint); }
.voice__facts li.is-on { color: var(--text); }
.voice__facts li.is-on::after { opacity: 1; box-shadow: 0 0 8px rgb(var(--signal-rgb) / .55); }
.voice__facts li.is-on svg { opacity: 1; filter: drop-shadow(0 0 5px rgb(var(--signal-rgb) / .7)); }
@container voicefacts (max-width: 339px) {
  .voice__facts li { padding-left: 0; }
  .voice__facts svg { display: none; }
}
.voice__more { font-size: 14px; color: var(--text); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 4px; }
.voice__more:hover { text-decoration-color: var(--signal); }
.voice__more:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Stage: a lit plate, like the workflow cards below it (23 November 2026, the user's request: the
   section read blank beside the rest of the page). The 1px edge stays a border, so the stage keeps
   its size: a gradient on the border box catches teal light at the top and falls away below, and a
   soft glow sits round the waveform. */
.voice-stage { position: relative; margin: 0; border: 1px solid transparent; border-radius: 10px; overflow: hidden; container-type: inline-size; isolation: isolate;
  background:
    radial-gradient(64% 104px at 50% 74px, rgb(var(--signal-rgb) / .1), transparent 72%) padding-box,
    linear-gradient(180deg, rgb(var(--signal-rgb) / .035), transparent 150px) padding-box,
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(180deg, rgb(var(--signal-rgb) / .5), var(--line-2) 24%, var(--line) 70%, var(--line-2)) border-box;
  box-shadow: 0 30px 60px -32px rgb(0 0 0 / .85), 0 0 90px -46px rgb(var(--signal-rgb) / .5); }
[data-theme='light'] .voice-stage {
  box-shadow: 0 30px 60px -36px rgb(40 30 10 / .3), 0 0 80px -46px rgb(var(--signal-rgb) / .35); }
.voice-stage__fx { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }

.voice-dock { display: flex; align-items: center; gap: 14px; padding: 13px 18px; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.2; }
.voice-dock__state { display: inline-flex; align-items: center; gap: 9px; margin-right: auto; color: var(--text); }
.voice-dock__state i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); }
/* The microphone's level: five bars the canvas draws in this box (js/home-voice.js drawMeter). */
.voice-dock__meter { flex: none; width: 18px; height: 12px; margin-right: -6px; }
.voice-dock__src { font-size: 12px; color: var(--faint); }
.voice-dock__time { min-width: 4ch; font: 400 12px/1 var(--mono); text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.voice-stage[data-phase='idle'] .voice-dock__state i { background: none; box-shadow: inset 0 0 0 1.5px var(--faint); }
.voice-stage[data-phase='rec'] .voice-dock__state i { background: rgb(var(--voice-rec-rgb)); animation: voice-rec 1.1s ease-in-out infinite; }
.voice-stage[data-phase='write'] .voice-dock__state i,
.voice-stage[data-phase='draft'] .voice-dock__state i { animation: voice-work .7s ease-in-out infinite alternate; }
@keyframes voice-rec {
  0%, 100% { box-shadow: 0 0 0 0 rgb(var(--voice-rec-rgb) / .45); }
  60% { box-shadow: 0 0 0 6px rgb(var(--voice-rec-rgb) / 0); }
}
@keyframes voice-work { from { opacity: .35; } to { opacity: 1; } }

/* The waveform is drawn on the canvas over this strip; the hairline is its baseline. The strip reads
   as a recorder's scale: a tick for each second of the 48-second call along its foot, a taller one
   and a faint grid line every 12 seconds, inset 18px like the bars. Once the call is written up the
   canvas leaves the words on the baseline, with a pin at each word the ticket is proved by. */
.voice-wave { height: 56px; border-bottom: 1px solid var(--line);
  background:
    linear-gradient(var(--line), var(--line)) center / calc(100% - 36px) 1px no-repeat,
    linear-gradient(var(--line-2), var(--line-2)) right 18px bottom 0 / 1px 9px no-repeat,
    repeating-linear-gradient(90deg, var(--line-2) 0 1px, transparent 1px 25%) 18px 100% / calc(100% - 36px) 9px no-repeat,
    repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px calc(100% / 48)) 18px 100% / calc(100% - 36px) 4px no-repeat,
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--line) 55%, transparent) 0 1px, transparent 1px 25%) 18px 0 / calc(100% - 36px) 100% no-repeat,
    linear-gradient(180deg, transparent 20%, rgb(var(--signal-rgb) / .035)); }

.voice-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 26px; padding: 18px 18px 20px; }
.voice-label { margin: 0 0 10px; font: 500 11px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.voice-text { margin: 0; font-size: 14px; line-height: 1.65; color: var(--muted); }
.voice-text mark { background: none; color: var(--text); white-space: nowrap; box-shadow: inset 0 -1px 0 rgb(var(--signal-rgb) / .75); }

.voice-rows { margin: 0; }
.voice-row { position: relative; display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 8px 0 8px 14px; border-top: 1px solid var(--line); }
.voice-row::before { content: ''; position: absolute; left: 0; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--signal); transition: background-color .3s var(--ease); }
.voice-row dt { font-size: 12px; color: var(--faint); }
.voice-row dd { min-width: 0; margin: 0; font-size: 13px; color: var(--text); }
.voice-row--none::before { background: none; box-shadow: inset 0 0 0 1px var(--line-2); }
.voice-none { padding: 2px 8px; border: 1px dashed var(--line-2); border-radius: 999px; font-size: 12px; color: var(--muted); }

.voice-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 14px 0 0; font-size: 12px; color: var(--faint); }
.voice-create { position: relative; overflow: hidden; padding: 9px 14px; border-radius: 6px; background: var(--signal); font: 500 13px/1 var(--sans); color: var(--bg); transition: background-color .35s var(--ease), color .35s var(--ease), box-shadow .35s var(--ease); }

/* Replay states: everything above is the end state; .is-live hides what has not happened yet. */
.voice-stage.is-live .voice-w { opacity: 0; filter: blur(3px); transition: opacity .4s var(--ease), filter .4s var(--ease), color .5s var(--ease), box-shadow .5s var(--ease); }
.voice-stage.is-live .voice-w.is-in { opacity: 1; filter: none; }
.voice-stage.is-live mark.voice-w:not(.is-lit) { color: var(--muted); box-shadow: inset 0 -1px 0 transparent; }
.voice-stage.is-live mark.voice-w.is-lit { animation: voice-lit .9s var(--ease); }
@keyframes voice-lit { 0% { background-color: rgb(var(--signal-rgb) / .28); } 100% { background-color: rgb(var(--signal-rgb) / 0); } }
.voice-stage.is-live .voice-row:not(.is-filled)::before { background: var(--line-2); }
/* A value lands: its dot rings and a teal wash runs along the row once, while the draft is written. */
.voice-row::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; background: linear-gradient(90deg, var(--teal-wash, rgb(var(--signal-rgb) / .1)), transparent 85%); }
.voice-stage[data-phase='draft'] .voice-row.is-filled::after { animation: voice-row-in 1.1s var(--ease); }
.voice-stage[data-phase='draft'] .voice-row.is-filled:not(.voice-row--none)::before { animation: voice-dot-in .7s var(--ease); }
@keyframes voice-row-in { 0% { opacity: 0; clip-path: inset(0 100% 0 0); } 30% { opacity: 1; clip-path: inset(0 0 0 0); } 100% { opacity: 0; } }
@keyframes voice-dot-in { 0% { box-shadow: 0 0 0 0 rgb(var(--signal-rgb) / .55); } 100% { box-shadow: 0 0 0 7px rgb(var(--signal-rgb) / 0); } }
.voice-stage.is-live .voice-row--none:not(.is-filled) .voice-none { opacity: 0; }
.voice-none { transition: opacity .4s var(--ease); }
.voice-off { opacity: 0; }
.voice-row.is-typing .voice-on::after { content: ''; display: inline-block; width: 1.5px; height: 1.05em; margin-left: 1px; vertical-align: -2px; background: var(--signal); }
.voice-stage.is-live .voice-create:not(.is-ready) { background: transparent; color: var(--faint); box-shadow: inset 0 0 0 1px var(--line-2); }
.voice-stage.is-live .voice-create.is-ready::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / .45) 50%, transparent 70%); transform: translateX(-110%); animation: voice-sheen .9s var(--ease) .15s; }
@keyframes voice-sheen { to { transform: translateX(110%); } }

/* The Pause control holds the finished picture. */
html.xomea-motion-paused .voice-stage *,
html.xomea-motion-paused .voice-stage *::after,
html.xomea-motion-paused .voice-key,
html.xomea-motion-paused .voice-key::before,
html.xomea-motion-paused .voice__facts li,
html.xomea-motion-paused .voice__facts li::after,
html.xomea-motion-paused .voice__facts svg { animation: none !important; transition: none !important; }

@container (max-width: 540px) {
  .voice-body { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .voice-dock__src { display: none; }
}
@media (max-width: 960px) {
  .voice__grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
}
/* Stacked on a tablet the copy kept its desktop measure and left the right half of the row empty
   (19 November 2026, the user's request): the facts and the link stand beside the heading instead,
   their first rule level with the title. Phones keep the single column. */
@media (min-width: 701px) and (max-width: 960px) {
  .voice__grid > :first-child { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 44px; }
  .voice__grid > :first-child > .section-heading { grid-column: 1; grid-row: 1 / span 2; margin-bottom: 0; }
  /* 32px: the eyebrow's line and the heading's 16px gap, so the first rule meets the title */
  .voice__facts { grid-column: 2; grid-row: 1; max-width: none; margin-top: 32px; }
  .voice__more { grid-column: 2; grid-row: 2; justify-self: start; align-self: start; }
}
