/* ==========================================================================
   Skeleton loading states — Ops Console UI Kit
   Reads tokens.css only. The shimmer's period is derived from --dur-slow so
   the whole kit can still be re-timed from one place, and it is switched off
   entirely (not sped up) under reduced motion — a 0.01s sweep would strobe.
   GSAP owns opacity/transform on .sk__ghost, .sk__real and [data-sk-item].
   ========================================================================== */

.sk .card__head { flex-wrap: wrap; }
.sk__controls { display: flex; align-items: center; gap: var(--sp-3); }
.sk__status[data-state="loading"] { background: var(--info-wash); color: var(--info); }

.sk__body { display: flex; flex-direction: column; gap: var(--sp-5); }

/* Ghost and content share one grid cell, so the crossfade has no reflow and
   the block keeps the taller of the two heights. */
.sk__block { display: grid; }
.sk__block > * { grid-area: 1 / 1; min-width: 0; }

.sk__ghost { pointer-events: none; }

.sk__grid { display: grid; gap: var(--sp-3); }
.sk__grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.sk__panel,
.sk__tile,
.sk__stat {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

/* ---------- bones ---------- */

.sk__bone {
  display: block;
  border-radius: var(--radius-sm);
  background-color: var(--surface-hover);
  background-image: linear-gradient(
    100deg,
    var(--surface-hover) 0%,
    var(--line-strong) 45%,
    var(--surface-hover) 72%
  );
  background-size: 220% 100%;
  background-repeat: no-repeat;
  animation: sk-shimmer calc(var(--dur-slow) * 3.4) linear infinite;
}
.sk__bone--label { width: 42%; height: var(--sp-3); }
.sk__bone--figure { width: 64%; height: var(--sp-5); border-radius: var(--radius); }
.sk__bone--meta { width: 78%; height: var(--sp-3); }
.sk__bone--title { width: 34%; height: var(--sp-4); }
.sk__bone--cell { height: var(--sp-3); }
.sk__bone--bar { width: 100%; align-self: flex-end; border-radius: var(--radius-sm); }

@keyframes sk-shimmer {
  from { background-position: 150% 0; }
  to { background-position: -70% 0; }
}

/* Reduced motion gets a flat tint, not a slower sheen. */
@media (prefers-reduced-motion: reduce) {
  .sk__bone {
    animation: none;
    background-image: none;
    background-color: var(--surface-hover);
    box-shadow: inset 0 0 0 1px var(--line);
  }
}

/* ---------- stat tiles ---------- */

.sk__tile { min-height: 96px; }
.sk__stat { min-height: 96px; }
.sk__stat-label { color: var(--ink-faint); font-size: var(--text-xs); font-family: var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; }
.sk__stat-figure { color: var(--ink); font-size: var(--text-2xl); font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; }
.sk__stat-figure small { font-size: var(--text-lg); color: var(--ink-muted); }
.sk__stat-meta { display: flex; align-items: center; gap: var(--sp-2); color: var(--ink-muted); font-size: var(--text-xs); }

/* ---------- chart ---------- */

.sk__panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.sk__panel-title { color: var(--ink); font-size: var(--text-sm); font-weight: 600; }

.sk__bars {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-2);
  height: 120px;
  padding-top: var(--sp-2);
}
.sk__bars > * { flex: 1 1 0; min-width: 0; }
.sk__bar {
  display: block;
  align-self: flex-end;
  border-radius: var(--radius-sm);
  background: var(--series-1);
  opacity: 0.62;
}
.sk__bar--peak { background: var(--series-5); opacity: 1; }

/* ---------- table ---------- */

.sk__row { display: flex; align-items: center; gap: var(--sp-4); min-height: var(--control-h); }
.sk__row--head { border-bottom: 1px solid var(--line); }

.sk__table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.sk__table th,
.sk__table td {
  padding: var(--sp-2) var(--sp-2) var(--sp-2) 0;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sk__table th {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sk__table td { color: var(--ink-muted); }
.sk__table td:first-child { color: var(--ink); }
.sk__table tbody tr:last-child td { border-bottom: 0; }

@media (max-width: 720px) {
  .sk__grid--3 { grid-template-columns: minmax(0, 1fr); }
  .sk__table th:nth-child(3), .sk__table td:nth-child(3) { display: none; }
}

/* Reveal start state, gated on .has-js (added by shell.js only when GSAP is
   present), so a no-JS visitor gets the loaded content and never a blank box. */
.has-js .sk__real { opacity: 0; visibility: hidden; }
