/* Ask Bowie: mascot, nav pill, hero stage and chat sidebar. Uses the theme's colour tokens (light/dark). */

/* ---- Mascot effects ---- */
.bwb-fx { opacity: 0; transition: opacity .35s; }
.bwb-fx.show { opacity: 1; }
.bwb-zzz text { animation: bwb-zz 2.4s infinite; }
.bwb-zzz text:nth-child(2) { animation-delay: .8s; }
.bwb-zzz text:nth-child(3) { animation-delay: 1.6s; }
@keyframes bwb-zz { 0% { opacity: 0; transform: translate(0, 0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(14px, -26px); } }
.bwb-sparkles path { transform-box: fill-box; transform-origin: center; animation: bwb-tw 1.1s infinite alternate; }
.bwb-sparkles path:nth-child(2) { animation-delay: .4s; }
.bwb-sparkles path:nth-child(3) { animation-delay: .7s; }
@keyframes bwb-tw { from { transform: scale(.5) rotate(0); } to { transform: scale(1.1) rotate(25deg); } }
.bwb-dots circle { animation: bwb-td 1.2s infinite; }
.bwb-dots circle:nth-child(2) { animation-delay: .2s; }
.bwb-dots circle:nth-child(3) { animation-delay: .4s; }
@keyframes bwb-td { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
.bwb-scan { animation: bwb-scan 3.2s linear infinite; }
@keyframes bwb-scan { from { transform: translateY(0); } to { transform: translateY(80px); } }
#bwb-ant, #bwb-antGlow { transition: fill .4s; }

.bwb-inst { display: block; flex: none; }

/* ---- Nav pill ---- */
.bwb-pill { display: inline-flex; align-items: center; gap: 10px; padding: 5px 20px 5px 5px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--text); font: 600 14px/1 var(--font-body); cursor: pointer; transition: border-color .25s, transform .25s; }
.bwb-pill:hover { border-color: var(--brand-ui); transform: translateY(-1px); }
.bwb-pill:focus-visible, .bwb-btn:focus-visible, .bwb-chip:focus-visible, .bwb-stage__bowie:focus-visible { outline: 2px solid var(--brand-ui); outline-offset: 2px; }
.bwb-inst--nav { width: 40px; height: 40px; border-radius: 50%; background: var(--soft); }
@media (max-width: 640px) {
	.bwb-pill { padding: 3px; }
	.bwb-pill__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---- Hero / inline stage ---- */
.bwb-stage { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; min-height: clamp(340px, 36vw, 480px); border-radius: var(--r-lg); background: var(--soft); overflow: hidden; isolation: isolate; }
.bwb-stage::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(color-mix(in srgb, var(--brand-ui) 24%, transparent) 1.2px, transparent 1.3px); background-size: 22px 22px; }
.bwb-stage__ring { position: absolute; z-index: -1; width: 74%; aspect-ratio: 1; max-width: 460px; border-radius: 50%; border: 1px dashed color-mix(in srgb, var(--brand-ui) 38%, transparent); }
.bwb-stage__bowie { display: block; width: min(78%, 340px); padding: 0; border: 0; background: none; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.bwb-stage__bowie .bwb-inst { width: 100%; height: auto; }
.bwb-stage--inline { min-height: 300px; }

/* ---- Full-screen chat ---- */
.bwb-side { --bwb-x: 100%; --bwb-y: 0px; --bwb-t: .75s; position: fixed; inset: 0; z-index: 99999; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); background: var(--surface); color: var(--text); visibility: hidden; clip-path: circle(0 at var(--bwb-x) var(--bwb-y)); transition: clip-path var(--bwb-t) cubic-bezier(.22, .9, .24, 1), visibility 0s var(--bwb-t); }
.bwb-side.is-open { visibility: visible; clip-path: circle(150vmax at var(--bwb-x) var(--bwb-y)); transition: clip-path var(--bwb-t) cubic-bezier(.22, .9, .24, 1), visibility 0s; }
.bwb-side:focus { outline: 0; }
.bwb-side__stage, .bwb-chat { opacity: 0; transform: translateY(18px); transition: opacity .3s, transform .3s; }
.bwb-side.is-open .bwb-side__stage { opacity: 1; transform: none; transition: opacity .5s .3s, transform .6s .3s cubic-bezier(.2, .9, .2, 1); }
.bwb-side.is-open .bwb-chat { opacity: 1; transform: none; transition: opacity .5s .38s, transform .6s .38s cubic-bezier(.2, .9, .2, 1); }
.bwb-side__stage { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--soft); overflow: hidden; isolation: isolate; }
.bwb-side__stage::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(color-mix(in srgb, var(--brand-ui) 24%, transparent) 1.2px, transparent 1.3px); background-size: 22px 22px; }
.bwb-side__ring { position: absolute; z-index: -1; width: min(70%, 520px); aspect-ratio: 1; border-radius: 50%; border: 1px dashed color-mix(in srgb, var(--brand-ui) 38%, transparent); }
.bwb-inst--stage { width: min(70%, 380px); height: auto; }
.bwb-side__tag { margin: 0; font: 500 12px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.bwb-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 0 clamp(16px, 4vw, 56px); }
.bwb-chat > * { width: 100%; max-width: 760px; margin-inline: auto; }
.bwb-side__head { display: flex; align-items: center; gap: 12px; padding: 18px 0 14px; border-bottom: 1px solid var(--line); }
.bwb-inst--side { display: none; width: 52px; height: 52px; border-radius: 16px; background: var(--soft); }
.bwb-side__who b { display: block; font: 700 18px/1.2 var(--font-display); }
.bwb-side__who small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.bwb-side__tools { display: flex; gap: 8px; margin-left: auto; }
.bwb-btn { padding: 8px 13px; border: 1px solid var(--line-2); border-radius: 10px; background: transparent; color: var(--text); font: 500 13px/1 var(--font-body); cursor: pointer; }
.bwb-btn:hover { border-color: var(--brand-ui); }
.bwb-btn--icon { padding: 8px 11px; }
.bwb-msgs { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 18px 0; overflow-y: auto; overscroll-behavior: contain; }
.bwb-msg { max-width: 86%; padding: 11px 14px; border-radius: 16px; font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.bwb-msg--user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
.bwb-msg--bot { align-self: flex-start; background: var(--bg); color: var(--text); border-bottom-left-radius: 5px; }
.bwb-msg a.bwb-link { display: inline-block; margin-top: 8px; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.bwb-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.bwb-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: bwb-td 1s infinite; }
.bwb-typing i:nth-child(2) { animation-delay: .15s; }
.bwb-typing i:nth-child(3) { animation-delay: .3s; }
.bwb-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 12px; }
.bwb-chip { padding: 7px 13px; border: 1px solid var(--line-2); border-radius: 999px; background: transparent; color: var(--body); font: 500 13px/1.2 var(--font-body); cursor: pointer; }
.bwb-chip:hover { border-color: var(--brand-ui); color: var(--brand-ui); }
.bwb-form { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.bwb-form input { flex: 1; min-width: 0; padding: 13px 15px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--bg); color: var(--text); font: 400 16px var(--font-body); }
.bwb-form input:focus { outline: 2px solid var(--brand-ui); outline-offset: 1px; }
.bwb-send { padding: 0 20px; border: 0; border-radius: 14px; background: var(--btn); color: var(--btn-text); font: 600 15px var(--font-body); cursor: pointer; }
.bwb-disc { margin: 0 auto; padding: 8px 0 18px; font-size: 11.5px; line-height: 1.45; color: var(--muted); }
body.bwb-open { overflow: hidden; }
@media (max-width: 899px) {
	.bwb-side { grid-template-columns: minmax(0, 1fr); }
	.bwb-side__stage { display: none; }
	.bwb-inst--side { display: block; }
	.bwb-chat { padding: 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
	.bwb-zzz text, .bwb-sparkles path, .bwb-dots circle, .bwb-typing i, .bwb-scan, .bwb-msg { animation: none; }
	.bwb-side, .bwb-side__stage, .bwb-chat, .bwb-pill { transition: none !important; }
	.bwb-side { clip-path: none; opacity: 0; }
	.bwb-side.is-open { opacity: 1; }
}

/* ---- Polish: theme colours, light/dark, small screens ---- */
.bwb-pill { position: relative; border-color: color-mix(in srgb, var(--brand-ui) 38%, var(--line-2)); box-shadow: 0 6px 18px -12px color-mix(in srgb, var(--brand-ui) 60%, transparent); }
.bwb-pill:hover { background: color-mix(in srgb, var(--brand-ui) 9%, var(--surface)); border-color: var(--brand-ui); }
.bwb-pill::after { content: ""; position: absolute; left: 34px; bottom: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); border: 2px solid var(--surface); }
.bwb-side { height: 100vh; height: 100dvh; }
.bwb-side__head { border-bottom-color: var(--line); }
.bwb-side__who small::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--ok); vertical-align: 1px; }
.bwb-msg { animation: bwb-in .35s cubic-bezier(.2, .9, .2, 1) both; }
@keyframes bwb-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.bwb-msg--user { background: var(--brand); box-shadow: 0 8px 20px -14px var(--brand); }
[data-theme="dark"] .bwb-msg--user { background: color-mix(in srgb, var(--brand) 78%, #fff 6%); }
[data-theme="dark"] .bwb-msg--bot { background: var(--soft); border: 1px solid var(--line); }
[data-theme="dark"] .bwb-form input { background: var(--soft); }
[data-theme="dark"] .bwb-stage, [data-theme="dark"] .bwb-side__stage { background: color-mix(in srgb, var(--brand) 14%, var(--soft)); }
.bwb-send:hover { background: var(--accent); color: #fff; }
.bwb-btn:hover, .bwb-chip:hover { background: color-mix(in srgb, var(--brand-ui) 9%, transparent); }
.bwb-chat { padding-bottom: env(safe-area-inset-bottom, 0px); }
@media (max-height: 640px) { .bwb-inst--stage { width: auto; height: 58vh; } .bwb-side__tag { display: none; } }
@media (min-width: 900px) and (max-width: 1100px) { .bwb-side { grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); } }
@media (max-width: 899px) {
	.bwb-chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: -14px; padding: 0 14px 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
	.bwb-chips::-webkit-scrollbar { display: none; }
	.bwb-chip { flex: none; }
	.bwb-msg { max-width: 92%; }
	.bwb-side__head { padding-top: max(14px, env(safe-area-inset-top, 0px)); }
}
@media (max-width: 640px) { .bwb-pill::after { left: 31px; } .bwb-stage { min-height: 320px; } }

/* Inside the Chatbot homepage hero the stage fills the media card. */
.hero-chat__media > .bwb-stage { height: 100%; min-height: 0; border-radius: 0; }
.hero-chat__media:has(> .bwb-stage) { background: var(--soft); }

@media (prefers-reduced-motion: reduce) { .bwb-msg { animation: none; } }

/* ===== v1.17: mobile launcher, premium hover, premium chat, lock, mic ===== */
.bwb-fab { display: none; }
@media (max-width: 899px) {
	.bwb-pill { display: none; }
	.bwb-fab { display: grid; place-items: center; position: fixed; left: 20px; bottom: 20px; z-index: 91; width: 58px; height: 58px; padding: 0; border: 1px solid color-mix(in srgb, var(--brand-ui) 40%, var(--line-2)); border-radius: 50%; background: var(--surface); box-shadow: 0 14px 30px -14px rgba(10, 20, 50, .55); cursor: pointer; transition: transform .25s cubic-bezier(.2, .9, .2, 1), box-shadow .25s; -webkit-tap-highlight-color: transparent; }
	.bwb-fab:active { transform: scale(.94); }
	.bwb-fab .bwb-inst { width: 40px; height: 46px; }
	.bwb-fab__dot { position: absolute; right: 4px; bottom: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); border: 2px solid var(--surface); }
	.bwb-fab::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--brand-ui); opacity: 0; animation: bwb-ping 3.2s ease-out infinite; }
	body.bwb-open .bwb-fab, body.bwb-open .wa-float, body.bwb-open .to-top { visibility: hidden; }
	.wa-float { bottom: 90px !important; }
}
@keyframes bwb-ping { 0% { opacity: .55; transform: scale(.9); } 70%, 100% { opacity: 0; transform: scale(1.35); } }

