/* reunite.work — motion.
   Thesis: the site of a video editor opens like a timeline.
   Focal moment: a playhead scrubs across the name and "renders" it.
   Supporting motion: section stickers get slapped onto the page,
   and every control answers the pointer. Content is never hidden
   if JavaScript fails; reduced motion keeps fades, drops movement. */

.sp {
  --mx-out: cubic-bezier(.16, 1, .3, 1);
  --mx-scrub: cubic-bezier(.5, 0, .2, 1);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* ---------- Focal moment: playhead scrub over the name ---------- */
  .sp[data-motion="1"] .sp-text > .sp-namebox { animation: none; }
  .sp[data-motion="1"] .sp-name {
    display: inline-block;
    position: relative;
    animation: mx-render .72s var(--mx-scrub) .2s both;
  }
  .sp[data-motion="1"] .sp-name::after {
    content: "";
    position: absolute;
    inset: -.08em auto -.08em 0;
    width: 3px;
    border-radius: 2px;
    background: var(--sp-accent-ink);
    box-shadow: 0 0 0 1px var(--sp-accent), 0 0 18px 2px var(--sp-accent-glow);
    pointer-events: none;
    animation: mx-playhead .72s var(--mx-scrub) .2s both;
  }

  /* The subtitle pill is a sticker slapped on once the name is rendered */
  .sp[data-motion="1"] .sp-text > .sp-title {
    animation: mx-slap .42s var(--mx-out) .86s both;
  }
  /* Hero buttons land one after the other, each dropping its sticker shadow */
  .sp[data-motion="1"] .sp-text > .sp-actions { animation: none; }
  .sp[data-motion="1"] .sp-actions .sp-btn {
    animation: mx-btn-in .5s var(--mx-out) 1s backwards;
  }
  .sp[data-motion="1"] .sp-actions .sp-btn + .sp-btn { animation-delay: 1.09s; }

  /* Hover: the sticker lifts (shadow grows), the arrow says where it goes */
  .sp[data-theme=creator] .sp-actions .sp-btn:hover { box-shadow: 7px 7px 0 var(--sp-text); }
  .sp[data-theme=creator] .sp-actions .sp-btn-ghost:hover { box-shadow: 7px 7px 0 var(--sp-accent); }
  .sp .sp-btn-ic { transition: translate .25s var(--mx-out); }
  .sp .sp-btn-work:hover .sp-btn-ic { animation: mx-nudge-down .9s var(--mx-out) infinite; }
  .sp .sp-btn-talk:hover .sp-btn-ic { translate: 4px 0; }

  /* ---------- Section stickers slap on as they arrive ---------- */
  .rx-armed .sp-h-text {
    transition: scale .42s var(--mx-out), rotate .42s var(--mx-out),
                opacity .2s linear, box-shadow .42s var(--mx-out);
  }
  .rx-armed .sp-h:not(.is-in) .sp-h-text {
    opacity: 0;
    scale: 1.18;
    rotate: -6deg;
    box-shadow: 0 0 0 var(--sp-text);
  }

  /* ---------- Feedback ---------- */
  /* Play button answers hover and press; the card itself stays put */
  .sp .sp-play { transition: scale .2s var(--mx-out), box-shadow .2s var(--mx-out); }
  .sp .sp-player:hover .sp-play { scale: 1.1; }
  .sp .sp-player:active .sp-play { scale: .94; transition-duration: .1s; }

  /* Buttons press into the page instead of floating away */
  .sp .sp-btn:hover { translate: none; }
  .sp[data-theme=creator] .sp-btn:active,
  .sp[data-theme=creator] .sp-actions .sp-btn:active {
    translate: 3px 3px;
    box-shadow: 1px 1px 0 var(--sp-text);
    transition-duration: .08s;
  }
  .sp[data-theme=creator] .sp-btn-ghost:active,
  .sp[data-theme=creator] .sp-actions .sp-btn-ghost:active { box-shadow: 1px 1px 0 var(--sp-accent); }

  .sp .sp-anchors a { transition: background-color .18s, color .18s; }

  /* Video swaps in without a black flash */
  .sp .sp-player iframe { opacity: 0; transition: opacity .35s linear; }
  .sp .sp-player iframe.is-ready { opacity: 1; }

  /* Discord copy confirmation */
  .sp .sp-copied.is-done { animation: mx-pop .32s var(--mx-out); }
}

/* Button arrows (all motion settings) */
.sp .sp-btn-ic { width: 16px; height: 16px; flex: none; }

/* Reduced motion: same states, no travel */
@media (prefers-reduced-motion: reduce) {
  .sp .sp-player iframe { opacity: 1; }
}

@keyframes mx-render {
  from { clip-path: inset(-.3em 100% -.3em -.3em); }
  to   { clip-path: inset(-.3em -.3em -.3em -.3em); }
}
@keyframes mx-playhead {
  0%   { left: 0; opacity: 1; }
  85%  { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}
@keyframes mx-slap {
  from { opacity: 0; scale: 1.3; rotate: -8deg; }
  to   { opacity: 1; scale: 1; rotate: -1.5deg; }
}
@keyframes mx-btn-in {
  from { opacity: 0; scale: .6; rotate: -6deg; box-shadow: 0 0 0 transparent; }
}
@keyframes mx-nudge-down {
  0%, 100% { translate: 0 0; }
  45% { translate: 0 4px; }
}
@keyframes mx-pop {
  0% { scale: .7; } 60% { scale: 1.15; } 100% { scale: 1; }
}
