/* =========================================================
   WAHAJ AI — living gradient orb, animated borders, top bar entry,
   proactive bubbles and the quick-chat panel
   ========================================================= */
@property --orb-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@property --orb-x { syntax: '<percentage>'; inherits: false; initial-value: 28%; }
@property --orb-y { syntax: '<percentage>'; inherits: false; initial-value: 74%; }
@property --ai-b { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

/* the orb: WAHAJ AI's face, the same glass sphere as the mentor, with a living dot-matrix screen.
   ::before plays a 60-frame strip (5 s): the colours drift, a scanline passes, the eyes blink and glance.
   Small orbs use the 96 px strip, large ones (.orb-l) the 192 px strip. Reduce motion holds frame 0. */
.orb {
  position: relative; display: inline-block; flex: none; border-radius: 50%; isolation: isolate;
  background: none;
  box-shadow: none;
  animation: orbSpin 7s linear infinite, orbDrift 5.5s ease-in-out infinite alternate, orbBreath 4s ease-in-out infinite}
.orb::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: url(../assets/ai_orb_96.webp) 0 0 / 6000% 100% no-repeat;
  animation: orbFace 5s steps(60, jump-none) infinite}
.orb.orb-l::before { background-image: url(../assets/ai_orb_192.webp)}
@keyframes orbFace { to { background-position: 100% 0} }
body.ai-speaking .orb::before { animation-duration: 2.5s}
/* the AI Mentor wears the same animated face (mission mentor cards and the mentor chat) */
.mface { position: relative; display: inline-block; flex: none; border-radius: 50%; overflow: hidden}
.mface::before { content: ""; position: absolute; inset: 0; background: url(../assets/ai_orb_96.webp) 0 0 / 6000% 100% no-repeat; animation: orbFace 5s steps(60, jump-none) infinite}
.mface.l::before { background-image: url(../assets/ai_orb_192.webp)}
.mx-mav .mface { display: block; width: 44px; height: 44px}
.mh-hello .mface { width: 36px; height: 36px}
/* in a conversation only the newest answer is alive, faster while it types; earlier answers hold still */
.cv-a .mface::before { animation: none}
.cv-a:nth-last-child(1 of .cv-a) .mface::before { animation: orbFace 5s steps(60, jump-none) infinite}
.cv-a:has(.typing) .mface::before { animation-duration: 2.5s}
body.ai-speaking .mface::before { animation-duration: 2.5s}
.reduce-motion .mface::before { animation: none !important}
.orb::after {
  content: ""; position: absolute; inset-block: 7% 55%; inset-inline: 20% 16%; border-radius: 50%;
  content: none}
.orb.live { animation: orbSpin 7s linear infinite, orbDrift 5.5s ease-in-out infinite alternate, orbBreath 4s ease-in-out infinite}
@keyframes orbSpin { to { --orb-a: 360deg} }
@keyframes orbDrift { 0% { --orb-x: 24%; --orb-y: 76%} 50% { --orb-x: 70%; --orb-y: 62%} 100% { --orb-x: 40%; --orb-y: 36%} }
@keyframes orbBreath { 50% { transform: scale(1.045)} }
body.ai-speaking .orb.live { animation: orbSpin 1.6s linear infinite, orbDrift 1.2s ease-in-out infinite alternate, orbTalk .42s ease-in-out infinite alternate}
@keyframes orbTalk { from { transform: scale(1)} to { transform: scale(1.1)} }
.reduce-motion .orb, .reduce-motion .orb::before { animation: none !important}

