/* MedDex motion system — shared by Chat, Spatial Intelligence and the Spatial
   Workspace. One set of curves and durations so every surface moves the same
   way: quick to respond, soft to land, never bouncy for its own sake.

   Everything here is zero-specificity (:where) or additive (individual
   `scale`/`translate` properties, which compose with a component's own
   `transform`), so a component's existing styling always wins. */
:root {
  --mdx-ease-out: cubic-bezier(.22, 1, .36, 1);      /* settle: fast start, long landing */
  --mdx-ease-in-out: cubic-bezier(.65, 0, .35, 1);    /* move between two places */
  --mdx-ease-spring: cubic-bezier(.34, 1.36, .64, 1); /* a small, confident overshoot */
  --mdx-dur-press: 90ms;
  --mdx-dur-quick: 160ms;
  --mdx-dur-base: 240ms;
  --mdx-dur-slow: 420ms;
  --mdx-focus-ring: rgba(92, 196, 232, .72);
}

/* Press feedback: every control acknowledges the finger immediately (the
   press is 90 ms, the release springs back), so taps feel physical. */
:where(button, [role="button"], a.button, .btn, summary):not(:disabled):not([aria-disabled="true"]) {
  transition-property: scale, background-color, border-color, color, box-shadow, opacity, filter;
  transition-duration: var(--mdx-dur-base);
  transition-timing-function: var(--mdx-ease-spring);
  -webkit-tap-highlight-color: transparent;
}
:where(button, [role="button"], a.button, .btn):not(:disabled):not([aria-disabled="true"]):active {
  scale: .965;
  transition-duration: var(--mdx-dur-press);
  transition-timing-function: var(--mdx-ease-out);
}
:where(button, [role="button"], a, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--mdx-focus-ring);
  outline-offset: 2px;
}

/* Menus, listboxes and popovers open from where they were summoned instead of
   popping into existence. They re-run this each time `hidden` is removed. */
@keyframes mdx-pop-in {
  from { opacity: 0; scale: .96; translate: 0 -4px; }
  to { opacity: 1; scale: 1; translate: 0 0; }
}
:where([role="menu"], [role="listbox"], [popover], .mdx-guideline-menu, .mdx-menu, .mdx-popover):not([hidden]) {
  animation: mdx-pop-in var(--mdx-dur-quick) var(--mdx-ease-out) both;
  transform-origin: top center;
}

/* Loading copy breathes rather than blinking. */
@keyframes mdx-soft-pulse { 0%, 100% { opacity: .62; } 50% { opacity: 1; } }
:where(.bchat-status-text, .mdx-loading-text) { animation: mdx-soft-pulse 1.8s var(--mdx-ease-in-out) infinite; }

/* Scroll surfaces: momentum on touch, no scroll chaining into the page. */
:where(#meddexChatLog, .chat-log, .mdx-spatial-tools, #interpreter-transcript) {
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

/* Spatial Workspace: panels and results arrive, they don't appear. */
@keyframes mdx-rise-in { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
:where(.mdx-spatial-tools):not([hidden]) { animation: mdx-pop-in var(--mdx-dur-base) var(--mdx-ease-out) both; transform-origin: top right; }
:where(.bchat-acts, .bchat-sources) { animation: mdx-rise-in var(--mdx-dur-slow) var(--mdx-ease-out) both; }
:where(.mdx-spatial-tool-tabs button) { transition: background-color var(--mdx-dur-base) var(--mdx-ease-out), color var(--mdx-dur-base) var(--mdx-ease-out), border-color var(--mdx-dur-base) var(--mdx-ease-out), scale var(--mdx-dur-base) var(--mdx-ease-spring); }

@media (prefers-reduced-motion: reduce) {
  :where(.mdx-spatial-tools):not([hidden]), :where(.bchat-acts, .bchat-sources) { animation: none; }
  :where(button, [role="button"], a.button, .btn):active { scale: none; }
  :where([role="menu"], [role="listbox"], [popover], .mdx-guideline-menu, .mdx-menu, .mdx-popover):not([hidden]),
  :where(.bchat-status-text, .mdx-loading-text) { animation: none; }
}
