/* ==========================================================================
   VEMA: Venu's AI twin (chat panel on every page).
   The panel has its own surface so it stands apart from the page: crisp white in the light theme,
   a lifted navy in the dark theme. Areas are separated with soft fills and space, not outlines.
   ========================================================================== */
.vema,
.vema-launch {
  --vema-bg: #ffffff;
  --vema-soft: #f1f3f5; /* bubbles, typing box, toggle */
  --vema-chip: rgba(3, 105, 161, 0.08);
  --vema-chip-hover: rgba(3, 105, 161, 0.15);
  --vema-chip-text: #075985;
  --vema-muted: #5b6272;
  --vema-shadow: 0 28px 70px -22px rgba(10, 15, 26, 0.5), 0 0 0 1px rgba(10, 15, 26, 0.06);
  --vema-glow: 3, 105, 161; /* accent as RGB, for the glow around the typing box */
}
:root[data-theme="dark"] .vema,
:root[data-theme="dark"] .vema-launch {
  --vema-bg: #141d31;
  --vema-soft: #1e2942;
  --vema-chip: rgba(56, 189, 248, 0.14);
  --vema-chip-hover: rgba(56, 189, 248, 0.24);
  --vema-chip-text: #bae6fd;
  --vema-muted: #a3acbf;
  --vema-shadow: 0 28px 70px -22px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --vema-glow: 56, 189, 248;
}

.vema-orb {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  color: #fff;
  background: radial-gradient(circle at 32% 26%, #ff9a5c 0%, #e8501a 34%, #a8380a 66%, #4a1604 100%); /* the brand dot, in dark orange */
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.vema-orb::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: inherit;
  filter: blur(8px);
  opacity: 0.45;
  z-index: -1;
}
.vema-orb svg {
  width: 58%;
  height: 58%;
}

/* Launcher */
.vema-launch {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 55;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  height: 52px;
  padding: 0 1.1rem 0 0.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--color-text);
  color: var(--color-bg);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 30px -10px rgba(10, 15, 26, 0.55);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.vema-launch:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px -10px rgba(10, 15, 26, 0.6);
}
.vema-launch:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}
.vema-is-open .vema-launch {
  display: none;
}
.site-footer {
  padding-bottom: calc(2.25rem + 64px); /* the launcher never covers the footer links */
}

/* Panel */
.vema {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 56;
  display: flex;
  flex-direction: column;
  width: min(420px, 100vw - 40px);
  height: min(680px, 100dvh - 40px);
  background: var(--vema-bg);
  color: var(--color-text);
  border-radius: 22px;
  box-shadow: var(--vema-shadow);
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.vema.is-in {
  opacity: 1;
  transform: none;
}
.vema[hidden] {
  display: none;
}
.vema__head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 0.75rem 0.75rem 1.1rem;
}
.vema__head .vema-orb {
  width: 40px;
  height: 40px;
}
.vema__id {
  flex: 1;
  min-width: 0;
}
.vema__top { /* title and the audio, new chat and close buttons share one row */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-block: -1px -3px;
}
.vema__id h2 {
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.vema__id p {
  font-size: 0.8rem;
  color: var(--vema-muted);
}
.vema__mode {
  font-weight: 600;
}
.vema__mode.is-live {
  color: var(--color-accent);
}
.vema__tools {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin-right: -0.25rem;
}
.vema__intro {
  margin-top: 0.15rem;
  line-height: 1.4;
}
.vema__icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
}
.vema__icon:hover {
  background: var(--vema-soft);
}
.vema__icon svg {
  width: 18px;
  height: 18px;
}
.vema__icon.is-on,
.vema__icon[aria-pressed="true"] {
  background: var(--vema-chip);
  color: var(--color-accent);
}
.is-speaking .vema__head .vema-orb {
  animation: vema-talk 1.1s ease-in-out infinite;
}
@keyframes vema-talk {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 80, 26, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(232, 80, 26, 0); }
}

