/**
 * skeleton.css
 *
 * Shared skeleton loader system. Stamp these classes into a component slot
 * while data is loading, then wipe innerHTML once the real DOM is ready.
 *
 * BEM block: .skeleton
 *   Modifiers : --text, --text-line, --avatar, --avatar-sm, --button, --bar
 *   Elements  : __row, __stack
 *
 * Theming: reads --surface-2 and --text from design_tokens.css. Both light
 * and dark themes flip automatically. Never redeclare those tokens here.
 *
 * Reduced motion: when the user prefers reduced motion the shimmer pauses
 * and the surface stays at its base tint.
 *
 * See ai_agents_folder/ai_agent_instructions/03_design_guideline.md, section
 * "Skeleton loaders".
 */

.skeleton {
    --skeleton-base: var(--surface-2);
    --skeleton-band: color-mix(in srgb, var(--text) 6%, var(--surface-2));

    display: block;
    background-color: var(--skeleton-base);
    background-image: linear-gradient(
        90deg,
        var(--skeleton-base) 0%,
        var(--skeleton-band) 50%,
        var(--skeleton-base) 100%
    );
    background-size: 200% 100%;
    background-repeat: no-repeat;
    background-position: 100% 0;
    border-radius: 8px;
    animation: skeletonShimmer 1.4s linear infinite;
}

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

/* ---------- Shape modifiers ---------- */

.skeleton--text {
    height: 12px;
    width: 60%;
    border-radius: 6px;
}

.skeleton--text-line {
    height: 14px;
    width: 100%;
    border-radius: 6px;
}

.skeleton--avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.skeleton--avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
}

.skeleton--button {
    width: 64px;
    height: 28px;
    border-radius: 999px;
    flex-shrink: 0;
}

.skeleton--bar {
    height: 6px;
    width: 100%;
    border-radius: 999px;
}

/* ---------- Element parts ---------- */

.skeleton__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.skeleton__stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none;
        background-image: none;
        background-color: var(--skeleton-base);
    }
}
