/* One chat window for every Lumi chat on this page (his picks, 19 Nov 2026, chat LUMI CHAT LOOK).
   Built from the "One brain, four jobs" window: a glass shell, the messages on one inner white card,
   the buttons at the card's foot, a glow only while Lumi replies, a small live Lumi in the name row,
   Lumi's own lines in a lavender to blue bubble (his lines stay the black pill: they are the
   visitor's), and the site chat greets you instead of naming itself.
   It dresses the windows the sections already draw: the hero (.hc-*) and the kit's .ccs windows in
   "It speaks for me", "One brain, four jobs" and the Rulebook. chat.js adds the parts styled here
   (.cw-halo, .cw-card, .cw-av, .cw-greet). It loads after every section's own sheet, and each rule
   starts html[data-study="lumi"] so it outranks the section's own.
   The glow is a copy of the site chat's (PR 1414, .ccs-halo): once that lands in the kit and the lift
   brings it into ccs.css, this copy goes. */

/* ---------- The glow while Lumi replies ---------- */
@property --cw-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes cw-spin { to { --cw-a: 360deg; } }
.cw-halo { position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; --cw-g: 0; }
.cw-halo i {
  position: absolute; border-radius: inherit; opacity: calc(var(--cw-g) * var(--alpha-600) * var(--cw-p));
  transition: opacity var(--duration-slow) var(--ease-default);
  background: conic-gradient(from var(--cw-a), var(--fx-spectrum-1), var(--fx-spectrum-2), var(--fx-spectrum-3), var(--fx-spectrum-4), var(--fx-spectrum-5), var(--fx-spectrum-6), var(--fx-spectrum-1));
  animation: cw-spin calc(var(--fx-spectrum-spin) * 5) linear infinite;
}
.cw-halo i:first-child { inset: calc(-1 * var(--space-50)); filter: blur(var(--space-200)); --cw-p: var(--alpha-700); }
.cw-halo i + i { inset: calc(-1 * var(--space-300)); filter: blur(var(--space-600)); --cw-p: var(--alpha-500); }
.cw-halo b { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(var(--glass-tint-scrolled), var(--glass-tint-scrolled)), var(--color-surface); opacity: var(--cw-g); transition: opacity var(--duration-slow) var(--ease-default); }
:is(.ccs, .h-win-m)[data-busy] .cw-halo { --cw-g: 1; }
@media (prefers-reduced-motion: reduce) { .cw-halo i { animation: none; --cw-a: 125deg; } .cw-halo b, .cw-av { transition: none; } }
[data-motion-paused="1"] .cw-av { transition: none; }
[data-motion-paused="1"] .cw-halo i { animation: none; }
@media (forced-colors: active) { .cw-halo { display: none !important; } }
html[data-study="lumi"] .ccs-ring { display: none; }
/* the hero's own glow came on while Lumi thinks and stayed once the booking was done: now only while it replies */
html[data-study="lumi"] #hero .hero[data-on~="win"] .h-win[data-glow], html[data-study="lumi"] #hero .h-win { --glow-on: 0; }
html[data-study="lumi"] #hero .h-halo { display: none; }

/* ---------- The shell: one light glass on every ground ---------- */
/* Every colour is worked out on the element that wears it, from the theme tokens, so a window the page
   keeps light inside the dark theme (the Rulebook's) stays light, and the others follow the page. */
[data-theme="light"] { --cw-ga: 55%; --cw-gb: 45%; --cw-quiet: 100%; }
[data-theme="dark"] { --cw-ga: 38%; --cw-gb: 32%; --cw-quiet: 30%; }
/* the lit rule follows the page's theme, not the Rulebook sheet's own light one, so its two numbers sit on the root alone */
html[data-theme="light"] { --cw-lit-a: 55%; --cw-lit-b: 45%; }
html[data-theme="dark"] { --cw-lit-a: 38%; --cw-lit-b: 32%; }
html[data-study="lumi"] .ccs-win, html[data-study="lumi"] .hc-win { isolation: isolate; }
html[data-study="lumi"] :is(.ccs-win, .hc-win) { --cw-shell: color-mix(in srgb, color-mix(in srgb, var(--color-text-primary) 5%, var(--color-surface)) 82%, transparent); }
html[data-study="lumi"] .ccs-win, html[data-study="lumi"] #hero .hc-win, html[data-study="lumi"] #brief .b-win .ccs-win, html[data-study="lumi"] #thinks .t-win .ccs-win { background: var(--cw-shell); }
/* the Rulebook's window keeps a solid shell: the page holds it light in both themes, so the dark page never shows through */
html[data-study="lumi"] #rulebook .r-win .ccs-win { --cw-shell: color-mix(in srgb, var(--color-text-primary) 5%, var(--color-surface)); background: var(--cw-shell); }

