/* ═══════════ ASK-AI — floating wobbly orb + chat panel (ask-ai.js) ═══════════ */
:root {
  --ai-lime: #9fd801;
  --ai-violet: #7b5cff;
  --ai-cyan: #22d3ee;
  --ai-bg: rgba(10, 12, 24, 0.94);
  --ai-line: rgba(159, 216, 1, 0.18);
  --ai-text: #eef1fa;
  --ai-sub: #8b93ac;
}

/* ---------- the orb ---------- */
@property --ai-hue { syntax: '<angle>'; inherits: true; initial-value: 0deg; }
@property --ai-sweep { syntax: '<percentage>'; inherits: false; initial-value: -60%; }

.ai-orb {
  position: fixed; right: 44px; bottom: 40px; z-index: 1400;
  width: 68px; height: 68px; padding: 0; border: 0; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .3s ease;
}
.ai-orb:hover { transform: scale(1.08); }
.ai-orb:active { transform: scale(.94); }
.ai-orb:focus-visible { outline: none; }
.ai-orb:focus-visible .ai-blob-core { box-shadow: 0 0 0 3px #070810, 0 0 0 5px var(--ai-lime); }

.ai-blob, .ai-blob-core, .ai-blob-halo {
  position: absolute; inset: 0;
  border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%;
}
/* colours flow around the rim (--ai-hue turns the gradient) while the shape wobbles */
.ai-blob-halo {
  inset: -12px; filter: blur(16px) saturate(1.4); opacity: .6;
  background: conic-gradient(from var(--ai-hue), var(--ai-lime), var(--ai-cyan), #ff4fd8, var(--ai-violet), var(--ai-lime));
  animation: ai-wobble 7s ease-in-out infinite, ai-hue 4s linear infinite, ai-pulse 3.2s ease-in-out infinite;
}
.ai-blob {
  background: conic-gradient(from var(--ai-hue), var(--ai-lime), var(--ai-cyan) 28%, #ff4fd8 52%, var(--ai-violet) 72%, var(--ai-lime));
  animation: ai-wobble 5.5s ease-in-out infinite, ai-hue 3s linear infinite reverse, ai-shimmer 6s ease-in-out infinite;
}
.ai-blob-core {
  inset: 5px; overflow: hidden;
  background:
    radial-gradient(circle at 50% 120%, rgba(34,211,238,.28), transparent 60%),
    radial-gradient(circle at 34% 30%, #2a2f52 0%, #0d1024 62%, #070810 100%);
  animation: ai-wobble 6.5s ease-in-out infinite reverse;
}
/* glossy highlight that drifts around + a shine band that sweeps across */
.ai-blob-core::before {
  content: ""; position: absolute; width: 46%; height: 34%; left: 16%; top: 12%;
  border-radius: 50%; background: radial-gradient(ellipse, rgba(255,255,255,.45), rgba(255,255,255,0) 70%);
  filter: blur(1px); animation: ai-gloss 5s ease-in-out infinite;
}
.ai-blob-core::after {
  content: ""; position: absolute; inset: -20%;
  background: linear-gradient(115deg, transparent calc(var(--ai-sweep) - 12%), rgba(255,255,255,.32) var(--ai-sweep), transparent calc(var(--ai-sweep) + 12%));
  animation: ai-sweep 3.6s ease-in-out infinite;
}
.ai-head-orb .ai-blob-core::after { display: none; }
.ai-orb-icon {
  position: absolute; inset: 0; margin: auto; width: 28px; height: 28px;
  color: var(--ai-lime); filter: drop-shadow(0 0 6px rgba(159,216,1,.6));
  animation: ai-breathe 3.2s ease-in-out infinite;
}
.ai-orb-label {
  position: absolute; right: 80px; top: 50%; transform: translate(8px, -50%);
  white-space: nowrap; pointer-events: none; opacity: 0;
  font: 500 .82rem/1 'Space Grotesk', system-ui, sans-serif; letter-spacing: .02em;
  color: var(--ai-text); background: var(--ai-bg); border: 1px solid var(--ai-line);
  padding: .55rem .8rem; border-radius: 999px;
  transition: opacity .25s ease, transform .25s ease;
}
.ai-orb:hover .ai-orb-label, .ai-orb.ai-hint .ai-orb-label { opacity: 1; transform: translate(0, -50%); }

/* thinking = faster, livelier wobble */
.ai-orb.ai-busy .ai-blob, .ai-head-orb.ai-busy .ai-blob { animation-duration: 1.4s, 1s, 6s; }
.ai-orb.ai-busy .ai-blob-halo { animation-duration: 1.8s, 1.2s, 1.2s; opacity: .9; }
.ai-orb:hover .ai-blob-halo { opacity: .85; }

/* open state: orb shrinks back a touch */
.ai-orb[aria-expanded="true"] { transform: scale(.86); }
.ai-orb[aria-expanded="true"] .ai-orb-label { opacity: 0; }

/* hide during the boot screen and the 3D game */
html:not(.ai-ready) .ai-orb, body.flight-active .ai-orb, body.flight-active .ai-panel { opacity: 0; pointer-events: none; visibility: hidden; }

@keyframes ai-wobble {
  0%, 100% { border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%; }
  25%      { border-radius: 58% 42% 38% 62% / 55% 38% 62% 45%; }
  50%      { border-radius: 38% 62% 54% 46% / 62% 55% 45% 38%; }
  75%      { border-radius: 63% 37% 46% 54% / 44% 61% 39% 56%; }
}
@keyframes ai-hue { to { --ai-hue: 360deg; } }
@keyframes ai-shimmer { 0%, 100% { filter: brightness(1) saturate(1.1); } 50% { filter: brightness(1.35) saturate(1.5); } }
@keyframes ai-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes ai-gloss {
  0%, 100% { transform: translate(0, 0) rotate(-20deg); opacity: .9; }
  33%      { transform: translate(40%, 18%) rotate(10deg); opacity: .6; }
  66%      { transform: translate(-8%, 60%) rotate(-35deg); opacity: .4; }
}
@keyframes ai-sweep { 0% { --ai-sweep: -60%; } 55%, 100% { --ai-sweep: 160%; } }
@keyframes ai-breathe { 0%, 100% { transform: scale(1); opacity: .95; } 50% { transform: scale(1.12); opacity: 1; } }

/* ---------- the panel ---------- */
.ai-panel {
  position: fixed; right: 44px; bottom: 124px; z-index: 1400;
  width: min(390px, calc(100vw - 32px)); height: min(560px, calc(100vh - 140px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--ai-bg); color: var(--ai-text);
  border: 1px solid var(--ai-line); border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0,0,0,.55), 0 0 0 1px rgba(123,92,255,.08), 0 0 60px rgba(159,216,1,.07);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  transform-origin: calc(100% - 34px) calc(100% + 50px);
  transform: scale(.4) translateY(30px); opacity: 0; visibility: hidden;
  transition: transform .42s cubic-bezier(.34,1.4,.64,1), opacity .25s ease, visibility 0s linear .42s;
}
.ai-panel.ai-open { transform: none; opacity: 1; visibility: visible; transition-delay: 0s; }

.ai-head {
  display: flex; align-items: center; gap: .75rem;
  padding: .95rem 1rem; border-bottom: 1px solid var(--ai-line);
}
.ai-head-orb { position: relative; width: 30px; height: 30px; flex: none; }
.ai-head-orb .ai-blob-core { inset: 3px; }
.ai-head-txt { flex: 1; min-width: 0; }
.ai-title { margin: 0; font: 600 .95rem/1.2 'Space Grotesk', system-ui, sans-serif; }
.ai-sub { margin: .15rem 0 0; font-size: .72rem; color: var(--ai-sub); letter-spacing: .02em; }
.ai-sub::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-right: .4rem; border-radius: 50%;
  background: var(--ai-lime); box-shadow: 0 0 8px var(--ai-lime); vertical-align: 1px;
}
.ai-icon-btn {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 10px; background: none; color: var(--ai-sub); cursor: pointer;
  transition: color .2s, background .2s, border-color .2s;
}
.ai-icon-btn:hover { color: var(--ai-text); background: rgba(255,255,255,.05); border-color: var(--ai-line); }
.ai-icon-btn:focus-visible { outline: 2px solid var(--ai-lime); outline-offset: 1px; }
.ai-icon-btn svg { width: 16px; height: 16px; }

.ai-log {
  flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .7rem;
  scrollbar-width: thin; scrollbar-color: rgba(159,216,1,.25) transparent; overscroll-behavior: contain;
}
.ai-msg {
  max-width: 88%; padding: .65rem .85rem; border-radius: 14px;
  font-size: .88rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
  animation: ai-pop .32s cubic-bezier(.34,1.4,.64,1) both;
}
.ai-msg a { color: var(--ai-lime); text-underline-offset: 2px; }
.ai-msg.ai-bot { align-self: flex-start; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.06); border-bottom-left-radius: 4px; }
.ai-msg.ai-user { align-self: flex-end; background: linear-gradient(135deg, rgba(159,216,1,.22), rgba(34,211,238,.14)); border: 1px solid rgba(159,216,1,.25); border-bottom-right-radius: 4px; }
.ai-contact { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; white-space: normal; }
.ai-msg a.ai-contact-pill {
  display: inline-flex; align-items: center; padding: .32rem .65rem; border-radius: 999px;
  font-size: .76rem; font-weight: 600; text-decoration: none; color: #070810; background: var(--ai-lime);
  transition: transform .2s, box-shadow .2s;
}
.ai-msg a.ai-contact-pill + a.ai-contact-pill { color: var(--ai-lime); background: rgba(159,216,1,.08); border: 1px solid rgba(159,216,1,.35); }
.ai-msg a.ai-contact-pill:hover { transform: translateY(-1px); box-shadow: 0 0 14px rgba(159,216,1,.35); }
.ai-msg a.ai-contact-pill:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.ai-msg.ai-err { border-color: rgba(255,120,120,.3); color: #ffc7c7; }
@keyframes ai-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }

.ai-typing { display: inline-flex; gap: 4px; padding: .2rem 0; }
.ai-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ai-lime); opacity: .4; animation: ai-dot 1.1s ease-in-out infinite; }
.ai-typing i:nth-child(2) { animation-delay: .15s; }
.ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

