/* The cyborg's ride from "The problem" to "One brain. Built for growth." on the home page. Goes with story.js.
   Only applies once story.js has run (#story.cy-ready), so without the script the designer's layout stays. */

/* The ride: #brains spans from her spot in the problem stage to her spot in "One brain";
   she sticks to the screen inside it, so she glides between the two. */
#story.cy-ready{ position: relative; }
#story.cy-ready .brains{
  position: absolute;
  left: 0;
  right: 0;
  width: auto;
  z-index: 4;
  pointer-events: none;
}
#story.cy-ready .brains .agent-still{
  position: sticky;
  top: var(--cy-stick, 30vh);
  left: auto;
  display: block;
  width: var(--cy-size, 340px);
  height: var(--cy-size, 340px);
  margin: 0 auto;
  transform: none;
  opacity: 1;
  filter: saturate(.7) brightness(.86);
  animation: cyFloat 6s ease-in-out infinite;
  transition: filter .7s ease;
  /* A soft glow behind her (the picture is a see-through PNG), so she never looks cut out
     while crossing from the dark card to the white page. */
  background: radial-gradient(closest-side at 50% 42%, rgba(150, 120, 255, .30), rgba(110, 86, 240, .10) 62%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 80%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 80%, transparent 100%);
}
#story.cy-ready .brains.clear .agent-still{
  filter: none;
  background: radial-gradient(closest-side at 50% 42%, rgba(150, 120, 255, .45), rgba(110, 86, 240, .16) 62%, transparent);
}

@keyframes cyFloat{ 0%, 100%{ translate: 0 0; } 50%{ translate: 0 -8px; } }

/* Pills: story.js sets --x/--y (their spot round her); the CSS adds the gentle wobble. */
#story.cy-ready .pill{
  transform: translate(-50%, -50%) translate(var(--x, 0px), var(--y, 0px));
}
#story.cy-ready .pill[hidden]{ display: none; }
#story.cy-ready .stage.cy-gone .pill{ opacity: 0; }
#story.cy-ready .pill > *{ animation: cyWobble 1.8s linear infinite; animation-delay: calc(var(--d, 0s) * -1); }
#story.cy-ready .pill i{ animation: none; }
@keyframes cyWobble{
  0%{ translate: 4px 0; } 25%{ translate: 0 4px; } 50%{ translate: -4px 0; } 75%{ translate: 0 -4px; } 100%{ translate: 4px 0; }
}

#story .cy-slot{ display: none; }

/* Phones and small tablets: the problem card reads head, facts, her (with four questions round her),
   then "Here's what changes"; she then glides down into her own slot at the top of "One brain". */
@media (max-width: 900px){
  #story.cy-ready .problem-foot{ display: contents; }
  #story.cy-ready .problem-head{ order: 1; }
  #story.cy-ready .facts{ order: 2; margin: 18px 0 4px; align-self: center; }
  #story.cy-ready .problem .stage{ order: 3; min-height: calc(var(--cy-size, 220px) + 128px); }
  #story.cy-ready .next{ order: 4; margin-top: 4px; }
  #story.cy-ready .pill{
    font-size: 13px;
    padding: 8px 12px;
    gap: 6px;
    max-width: calc(50% - 6px);
  }
  #story.cy-ready .pill i{ width: 18px; height: 18px; font-size: 11px; }
  #story .cy-slot{
    display: block;
    flex: none;
    width: 100%;
    height: calc(var(--cy-size, 220px) + 8px);
  }
  #story.cy-ready .thinks{ padding-top: 12px; }
  #story.cy-ready .brains{ z-index: 4; }
}

@media (prefers-reduced-motion: reduce){
  #story.cy-ready .brains .agent-still,
  #story.cy-ready .pill > *{ animation: none; }
}