/* Hover: lift, glow, sheen sweep */
@media (hover: hover) {
	.bwb-pill { overflow: hidden; }
	.bwb-pill::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, color-mix(in srgb, var(--accent) 22%, transparent) 50%, transparent 70%); transform: translateX(-120%); transition: transform .7s ease; pointer-events: none; }
	.bwb-pill:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -14px color-mix(in srgb, var(--brand-ui) 75%, transparent), 0 0 0 4px color-mix(in srgb, var(--brand-ui) 12%, transparent); }
	.bwb-pill:hover::before { transform: translateX(120%); }
	.bwb-pill:hover .bwb-inst--nav { transform: rotate(-6deg) scale(1.08); }
}
.bwb-pill .bwb-inst--nav { transition: transform .35s cubic-bezier(.2, 1.4, .4, 1); }

/* Premium chat surfaces */
.bwb-side { background: radial-gradient(1200px 600px at 12% 8%, color-mix(in srgb, var(--brand-ui) 12%, transparent), transparent 60%), radial-gradient(900px 500px at 95% 100%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 60%), var(--surface); }
.bwb-chat { backdrop-filter: blur(14px); }
.bwb-side__head { border-bottom: 0; position: relative; }
.bwb-side__head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, var(--brand-ui), color-mix(in srgb, var(--accent) 60%, transparent), transparent); opacity: .5; }
.bwb-msg--bot { background: color-mix(in srgb, var(--surface) 70%, var(--soft)); border: 1px solid var(--line); box-shadow: 0 10px 24px -20px rgba(10, 20, 50, .5); }
.bwb-msg--user { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand-ui) 80%, var(--brand))); box-shadow: 0 12px 26px -16px var(--brand); }
.bwb-form { align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line-2); border-radius: 18px; background: var(--bg); box-shadow: 0 14px 30px -22px rgba(10, 20, 50, .55); transition: border-color .2s, box-shadow .2s; }
.bwb-form:focus-within { border-color: var(--brand-ui); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-ui) 14%, transparent); }
.bwb-form input, [data-theme="dark"] .bwb-form input { border: 0; background: transparent; padding: 10px 8px; }
.bwb-form input:focus { outline: none; }
.bwb-send { padding: 11px 20px; border-radius: 12px; }
.bwb-mic { display: grid; place-items: center; flex: none; width: 42px; height: 42px; padding: 0; border: 1px solid var(--line-2); border-radius: 50%; background: transparent; color: var(--body); cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.bwb-mic[hidden] { display: none; }
.bwb-mic:hover { border-color: var(--brand-ui); color: var(--brand-ui); }
.bwb-mic.is-on { background: var(--accent); border-color: var(--accent); color: #fff; animation: bwb-rec 1.2s ease-in-out infinite; }
.bwb-mic:focus-visible { outline: 2px solid var(--brand-ui); outline-offset: 2px; }
@keyframes bwb-rec { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 50% { box-shadow: 0 0 0 9px transparent; } }
.bwb-chip { background: var(--surface); transition: transform .2s, border-color .2s, color .2s; }
.bwb-chip:hover { transform: translateY(-2px); }
.bwb-disc { font-size: 12px; line-height: 1.5; color: var(--muted); }

/* Locked state */
.bwb-lock { margin: 0 0 12px; padding: 16px 18px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 16px; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); color: var(--text); }
.bwb-lock[hidden] { display: none; }
.bwb-lock b { display: block; margin-bottom: 4px; color: var(--accent); }
.bwb-lock p { margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: var(--body); }
.bwb-side.is-locked .bwb-form { opacity: .55; pointer-events: none; }

@media (max-width: 899px) {
	.bwb-form { margin-bottom: max(6px, env(safe-area-inset-bottom, 0px)); }
	.bwb-mic { width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) { .bwb-fab::before, .bwb-mic.is-on { animation: none; } .bwb-pill::before { display: none; } }
