/* One quiet breathing sweep for AI waiting, context gathering and live edits on
 * both Lesson Studio and Lesson Space. Keep labels readable without motion. */
:root {
  --ai-progress-gradient: linear-gradient(90deg, var(--text-tertiary) 35%, var(--text-primary) 50%, var(--text-tertiary) 65%);
}

.ls3-ai-artifact-building {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 4px 0;
  overflow-wrap: anywhere;
  font-size: 0.75rem;
  font-weight: 650;
}

.ls3-ai-artifact-building,
.ai-progress-text,
.ls3-p5-editor.is-ai-writing::after,
.ls3-geoscript-editor.is-ai-writing::after {
  background-image: var(--ai-progress-gradient);
  background-size: 300% 100%;
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ls3-artifact-shimmer 4.8s ease-in-out infinite;
}

@keyframes ls3-artifact-shimmer {
  /* A single highlight crosses the label, then rests outside it. Both ends
   * show the same flat colour, so resetting the sweep cannot flash. */
  0%, 12% { background-position: 100% 0; opacity: .8; }
  50% { background-position: 50% 0; opacity: 1; }
  82%, 100% { background-position: 0% 0; opacity: .8; }
}

@media (prefers-reduced-motion: reduce), (forced-colors: active) {
  .ls3-ai-artifact-building,
  .ai-progress-text,
  .ls3-p5-editor.is-ai-writing::after,
  .ls3-geoscript-editor.is-ai-writing::after {
    background-image: none;
    color: var(--text-secondary);
    -webkit-text-fill-color: currentColor;
    animation: none;
    opacity: 1;
  }
}
