/* Skeleton primitives — grey placeholder shapes that animate while data
 * loads. Used on async-rendered pages so the user sees structure
 * immediately instead of an empty container.
 *
 * The Exec.css file already has `.skeleton-bar` + `@keyframes shimmer`
 * for the device-list initial-load case. This file extends the system
 * with row + block + text variants the rest of the codebase can reuse. */

/* Base shimmer-able element. Anything with .skeleton inherits it. */
.skeleton {
    background: linear-gradient(
        90deg,
        #eef0f4 0%,
        #f6f8fa 50%,
        #eef0f4 100%
    );
    background-size: 200% 100%;
    border-radius: 4px;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
    color: transparent;
    user-select: none;
    pointer-events: none;
}

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

/* ── Variants ──────────────────────────────────────────────────────── */

/* Single line of text. Width defaults to 100% — override inline if you
 * want shorter, randomised rows (which feels more realistic). */
.skeleton-line {
    height: 0.85rem;
    width: 100%;
    margin: 0.4rem 0;
}

/* Like .skeleton-line but a tad shorter — pair with .skeleton-line for
 * a "title + sub" feel. */
.skeleton-line--short {
    width: 60%;
}

.skeleton-line--tiny {
    width: 30%;
    height: 0.7rem;
}

/* Block: rectangular placeholder for an image / chart / preview. */
.skeleton-block {
    width: 100%;
    height: 120px;
    border-radius: 8px;
}

/* Table row built from .skeleton-cell. Drop ~5 of these into a tbody
 * while waiting for the fetch. */
.skeleton-row td {
    padding: 0.55rem 0.75rem;
}

.skeleton-cell {
    display: block;
    height: 0.85rem;
    width: 80%;
}

/* ── State helper ──────────────────────────────────────────────────── */

/* Add `[hidden]` works natively, but `.is-loaded` lets templates fade
 * skeletons out gracefully after a fetch resolves: container starts with
 * .is-loading, swap to .is-loaded → skeletons fade out, real rows fade in. */
[data-skeleton-target] .skeleton {
    opacity: 1;
    transition: opacity 200ms ease;
}

[data-skeleton-target].is-loaded .skeleton {
    opacity: 0;
    pointer-events: none;
}
