/* Slot tokens are public: packs consume these without changing component layout. */
:root {
  --ds-icon-stroke-width: 1.5;
  --ds-motion-duration: 900ms;
  --ds-motion-pulse-duration: 1200ms;
  --ds-motion-arrive-duration: 220ms;
  --ds-motion-ease: cubic-bezier(.22, 1, .36, 1);
  --ds-motion-dot-size: 2px;
  --ds-motion-dot-gap: 3px;
  --ds-motion-indicator-width: 18px;
  --ds-motion-indicator-height: 6px;
  --ds-motion-ring-size: 10px;
  --ds-motion-line-width: calc(1.5px * var(--ds-line-scale, 1));
  --ds-motion-arrive-distance: calc(5px * var(--ds-space-scale, 1));
  --ds-motion-minimal-distance: calc(2px * var(--ds-space-scale, 1));
  --ds-motion-matrix-duration: 1440ms;
  --ds-motion-matrix-size: 16px;
}
/* Original motion: nine fixed dots with a short bright head and a fading trail.
   Inspired by Erdem Kirmitci's AI-loader reference; no image/video dependency. */
.elements-ai-matrix {
  display: inline-block; flex: none;
  width: var(--ds-motion-matrix-size); height: var(--ds-motion-matrix-size);
  overflow: visible; vertical-align: -3px; pointer-events: none;
  color: inherit;
}
.elements-ai-matrix:not([data-motion-variant]) > circle {
  opacity: .12;
  animation: elements-matrix-light var(--ds-motion-matrix-duration) linear infinite;
  animation-delay: calc((var(--matrix-phase) - 9) * var(--ds-motion-matrix-duration) / 9);
}
@keyframes elements-matrix-light {
  0%, 70%, 100% { opacity: .12; }
  8%, 19% { opacity: 1; }
  34% { opacity: .48; }
  50% { opacity: .17; }
}
html [data-elements-ai-matrix="loading"],
html [data-elements-ai-matrix="thinking"] {
  display: inline-grid !important; place-items: center;
  grid-template: 1fr / 1fr !important; gap: 0 !important;
  width: var(--ds-motion-matrix-size) !important; height: var(--ds-motion-matrix-size) !important;
  border: 0 !important; border-radius: 0 !important; background: none !important;
  animation: none !important; transform: none !important; line-height: 1;
}
html [data-elements-ai-matrix="loading"] > :not(.elements-ai-matrix),
html [data-elements-ai-matrix="thinking"] > :not(.elements-ai-matrix) { display: none !important; }
html [data-elements-ai-matrix="loading"]::before,
html [data-elements-ai-matrix="loading"]::after,
html [data-elements-ai-matrix="thinking"]::before,
html [data-elements-ai-matrix="thinking"]::after { content: none !important; }
html [data-elements-ai-matrix="ai-status"] {
  display: inline-flex !important; align-items: center; gap: 8px;
  padding-inline-end: 0 !important; background: none !important;
  color: var(--ds-color-text) !important; -webkit-text-fill-color: currentColor !important;
  animation: none !important;
}
html [data-elements-ai-matrix="ai-status"]::before,
html [data-elements-ai-matrix="ai-status"]::after { content: none !important; }
html [data-elements-ai-matrix="ai-status"] > :not(.elements-ai-matrix),
html .codex-process__activity:has([data-elements-ai-matrix="ai-status"]) > .codex-process__icon { display: none !important; }

