/* Cluecog motion: tactile presses, the turning cogs, ticket printing, the result stamp and the cog burst.
   Loaded just before theme.css. Everything that moves is inside the no-preference query below,
   so players who ask for reduced motion get the same page, standing still. */

/* Cog shapes used as masks by the solve burst. */
.confetti i.cog-bit{width:16px;height:16px;border-radius:0;-webkit-mask:var(--cog-mask) center/contain no-repeat;mask:var(--cog-mask) center/contain no-repeat}
.confetti i.cog-bit.big{width:22px;height:22px}

@media (prefers-reduced-motion:no-preference){
  /* Tactile buttons: lift on hover, press flat on click. */
  .button,.mode-tab,.icon-button,.hint-button,.rush-launch,.first-choice,.level-option,.example:not(.example-placeholder),.notes-toggle,.journal-day,.archive-play{transition:transform .14s cubic-bezier(.3,.7,.4,1),box-shadow .14s cubic-bezier(.3,.7,.4,1),background-color .16s ease}
  @media (hover:hover){
    .button:hover:not(:disabled),.hint-button:hover,.first-choice:hover,.mode-tab:not(.active):hover,.icon-button:hover{transform:translate(-1px,-2px);box-shadow:3px 5px 0 var(--ink)}
    .examples .example:hover{transform:translate(-1px,-2px);box-shadow:3px 5px 0 var(--ink)}
    .rush-launch:hover{transform:translate(-2px,-2px)}
    .rush-launch:hover .rush-bolt{animation:bolt-buzz .4s steps(2) 2}
    .brand:hover .brand-icon svg{animation:brand-wobble .6s cubic-bezier(.3,1.6,.5,1)}
  }
  .button:active:not(:disabled),.hint-button:active,.first-choice:active,.mode-tab:active,.icon-button:active,.examples .example:active,.rush-launch:active{transform:translate(2px,3px);box-shadow:0 0 0 var(--ink);transition-duration:.05s}

  /* The workshop window: two cogs turn slowly; they kick when Oddbot runs a number. */
  .machine-scene .scene-cloud{animation:cog-spin 26s linear infinite}
  .machine-scene .scene-cloud-right{animation:cog-spin-back 18s linear infinite}
  .machine-scene:has(.contraption.running) .scene-cloud{animation:cog-spin 26s linear infinite,cog-kick .55s ease-out}
  .machine-scene:has(.contraption.running) .scene-cloud-right{animation:cog-spin-back 18s linear infinite,cog-kick .55s .08s ease-out}
  .machine-scene:has(.contraption.running) .bot-antenna:after{animation:antenna-flash .55s steps(2) 1}
  .machine-scene .output-port.just-printed{animation:port-pop .38s cubic-bezier(.3,1.6,.5,1)}
  .contraption .bot-eyes i{animation:bot-blink 6s 2s infinite}
  .contraption[data-state=solved] .bot-eyes i{animation:none}

  /* A fresh machine prints its clue tickets one after another. */
  .examples.is-printing .example{animation:ticket-in .42s cubic-bezier(.25,1.4,.5,1) backwards}
  .examples.is-printing .example:nth-child(2){animation-delay:.06s}
  .examples.is-printing .example:nth-child(3){animation-delay:.12s}
  .examples.is-printing .example:nth-child(4){animation-delay:.18s}
  .examples.is-printing .example:nth-child(5){animation-delay:.24s}
  .examples.is-printing .example:nth-child(6){animation-delay:.3s}
  .experiment-log .example:last-child.is-new{animation:ticket-in .42s cubic-bezier(.25,1.4,.5,1) backwards}

  /* The result lands like a rubber stamp. */
  .result-content.is-stamping .result-stamp{animation:stamp-slam .5s cubic-bezier(.2,.9,.3,1.2) backwards}
  .result-content.is-stamping>:not(.result-stamp):not(.confetti){animation:result-rise .45s .25s ease-out backwards}

  /* Dialogs open with a small pop. */
  .dialog[open]{animation:dialog-pop .26s cubic-bezier(.25,1.35,.5,1)}
  .dialog[open]::backdrop{animation:backdrop-in .2s ease-out}

  .toast:not([hidden]){animation:toast-in .3s cubic-bezier(.25,1.4,.5,1)}
  .notes-toggle{transition:transform .2s ease}
  .notes-panel[open] .notes-toggle{transform:rotate(45deg)}
}

@keyframes cog-spin{to{rotate:360deg}}
@keyframes cog-spin-back{to{rotate:-360deg}}
@keyframes cog-kick{40%{scale:1.1}}
@keyframes antenna-flash{50%{background:var(--sun);box-shadow:0 0 0 5px #ffc83d66}}
@keyframes port-pop{0%{transform:scale(.86)}60%{transform:scale(1.06)}100%{transform:none}}
@keyframes bot-blink{0%,96%,100%{transform:none}98%{transform:scaleY(.12)}}
@keyframes ticket-in{0%{opacity:0;transform:translateY(10px) rotate(-1.5deg) scale(.96)}100%{opacity:1;transform:none}}
@keyframes stamp-slam{0%{opacity:0;transform:rotate(-14deg) scale(2.1)}55%{opacity:1;transform:rotate(-7deg) scale(.94)}100%{transform:rotate(-6deg) scale(1)}}
@keyframes result-rise{0%{opacity:0;transform:translateY(8px)}100%{opacity:1;transform:none}}
@keyframes dialog-pop{0%{opacity:0;transform:translateY(14px) scale(.96)}100%{opacity:1;transform:none}}
@keyframes backdrop-in{from{opacity:0}}
@keyframes toast-in{0%{opacity:0;transform:translate(-50%,12px)}100%{opacity:1}}
@keyframes bolt-buzz{50%{transform:rotate(-12deg) scale(1.08)}}
@keyframes brand-wobble{30%{transform:rotate(-10deg) translateY(-2px)}60%{transform:rotate(6deg)}100%{transform:none}}
