/* Floating chat assistant (assets/js/bot.js), every page, bottom right.
   The avatar is the terminal logo come alive: the rounded square is the head, two eyes follow the pointer and blink,
   the brick caret is the mouth. Flat colours only (no gradients, glows or blur). Texts are placeholders for now. */
.mlb { --mlb-ink: #0B1315; --mlb-panel: #121D20; --mlb-raise: #172427; --mlb-line: #22343A; --mlb-line2: #3A4E53;
  --mlb-text: #ECF0F0; --mlb-body: #C7D1D2; --mlb-meta: #A9B6B8; --mlb-brick: #B8432F; --mlb-brick2: #A33A28; --mlb-caret: #D2553D; --mlb-bone: #EEEAE2;
  --mlb-ease: cubic-bezier(.2, .8, .2, 1); --mlb-spring: cubic-bezier(.16, 1, .3, 1);
  --mlb-right: max(20px, env(safe-area-inset-right, 0px)); --mlb-bottom: max(20px, env(safe-area-inset-bottom, 0px));
  position: fixed; z-index: 60; right: var(--mlb-right); bottom: var(--mlb-bottom);
  font: 450 15px/1.5 "Bricolage Grotesque", "Geist", system-ui, sans-serif; color: var(--mlb-text); -webkit-font-smoothing: auto;
  transition: bottom .4s var(--mlb-ease); }
/* stays out of the way: hidden during the robot intro, lifted above the phone's "Let's work together" bar */
html.rb-playing .mlb, html.intro-wait .mlb { visibility: hidden; opacity: 0; }
body:has(.mbar.on) .mlb { bottom: calc(var(--mlb-bottom) + 64px); }

/* ---------- the avatar button ---------- */
.mlb__btn { position: relative; display: block; width: 64px; height: 64px; padding: 0; border: 0; border-radius: 18px; background: none; cursor: pointer;
  transition: transform .45s var(--mlb-spring); -webkit-tap-highlight-color: transparent; }
@media (hover: hover) { .mlb__btn:hover { transform: translateY(-3px) rotate(-3deg); } }   /* touch screens: no hover state left stuck after a tap */
.mlb__btn:active { transform: translateY(0) scale(.94); transition-duration: .12s; }
.mlb__btn:focus-visible { outline: 2px solid var(--mlb-caret); outline-offset: 4px; }
.mlb__face { display: block; width: 100%; height: 100%; }
.mlb__face svg { display: block; width: 100%; height: 100%; overflow: visible; }
/* the open/close morph: the face turns away and a close mark turns in */
.mlb__btn .mlb__face, .mlb__btn .mlb__xmark { transition: transform .5s var(--mlb-spring), opacity .25s ease; }
.mlb__xmark { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 18px; background: var(--mlb-brick); opacity: 0; transform: rotate(-90deg) scale(.6); }
.mlb__xmark svg { width: 22px; height: 22px; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; fill: none; }
.mlb.is-open .mlb__btn .mlb__face { opacity: 0; transform: rotate(90deg) scale(.6); }
.mlb.is-open .mlb__btn .mlb__xmark { opacity: 1; transform: none; }
.mlb__badge { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center;
  background: var(--mlb-brick); color: #fff; font: 700 12px/1 "Bricolage Grotesque", "Geist", system-ui, sans-serif; box-shadow: 0 0 0 3px var(--mlb-ink);
  transform: scale(0); transition: transform .45s var(--mlb-spring); }
.mlb.has-badge .mlb__badge { transform: scale(1); }
.mlb.is-open .mlb__badge { transform: scale(0); }
/* a soft ring that pulses outwards once in a while to say hello (a flat outline, not a glow) */
.mlb__btn::after { content: ""; position: absolute; inset: 0; border-radius: 18px; border: 2px solid var(--mlb-caret); opacity: 0; pointer-events: none; }
.mlb.is-wave .mlb__btn::after { animation: mlb-ring 1.4s var(--mlb-ease); }
@keyframes mlb-ring { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.55); } }

