/*
 * DD-14 Skeleton — app/components/ui/skeleton_component.rb
 *
 * Every `.ui-skeleton` block is a surface-sunken rect at the radius of the
 * thing it replaces, with a shimmer sweep driven by a translated
 * ::after gradient (--duration-shimmer, 1.4s). The global
 * prefers-reduced-motion rule in base.css collapses all animation
 * durations to ~0, which is what turns the sweep into a static tint —
 * no extra media query needed here.
 *
 * Token vars only — enforced by test/lint/css_token_lint_test.rb.
 */

.ui-skeleton {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--color-surface-sunken);
  border-radius: var(--radius-xs);
}

.ui-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--color-surface-solid) 50%, transparent), transparent);
  animation: ui-skeleton-shimmer var(--duration-shimmer) var(--ease-in-out) infinite;
}

@keyframes ui-skeleton-shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* text-line */
.ui-skeleton--text-line {
  width: 70%;
  height: 12px;
}

/* kpi-tile — label + value, stacked above one another */
.ui-skeleton-group--kpi-tile {
  display: flex;
  flex-direction: column;
}

.ui-skeleton--kpi-label {
  width: 96px;
  height: 10px;
  margin-bottom: var(--space-2);
}

.ui-skeleton--kpi-value {
  width: 128px;
  height: 28px;
  border-radius: var(--radius-sm);
}

/* table-rows(n) */
.ui-skeleton-group--table-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ui-skeleton--table-row {
  width: 100%;
  height: 44px;
}

/* list-rows(n) — mirrors DD-03's leading avatar frame + two-line body */
.ui-skeleton-group--list-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ui-skeleton-list-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ui-skeleton-list-row__lines {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.ui-skeleton--list-avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
}

.ui-skeleton--list-line-primary {
  width: 60%;
  height: 14px;
  margin-bottom: var(--space-1);
}

.ui-skeleton--list-line-secondary {
  width: 40%;
  height: 11px;
}

/* card — matches CN-01's --radius-lg glass panel */
.ui-skeleton--card {
  width: 100%;
  height: 120px;
  border-radius: var(--radius-lg);
}

/* chart — matches DD-08's capsule bars */
.ui-skeleton-chart {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  height: 160px;
}

.ui-skeleton--chart-bar {
  width: 24px;
  height: var(--bar-height, 60px);
  border-radius: var(--radius-pill);
}
