/* ═══════════════════════════════════════════════════
   Sync — Cloud Syncing Animation
   ═══════════════════════════════════════════════════ */

/* ── Ripple keyframes ───────────────────────────── */

@keyframes nb-sync-ripple {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
  25% {
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
  }
}

/* ── Trail keyframes ────────────────────────────── */

@keyframes nb-sync-trail-x {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@keyframes nb-sync-trail-flip {
  0%, 48% { transform: rotate(0deg); }
  50%, 98% { transform: rotate(180deg); }
  100% { transform: rotate(360deg); }
}

/* ── Spinner keyframes ──────────────────────────── */

@keyframes nb-sync-spin {
  to { transform: rotate(360deg); }
}

/* ── Root ────────────────────────────────────────── */

.nb-sync {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Cloud icon + ripples ────────────────────────── */

.nb-sync__cloud {
  position: relative;
}

.nb-sync__icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  box-shadow:
    0 0 0 1px rgba(29, 29, 32, 0.04),
    0 0 0 5px rgba(99, 102, 241, 0.1),
    0 1px 3px 0 rgba(79, 70, 229, 0.25),
    0 1px 2px -1px rgba(79, 70, 229, 0.25);
}

.nb-sync__cloud-icon {
  display: block;
}

.nb-sync__cloud-logo {
  display: block;
  object-fit: contain;
}

.nb-sync__ripple {
  position: absolute;
  border-style: solid;
  aspect-ratio: 1 / 1;
  top: 50%;
  left: 50%;
  border-radius: 9999px;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  animation: nb-sync-ripple calc(var(--nb-sync-ripple-dur, 4.25) * 1s) cubic-bezier(0.16, 1, 0.3, 1) infinite;
  animation-delay: calc(var(--i, 0) * 0.825s);
  pointer-events: none;
}

/* ── Connection line ─────────────────────────────── */

.nb-sync__line {
  flex: 1 1 0%;
  position: relative;
  padding: 16px 0;
  mask: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}

.nb-sync__line-base {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 0;
  right: 0;
  border-radius: 9999px;
}

.nb-sync__trail-mover {
  position: absolute;
  inset: 0;
  animation: nb-sync-trail-x calc(var(--nb-sync-trail-dur, 4) * 0.5s) ease-in-out infinite alternate;
  animation-delay: 0.25s;
}

.nb-sync__trail-flipper {
  width: 100%;
  height: 100%;
  animation: nb-sync-trail-flip calc(var(--nb-sync-trail-dur, 4) * 1s) linear infinite;
  animation-delay: 0.25s;
}

.nb-sync__trail {
  mask: linear-gradient(90deg, transparent, #000);
  -webkit-mask: linear-gradient(90deg, transparent, #000);
  padding-right: 12px;
  width: 33.3333%;
  height: 100%;
  display: flex;
  align-items: center;
}

.nb-sync__trail-line {
  width: 100%;
  box-shadow: 0 0 8px 2px rgba(99, 102, 241, 0.15);
  border-radius: 9999px;
}

.nb-sync__trail-dot {
  width: 4px;
  height: 4px;
  margin-left: -4px;
  flex-shrink: 0;
  border-radius: 9999px;
  box-shadow: 0 0 8px 2px rgba(99, 102, 241, 0.4);
}

/* ── Badge ───────────────────────────────────────── */

.nb-sync__badge {
  box-shadow:
    0 0 0 1px rgba(29, 29, 32, 0.08),
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -2px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.nb-sync__spinner {
  display: flex;
  animation: nb-sync-spin calc(var(--nb-sync-spinner-dur, 2) * 1s) linear infinite;
}

.nb-sync__spinner svg {
  display: block;
}
