/*
 * Loading states (KAN-639), one set for every page: placeholders shaped like
 * what is coming, the branded loader, and fresh figures fading in. The busy
 * button's dots are with the rest of the busy button in app-shell.css.
 *
 * Not one colour is written. Everything is a tint of the text colour around it,
 * so it reads in light and dark, on pages with no theme sheet, and takes a new
 * palette without a change. The shine is a tint of the same colour moving across.
 *
 * Nothing shows for the first 300 ms: a screen that answers quickly never
 * flickers. With less motion asked for, everything stands still and still shows.
 */
@keyframes ld-appear { to { opacity: 1; } }
@keyframes ld-shine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes ld-dot { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }
@keyframes ld-fresh { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

.ld-skel { opacity: 0; animation: ld-appear 1ms linear 300ms forwards; }
.ld-bar { position: relative; overflow: hidden; border-radius: 8px; background: color-mix(in srgb, currentColor 11%, transparent); }
.ld-bar::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, currentColor 12%, transparent), transparent); animation: ld-shine 1.4s ease-in-out infinite; }

.ld-lines { display: grid; gap: 10px; }
.ld-lines .ld-bar { height: 12px; }
.ld-w1 { width: 100%; }
.ld-w2 { width: 92%; }
.ld-w3 { width: 78%; }
.ld-w4 { width: 85%; }
.ld-w5 { width: 64%; }

.ld-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 16px; }
.ld-tile { height: 74px; border-radius: 12px; }

.ld-table { display: grid; gap: 8px; }
.ld-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.ld-row .ld-bar { height: 14px; }
.ld-row.ld-head .ld-bar { height: 10px; }

.ld-chart { display: flex; align-items: flex-end; gap: 10px; height: 160px; }
.ld-col { flex: 1 1 0; border-radius: 6px 6px 0 0; }
.ld-h1 { height: 45%; }
.ld-h2 { height: 70%; }
.ld-h3 { height: 55%; }
.ld-h4 { height: 90%; }
.ld-h5 { height: 65%; }

.ld-brand { opacity: 0; animation: ld-appear 1ms linear 300ms forwards; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 40vh; padding: 24px; text-align: center; }
.ld-mark { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 16px; border: 2px solid currentColor; font-size: 24px; }
.ld-dots { display: inline-flex; gap: 8px; }
.ld-dots i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; animation: ld-dot 1.2s ease-in-out infinite; }
.ld-dots i:nth-child(2) { animation-delay: 0.18s; }
.ld-dots i:nth-child(3) { animation-delay: 0.36s; }
.ld-say { margin: 0; font-weight: 600; font-size: 14px; }
/* Inside a card, for a long job that fills only its own box. */
.ld-small { min-height: 0; padding: 12px; gap: 8px; }
.ld-small .ld-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 16px; }
/* A way out if the app never starts: hidden, so it cannot be pressed, until 15 seconds have passed. */
@keyframes ld-reveal { to { visibility: visible; } }
.ld-slow { visibility: hidden; animation: ld-reveal 1ms linear 15s forwards; color: inherit; text-decoration: underline; font-size: 13px; padding: 12px; }

/* A tile's figure fades in each time it is written, so a refresh does not jump. */
.vx-kpi .val, .ux-tile-value { animation: ld-fresh 0.45s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .ld-bar::after { animation: none; display: none; }
  .ld-dots i { animation: none; opacity: 0.7; }
  .vx-kpi .val, .ux-tile-value { animation: none; }
}