/* ---------- the "peek" bubble that appears once, next to the avatar ---------- */
.mlb__peek { position: absolute; right: 78px; bottom: 6px; width: max-content; max-width: min(280px, calc(100vw - 120px)); padding: 14px 40px 14px 16px; border-radius: 16px 16px 4px 16px;
  background: var(--mlb-bone); color: var(--mlb-ink); box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .7);
  transform-origin: 100% 100%; transform: translateX(10px) scale(.85); opacity: 0; pointer-events: none; transition: transform .5s var(--mlb-spring), opacity .25s ease; }
.mlb__peek p { margin: 0; font-size: 15px; font-weight: 500; line-height: 1.45; }
.mlb__peek p b { display: block; font-weight: 700; margin-bottom: 2px; }
.mlb__peek-x { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: #4A5658; cursor: pointer; display: grid; place-items: center; }
.mlb__peek-x:hover { background: rgba(11, 19, 21, .08); color: var(--mlb-ink); }
.mlb__peek-x svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.mlb.is-peek .mlb__peek { transform: none; opacity: 1; pointer-events: auto; }
.mlb.is-open .mlb__peek { transform: translateX(10px) scale(.85); opacity: 0; pointer-events: none; }

/* ---------- the panel ---------- */
.mlb__panel { position: absolute; right: 0; bottom: 80px; width: min(400px, calc(100vw - 2 * var(--mlb-right))); height: min(600px, calc(100svh - 140px));
  display: grid; grid-template-rows: auto 1fr auto auto; background: var(--mlb-ink); border: 1px solid var(--mlb-line2); border-radius: 20px; overflow: hidden;
  box-shadow: 0 30px 70px -24px rgba(0, 0, 0, .8), 0 10px 24px -12px rgba(0, 0, 0, .6);
  transform-origin: calc(100% - 32px) calc(100% + 48px); }
.mlb__panel[hidden] { display: none; }
.mlb__head { display: flex; align-items: center; gap: 12px; padding: 16px 14px 14px 16px; border-bottom: 1px solid var(--mlb-line); background: var(--mlb-panel); }
.mlb__head .mlb__face { width: 42px; height: 42px; flex: none; }
.mlb__who { min-width: 0; flex: 1; }
.mlb__who h2 { margin: 0; font: 650 16px/1.25 "Bricolage Grotesque", "Geist", system-ui, sans-serif; letter-spacing: -.01em; color: var(--mlb-text); }
.mlb__status { margin: 2px 0 0; display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 500; color: var(--mlb-meta); }
.mlb__status i { width: 8px; height: 8px; border-radius: 50%; background: #3DBE72; box-shadow: 0 0 0 3px rgba(61, 190, 114, .18); }
.mlb__close { flex: none; width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; color: var(--mlb-meta); cursor: pointer; display: grid; place-items: center; transition: background-color .2s, color .2s; }
.mlb__close:hover { background: var(--mlb-raise); color: var(--mlb-text); }
.mlb__close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.mlb__close:focus-visible, .mlb__chip:focus-visible, .mlb__send:focus-visible, .mlb__peek-x:focus-visible { outline: 2px solid var(--mlb-caret); outline-offset: 2px; }

/* the conversation */
.mlb__log { overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: var(--mlb-line2) transparent; }
.mlb__day { align-self: center; margin: 2px 0 6px; font-size: 12.5px; font-weight: 500; color: var(--mlb-meta); }
.mlb__msg { max-width: 84%; padding: 11px 14px; font-size: 15px; line-height: 1.5; font-weight: 450; overflow-wrap: anywhere; text-wrap: pretty;
  animation: mlb-in .45s var(--mlb-spring) both; }
.mlb__msg--bot { align-self: flex-start; background: var(--mlb-panel); color: var(--mlb-body); border: 1px solid var(--mlb-line); border-radius: 4px 16px 16px 16px; transform-origin: 0 0; }
.mlb__msg--bot b { color: var(--mlb-text); font-weight: 600; }
.mlb__msg--me { align-self: flex-end; background: var(--mlb-brick); color: #fff; border-radius: 16px 4px 16px 16px; transform-origin: 100% 0; font-weight: 500; }
@keyframes mlb-in { from { opacity: 0; transform: translateY(8px) scale(.94); } to { opacity: 1; transform: none; } }
/* typing: the brick caret blinking in a bubble, like the logo */
.mlb__typing { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 12px 14px; border-radius: 4px 16px 16px 16px; background: var(--mlb-panel); border: 1px solid var(--mlb-line); animation: mlb-in .35s var(--mlb-spring) both; }
.mlb__typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--mlb-meta); animation: mlb-dot 1s var(--mlb-ease) infinite; }
.mlb__typing i:nth-child(2) { animation-delay: .15s; } .mlb__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes mlb-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }

