/* The demo: the intro gate, the panel (step strip, chat pane, output pane), the widgets and the connector lines.
   Colours come from tokens.css only. A picked or pressed thing is filled with ink; a highlighted one gets a 1.5px ink
   outline; moss marks only the done tag and the applied value; danger is used only on a refusal, next to its words. */

/* ---- Intro gate: the logo, the subtitle, the demo, the waitlist and the footer stay hidden until the first intro frame ----------------------- */
html.intro .page h1, html.intro .tagline, html.intro .demo, html.intro .waitlist, html.intro .page footer { visibility: hidden; }
.tc-logo .tc-w { white-space: pre; }
.tc-logo .n { color: var(--line-strong); }

/* ---- Panel ---------------------------------------------------------------------------------------------------- */
.demo {
  /* The type scale of tokens.css (.label 12/16, .code 13/20, .body-sm 14/22), which defines it in classes only. */
  --fs-label: 12px; --fs-code: 13px; --fs-body-sm: 14px;
  --demo-w: 860px; --body-h: 500px; --chat-w: 400px; --chat-narrow-h: 500px;
  grid-row: 4; align-self: start; width: 100%; max-width: var(--demo-w); margin-top: var(--space-8);
}
.demo:not(.on) { visibility: hidden; }
.demo-panel { position: relative; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.demo-step { display: flex; align-items: baseline; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); }
.demo-step-n { flex: none; font-family: var(--font-mono); font-size: var(--fs-label); line-height: 22px; letter-spacing: 0.06em; color: var(--ink-muted); }
.demo-step-t { font-family: var(--font-sans); font-size: var(--fs-body-sm); line-height: 22px; color: var(--ink); height: 66px; overflow: hidden; }
@media (min-width: 640px) { .demo-step-t { height: 44px; } }
.demo-body { display: grid; grid-template-columns: var(--chat-w) 1fr; height: var(--body-h); }
.demo-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: var(--space-4); position: relative; }
.demo-pane + .demo-pane { border-left: 1px solid var(--line); }
.demo-label { display: flex; justify-content: space-between; gap: var(--space-3); height: 16px; margin-bottom: var(--space-2); font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 500; line-height: 16px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; }
.demo-label.status { display: block; flex: none; height: 44px; margin: auto 0 0; line-height: 44px; font-weight: 400; text-transform: none; letter-spacing: 0; }
.demo-label .did { color: var(--ink); }
.demo-label .now { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.25em; }
.demo-label .todo { color: var(--ink-muted); }
.demo-label .danger { color: var(--danger); }