/* Orbs: fixed-size, palette-aware motion choices. Only transform/opacity animate. */
.elements-ai-matrix[data-motion-variant] > * {
  transform-box: fill-box; transform-origin: center;
  animation-delay: var(--orb-delay, 0s);
  animation-timing-function: ease-in-out; animation-iteration-count: infinite;
}
.elements-ai-matrix[data-motion-variant="ripple"] > circle {
  animation-name: elements-orb-ripple; animation-duration: 1.8s;
}
@keyframes elements-orb-ripple {
  0%, 65%, 100% { opacity: .15; transform: scale(.72); }
  25% { opacity: 1; transform: scale(1.05); }
}
.elements-ai-matrix[data-motion-variant="sweep"] > circle {
  animation-name: elements-orb-sweep; animation-duration: 1.6s;
}
@keyframes elements-orb-sweep {
  0%, 62%, 100% { opacity: .12; }
  25%, 36% { opacity: 1; }
}
.elements-ai-matrix[data-motion-variant="orbit"] > circle:not(.orb-core) {
  animation-name: elements-orb-orbit; animation-duration: 1.25s;
  animation-timing-function: linear;
}
@keyframes elements-orb-orbit {
  0%, 100% { opacity: 1; transform: scale(1.08); }
  32% { opacity: .4; transform: scale(.9); }
  72% { opacity: .1; transform: scale(.75); }
}
.elements-ai-matrix[data-motion-variant="orbit"] .orb-core { opacity: .22; }
.elements-ai-matrix[data-motion-variant="globe"] > circle {
  animation-name: elements-orb-globe; animation-duration: 2.8s;
}
@keyframes elements-orb-globe {
  0%, 100% { transform: translateX(0) scale(1.08); opacity: .95; }
  25% { transform: translateX(var(--orb-radius)) scale(.82); opacity: .5; }
  50% { transform: translateX(0) scale(.6); opacity: .12; }
  75% { transform: translateX(calc(-1 * var(--orb-radius))) scale(.82); opacity: .5; }
}
.elements-ai-matrix[data-motion-variant="wave"] > rect {
  animation-name: elements-orb-wave; animation-duration: 1.2s;
}
@keyframes elements-orb-wave {
  0%, 100% { transform: scaleY(.24); opacity: .4; }
  45% { transform: scaleY(1); opacity: 1; }
}
.elements-ai-matrix[data-motion-variant="pulse"] .orb-halo {
  animation-name: elements-orb-halo; animation-duration: 2s;
}
.elements-ai-matrix[data-motion-variant="pulse"] .orb-core {
  animation-name: elements-orb-breathe; animation-duration: 2s;
}
@keyframes elements-orb-halo {
  0% { transform: scale(.3); opacity: .65; }
  85%, 100% { transform: scale(1.1); opacity: 0; }
}
@keyframes elements-orb-breathe {
  0%, 100% { opacity: .5; transform: scale(.8); }
  45% { opacity: 1; transform: scale(1.12); }
}
.elements-ai-matrix[data-motion-variant="gather"] > circle:not(.orb-core) {
  animation-name: elements-orb-gather; animation-duration: 2.2s;
}
@keyframes elements-orb-gather {
  0%, 15%, 100% { transform: translate(0, 0); opacity: .35; }
  48%, 60% { transform: translate(var(--orb-in-x), var(--orb-in-y)); opacity: 1; }
}
.elements-ai-matrix[data-motion-variant="scatter"] > circle:not(.orb-core) {
  animation-name: elements-orb-scatter; animation-duration: 1.8s;
}
@keyframes elements-orb-scatter {
  0% { transform: translate(var(--orb-in-x), var(--orb-in-y)) scale(.6); opacity: 0; }
  20% { opacity: 1; }
  70% { transform: translate(0, 0) scale(.85); opacity: .25; }
  92%, 100% { transform: translate(0, 0) scale(.4); opacity: 0; }
}
.elements-ai-matrix:is([data-motion-variant="gather"], [data-motion-variant="scatter"]) .orb-core { opacity: .5; }
html[data-motion-paused="true"] .elements-ai-matrix > *,
[data-motion-paused="true"] .elements-ai-matrix > * { animation-play-state: paused !important; }
html[data-elements-motion="none"] .elements-ai-matrix > * { animation: none !important; opacity: .45; }
@media (prefers-reduced-motion: reduce) {
  .elements-ai-matrix > * { animation: none !important; opacity: .5; }
  .elements-ai-matrix > circle:nth-child(5) { opacity: 1; }
  .elements-ai-matrix[data-motion-variant="globe"] > circle { transform: translateX(var(--orb-radius)); }
  .elements-ai-matrix[data-motion-variant="globe"] > circle:nth-child(even) { transform: translateX(calc(-1 * var(--orb-radius))); }
  .elements-ai-matrix[data-motion-variant="pulse"] .orb-halo { opacity: .25; }
}
svg[data-elements-icon-rendered="true"] {
  background-color: currentColor !important;
  -webkit-mask: var(--elements-icon-mask) center / contain no-repeat !important;
  mask: var(--elements-icon-mask) center / contain no-repeat !important;
  mask-mode: alpha;
}
svg[data-elements-icon-rendered="true"] > * { opacity: 0 !important; }
html[data-elements-motion="dots"] [data-elements-motion-slot="loading"]::after {
  display: block !important;
  content: "";
  width: var(--ds-motion-indicator-width) !important;
  height: var(--ds-motion-indicator-height) !important;
  max-width: none !important;
  max-height: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: radial-gradient(circle, currentColor 55%, transparent 60%) left center / 25% 75% no-repeat,
    radial-gradient(circle, currentColor 55%, transparent 60%) center / 25% 75% no-repeat,
    radial-gradient(circle, currentColor 55%, transparent 60%) right center / 25% 75% no-repeat;
  animation: elements-slot-dots var(--ds-motion-duration) steps(3, end) infinite !important;
}
html[data-elements-motion="dots"] .anticon-loading > svg,
html[data-elements-motion="minimal"] .anticon-loading > svg { display: none !important; }
html[data-elements-motion="dots"] .anticon-loading,
html[data-elements-motion="minimal"] .anticon-loading { display: inline-grid; place-items: center; }
html[data-elements-motion="dots"] .thinking-dot-matrix {
  width: var(--ds-motion-indicator-width);
  height: var(--ds-motion-indicator-height);
  grid-template-columns: repeat(3, var(--ds-motion-dot-size));
  grid-template-rows: var(--ds-motion-dot-size);
  gap: var(--ds-motion-dot-gap);
  align-content: center;
  color: var(--ds-color-accent, currentColor);
}
html[data-elements-motion="dots"] .thinking-dot { grid-area: auto; }
html[data-elements-motion="dots"] .thinking-dot:nth-child(n+4) { display: none; }
html[data-elements-motion="dots"] .thinking-dot-matrix[data-state="active"] .thinking-dot {
  animation: elements-slot-pulse var(--ds-motion-duration) ease-in-out infinite;
}
html[data-elements-motion="dots"] .thinking-dot:nth-child(2) { animation-delay: -600ms; }
html[data-elements-motion="dots"] .thinking-dot:nth-child(3) { animation-delay: -300ms; }
html[data-elements-motion="dots"] .gallery-flow-particles { filter: none; color: var(--ds-color-accent, currentColor); }
html[data-elements-motion="dots"] .gallery-flow-particles circle { r: var(--ds-motion-dot-size); }
html[data-elements-motion="dots"] .attachment-chip { animation: elements-slot-arrive var(--ds-motion-arrive-duration) steps(5, end) both; }
html[data-elements-motion="minimal"] [data-elements-motion-slot="loading"]::after {
  display: block !important;
  content: "";
  width: var(--ds-motion-ring-size) !important;
  height: var(--ds-motion-ring-size) !important;
  border: var(--ds-motion-line-width) solid currentColor !important;
  border-right-color: transparent !important;
  border-radius: 50% !important;
  background: none !important;
  animation: elements-slot-rotate var(--ds-motion-pulse-duration) linear infinite !important;
}
html[data-elements-motion="minimal"] .thinking-dot-matrix {
  display: inline-grid;
  width: var(--ds-motion-ring-size);
  height: var(--ds-motion-ring-size);
  color: var(--ds-color-muted, currentColor);
}
html[data-elements-motion="minimal"] .thinking-dot { display: none; }
html[data-elements-motion="minimal"] .thinking-dot-matrix[data-state="active"]::after {
  content: "";
  width: 100%; height: 100%; box-sizing: border-box;
  border: var(--ds-motion-line-width) solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: elements-slot-rotate var(--ds-motion-pulse-duration) linear infinite;
}
html[data-elements-motion="minimal"] .gallery-flow-particles { filter: none; }
html[data-elements-motion="minimal"] .gallery-flow-particles circle:nth-child(n+2) { display: none; }
html[data-elements-motion="minimal"] .attachment-chip,
html[data-elements-motion="minimal"] .gallery-card { animation: elements-slot-fade var(--ds-motion-arrive-duration) var(--ds-motion-ease) both; }
html[data-elements-motion="none"] *,
html[data-elements-motion="none"] *::before,
html[data-elements-motion="none"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html[data-elements-motion="none"] .gallery-flow-particles,
html[data-elements-motion="none"] .thinking-dot-matrix { visibility: hidden !important; }
html[data-elements-motion="none"] .canvas-flow-node[data-gallery-flow-active="true"] .canvas-flow-node-icon { box-shadow: none !important; background-image: none !important; }
html[data-motion-paused="true"] [data-elements-motion-slot],
html[data-motion-paused="true"] [data-elements-motion-slot] *,
html[data-motion-paused="true"] [data-elements-motion-slot]::after,
html[data-motion-paused="true"] [data-elements-motion-slot]::before,
html[data-motion-paused="true"] .thinking-dot-matrix::after { animation-play-state: paused !important; }
@keyframes elements-slot-dots { 0%, 100% { opacity: .9; } 33% { opacity: .35; } 66% { opacity: .6; } }
@keyframes elements-slot-pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@keyframes elements-slot-rotate { to { transform: rotate(360deg); } }
@keyframes elements-slot-arrive { from { opacity: 0; transform: translateY(var(--ds-motion-arrive-distance)); } to { opacity: 1; transform: none; } }
@keyframes elements-slot-fade { from { opacity: 0; transform: translateY(var(--ds-motion-minimal-distance)); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  [data-elements-motion-slot], [data-elements-motion-slot] *, [data-elements-motion-slot]::after,
  [data-elements-motion-slot]::before, .thinking-dot-matrix::after { animation: none !important; transition: none !important; }
  .gallery-flow-particles { visibility: hidden !important; }
}
html[data-elements-motion="dots"] .chat-loading-spinner,
html[data-elements-motion="minimal"] .chat-loading-spinner { border: 0 !important; background: none !important; animation: none !important; }
html[data-elements-motion="dots"] .ant-progress-bg,
html[data-elements-motion="dots"] .ob-progress-bg {
  background-image: radial-gradient(circle, var(--ds-color-surface, white) 20%, transparent 25%);
  background-size: var(--ds-motion-indicator-height) var(--ds-motion-indicator-height);
}
html[data-elements-motion="minimal"] [data-elements-motion-slot="feedback"] {
  transition-duration: var(--ds-motion-arrive-duration);
  animation-duration: var(--ds-motion-pulse-duration);
  animation-timing-function: var(--ds-motion-ease);
}