/* suggested replies */
.mlb__chips { display: flex; gap: 8px; padding: 6px 16px 10px; overflow-x: auto; scrollbar-width: none; }
.mlb__chips::-webkit-scrollbar { display: none; }
.mlb__chip { flex: none; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--mlb-line2); background: none; color: var(--mlb-text);
  font: 500 14px "Bricolage Grotesque", "Geist", system-ui, sans-serif; cursor: pointer; transition: background-color .2s, border-color .2s, transform .3s var(--mlb-spring); animation: mlb-in .45s var(--mlb-spring) both; }
.mlb__chip:hover { background: var(--mlb-raise); border-color: var(--mlb-text); transform: translateY(-1px); }

/* the message box */
.mlb__form { display: flex; align-items: center; gap: 8px; margin: 0 12px; padding: 6px 6px 6px 14px; border: 1px solid var(--mlb-line2); border-radius: 14px; background: var(--mlb-panel); transition: border-color .2s; }
.mlb__form:focus-within { border-color: var(--mlb-text); }
.mlb__in { flex: 1; min-width: 0; height: 40px; border: 0; outline: 0; background: none; color: var(--mlb-text); font: 450 15px "Bricolage Grotesque", "Geist", system-ui, sans-serif; caret-color: var(--mlb-caret); }
.mlb__in::placeholder { color: #8FA0A2; }
.mlb__send { flex: none; width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--mlb-brick); color: #fff; cursor: pointer; display: grid; place-items: center;
  transition: background-color .2s, transform .35s var(--mlb-spring); }
.mlb__send:hover { background: var(--mlb-brick2); } .mlb__send:active { transform: scale(.9); }
.mlb__send:disabled { background: var(--mlb-raise); color: var(--mlb-meta); cursor: default; }
.mlb__send svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.mlb__fine { margin: 8px 16px 12px; font-size: 12.5px; font-weight: 450; color: var(--mlb-meta); text-align: center; }
.mlb .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* phones: the panel becomes a sheet over most of the screen */
@media (max-width: 560px) {
  .mlb { --mlb-right: max(14px, env(safe-area-inset-right, 0px)); --mlb-bottom: max(14px, env(safe-area-inset-bottom, 0px)); }
  .mlb__btn { width: 58px; height: 58px; }
  /* phones: the chat is a full sheet over the page that follows the visible area, so the on-screen keyboard
     never squeezes it or covers the box (bot.js keeps --mlb-vt / --mlb-vh in step with window.visualViewport) */
  .mlb__panel, body:has(.mbar.on) .mlb__panel { position: fixed; left: 0; right: 0; bottom: auto; top: var(--mlb-vt, 0px); width: auto;
    height: var(--mlb-vh, 100dvh); border-radius: 0; border: 0; padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
    transform-origin: calc(100% - 30px) 100%; }
  .mlb__head { padding-top: max(14px, env(safe-area-inset-top, 0px)); }
  .mlb.is-open .mlb__btn, body:has(.mlb.is-open) .mbar { visibility: hidden; opacity: 0; pointer-events: none; }
  html:has(.mlb.is-open) { overflow: hidden; }
  .mlb.is-kb .mlb__stage { display: none; }   /* keyboard up: the messages and the box get the room */
}
@media (prefers-reduced-motion: reduce) {
  .mlb *, .mlb *::after { animation: none !important; transition-duration: .01ms !important; }
}