/* ---- Chat: messages stack from the bottom; older ones leave at the top ---------------------------------------- */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 28px); mask-image: linear-gradient(transparent, #000 28px); }
.cm { flex: none; overflow: hidden; padding-top: var(--space-3); display: none; }
.cm-user.shown { display: flex; justify-content: flex-end; }
.cm-sys.shown { display: block; }
.cm-user .b { max-width: 85%; padding: var(--space-2) var(--space-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); font-family: var(--font-sans); font-size: var(--fs-body-sm); line-height: 22px; color: var(--ink); }
.cm-user .w.lit, .cm-sys .qw.lit, .refusal .w.lit { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.cm-user.refused .b { text-decoration: underline; text-decoration-color: var(--danger); text-decoration-thickness: 1.5px; text-underline-offset: 0.25em; }
/* typed.chat's messages, a confirm card included, take the full width of the chat with a rule on their left; the person's are filled
   bubbles on the right. */
.cm-sys .sb, .card { border-left: 2px solid var(--line-strong); padding: var(--space-1) 0 var(--space-1) var(--space-3); }
.cm-meta { margin-bottom: var(--space-1); font-family: var(--font-mono); font-size: var(--fs-label); font-weight: 500; line-height: 16px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.q { display: flex; align-items: baseline; gap: var(--space-2); font-family: var(--font-sans); font-size: var(--fs-body-sm); line-height: 22px; color: var(--ink); }
.q-role { font-family: var(--font-mono); font-size: var(--fs-code); line-height: 20px; color: var(--ink-muted); }
.q-words { font-family: var(--font-mono); font-size: var(--fs-code); line-height: 20px; color: var(--ink); }
.q-slot { display: inline-flex; gap: var(--space-2); margin-top: var(--space-2); padding: 2px var(--space-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: var(--fs-code); line-height: 20px; color: var(--ink); }
.q-slot .k { color: var(--ink-muted); }
.q-opts { display: flex; flex-direction: column; gap: var(--space-1); margin-top: var(--space-2); }
.q-opt { display: flex; gap: var(--space-2); padding: 2px var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: var(--font-sans); font-size: var(--fs-body-sm); line-height: 20px; color: var(--ink); }
.q-opt .n { flex: none; font-family: var(--font-mono); font-size: var(--fs-code); color: var(--ink-muted); }
/* A refusal: the fixed sentence under a danger rule, in the question or card it was shown again with. */
.refusal { margin-top: var(--space-2); padding-top: var(--space-1); border-top: 1.5px solid var(--danger); font-family: var(--font-sans); font-size: var(--fs-body-sm); line-height: 20px; color: var(--danger); }
.refusal .w { font-family: var(--font-mono); font-size: var(--fs-code); }

/* Options: highlighted, picked, and the others once the pick is made. */
[data-o].hl { outline: 1.5px solid var(--ink); outline-offset: 1px; }
[data-o].pk { background: var(--ink); border-color: var(--ink); color: var(--surface-raised); }
[data-o].pk .n { color: var(--surface-raised); }
[data-o].dim { opacity: 0.45; }

/* ---- Confirm card --------------------------------------------------------------------------------------------- */
.card { display: flex; flex-direction: column; gap: var(--space-2); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.card-title { font-family: var(--font-mono); font-size: var(--fs-body-sm); line-height: 20px; font-weight: 500; color: var(--ink); }
.card .done:not(.on) { visibility: hidden; }
.card dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; column-gap: var(--space-3); row-gap: 2px; font-family: var(--font-mono); font-size: var(--fs-code); line-height: 20px; }
.card dt { color: var(--ink-muted); }
.card dd { margin: 0; color: var(--ink); min-width: 0; }
.card .fbs { margin-left: var(--space-2); font-size: var(--fs-label); line-height: 16px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; }
.card .rw .qw { color: var(--ink-muted); }
.card .rep .why { font-family: var(--font-sans); color: var(--ink-muted); }
.card .badge { height: 20px; background: transparent; border-color: var(--line-strong); color: var(--ink); }
.card .refusal { margin-top: 0; }
.tick { display: inline-flex; align-items: center; gap: var(--space-2); font-family: var(--font-sans); font-size: var(--fs-body-sm); color: var(--ink); }
.tick .box { flex: none; display: inline-grid; place-items: center; width: 14px; height: 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); }
.tick .box svg { width: 10px; height: 10px; fill: none; stroke: var(--surface-raised); stroke-width: 1.5; stroke-linecap: square; stroke-linejoin: miter; visibility: hidden; }
.tick.ticked .box { background: var(--ink); border-color: var(--ink); }
.tick.ticked .box svg { visibility: visible; }
.tick.pulse .box { border-color: var(--danger); outline: 1.5px solid var(--danger); outline-offset: 1px; }
.part { overflow: hidden; }
.part:not(.shown) { display: none; }
.card-actions { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); }
.card-actions .tc-btn { height: 28px; padding: 0 var(--space-3); font-size: var(--fs-body-sm); cursor: default; transition: none; }
.card-actions .tc-btn.pressed { background: var(--ink); border-color: var(--ink); color: var(--surface-raised); }

/* ---- Composer and the pop slot above it ----------------------------------------------------------------------- */
.composer-wrap { position: relative; flex: none; margin-top: var(--space-3); }
.composer { display: flex; align-items: center; height: 44px; padding: 0 var(--space-3); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-md); font-family: var(--font-sans); font-size: var(--fs-body-sm); line-height: 22px; color: var(--ink); white-space: pre; overflow: hidden; }
/* The typed text and the caret: once they are wider than the field, the start is cut so the caret stays in view. */
.composer .run { display: flex; flex: 0 1 auto; min-width: 0; align-items: center; justify-content: flex-end; overflow: hidden; }
.composer .txt, .composer .caret { flex: none; }
.composer .ph { color: var(--ink-muted); }
.composer .ph.ghost { font-family: var(--font-mono); font-size: var(--fs-code); }
.composer .caret { display: inline-block; width: 0.55em; height: 1.15em; margin-left: 1px; background: var(--ink); }
.composer .ph:not(.on), .composer .caret:not(.on) { display: none; }
.pops { position: absolute; left: 0; right: 0; bottom: calc(100% + var(--space-2)); display: flex; justify-content: center; }
.pop:not(.open) { display: none; }

/* Date picker */
.dp { display: grid; grid-template-columns: max-content; padding: var(--space-2) var(--space-3); background: var(--surface-raised); border: 1px solid var(--line-strong); border-radius: var(--radius-md); font-family: var(--font-mono); font-size: var(--fs-code); line-height: 20px; white-space: pre; color: var(--ink-muted); }
.dp .d { color: var(--ink); }
.dp .d.in { background: var(--line); }
.dp .d.end, .dp .d.pk { background: var(--ink); color: var(--surface-raised); }
.dp .d.hl { outline-offset: 0; }
.dp .d.dim { opacity: 1; }

/* Record cards */
.rc { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.rc-card { flex: 1; display: grid; grid-template-columns: 24px auto; grid-template-rows: auto auto; column-gap: var(--space-2); align-items: center; padding: var(--space-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--ink); }
.rc-icon { grid-row: 1 / 3; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: square; stroke-linejoin: miter; }
.rc-n { justify-self: start; min-width: 16px; padding: 0 4px; border: 1px solid currentColor; border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: var(--fs-label); line-height: 14px; text-align: center; }
.rc-l { font-family: var(--font-mono); font-size: var(--fs-code); line-height: 20px; white-space: nowrap; }

/* Seat map: each seat shows its option number over its label. */
.sm { display: inline-grid; grid-template-columns: 16px repeat(var(--sm-cols), 32px); grid-auto-rows: 34px; gap: var(--space-1); margin-top: var(--space-2); padding: var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: var(--fs-label); line-height: 14px; }
.sm-row { grid-column: 1; align-self: center; color: var(--ink-muted); }
.sm-seat { display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1.5px solid var(--ink-muted); border-radius: var(--radius-sm); color: var(--ink); }
.sm-seat .n { color: var(--ink-muted); }

/* Hour list: each free hour shows its option number over the hour. */
.hours { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); font-family: var(--font-mono); font-size: var(--fs-label); line-height: 14px; }
.hours-h { display: flex; flex-direction: column; align-items: center; min-width: 56px; padding: var(--space-1) var(--space-2); border: 1.5px solid var(--ink-muted); border-radius: var(--radius-sm); color: var(--ink); }
.hours-h .n { color: var(--ink-muted); }
.hours-h .l { font-size: var(--fs-code); line-height: 20px; }

/* Dial */
.dial { margin-top: var(--space-2); }
.dial-svg { display: block; width: 200px; height: 108px; overflow: visible; }
.dial-arc { fill: none; stroke: var(--line); stroke-width: 10; }
.dial-arc.hl { outline: 0; stroke: var(--line-strong); }
.dial-arc.pk { stroke: var(--ink); }
.dial-icon { fill: none; stroke: var(--ink-muted); stroke-width: 1.5; stroke-linecap: square; stroke-linejoin: miter; }
.dial-n { font-family: var(--font-mono); font-size: var(--fs-label); fill: var(--ink-muted); }
.dial-needle line { stroke: var(--ink); stroke-width: 1.5; stroke-linecap: square; }
.dial-needle rect { fill: var(--ink); }

/* The bubble as a cut picker */
.cut { display: flex; flex-direction: column; align-items: flex-end; max-width: 85%; padding-bottom: 4px; }
.cut .b { max-width: 100%; }
.cut-whole.pk { background: var(--surface); color: var(--ink); }
.cut-whole.dim { opacity: 1; }
.cut-seam { display: inline-block; width: 0; height: 1.1em; margin: 0 1px; vertical-align: -0.2em; border-left: 1.5px dashed transparent; }
.cut-seam.hl, .cut-seam.pk { outline: 0; background: none; border-left-color: var(--ink); }
.cut-split { display: none; flex-direction: column; align-items: flex-end; }
.cut.split .cut-whole { display: none; }
.cut.split .cut-split { display: flex; }
.cut-part + .cut-part { margin-top: -1px; }
.cut-part .ln { margin-right: var(--space-2); font-family: var(--font-mono); font-size: var(--fs-code); color: var(--ink-muted); }

/* ---- What typed.chat sends: a character grid, one span per cell ------------------------------------------------ */
.out { font-family: var(--font-mono); font-variant-ligatures: none; font-size: var(--fs-label); line-height: 1.5; white-space: pre; color: var(--ink-muted); }
.out div { height: 1.5em; }
.out .v { color: var(--ink); }
.out .n { color: var(--line-strong); }
.out .m { color: var(--moss); }
.out .lk { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.25em; }

/* ---- Connector lines ------------------------------------------------------------------------------------------ */
.links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.links path { fill: none; stroke: var(--ink-muted); stroke-width: 1; }
.links rect { fill: var(--ink-muted); }

@media (max-width: 899px) {
  .demo-body { grid-template-columns: 1fr; height: auto; }
  .demo-chat { height: var(--chat-narrow-h); }
  .demo-pane + .demo-pane { border-left: 0; border-top: 1px solid var(--line); }
  .out { font-size: min(var(--fs-label), calc((100vw - 66px) / (var(--out-cols, 58) * 0.6))); height: calc(var(--out-rows, 20) * 1.5em); }
}
