/* Timelines from the Figma message demo and the Quran sciences demo. */
@property --chat-x {
  syntax: "<number>";
  initial-value: 0;
  inherits: false;
}

@property --chat-y {
  syntax: "<number>";
  initial-value: 0;
  inherits: false;
}

@property --chat-scale {
  syntax: "<number>";
  initial-value: 1;
  inherits: false;
}

@media (prefers-reduced-motion: no-preference) {
  .assistant-logo img:first-child {
    animation: chat-logo-glow 6.003s linear infinite;
  }

  /* The circular gradient rotates through three Smart Animate variants. */
  @keyframes chat-logo-glow {
    0%, 0.016658% { rotate: 0deg; }
    33.333333%, 33.349992% { rotate: 90deg; }
    66.666667%, 66.683325% { rotate: 180deg; }
    100% { rotate: 360deg; }
  }

  .chat-demo__showcase.is-playing [data-chat-motion] {
    transform: translate(calc(var(--chat-x) * var(--p)), calc(var(--chat-y) * var(--p))) scale(var(--chat-scale));
  }

  /* Search rests on the final answer until the 47-second Figma timeline repeats. */
  .chat-demo__showcase { --chat-search-cycle: 47s; }

  .chat-demo__showcase.is-playing [data-chat-motion="scroll"] {
    animation: chat-scroll-y var(--chat-search-cycle) linear infinite;
  }

  .chat-demo__showcase.is-playing [data-chat-motion="date"] {
    animation: chat-date-opacity var(--chat-search-cycle) linear infinite,
      chat-date-y var(--chat-search-cycle) linear infinite;
  }

  .chat-demo__showcase.is-playing [data-chat-motion="welcome"] {
    animation: chat-welcome-opacity var(--chat-search-cycle) linear infinite,
      chat-welcome-scale var(--chat-search-cycle) linear infinite,
      chat-welcome-y var(--chat-search-cycle) linear infinite;
  }

  .chat-demo__showcase.is-playing [data-chat-motion="question"] {
    animation: chat-question-opacity var(--chat-search-cycle) linear infinite,
      chat-question-scale var(--chat-search-cycle) linear infinite,
      chat-question-y var(--chat-search-cycle) linear infinite;
  }

  .chat-demo__showcase.is-playing [data-chat-motion="answer"] {
    animation: chat-answer-opacity var(--chat-search-cycle) linear infinite,
      chat-answer-scale var(--chat-search-cycle) linear infinite,
      chat-answer-y var(--chat-search-cycle) linear infinite;
  }

  .chat-demo__showcase.is-playing [data-chat-motion="follow-up"] {
    animation: chat-follow-up-opacity var(--chat-search-cycle) linear infinite,
      chat-follow-up-scale var(--chat-search-cycle) linear infinite,
      chat-follow-up-y var(--chat-search-cycle) linear infinite;
  }

  .chat-demo__showcase.is-playing [data-chat-motion="last-answer"] {
    animation: chat-last-answer-opacity var(--chat-search-cycle) linear infinite,
      chat-last-answer-scale var(--chat-search-cycle) linear infinite,
      chat-last-answer-y var(--chat-search-cycle) linear infinite;
  }

  .chat-demo__showcase.is-playing [data-chat-motion="science-list"] {
    animation: chat-science-list-x 6.5s linear infinite;
  }

  .chat-demo__showcase.is-playing [data-chat-motion="disabled-composer"] {
    animation: chat-disabled-composer-opacity 6.5s linear infinite;
  }

  .chat-demo__showcase.is-playing [data-chat-motion="tafsir-list"] {
    animation: chat-tafsir-list-x 6.5s linear infinite;
  }

  .chat-demo__showcase.is-playing [data-chat-motion="chosen-science"] {
    animation: chat-chosen-science-x 6.5s linear infinite;
  }

  .chat-demo__showcase.is-playing [data-chat-motion="enabled-composer"] {
    animation: chat-enabled-composer-opacity 6.5s linear infinite;
  }

  .chat-demo__showcase.is-playing [data-chat-motion="tap-tafsir"] {
    animation: chat-tap-tafsir-opacity 6.5s linear infinite,
      chat-tap-tafsir-scale 6.5s linear infinite;
  }

  .chat-demo__showcase.is-playing [data-chat-motion="tap-subscience"] {
    animation: chat-tap-subscience-opacity 6.5s linear infinite,
      chat-tap-subscience-scale 6.5s linear infinite;
  }

  .chat-demo__showcase.is-playing [data-chat-motion="typing-composer"] {
    animation: chat-typing-composer-opacity 6.5s linear infinite;
  }

  .chat-demo__showcase.is-playing [data-chat-motion="cursor"] {
    animation: chat-cursor-opacity 6.5s linear infinite;
  }

  .chat-demo__showcase.is-playing [data-chat-motion="tap-composer"] {
    animation: chat-tap-composer-opacity 6.5s linear infinite,
      chat-tap-composer-scale 6.5s linear infinite;
  }

  @keyframes chat-scroll-y {
    0% { --chat-y: 0; }
    11.596% { animation-timing-function: cubic-bezier(0.32, 0, 0.2, 1); --chat-y: 0; }
    13.085% { --chat-y: -250.898; }
    100% { --chat-y: -250.898; }
  }

  @keyframes chat-date-opacity {
    0% { opacity: 0; }
    0.213% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); opacity: 0; }
    0.63% { opacity: 1; }
    100% { opacity: 1; }
  }

  @keyframes chat-date-y {
    0% { --chat-y: 3; }
    0.213% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-y: 3; }
    0.809% { --chat-y: 0; }
    100% { --chat-y: 0; }
  }

  @keyframes chat-welcome-opacity {
    0% { opacity: 0; }
    0.745% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); opacity: 0; }
    1.519% { opacity: 1; }
    100% { opacity: 1; }
  }

  @keyframes chat-welcome-scale {
    0% { --chat-scale: 0.992; }
    0.745% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-scale: 0.992; }
    1.851% { --chat-scale: 1; }
    100% { --chat-scale: 1; }
  }

  @keyframes chat-welcome-y {
    0% { --chat-y: 10; }
    0.745% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-y: 10; }
    1.851% { --chat-y: 0; }
    100% { --chat-y: 0; }
  }

  @keyframes chat-question-opacity {
    0% { opacity: 0; }
    3.298% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); opacity: 0; }
    3.953% { opacity: 1; }
    100% { opacity: 1; }
  }

  @keyframes chat-question-scale {
    0% { --chat-scale: 0.98; }
    3.298% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-scale: 0.98; }
    4.234% { --chat-scale: 1; }
    100% { --chat-scale: 1; }
  }

  @keyframes chat-question-y {
    0% { --chat-y: 10; }
    3.298% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-y: 10; }
    4.234% { --chat-y: 0; }
    100% { --chat-y: 0; }
  }

  @keyframes chat-answer-opacity {
    0% { opacity: 0; }
    5.851% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); opacity: 0; }
    6.685% { opacity: 1; }
    100% { opacity: 1; }
  }

  @keyframes chat-answer-scale {
    0% { --chat-scale: 0.992; }
    5.851% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-scale: 0.992; }
    7.043% { --chat-scale: 1; }
    100% { --chat-scale: 1; }
  }

  @keyframes chat-answer-y {
    0% { --chat-y: 10; }
    5.851% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-y: 10; }
    7.043% { --chat-y: 0; }
    100% { --chat-y: 0; }
  }

  @keyframes chat-follow-up-opacity {
    0% { opacity: 0; }
    9.043% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); opacity: 0; }
    9.698% { opacity: 1; }
    100% { opacity: 1; }
  }

  @keyframes chat-follow-up-scale {
    0% { --chat-scale: 0.98; }
    9.043% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-scale: 0.98; }
    9.979% { --chat-scale: 1; }
    100% { --chat-scale: 1; }
  }

  @keyframes chat-follow-up-y {
    0% { --chat-y: 10; }
    9.043% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-y: 10; }
    9.979% { --chat-y: 0; }
    100% { --chat-y: 0; }
  }

  @keyframes chat-last-answer-opacity {
    0% { opacity: 0; }
    11.702% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); opacity: 0; }
    12.536% { opacity: 1; }
    100% { opacity: 1; }
  }

  @keyframes chat-last-answer-scale {
    0% { --chat-scale: 0.992; }
    11.702% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-scale: 0.992; }
    12.894% { --chat-scale: 1; }
    100% { --chat-scale: 1; }
  }

  @keyframes chat-last-answer-y {
    0% { --chat-y: 10; }
    11.702% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-y: 10; }
    12.894% { --chat-y: 0; }
    100% { --chat-y: 0; }
  }

  @keyframes chat-science-list-x {
    0% { --chat-x: 0; }
    19.231% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-x: 0; }
    26.923% { --chat-x: -344; }
    100% { --chat-x: -344; }
  }

  @keyframes chat-disabled-composer-opacity {
    0% { opacity: 1; }
    19.231% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); opacity: 1; }
    24.615% { opacity: 0; }
    100% { opacity: 0; }
  }

  @keyframes chat-tafsir-list-x {
    0% { --chat-x: 0; }
    19.231% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-x: 0; }
    26.923% { --chat-x: -344; }
    46.923% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-x: -344; }
    54.615% { --chat-x: -688; }
    100% { --chat-x: -688; }
  }

  @keyframes chat-chosen-science-x {
    0% { --chat-x: 0; }
    46.923% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-x: 0; }
    54.615% { --chat-x: -344; }
    100% { --chat-x: -344; }
  }

  @keyframes chat-enabled-composer-opacity {
    0% { opacity: 0; }
    19.231% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); opacity: 0; }
    24.615% { opacity: 1; }
    70% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); opacity: 1; }
    73.077% { opacity: 0; }
    100% { opacity: 0; }
  }

  @keyframes chat-tap-tafsir-opacity {
    0% { opacity: 0; }
    13.846% { opacity: 0; }
    15.385% { opacity: 0.18; }
    17.231% { opacity: 0.3; }
    19.231% { opacity: 0; }
    100% { opacity: 0; }
  }

  @keyframes chat-tap-tafsir-scale {
    0% { --chat-scale: 1; }
    13.846% { --chat-scale: 1; }
    17.231% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-scale: 0.8; }
    19.231% { --chat-scale: 1.35; }
    100% { --chat-scale: 1.35; }
  }

  @keyframes chat-tap-subscience-opacity {
    0% { opacity: 0; }
    41.538% { opacity: 0; }
    43.077% { opacity: 0.18; }
    44.923% { opacity: 0.3; }
    46.923% { opacity: 0; }
    100% { opacity: 0; }
  }

  @keyframes chat-tap-subscience-scale {
    0% { --chat-scale: 1; }
    41.538% { --chat-scale: 1; }
    44.923% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-scale: 0.8; }
    46.923% { --chat-scale: 1.35; }
    100% { --chat-scale: 1.35; }
  }

  @keyframes chat-typing-composer-opacity {
    0% { opacity: 0; }
    70% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); opacity: 0; }
    73.077% { opacity: 1; }
    100% { opacity: 1; }
  }

  @keyframes chat-cursor-opacity {
    0% { opacity: 0; }
    70% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); opacity: 0; }
    73.077% { animation-timing-function: step-end; opacity: 1; }
    79.231% { animation-timing-function: step-end; opacity: 0; }
    86.923% { animation-timing-function: step-end; opacity: 1; }
    94.615% { animation-timing-function: step-end; opacity: 0; }
    100% { opacity: 1; }
  }

  @keyframes chat-tap-composer-opacity {
    0% { opacity: 0; }
    64.615% { opacity: 0; }
    66.154% { opacity: 0.18; }
    68% { opacity: 0.3; }
    70% { opacity: 0; }
    100% { opacity: 0; }
  }

  @keyframes chat-tap-composer-scale {
    0% { --chat-scale: 1; }
    64.615% { --chat-scale: 1; }
    68% { animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); --chat-scale: 0.8; }
    70% { --chat-scale: 1.35; }
    100% { --chat-scale: 1.35; }
  }
}