/* Conversation */
.vema__log {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.75rem 1.1rem 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}
.vema-msg {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.vema-msg .vema-orb {
  width: 28px;
  height: 28px;
  margin-top: 2px;
}
.vema-msg .vema-orb::after {
  display: none;
}
.vema-bubble {
  min-width: 0;
  padding: 0.7rem 0.95rem;
  border-radius: 6px 18px 18px 18px;
  background: var(--vema-soft);
  font-size: 0.95rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.vema-bubble p + p,
.vema-bubble p + ul,
.vema-bubble p + ol,
.vema-bubble ul + p,
.vema-bubble ol + p {
  margin-top: 0.55rem;
}
.vema-bubble ul,
.vema-bubble ol {
  display: grid;
  gap: 0.3rem;
  padding-left: 1.15rem;
}
.vema-bubble ul {
  list-style: disc;
}
.vema-bubble ol {
  list-style: decimal;
}
.vema-bubble a {
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.vema-msg--user {
  justify-content: flex-end;
}
.vema-msg--user .vema-bubble {
  max-width: 85%;
  border-radius: 18px 18px 6px 18px;
  background: var(--color-accent);
  color: #fff;
}
:root[data-theme="dark"] .vema-msg--user .vema-bubble {
  color: #0a0f1a;
}
.vema-dots {
  display: inline-flex;
  gap: 4px;
  padding: 0.35rem 0;
}
.vema-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--vema-muted);
  animation: vema-dot 1s infinite ease-in-out;
}
.vema-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.vema-dots i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes vema-dot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* Suggested questions: soft filled pills, no outlines */
.vema__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.25rem 1.1rem 1rem;
}
.vema__chips[hidden] {
  display: none;
}
.vema-chip {
  padding: 0.5rem 0.85rem;
  border: 0;
  border-radius: 999px;
  background: var(--vema-chip);
  color: var(--vema-chip-text);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}
.vema-chip:hover {
  background: var(--vema-chip-hover);
}
.vema-chip.is-fun { /* playful questions get a soft rainbow wash */
  background: linear-gradient(100deg, rgba(255, 184, 77, 0.2), rgba(123, 92, 240, 0.16), rgba(77, 184, 255, 0.18));
  color: var(--color-text);
}
.vema-chip.is-fun:hover {
  background: linear-gradient(100deg, rgba(255, 184, 77, 0.32), rgba(123, 92, 240, 0.26), rgba(77, 184, 255, 0.3));
}

.vema-chip.is-design { /* "Ask me a design question": the brand orange (text 4.9:1 on the light panel) */
  background: rgba(232, 80, 26, 0.1);
  color: #a8380a;
}
.vema-chip.is-design:hover {
  background: rgba(232, 80, 26, 0.18);
}
:root[data-theme="dark"] .vema-chip.is-design {
  background: rgba(232, 80, 26, 0.18);
  color: #ffb28f;
}
:root[data-theme="dark"] .vema-chip.is-design:hover {
  background: rgba(232, 80, 26, 0.28);
}