/* ---------- the robot (flat drawing): the droid from the home intro ---------- */
.mlb__r-bg { fill: #121D20; stroke: #3A4E53; stroke-width: 1.5; }
.mlb__r-body, .mlb__r-shell { fill: #ECEBE6; }
.mlb__r-tip { fill: #D2553D; }
.mlb__r-eye { fill: #38C6FF; transform-box: fill-box; transform-origin: 50% 50%; transition: transform .12s ease-out; }
.mlb__r-eyes { transition: transform .25s var(--mlb-ease); }
.mlb__r-head { transform-box: view-box; transform-origin: 32px 44px; transition: transform .35s var(--mlb-ease); }
.mlb__r-ant { transform-box: view-box; transform-origin: 25.2px 12.5px; animation: mlb-ant 2.6s ease-in-out infinite alternate; }
@keyframes mlb-ant { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
.mlb__btn .mlb__r-bob { animation: mlb-float 4.2s ease-in-out infinite; }
@keyframes mlb-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.5px); } }
.mlb.is-blink .mlb__r-eye { transform: scaleY(.12); }
.mlb.is-happy .mlb__r-eye { transform: scaleY(.45); }
/* thinking: a small nod, the antenna tip flashes, the eyes dart */
.mlb.is-talking .mlb__r-bob { animation: mlb-nod .45s ease-in-out infinite alternate; }
@keyframes mlb-nod { from { transform: translateY(0); } to { transform: translateY(1.2px); } }
.mlb.is-talking .mlb__r-tip { animation: mlb-tip .5s steps(1) infinite; }
@keyframes mlb-tip { 50% { fill: #FF8A6E; } }
.mlb.is-talking .mlb__r-eyes { animation: mlb-think 1.3s ease-in-out infinite alternate; }
@keyframes mlb-think { 0%, 45% { transform: translate(-1.2px, -.4px); } 55%, 100% { transform: translate(1.2px, -.4px); } }
/* listening: looks down at the message box while you write */
.mlb.is-listening:not(.is-talking) .mlb__r-eyes { animation: none; transform: translate(-.6px, 1.4px) !important; }
.mlb__btn:hover .mlb__r-bg { stroke: #ECF0F0; }

/* ---------- the stage at the top of the panel: the 3D droid (or the flat one until it is ready) ---------- */
.mlb__panel { grid-template-rows: auto auto 1fr auto auto auto; }
.mlb__stage { position: relative; height: 150px; background: #0F1A1D; border-bottom: 1px solid var(--mlb-line); overflow: hidden; }
.mlb__stage-hi { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); z-index: 2; margin: 0; max-width: 44%; font: 450 14.5px/1.45 "Bricolage Grotesque", "Geist", system-ui, sans-serif; color: var(--mlb-meta); }
.mlb__stage-hi b { display: block; font: 650 19px/1.2 "Bricolage Grotesque", "Geist", system-ui, sans-serif; letter-spacing: -.02em; color: var(--mlb-text); margin-bottom: 4px; }
.mlb__stage-flat { position: absolute; left: calc(64% - 85px); bottom: -26px; width: 170px; height: 170px; transition: opacity .5s ease; }
.mlb__stage-flat .mlb__r-bg { fill: none; stroke: none; }
.mlb__stage-3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .6s ease; }
.mlb__stage.is-3d .mlb__stage-3d { opacity: 1; }
.mlb__stage.is-3d .mlb__stage-flat { opacity: 0; }
@media (max-width: 560px) { .mlb__stage { height: 128px; } .mlb__stage-flat { width: 150px; height: 150px; bottom: -22px; left: calc(64% - 75px); } }
@media (prefers-reduced-motion: reduce) { .mlb__r-ant, .mlb__r-bob { animation: none !important; } }

/* real answers (18 Nov 2026): line breaks kept, links under an answer */
.mlb__msg--bot { white-space: pre-line; }
.mlb__links { display: flex; flex-wrap: wrap; gap: 8px; margin: -2px 0 4px; }
.mlb__link { display: inline-flex; align-items: center; min-height: 36px; padding: 0 13px; border-radius: 9px; border: 1px solid var(--mlb-line2); background: none;
  color: var(--mlb-text); font: 500 14px "Bricolage Grotesque", "Geist", system-ui, sans-serif; text-decoration: none; cursor: pointer; transition: background-color .2s, border-color .2s; }
.mlb__link::after { content: "→"; margin-left: 7px; }
.mlb__link[data-pass] { background: var(--mlb-brick); border-color: var(--mlb-brick); color: #fff; }
@media (hover: hover) { .mlb__link:hover { border-color: var(--mlb-text); } .mlb__link[data-pass]:hover { background: var(--mlb-brick2); border-color: var(--mlb-brick2); } }
.mlb__link:focus-visible { outline: 2px solid var(--mlb-caret); outline-offset: 2px; }
/* the hello bubble in Geist (Darco, 18 Nov 2026: Bricolage's Q looked odd at this size) */
.mlb__peek p { font-family: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif; }

/* Less in the way (19 Nov 2026, design review UX 1 + 2) */
/* Phones/tablets: the chat button sits in the same row as the "Contact" bar (same height, bottom right), not stacked above it */
@media (max-width: 820px) {
  .mlb { --mlb-right: max(12px, env(safe-area-inset-right, 0px)); --mlb-bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
  .mlb__btn { width: 50px; height: 50px; border-radius: 14px; }
  body:has(.mbar.on) .mlb { bottom: var(--mlb-bottom); }
  body:has(.mlb) .mbar { right: 72px; }
  .mlb__peek { right: 62px; bottom: 0; }
  .ftr { padding-bottom: 64px; }   /* the end of the footer stays readable above the chat button */
}
/* Computers: a slightly smaller button, and the footer's last line keeps clear of it */
@media (min-width: 821px) {
  .mlb { --mlb-right: max(16px, env(safe-area-inset-right, 0px)); --mlb-bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
  .mlb__btn { width: 56px; height: 56px; border-radius: 16px; }
  .mlb__peek { right: 68px; }
  .ftr__base { padding-right: 76px; }
}

/* "Prefer a person?" link under the message box (19 Nov 2026) */
.mlb__team { margin: 4px 16px 0; text-align: center; }
.mlb__team button { padding: 6px 4px; min-height: 28px; border: 0; background: none; color: var(--mlb-text); font: 500 13.5px "Bricolage Grotesque", "Geist", system-ui, sans-serif; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--mlb-line2); }
.mlb__team button:hover { text-decoration-color: currentColor; }
.mlb__team button:focus-visible { outline: 2px solid var(--mlb-caret); outline-offset: 2px; border-radius: 4px; }

/* ---------- The robot stage never crowds out the conversation (21 Nov 2026, Darco: "the robot takes the entire space") ----------
   Once the visitor writes, the stage folds away and the messages get the room.
   Short windows start with a smaller stage too. */
.mlb__stage { transition: height .45s cubic-bezier(.16, 1, .3, 1); }
.mlb__stage-hi { transition: opacity .25s ease; }
/* once the visitor writes, the stage folds away completely: the header already shows the assistant (Darco, 21 Nov 2026) */
.mlb.is-chatting .mlb__stage { height: 0 !important; border-bottom-width: 0; }
.mlb.is-chatting .mlb__stage-hi { opacity: 0; pointer-events: none; }
/* Short windows (Darco, 21 Nov 2026: "the space of the chat is too small"): the panel may reach 30 px from the top,
   the robot strip is skipped (the robot is already in the header) and the lines under the box sit closer */
@media (min-width: 821px) { .mlb__panel { height: min(640px, calc(100svh - 110px)); } }
@media (max-height: 760px) {
  .mlb__stage { display: none; }
  .mlb__team { margin-top: 0; }
  .mlb__team button { min-height: 24px; padding: 2px 4px; }
  .mlb__fine { margin: 0 16px 8px; font-size: 12px; }
  .mlb__chips { padding-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { .mlb__stage, .mlb__stage-hi { transition: none; } }
