/* Creative Suite — motion system.
 *
 * Restrained, "settling into place" entrances plus three ambient loops.
 * Only opacity / transform (and background-position for .m-shimmer) are
 * touched: no position, size or spacing rules, so dropping this file in or
 * out never shifts layout.
 *
 * Entrances are gated on html.js (set by motion.js): without JS every
 * [data-motion] element stays visible.
 *
 *   data-motion          settle: fade + 18px rise + .985 scale, 700ms
 *   data-motion="rise"   headline: 34px rise, 850ms
 *   data-motion="chips"  container stays put, direct children settle in 70ms steps
 *   .m-float             ambient 6px drift; desync with style="--fd: -2400ms"
 *   .m-shimmer           hairline sweep for code "loading" bars (page sets height)
 *   .m-blink             terminal caret
 */

:root {
  --m-ease: cubic-bezier(.2, .7, .2, 1);
  --m-dur: 700ms;
}

/* ---- Entrances ------------------------------------------------------- */

html.js [data-motion],
html.js [data-motion="chips"] > * {
  opacity: 0;
  transform: translateY(18px) scale(.985);
  transition:
    opacity var(--m-dur) var(--m-ease),
    transform var(--m-dur) var(--m-ease);
}

html.js [data-motion].m-seen,
html.js [data-motion="chips"].m-seen > * {
  opacity: 1;
  transform: none;
}

/* Section headlines: a longer, slower rise. */
html.js [data-motion="rise"] {
  transform: translateY(34px);
  transition-duration: 850ms;
}

/* Chips: the container is only the trigger; its children do the moving. */
html.js [data-motion="chips"] {
  opacity: 1;
  transform: none;
  transition: none;
}

html.js [data-motion="chips"] > :nth-child(2)  { transition-delay:  70ms; }
html.js [data-motion="chips"] > :nth-child(3)  { transition-delay: 140ms; }
html.js [data-motion="chips"] > :nth-child(4)  { transition-delay: 210ms; }
html.js [data-motion="chips"] > :nth-child(5)  { transition-delay: 280ms; }
html.js [data-motion="chips"] > :nth-child(6)  { transition-delay: 350ms; }
html.js [data-motion="chips"] > :nth-child(7)  { transition-delay: 420ms; }
html.js [data-motion="chips"] > :nth-child(8)  { transition-delay: 490ms; }
html.js [data-motion="chips"] > :nth-child(9)  { transition-delay: 560ms; }
html.js [data-motion="chips"] > :nth-child(10) { transition-delay: 630ms; }
html.js [data-motion="chips"] > :nth-child(11) { transition-delay: 700ms; }
/* 12th and beyond share the last step rather than all popping in at once. */
html.js [data-motion="chips"] > :nth-child(n+12) { transition-delay: 770ms; }

/* ---- Ambient: float ------------------------------------------------- */

/* Owns transform: don't put .m-float on the same element as data-motion,
   wrap one in the other. */
.m-float {
  animation: m-float 6s ease-in-out var(--fd, 0ms) infinite alternate;
}

@keyframes m-float {
  from { transform: translateY(0); }
  to   { transform: translateY(-6px); }
}

/* ---- Ambient: shimmer ----------------------------------------------- */

/* Tuned for #171A1F panels with rgba(255,255,255,.12) strokes: the resting
   bar sits just under the stroke, the highlight just above it. The page
   gives the bar its height (1px baseline or 6px bar). */
.m-shimmer {
  background-color: rgba(255, 255, 255, .06);
  background-image: linear-gradient(90deg,
    rgba(255, 255, 255, 0)   0%,
    rgba(255, 255, 255, 0)   42%,
    rgba(255, 255, 255, .22) 50%,
    rgba(255, 255, 255, 0)   58%,
    rgba(255, 255, 255, 0)   100%);
  background-size: 300% 100%;
  background-repeat: no-repeat;
  animation: m-shimmer 2.2s linear infinite;
}

/* 100% -> 0% with a 300% image moves the highlight from off-left to off-right. */
@keyframes m-shimmer {
  from { background-position: 100% 0; }
  to   { background-position: 0% 0; }
}

/* ---- Ambient: caret ------------------------------------------------- */

.m-blink {
  animation: m-blink 1.1s steps(1) infinite;
}

@keyframes m-blink {
  0%  { opacity: 1; }
  50% { opacity: 0; }
}

/* ---- Reduced motion: everything visible, nothing moves -------------- */

@media (prefers-reduced-motion: reduce) {
  html.js [data-motion],
  html.js [data-motion="chips"] > * {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .m-float,
  .m-shimmer {
    animation: none;
  }

  /* Caret shown solid. */
  .m-blink {
    animation: none;
    opacity: 1;
  }
}
