/* Concept demonstrations. Playback is owned by term-motion.js. */
.demo[data-demo="glass"] .glass-orb {
  animation: tm-glass-orbit 4s ease-in-out infinite;
}
.demo[data-demo="bento"] .bento-layout {
  animation: tm-bento-columns 4.5s ease-in-out infinite;
}
.demo[data-demo="bento"] .bento-layout > div {
  animation: tm-tile-emphasis 4.5s ease-in-out infinite;
}
.demo[data-demo="bento"] .bento-layout > div:nth-child(2) { animation-delay: -.9s; }
.demo[data-demo="bento"] .bento-layout > div:nth-child(3) { animation-delay: -1.8s; }
.demo[data-demo="bento"] .bento-layout > div:nth-child(4) { animation-delay: -2.7s; }
.demo[data-demo="grain"] .grain-overlay {
  inset: -8px;
  animation: tm-grain-shift 3.8s ease-in-out infinite;
}
.demo[data-demo="grain"] .grain-shape {
  overflow: hidden;
}
.demo[data-demo="grain"] .grain-shape::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background-image:
    radial-gradient(circle, #552b29b3 .7px, transparent 1px),
    radial-gradient(circle, #ffe1b7b3 .7px, transparent 1px);
  background-size: 4px 4px, 5px 5px;
  background-position: 0 0, 2px 3px;
  animation: tm-grain-texture-wipe 3.8s ease-in-out infinite;
}
.demo[data-demo="neumorphism"] .neu-buttons > div {
  animation: tm-neu-press 3.6s ease-in-out infinite;
}
.demo[data-demo="neumorphism"] .neu-buttons > div:nth-child(2) { animation-delay: -1.2s; }
.demo[data-demo="neumorphism"] .neu-buttons > div:nth-child(3) { animation-delay: -2.4s; }
.demo[data-demo="gradient-text"] .gradient-type {
  background-size: 240% 240%;
  animation: tm-gradient-flow 3.6s ease-in-out infinite;
}
.demo[data-demo="outline-text"] .outline-words {
  animation: tm-outline-fill 3.6s ease-in-out infinite;
}
.demo[data-demo="outline-text"] .outline-words span {
  -webkit-text-stroke: 1px #5b735e;
  animation: tm-outline-fill 3.6s ease-in-out -1.8s infinite;
}

/* Follow the request, supplied context, iteration, and component lineage. */
.demo[data-demo="prompt"] .prompt-note,
.demo[data-demo="prompt"] .workflow-arrow,
.demo[data-demo="prompt"] .workflow-result {
  animation: tm-stage-focus 3.6s ease-in-out infinite;
}
.demo[data-demo="prompt"] .workflow-arrow { animation-delay: -2.4s; }
.demo[data-demo="prompt"] .workflow-result { animation-delay: -1.2s; }
.demo[data-demo="context"] .context-stack > span,
.demo[data-demo="iteration"] .iteration-flow > div,
.demo[data-demo="component"] .component-token,
.demo[data-demo="component"] .component-children > span {
  animation: tm-stage-focus 3.6s ease-in-out infinite;
}
.demo[data-demo="context"] .context-stack > span:nth-child(2),
.demo[data-demo="iteration"] .iteration-flow > div:nth-of-type(2),
.demo[data-demo="component"] .component-children > span:first-child { animation-delay: -2.4s; }
.demo[data-demo="context"] .context-stack > span:nth-child(3),
.demo[data-demo="iteration"] .iteration-flow > div:nth-of-type(3),
.demo[data-demo="component"] .component-children > span:nth-child(2) { animation-delay: -1.2s; }
.demo[data-demo="component"] .component-children > span:last-child { animation-delay: -.6s; }

/* Concept diagrams: values remain fixed and the loss/gain symbols are equal. */
.demo[data-demo="anchoring"] .psych-price del {
  display: inline-block;
  animation: tm-price-anchor 4s ease-in-out infinite;
}
.demo[data-demo="anchoring"] .psych-price strong {
  animation: tm-price-sale 4s ease-in-out infinite;
}
.demo[data-demo="loss-aversion"] .psych-loss > div b {
  width: 78px;
  flex: 0 0 78px;
  text-align: center;
  animation: tm-loss-focus 4s ease-in-out infinite;
}
.demo[data-demo="loss-aversion"] .psych-loss > div:nth-of-type(2) b { animation-delay: -2s; }
.demo[data-demo="default-effect"] .psych-default > span:first-of-type {
  animation: tm-selected-focus 3.2s ease-in-out infinite;
}
.demo[data-demo="default-effect"] .psych-default > span:first-of-type i {
  animation: tm-selected-dot 3.2s ease-in-out infinite;
}
.demo[data-demo="streamgraph"] .stream-demo path {
  transform-box: view-box;
  transform-origin: 50% 50%;
  animation: tm-stream-wave 4.5s ease-in-out infinite;
}
.demo[data-demo="streamgraph"] .stream-demo path:nth-child(2) { animation-delay: -1.5s; }
.demo[data-demo="streamgraph"] .stream-demo path:nth-child(3) { animation-delay: -3s; }
.demo[data-demo="testimonials"] .testimonial-card > b {
  display: block;
  animation: tm-quote-focus 4s ease-in-out infinite;
}
.demo[data-demo="testimonials"] .testimonial-card > span {
  animation: tm-stage-focus 4s ease-in-out -2s infinite;
}
.demo[data-demo="filter"] .filter-example section i {
  animation: tm-filter-choice 3.6s ease-in-out infinite;
}
.demo[data-demo="filter"] .filter-example section i:nth-child(2) { animation-delay: -2.4s; }
.demo[data-demo="filter"] .filter-example section i:nth-child(3) { animation-delay: -1.2s; }
.demo[data-demo="pagination"] .pagination-demo > :nth-child(n+2):nth-child(-n+4) {
  border-radius: 4px;
  animation: tm-page-focus 3.6s ease-in-out infinite;
}
.demo[data-demo="pagination"] .pagination-demo > :nth-child(3) { animation-delay: -2.4s; }
.demo[data-demo="pagination"] .pagination-demo > :nth-child(4) { animation-delay: -1.2s; }

/* Animate the actual spacing and frame properties being explained. */
.demo[data-demo="padding"] .padding-box {
  box-sizing: border-box;
  animation: tm-padding-space 3.6s ease-in-out infinite;
}
.demo[data-demo="margin"] .margin-box { padding: 0; }
.demo[data-demo="margin"] .margin-box > div {
  width: auto;
  height: auto;
  flex: 1;
  align-self: stretch;
  margin: 29px;
  animation: tm-margin-space 3.6s ease-in-out infinite;
}
.demo[data-demo="gap"] .gap-example {
  animation: tm-gap-space 3.6s ease-in-out infinite;
}
.demo[data-demo="line-height"] .lineheight-demo {
  background: none;
  animation: tm-line-space 3.6s ease-in-out infinite;
}
.demo[data-demo="word-break"] .wordbreak-demo {
  animation: tm-word-width 4.5s ease-in-out infinite;
}
.demo[data-demo="hamburger"] .hamburger-demo i {
  transform-origin: center;
  animation: tm-menu-top 3.6s ease-in-out infinite;
}
.demo[data-demo="hamburger"] .hamburger-demo i:nth-child(2) { animation-name: tm-menu-middle; }
.demo[data-demo="hamburger"] .hamburger-demo i:nth-child(3) { animation-name: tm-menu-bottom; }
.demo[data-demo="breakpoint"] .breakpoint-demo > div:first-child {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  animation: tm-breakpoint-columns 4.2s ease-in-out infinite;
}
.demo[data-demo="cover"] .cover-example {
  animation: tm-cover-frame 4s ease-in-out infinite;
}
.demo[data-demo="cover"] .cover-landscape {
  inset: 0;
  width: 210px;
  height: 140px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.demo[data-demo="webp"] .webp-demo > span {
  animation: tm-image-tile 3.6s ease-in-out infinite;
}
.demo[data-demo="webp"] .webp-demo > b {
  animation: tm-file-emphasis 3.6s ease-in-out infinite;
}

@keyframes tm-glass-orbit {
  0%, 100% { transform: translate(-23px, 8px) scale(.9); }
  50% { transform: translate(67px, -15px) scale(1.1); }
}
@keyframes tm-bento-columns {
  0%, 100% { grid-template-columns: 1.15fr 1fr 1fr; }
  50% { grid-template-columns: 1.6fr .8fr 1fr; }
}
@keyframes tm-tile-emphasis {
  0%, 70%, 100% { box-shadow: 0 0 0 0 transparent; filter: brightness(1); }
  20%, 40% { box-shadow: 0 0 0 2px #8b9a5e; filter: brightness(1.08); }
}
@keyframes tm-grain-shift {
  0%, 100% { transform: translate(0, 0); opacity: .15; }
  50% { transform: translate(4px, -5px); opacity: .65; }
}
@keyframes tm-grain-texture-wipe {
  0%, 100% { clip-path: inset(0 94% 0 0); opacity: .45; }
  45%, 60% { clip-path: inset(0 0 0 0); opacity: .85; }
}
@keyframes tm-neu-press {
  0%, 60%, 100% { box-shadow: 7px 7px 13px #bbc5bd, -7px -7px 13px #fff; transform: translateY(0); }
  20%, 40% { box-shadow: inset 5px 5px 9px #c2ccc4, inset -5px -5px 9px #fff; transform: translateY(3px); color: #df7957; }
}
@keyframes tm-gradient-flow {
  0%, 100% { background-position: 0% 30%; }
  50% { background-position: 100% 70%; }
}
@keyframes tm-outline-fill {
  0%, 15%, 100% { color: transparent; }
  40%, 65% { color: #5b735e; }
}
@keyframes tm-stage-focus {
  0%, 70%, 100% { filter: brightness(1); transform: translateY(0); box-shadow: 0 0 0 0 transparent; }
  18%, 38% { filter: brightness(1.07); transform: translateY(-3px); box-shadow: 0 3px 0 #65785766; }
}
@keyframes tm-price-anchor {
  0%, 100% { color: #b7a18c; transform: scale(1); }
  15%, 35% { color: #83563b; transform: scale(1.12); }
}
@keyframes tm-price-sale {
  0%, 35%, 100% { transform: scale(1); }
  55%, 78% { transform: scale(1.1); }
}
@keyframes tm-loss-focus {
  0%, 60%, 100% { opacity: .65; box-shadow: 0 0 0 0 transparent; }
  18%, 40% { opacity: 1; box-shadow: 0 0 0 3px #8d817566; }
}
@keyframes tm-selected-focus {
  0%, 100% { box-shadow: 0 0 0 0 #95aa7b00; }
  45%, 65% { box-shadow: 0 0 0 3px #95aa7b66; background: #e1edce; }
}
@keyframes tm-selected-dot {
  0%, 100% { transform: scale(1); }
  45%, 65% { transform: scale(1.25); }
}
@keyframes tm-stream-wave {
  0%, 100% { transform: scaleY(1) skewX(0deg); }
  50% { transform: scaleY(1.24) skewX(4deg); }
}
@keyframes tm-quote-focus {
  0%, 100% { transform: translateX(0); opacity: 1; }
  40%, 60% { transform: translateX(7px); opacity: .65; }
}
@keyframes tm-filter-choice {
  0%, 25%, 100% { opacity: 1; transform: scale(1); }
  40%, 75% { opacity: .26; transform: scale(.84); }
}
@keyframes tm-page-focus {
  0%, 25%, 100% { background: #9b84b5; color: #fff; transform: translateY(-3px); }
  38%, 88% { background: transparent; color: #a091af; transform: translateY(0); }
}
@keyframes tm-padding-space {
  0%, 100% { padding: 29px; }
  50% { padding: 16px; }
}
@keyframes tm-margin-space {
  0%, 100% { margin: 29px; }
  50% { margin: 17px; }
}
@keyframes tm-gap-space {
  0%, 100% { gap: 8px; }
  50% { gap: 2px; }
}
@keyframes tm-line-space {
  0%, 100% { line-height: 31px; }
  50% { line-height: 43px; }
}
@keyframes tm-word-width {
  0%, 100% { width: 177px; }
  50% { width: 129px; }
}
@keyframes tm-menu-top {
  0%, 20%, 100% { transform: translateY(0) rotate(0); }
  45%, 75% { transform: translateY(8px) rotate(45deg); }
}
@keyframes tm-menu-middle {
  0%, 20%, 100% { opacity: 1; transform: scaleX(1); }
  45%, 75% { opacity: 0; transform: scaleX(.3); }
}
@keyframes tm-menu-bottom {
  0%, 20%, 100% { transform: translateY(0) rotate(0); }
  45%, 75% { transform: translateY(-8px) rotate(-45deg); }
}
@keyframes tm-breakpoint-columns {
  0%, 20%, 100% { width: 109px; grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr; }
  45%, 75% { width: 65px; grid-template-columns: 1fr; grid-template-rows: repeat(3, 1fr); }
}
@keyframes tm-cover-frame {
  0%, 100% { width: 160px; height: 120px; }
  50% { width: 110px; height: 140px; }
}
@keyframes tm-image-tile {
  0%, 100% { transform: rotateY(0); color: #b1b8d0; text-shadow: none; }
  50% { transform: rotateY(35deg); color: #8b99c0; text-shadow: -3px 0 #e7b8b955, 3px 0 #91c6c855; }
}
@keyframes tm-file-emphasis {
  0%, 100% { color: #7e88ab; }
  50% { color: #56678f; }
}

/* The shared RAF already eases pointer motion. Native transitions would keep
   moving for another fraction of a second after a preview is paused. */
.demo[data-demo="magnetic"] .magnetic-target,
.demo[data-demo="tilt"] .tilt-card,
.demo[data-demo="cursor"] .custom-cursor {
  transition: none !important;
}

/* Pause every term animation, including existing effects and pseudo elements.
   This deliberately never targets source/resource preview SVGs outside .demo. */
.demo[data-demo] *,
.demo[data-demo] *::before,
.demo[data-demo] *::after {
  animation-play-state: paused !important;
}
.demo[data-demo].is-demo-playing *,
.demo[data-demo].is-demo-playing *::before,
.demo[data-demo].is-demo-playing *::after {
  animation-play-state: running !important;
}
.demo[data-demo]:not(.is-demo-playing) *,
.demo[data-demo]:not(.is-demo-playing) *::before,
.demo[data-demo]:not(.is-demo-playing) *::after {
  animation-play-state: paused !important;
}
@media (prefers-reduced-motion: reduce) {
  .demo[data-demo] *,
  .demo[data-demo] *::before,
  .demo[data-demo] *::after {
    animation: none !important;
    transition: none !important;
  }
}