.ai-chips { display: flex; flex-wrap: wrap; gap: .45rem; padding: 0 1rem .75rem; }
.ai-chip {
  font: 500 .76rem/1.2 'Space Grotesk', system-ui, sans-serif; color: var(--ai-text);
  padding: .45rem .7rem; border-radius: 999px; cursor: pointer;
  background: rgba(159,216,1,.06); border: 1px solid var(--ai-line);
  transition: background .2s, border-color .2s, transform .2s;
}
.ai-chip:hover { background: rgba(159,216,1,.14); border-color: rgba(159,216,1,.45); transform: translateY(-1px); }
.ai-chip:focus-visible { outline: 2px solid var(--ai-lime); outline-offset: 1px; }

.ai-form { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--ai-line); }
.ai-input {
  flex: 1; min-width: 0; resize: none; max-height: 110px;
  font: 400 .9rem/1.4 'Space Grotesk', system-ui, sans-serif; color: var(--ai-text);
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 12px;
  padding: .65rem .8rem; outline: none; transition: border-color .2s, background .2s;
}
.ai-input::placeholder { color: var(--ai-sub); }
.ai-input:focus { border-color: rgba(159,216,1,.5); background: rgba(255,255,255,.06); }
.ai-send {
  width: 42px; height: 42px; flex: none; align-self: flex-end; display: grid; place-items: center;
  border: 0; border-radius: 12px; cursor: pointer; color: #070810; background: var(--ai-lime);
  transition: transform .2s, opacity .2s, box-shadow .2s;
}
.ai-send:hover { box-shadow: 0 0 18px rgba(159,216,1,.45); transform: translateY(-1px); }
.ai-send:disabled { opacity: .35; cursor: default; box-shadow: none; transform: none; }
.ai-send:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.ai-send svg { width: 18px; height: 18px; }
.ai-foot { margin: 0; padding: 0 1rem .7rem; font-size: .66rem; color: var(--ai-sub); text-align: center; letter-spacing: .02em; }

/* ---------- phones: bottom sheet ---------- */
@media (max-width: 600px) {
  .ai-orb { right: 16px; bottom: 16px; width: 58px; height: 58px; }
  .ai-orb-label { display: none; }
  .ai-panel {
    right: 16px; left: 16px; bottom: 86px; width: auto;
    height: min(72vh, calc(100svh - 110px)); border-radius: 18px;
  }
  .ai-input { font-size: 16px; } /* prevents iOS zoom-on-focus */
}
