/* ==========================================================================
   Component: Skeleton
   .skeleton with shimmer animation for loading placeholders.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Base Skeleton
   --------------------------------------------------------------------------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background-color: var(--bg-elevated);
  border-radius: var(--radius-md);
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}

/* All children become invisible */
.skeleton * {
  visibility: hidden !important;
}

/* ---------------------------------------------------------------------------
   Shimmer Effect
   --------------------------------------------------------------------------- */
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.04) 40%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.04) 60%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.8s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ---------------------------------------------------------------------------
   Preset shapes
   --------------------------------------------------------------------------- */
.skeleton--text {
  height: 14px;
  border-radius: var(--radius-sm);
  width: 100%;
}

.skeleton--text-sm {
  height: 11px;
  border-radius: var(--radius-sm);
  width: 60%;
}

.skeleton--heading {
  height: 20px;
  border-radius: var(--radius-sm);
  width: 40%;
}

.skeleton--avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.skeleton--avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.skeleton--thumbnail {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
}

.skeleton--button {
  height: 32px;
  width: 80px;
  border-radius: var(--radius-md);
}

.skeleton--badge {
  height: 20px;
  width: 48px;
  border-radius: var(--radius-full);
}

.skeleton--card {
  height: 120px;
  border-radius: var(--radius-lg);
}

.skeleton--row {
  height: 40px;
  border-radius: var(--radius-sm);
  width: 100%;
}

/* ---------------------------------------------------------------------------
   Skeleton Group — multiple skeletons in a layout
   --------------------------------------------------------------------------- */
.skeleton-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.skeleton-group--row {
  flex-direction: row;
  align-items: center;
}

/* Listing skeleton preset */
.skeleton--listing {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  height: 56px;
  border-radius: var(--radius-md);
}

/* ---------------------------------------------------------------------------
   Reduced motion — static placeholder, no shimmer
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .skeleton::after {
    animation: none;
    background: rgba(255, 255, 255, 0.04);
  }
}