/* animated gradient frame for AI surfaces */
.ai-frame {
  border: 1px solid rgba(139,92,246,.4) !important;
  background: var(--ai-bg, #111112) !important;
  animation: aiBorder 5s linear infinite}
@keyframes aiBorder { to { --ai-b: 360deg} }
.reduce-motion .ai-frame { animation: none}
.ai-grad-text { color: var(--accent-2-text)}
@keyframes gradText { to { background-position: 200% 0} }

/* ---------- top bar: up next, WAHAJ AI, theme ---------- */
.tb-next { display: flex; align-items: center; gap: 10px; height: 48px; padding-block: 0 0; padding-inline: 7px 10px; margin-inline-end: 10px; border-radius: 14px; border: 1px solid #232325; background: #111112; text-align: start; transition: border-color .2s, background .2s; max-width: 300px}
.tb-next:hover { border-color: var(--accent-line)}
.tbn-ring { position: relative; width: 34px; height: 34px; display: grid; place-items: center; color: var(--accent); flex: none}
.tbn-ring svg { position: absolute; inset: 0}
.tbn-ring .bg { fill: none; stroke: #232325; stroke-width: 3}
.tbn-ring .fg { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round}
.tbn-t { min-width: 0}
.tbn-t small { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted)}
.tbn-t b { display: block; font-size: 14.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 212px}
.tb-next > .ico { color: var(--muted)}
.tb-ai { --ai-bg: #111112; display: flex; align-items: center; gap: 10px; height: 46px; padding-block: 0 0; padding-inline: 8px 16px; border-radius: 999px; margin-inline-end: 6px; font-size: 14.5px; font-weight: 600; letter-spacing: .04em; color: var(--text); transition: transform .2s}
.tb-ai:hover { transform: translateY(-1px)}
.tb-ai.ping .orb { animation: orbSpin 1.4s linear infinite, orbPing .9s ease-out 2}
@keyframes orbPing { 50% { transform: scale(1.18)} }
.tb-theme { width: 50px}
.tb-av { display: block; width: 46px; height: 46px; border-radius: 50%; overflow: hidden; flex: none}
.tb-av img, .tb-av svg { width: 100%; height: 100%; object-fit: cover; display: block}
.tb-user .ico { margin-inline-start: 26px}

/* ---------- floating layer: bubbles and quick chat ---------- */
#ai-float { position: absolute; inset: 0; z-index: 75; pointer-events: none}
#ai-float > * { pointer-events: auto}
.ai-bub {
  position: absolute; width: 360px; padding: 12px 14px 14px; border-radius: 16px; z-index: 2;
  background: var(--panel); border: 1px solid var(--accent-2-line);
  box-shadow: none;
  animation: bubIn .38s cubic-bezier(.2,1.3,.4,1) both; transform-origin: 92% 0}
.ai-bub.happy { border-color: rgba(0,255,111,0.5); box-shadow: none}
.ai-bub.out { animation: bubOut .25s ease forwards}
@keyframes bubIn { from { opacity: 0; transform: translateY(-8px) scale(.9)} to { opacity: 1; transform: none} }
@keyframes bubOut { to { opacity: 0; transform: translateY(-6px) scale(.96)} }
.ai-bub-tail { position: absolute; top: -7px; width: 14px; height: 14px; background: inherit; border-inline-start: 1px solid rgba(139, 92, 246, 0.35); border-top: 1px solid rgba(139, 92, 246, 0.35); transform: rotate(45deg); border-start-start-radius: 3px; border-start-end-radius: 0; border-end-end-radius: 0; border-end-start-radius: 0}
.ai-bub.happy .ai-bub-tail { border-color: rgba(0,255,111,0.5)}
.ai-bub-h { display: flex; align-items: center; gap: 9px}
.ai-bub-h b { font-size: 13.5px; letter-spacing: .06em}
.ai-bub-h small { font-size: 12px; color: var(--muted)}
.ai-x { margin-inline-start: auto; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--muted)}
.ai-x + .ai-x { margin-inline-start: 0}
.ai-x:hover { background: var(--tile-hi); color: var(--text)}
.ai-bub-t { margin: 9px 0 0; font-size: 15px; line-height: 1.45; color: var(--text); min-height: 22px}
.ai-bub-t b { color: var(--accent); font-weight: 600}
.ai-caret { display: inline-block; width: 7px; height: 15px; margin-inline-start: 2px; vertical-align: -2px; border-radius: 2px; background: var(--accent-2); animation: blink .8s infinite}
.ai-bub-a { display: flex; gap: 8px; margin-top: 12px}
.ai-bub-a button { height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; font-weight: 500}
.ai-bub-a .pri { background: var(--accent); color: var(--accent-ink); font-weight: 600}
.ai-bub-a .pri:hover { background: var(--accent-hi)}
.ai-bub-a .ghost { border: 1px solid var(--line-3); color: var(--text)}
.ai-bub-a .ghost:hover { border-color: var(--accent-line)}

.ai-panel-wrap { position: absolute; width: 410px; animation: bubIn .32s cubic-bezier(.2,1.2,.4,1) both; transform-origin: 90% 0}
.ai-panel { --ai-bg: #111112; display: flex; flex-direction: column; height: 560px; border-radius: 20px; box-shadow: none; overflow: hidden}
.aip-h { display: flex; align-items: center; gap: 12px; padding-block: 14px 12px; padding-inline: 16px 12px; border-bottom: 1px solid var(--line); background: transparent}
.aip-h b { display: block; font-size: 16px; letter-spacing: .05em}
.aip-h small { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted)}
.aip-h small i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: none}
.aip-h .ai-x:first-of-type { margin-inline-start: auto}
.aip-body { flex: 1; min-height: 0; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 12px}
.aip-m { display: flex; gap: 8px; align-items: flex-end; animation: riseIn .3s ease both}
.aip-m.me { justify-content: flex-end}
.aip-bb { position: relative; max-width: 300px; padding: 10px 13px; border-start-start-radius: 14px; border-start-end-radius: 14px; border-end-end-radius: 14px; border-end-start-radius: 4px; background: #1d1d1f; border: 1px solid #232325; font-size: 14.5px; line-height: 1.45; color: var(--text-2)}
.aip-bb b { color: var(--text)}
.aip-m.me .aip-bb { border-start-start-radius: 14px; border-start-end-radius: 14px; border-end-end-radius: 4px; border-end-start-radius: 14px; background: rgba(124, 124, 124, 0.22); border-color: rgba(0,255,111,0.4); color: var(--text)}
.aip-say { position: absolute; inset-inline-end: -30px; bottom: 4px; width: 24px; height: 24px; display: grid; place-items: center; color: var(--muted); border-radius: 6px; opacity: .6}
.aip-say:hover { color: var(--accent); opacity: 1}
.aip-m.bot .aip-bb { margin-inline-end: 30px}
.aip-sugg { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 4px}
.aip-sugg button { height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; color: var(--text-2); border: 1px solid var(--line-2); background: var(--panel-2)}
.aip-sugg button:hover { border-color: var(--accent-line); color: var(--accent)}
.aip-in { display: flex; align-items: center; gap: 4px; margin: 8px 12px 12px; height: 48px; padding-block: 0 0; padding-inline: 14px 6px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--bg-deep)}
.aip-in:focus-within { border-color: var(--accent-line)}
.aip-in input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 14.5px; color: var(--text)}
.aip-in button { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--text-2)}
.aip-in button:hover { color: var(--accent)}
.aip-in .snd { background: #00FF6F; color: #161617}
.aip-in .snd:hover { color: #161617; filter: brightness(1.08)}

/* ---------- Home: WAHAJ AI card ---------- */
.ai.ai-home { --ai-bg: #0a0a0b; padding: 14px 16px !important}
.ai-home .ai-h b { font-size: 15px}
.ai-home .ai-stage { position: relative; width: 104px; height: 104px; margin: 8px auto 0; display: grid; place-items: center}
.ai-home .ai-stage i { position: absolute; inset: 6px; border-radius: 50%; border: 1px solid rgba(139, 92, 246, 0.45); animation: waRing 3s ease-out infinite}
.ai-home .ai-stage i:nth-child(2) { animation-delay: 1s}
.ai-home .ai-stage i:nth-child(3) { animation-delay: 2s}
.ai-home h4 { margin: 10px 0 0; font-size: 19px; font-weight: 600; text-align: start}
.ai-insight { display: flex; gap: 8px; align-items: flex-start; margin-top: 4px; min-height: 42px; font-size: 13.5px; line-height: 1.4; color: var(--text-2)}
.ai-insight .ico { color: var(--accent-2-text); margin-top: 2px}
.ai-insight b { color: var(--text); font-weight: 600}
.ai-home .ask { margin-top: 10px !important}

/* mentor page: the orb replaces the robot image */
.mt-prof .mt-orb { position: absolute; inset-inline-end: 18px; top: 16px}
.msg .av .orb { width: 100%; height: 100%}
.msg .av:has(.orb) { overflow: visible; background: none}
.mt-prof h3 { display: flex; align-items: center; gap: 8px}
body.chat-big .msg .bub { font-size: 17px}

/* welcome modal: aurora background */
.modal.welcome { position: relative}
.modal.welcome::before { content: none; position: absolute; inset: -40% -20% auto -20%; height: 360px; pointer-events: none; opacity: .55;
  background: none;
  filter: blur(20px); animation: aurora 9s ease-in-out infinite alternate}
@keyframes aurora { to { transform: translateX(8%) translateY(6%) rotate(6deg)} }
.wa-orb .orb { width: 96px; height: 96px}

/* Build Studio mentor cards: the orb takes the robot's place */
.st-mentor .orb.robot, .t-mentor .orb.robot { position: absolute; inset-inline-end: 16px; top: 10px; width: 38px !important; height: 38px !important; border-radius: 50%}
.st-mentor .online, .t-mentor .online { width: auto !important}
.st-mentor .say-btn, .t-mentor .say-btn { white-space: nowrap}
.st-mentor h3, .t-mentor h3 { background: #00FF6F; -webkit-background-clip: text; background-clip: text; color: transparent}
.c-mentor .orb { flex: none}

/* animated gradient surfaces for WAHAJ AI (Home card) and the Mentor Conversation:
   a Nebula light and a Glow light drift slowly around the panel while the base gradient turns */
@property --g1x { syntax: '<percentage>'; inherits: false; initial-value: 100%; }
@property --g1y { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
@property --g2x { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
@property --g2y { syntax: '<percentage>'; inherits: false; initial-value: 100%; }
@property --gang { syntax: '<angle>'; inherits: false; initial-value: 165deg; }
@keyframes aiDrift {
  0%   { --g1x: 100%; --g1y: 0%;   --g2x: 0%;   --g2y: 100%; --gang: 165deg}
  33%  { --g1x: 30%;  --g1y: 10%;  --g2x: 80%;  --g2y: 90%;  --gang: 200deg}
  66%  { --g1x: 10%;  --g1y: 60%;  --g2x: 90%;  --g2y: 30%;  --gang: 140deg}
  100% { --g1x: 85%;  --g1y: 90%;  --g2x: 20%;  --g2y: 10%;  --gang: 185deg}
}
.ai.ai-home.ai-frame {
  background: var(--panel) !important;
  animation: aiBorder 5s linear infinite, aiDrift 10s ease-in-out infinite alternate}
.mt-conv {
  background: var(--ip-card, #111112);
  border-color: rgba(139,92,246,.28);
  animation: aiDrift 14s ease-in-out infinite alternate}
.reduce-motion .ai.ai-home.ai-frame, .reduce-motion .mt-conv { animation: none}
@media (prefers-reduced-motion: reduce) { .ai.ai-home.ai-frame, .mt-conv { animation: none} }
.mt-conv .qp button, .mt-conv .mt-input { background-color: var(--panel)}

/* Home WAHAJ AI card: the ask field fits "Ask anything..." in full */
.ai-home .ask { gap: 2px; padding-block: 0 0; padding-inline: 12px 6px}
.ai-home .ask input, .ai-home .ask input::placeholder { font-size: 13.5px}
.ai-home .ask .send { width: 30px; height: 30px; flex: none}
