/* src/components/basic/XWUIProgressSkeleton/XWUIProgressSkeleton.css */
/**
 * XWUIProgressSkeleton Component Styles
 * 
 * Style Dependencies:
 * - Base: reset.css, typography.css, utilities.css
 * - Brand: brand/xwui/brand.css
 * - Style: style/modern/spacing.css
 * - Theme: theme/colors/{selected-theme}.css (MANDATORY - provides all color variables)
 * - Roundness: theme/roundness/skeleton/*.css (component-specific roundness)
 */

.xwui-skeleton-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 0.5rem);
}

.xwui-skeleton {
    /* Use dedicated skeleton color variable for theme-aware contrast */
    /* Falls back to bg-active, then to a medium gray */
    background: var(--skeleton-bg, var(--bg-active, #d0d0d0));
}

/* Variants */
.xwui-skeleton-text {
    border-radius: var(--radius-skeleton, var(--radius-xs, 4px));
}

.xwui-skeleton-circular {
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

.xwui-skeleton-rectangular {
    border-radius: 0;
    width: 100%;
    height: 120px;
}

.xwui-skeleton-rounded {
    border-radius: var(--radius-skeleton, var(--radius-md, 8px));
    width: 100%;
    height: 120px;
}

/* Pulse animation */
.xwui-skeleton-pulse {
    animation: xwui-skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes xwui-skeleton-pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

/* Wave animation */
.xwui-skeleton-wave {
    position: relative;
    overflow: hidden;
}

.xwui-skeleton-wave::after {
    content: '';
    position: absolute;
    inset-block: 0;
    inset-inline: 0;
    background: linear-gradient(
        90deg,
        transparent,
        var(--bg-elevated),
        transparent
    );
    animation: xwui-skeleton-wave 1.5s linear infinite;
}

/* The base sweep runs left to right; the RTL rules below reverse it. */
@keyframes xwui-skeleton-wave {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* The sheen travels in the reading direction: translateX has no logical form,
   so under RTL the same keyframes play backwards (right to left). Two rules,
   not one selector list, because an engine without :dir() drops a whole list
   it cannot parse. The fallback keys off the dir the base component stamps on
   its own host (re-stamped on xwui-locale-changed), the wrapper's parent. */
[dir="rtl"] > .xwui-skeleton-wrapper > .xwui-skeleton-wave::after {
    animation-direction: reverse;
}

.xwui-skeleton-wave:dir(rtl)::after {
    animation-direction: reverse;
}

/* No animation */
.xwui-skeleton-none {
    animation: none;
}

/* A skeleton animates for as long as the data takes to arrive, so a user who
   asked for reduced motion gets the static shape. The wave sheen is removed
   rather than stopped: frozen mid-sweep it would be a bright band across the
   middle of the bar. */
@media (prefers-reduced-motion: reduce) {
    .xwui-skeleton-pulse {
        animation: none;
    }

    .xwui-skeleton-wave::after {
        animation: none;
        display: none;
    }
}

/* The status label: the bars are aria-hidden shapes, so this is the only thing
   a screen reader hears. Absolutely positioned, so it takes no flex slot or
   gap in the wrapper's column. */
.xwui-skeleton__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* Preset compositions */
.xwui-skeleton-card {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 0.75rem);
}

.xwui-skeleton-avatar-text {
    display: flex;
    gap: var(--spacing-md, 1rem);
    align-items: center;
}

/* Preset-specific compositions */
.xwui-skeleton-preset-button {
    display: inline-flex;
}

.xwui-skeleton-preset-table {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs, 0.5rem);
}

.xwui-skeleton-preset-article {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 0.75rem);
}

.xwui-skeleton-preset-card {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 0.75rem);
}

.xwui-skeleton-preset-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 0.75rem);
}

.xwui-skeleton-preset-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md, 1rem);
}

.xwui-skeleton-preset-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md, 1rem);
}

.xwui-skeleton-preset-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 0.75rem);
    padding: var(--spacing-md, 1rem);
}

.xwui-skeleton-preset-footer {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 0.75rem);
}

.xwui-skeleton-preset-menu {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs, 0.5rem);
}

.xwui-skeleton-preset-avatar {
    display: inline-flex;
}

.xwui-skeleton-preset-image {
    display: block;
}

.xwui-skeleton-preset-video {
    display: block;
    aspect-ratio: 16 / 9;
}

.xwui-skeleton-preset-chart {
    display: block;
}

.xwui-skeleton-preset-code {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs, 0.5rem);
    font-family: monospace;
}

.xwui-skeleton-preset-badge {
    display: inline-flex;
}

.xwui-skeleton-preset-input {
    display: block;
}

.xwui-skeleton-preset-textarea {
    display: block;
}

.xwui-skeleton-preset-select {
    display: block;
}

.xwui-skeleton-preset-checkbox {
    display: inline-flex;
}

.xwui-skeleton-preset-radio {
    display: inline-flex;
}

/* Note: Dark theme support is handled automatically via theme/colors/{theme}.css files */