/* ---------- The inner white card, the buttons at its foot ---------- */
html[data-study="lumi"] .cw-card {
  position: relative; display: flex; flex-direction: column; flex: 0 1 auto; min-height: 0;
  background: var(--color-surface); border-radius: var(--radius-lg);
}
html[data-study="lumi"] .cw-card > .ccs-log { background: none; border-radius: 0; flex: 1 1 auto; }
html[data-study="lumi"] #rulebook .r-win .cw-card { flex: 1 1 auto; }
html[data-study="lumi"] .cw-card:has(+ .ccs-chips:not(:empty)) { border-end-start-radius: 0; border-end-end-radius: 0; }
html[data-study="lumi"] .ccs-win > .ccs-chips:not(:empty) {
  margin-top: calc(-1 * var(--space-200)); padding: 0 var(--space-300) var(--space-300);
  background: var(--color-surface); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
/* the hero is drawn in em, so it scales with its film: its card is .hc-body */
html[data-study="lumi"] #hero .hc-body { background: var(--color-surface); border-radius: var(--radius-lg); }
html[data-study="lumi"] #hero .hc-log { padding: 0.7em 0.8em; } /* lint-ok: the hero's chat is sized in em with its film */
html[data-study="lumi"] #hero .hc-name { padding-top: 0.35em; } /* lint-ok: em, as the hero's lockup */
html[data-study="lumi"] #hero .hc-body:has(+ .hc-chips:not(:empty)) { border-end-start-radius: 0; border-end-end-radius: 0; }
html[data-study="lumi"] #hero .hc-chips:not(:empty) {
  margin-top: -0.6em; padding: 0 0.8em 0.8em; /* lint-ok: em, as the hero's chat */
  background: var(--color-surface); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------- Lumi's own lines: a lavender to blue bubble, the thinking dots included ---------- */
html[data-study="lumi"] :is(.ccs-msg--bot, .hc-bot, .hc-typing, .hc-done) {
  --cw-bot-ink: var(--color-text-primary);
  --cw-bot: linear-gradient(120deg, color-mix(in srgb, var(--pastel-lavender-300) var(--cw-ga), var(--color-surface)), color-mix(in srgb, var(--pastel-blue-300) var(--cw-gb), var(--color-surface)));
}
html[data-study="lumi"] .ccs-msg--bot:not(.ccs-hello) { padding: var(--space-100) var(--space-300); border-radius: var(--radius-lg); color: var(--cw-bot-ink); background: var(--cw-bot); }
html[data-study="lumi"] #hero .hc-log :is(.hc-bot, .hc-typing, .hc-done) { padding: 0.35em 0.8em; border-radius: var(--radius-lg); color: var(--cw-bot-ink); background: var(--cw-bot); } /* lint-ok: em, as the hero's chat */
/* the dots take Lumi's ink on its bubble: the kit's lighter grey reads 2 to 1 on the dark bubble, under the 3 to 1 a shape needs */
html[data-study="lumi"] .ccs-msg--bot .ccs-dots i { background: var(--cw-bot-ink); }
/* the source link and the crossed-out guess keep their own look inside a bubble */
html[data-study="lumi"] .ccs-msg--bot a { color: inherit; }
/* the quieter words in a bubble (the guess once struck, its caption, a source link) keep the page's grey in the light
   theme; on the dark bubble that grey reads 2.55 to 1, so there it is mostly Lumi's ink: 4.74 to 1, over the 4.5 text needs */
html[data-study="lumi"] #brief :is(.b-wrong[data-struck] s, .b-why, .b-src:not(.strong)), html[data-study="lumi"] #thinks .t-src { color: color-mix(in srgb, var(--color-text-secondary) var(--cw-quiet), var(--color-text-primary)); }
/* the Rulebook: Lumi's line after the rule is a bubble now, not black strips, and the lit rule takes
   the same colours so the rule and its line still match; its ground and ink turn over with the theme.
   The pattern word that is on, in the sheet's side list, takes them too (his pick, 25 Nov 2026) */
html[data-study="lumi"] #rulebook .r-obey mark { background: none; color: inherit; padding: 0; line-height: inherit; }
html[data-study="lumi"] #rulebook .r-lit, html[data-study="lumi"] #rulebook .r-tab[aria-selected="true"] { background: linear-gradient(120deg, color-mix(in srgb, var(--pastel-lavender-300) var(--cw-lit-a), var(--neutral-0)), color-mix(in srgb, var(--pastel-blue-300) var(--cw-lit-b), var(--neutral-0))); color: var(--neutral-950); }

/* ---------- A small live Lumi in the name row (each window's own, beside the page's one big Lumi) ----------
   SIZE (his ask, 23 Nov 2026: "it should probably be the same height as the two lines of text"). Lumi's body
   is 0.56 of its canvas (critter.js, R_BODY), so a 64px canvas draws a body about as tall as the name's two
   lines; the hero's 3.9em canvas draws one as tall as its lumi / IMAGING lockup (2.17em). */
.cw-av { position: absolute; z-index: 2; width: var(--space-800); height: var(--space-800); pointer-events: none; transition: top var(--duration-moderate) var(--ease-emphasized), left var(--duration-moderate) var(--ease-emphasized); }
.cw-av canvas { display: block; width: 100%; height: 100%; }
#hero .cw-av { width: 3.9em; height: 3.9em; } /* lint-ok: em, as the hero's lockup: 2.17em of body */
html[data-study="lumi"] .ccs-head { padding-left: var(--space-800); }
/* stylelint-disable-next-line no-duplicate-selectors -- the name row's room for the small Lumi sits with the small Lumi's own rules */
html[data-study="lumi"] #hero .hc-name { padding-left: 3em; } /* lint-ok: em, room for the hero's Lumi */

/* ---------- The site chat says hello instead of "lumi / site chat" ---------- */
.cw-greet { display: none; flex: 1 1 auto; min-width: 0; margin: 0; font-size: var(--size-base); font-weight: var(--weight-medium); line-height: var(--line-snug); text-wrap: balance; } /* wraps on a phone, in even lines, never past the window's edge */
html[data-study="lumi"] .ccs[data-cw-site] .ccs-name { display: none; }
html[data-study="lumi"] .ccs[data-cw-site] .cw-greet { display: block; }
html[data-study="lumi"] .ccs[data-cw-site] .ccs-head { min-height: var(--space-700); padding-left: calc(var(--space-800) + var(--space-200)); }