/* Idle: a rainbow light runs around the panel edge for 8 seconds (every 3 minutes while idle) */
@property --vema-spin {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
.vema::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  padding: 2px;
  border-radius: inherit;
  background: conic-gradient(from var(--vema-spin), #ff4d4d, #ffb84d, #ffe14d, #4dd97a, #4db8ff, #7b5cf0, #ff4dc4, #ff4d4d);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  pointer-events: none;
}
.vema.is-glow::before { /* 8 seconds: fades in, keeps running around the panel, fades out */
  animation: vema-rainbow 8s linear forwards;
}
@keyframes vema-rainbow {
  0% { opacity: 0; --vema-spin: 0deg; }
  6% { opacity: 1; }
  90% { opacity: 1; }
  100% { opacity: 0; --vema-spin: 2160deg; }
}

/* Fun effects (js/vema-fx.js): drawn above everything; the site dims behind them */
.vema-fx {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.6s ease, background-color 0.45s ease;
}
.vema-fx--dim {
  background-color: rgba(5, 8, 16, 0);
}
.vema-fx--dim.is-on {
  background-color: rgba(5, 8, 16, 0.74);
}
.vema-fx.is-out {
  opacity: 0;
}
.vema-fx--interactive {
  pointer-events: auto;
  cursor: pointer;
}
.vema-fx__trail {
  position: absolute;
  inset: 0;
}
.vema-fx__path {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 5 9;
  opacity: 0.6;
}
.vema-fx--dim .vema-fx__path {
  stroke: #fff;
  opacity: 0.75;
}
.vema-fx__rider {
  position: absolute;
  top: 0;
  left: 0;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35)) drop-shadow(0 0 12px rgba(255, 255, 255, 0.35));
  will-change: transform;
}
.vema-fx__prop {
  transform-box: fill-box;
  transform-origin: center;
  animation: vm-prop 0.07s linear infinite alternate;
}
@keyframes vm-prop { from { transform: scaleY(1); } to { transform: scaleY(0.15); } }
.vema-fx__wheel {
  transform-box: fill-box;
  transform-origin: center;
  animation: vm-wheel 0.3s linear infinite;
}
@keyframes vm-wheel { to { transform: rotate(360deg); } }
.vema-fx__calm { /* Reduce Motion: a still illustration that fades in and out */
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%) scale(2);
  filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.3));
  opacity: 0;
}
/* Words glow in VEMA's colors: centered, medium size */
.vema-fx__glow {
  position: absolute;
  top: 50%;
  left: 50%;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 1.2rem + 2.2vw, 2.8rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: #fff;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.8), 0 0 14px rgba(56, 189, 248, 0.95), 0 0 28px rgba(43, 125, 233, 0.75), 0 0 46px rgba(123, 92, 240, 0.6);
  opacity: 0;
  pointer-events: none;
}
.vema-fx__canvas {
  position: absolute;
  inset: 0;
}

.vema__hint {
  margin: 0 1rem 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: 12px;
  background: var(--vema-soft);
  color: var(--vema-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}
.vema__hint[hidden] {
  display: none;
}

/* Footer: one link; "About VEMA" details expand and collapse */
.vema__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem 0.9rem 1.2rem;
  font-size: 0.82rem;
}
.vema__foot a {
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: none;
}
.vema__foot a:hover {
  text-decoration: underline;
}
.vema__info {
  width: 30px;
  height: 30px;
  color: var(--vema-muted);
}
.vema__info svg {
  width: 17px;
  height: 17px;
}
.vema__info[aria-expanded="true"] {
  background: var(--vema-soft);
  color: var(--color-text);
}
.vema__about {
  margin: -0.35rem 1.2rem 0.9rem;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--vema-muted);
}
.vema__about[hidden] {
  display: none;
}

/* Hero button */
.btn .vema-orb {
  width: 22px;
  height: 22px;
}
.btn .vema-orb::after {
  display: none;
}

/* Phones: full screen */
@media (max-width: 599px) {
  .vema-launch {
    right: 16px;
    bottom: 16px;
  }
  .vema {
    inset: 0;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
  }
  .vema-is-open,
  .vema-is-open body {
    overflow: hidden;
  }
}
@media (prefers-reduced-motion: reduce) {
  .vema,
  .vema-launch,
  .vema__log {
    transition: none;
    scroll-behavior: auto;
  }
  .vema-dots i,
  .is-speaking .vema__head .vema-orb {
    animation: none;
  }
  .vema-fx__wheel,
  .vema-fx__prop {
    animation: none !important;
  }
  .vema.is-glow::before {
    animation: none;
  }
}
@media print {
  .vema-launch,
  .vema {
    display: none !important;
  }
}
