/* ============================================================
   Claura — animation library (v1.0)
   ------------------------------------------------------------
   Five sanctioned animations for the Rails mark. Apply the class
   to an inline <svg> copy of the symbol — the rects inside are
   selected automatically.

   <svg class="claura-anim-reveal" viewBox="0 0 64 64">
     <rect x="14" y="28" width="6" height="24" rx="3" fill="#E8E8F1"/>
     <rect x="24" y="14" width="6" height="38" rx="3" fill="#7C6DF2"/>
     <rect x="34" y="20" width="6" height="32" rx="3" fill="#E8E8F1"/>
     <rect x="44" y="24" width="6" height="28" rx="3" fill="#E8E8F1"/>
   </svg>

   The DOM-order rules below assume that bar order, left to right.
   ============================================================ */

:where(.claura-anim-reveal, .claura-anim-scan, .claura-anim-sync,
       .claura-anim-breathe) rect {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

/* ── 1. Reveal (one-shot, on first paint) ─────────────────────
   Use for hero entry, page load, modal open. Plays once. */
.claura-anim-reveal rect {
  animation: claura-reveal 1100ms cubic-bezier(0.22, 1, 0.36, 1) both;
  opacity: 0;
}
.claura-anim-reveal rect:nth-child(1) { animation-delay:   0ms; }
.claura-anim-reveal rect:nth-child(2) { animation-delay:  80ms; }
.claura-anim-reveal rect:nth-child(3) { animation-delay: 160ms; }
.claura-anim-reveal rect:nth-child(4) { animation-delay: 240ms; }

@keyframes claura-reveal {
  0%   { transform: scaleY(0);   opacity: 0; }
  50%  {                         opacity: 1; }
  100% { transform: scaleY(1);   opacity: 1; }
}

/* ── 2. Pulse (idle infinite, only the violet rail) ───────────
   Use to indicate "system active" in product chrome.            */
.claura-anim-pulse rect:nth-child(2) {
  animation: claura-pulse 2800ms cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes claura-pulse {
  0%, 100% { opacity: 1;    filter: drop-shadow(0 0 0 transparent); }
  50%      { opacity: 0.86; filter: drop-shadow(0 0 4px rgba(124, 109, 242, 0.65)); }
}

/* ── 3. Scan loader (continuous wave) ─────────────────────────
   Primary product loader. Use for indeterminate progress.       */
.claura-anim-scan rect {
  animation: claura-scan 2000ms cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.claura-anim-scan rect:nth-child(1) { animation-delay:   0ms; }
.claura-anim-scan rect:nth-child(2) { animation-delay: 250ms; }
.claura-anim-scan rect:nth-child(3) { animation-delay: 500ms; }
.claura-anim-scan rect:nth-child(4) { animation-delay: 750ms; }

@keyframes claura-scan {
  0%, 70%, 100% { transform: scaleY(0.55); }
  25%           { transform: scaleY(1.00); }
}

/* ── 4. Breathe loader (passive, in-unison) ───────────────────
   Calmer loader for background work / "thinking" states.        */
.claura-anim-breathe rect {
  animation: claura-breathe 2400ms cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes claura-breathe {
  0%, 100% { transform: scaleY(0.78); }
  50%      { transform: scaleY(1.00); }
}

/* ── 5. Sync (data reconciliation moment) ─────────────────────
   For active sync, refresh, signal-aggregation moments.         */
.claura-anim-sync rect {
  animation: claura-sync 2400ms cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
.claura-anim-sync rect:nth-child(1) { animation-delay:   0ms; }
.claura-anim-sync rect:nth-child(2) { animation-delay: 100ms; }
.claura-anim-sync rect:nth-child(3) { animation-delay: 200ms; }
.claura-anim-sync rect:nth-child(4) { animation-delay: 300ms; }

@keyframes claura-sync {
  0%, 100% { transform: scaleY(1.00); }
  20%      { transform: scaleY(0.30); }
  45%      { transform: scaleY(1.05); }
  65%      { transform: scaleY(0.55); }
  85%      { transform: scaleY(1.02); }
}

/* ── Accessibility: honor user motion preference ──────────────
   All five animations collapse to a static mark when the user
   has reduced-motion enabled. Required, not optional.           */
@media (prefers-reduced-motion: reduce) {
  .claura-anim-reveal rect,
  .claura-anim-pulse rect:nth-child(2),
  .claura-anim-scan rect,
  .claura-anim-breathe rect,
  .claura-anim-sync rect {
    animation: none;
    opacity: 1;
  }
}
