/**
 * Creawith Revision 110
 * Scope: recommendation-feed states, toolbar mount, universe boundary, and sticky header.
 * Existing home-feed and work-card styles remain the sole owners of grid and card appearance.
 *
 * Design read: preserved community gallery with a quiet, low-chrome loading layer.
 * Dials: DESIGN_VARIANCE 7, MOTION_INTENSITY 5, VISUAL_DENSITY 4.
 * Shape rule: new controls use 12px corners; existing card geometry is inherited.
 * Layer scale: sticky header 30; no other layer is introduced.
 */

:where(body.home, body.page-template-page-home-php) {
    --cw-explore-accent: var(--cw-accent, #3d66cc);
    --cw-explore-muted: inherit;
    --cw-explore-line: rgb(99 106 120 / 18%);
    --cw-explore-soft: rgb(99 106 120 / 9%);
    --cw-explore-focus: rgb(61 102 204 / 42%);
}

/* Sticky positioning is present from first paint, so is-stuck changes appearance without CLS. */
:where(body.home, body.page-template-page-home-php) .creawith-header {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 64px;
    height: 64px;
}

:where(body.home, body.page-template-page-home-php) .creawith-header.is-stuck {
    border-bottom-color: var(--cw-explore-line);
    box-shadow: 0 12px 32px rgb(22 28 40 / 9%);
    backdrop-filter: blur(18px) saturate(135%);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
}

.cw-home-toolbar-mount[hidden],
#cw-creative-universe[hidden] {
    display: none !important;
}

.cw-home-toolbar-mount {
    height: 0;
    min-height: 0;
    overflow: clip;
}

.cw-header-sentinel {
    width: 100%;
    height: 0;
    pointer-events: none;
}

.cw-explore__status {
    display: grid;
    justify-items: center;
    gap: 14px;
    min-height: 112px;
    padding: 34px 16px 18px;
    color: var(--cw-explore-muted);
    text-align: center;
}

.cw-explore__message {
    max-width: 34ch;
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    opacity: .7;
}

.cw-explore__skeleton {
    display: none;
    grid-template-columns: repeat(3, 42px);
    gap: 8px;
    align-items: end;
    height: 34px;
}

.cw-explore__skeleton span {
    display: block;
    height: 24px;
    border-radius: 12px;
    background: var(--cw-explore-soft);
    transform-origin: center bottom;
}

.cw-explore__skeleton span:nth-child(2) {
    height: 34px;
}

.cw-explore__status[data-state="loading"] .cw-explore__skeleton {
    display: grid;
}

.cw-explore__status[data-state="idle"] {
    min-height: 40px;
    padding-block: 10px;
}

.cw-explore__status[data-state="idle"] .cw-explore__message,
.cw-explore__status[data-state="idle"] .cw-explore__skeleton {
    display: none;
}

.cw-explore__status[data-state="end"] {
    min-height: 68px;
    padding-bottom: 0;
}

.cw-explore__retry {
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid var(--cw-explore-accent);
    border-radius: 12px;
    background: transparent;
    color: var(--cw-explore-accent);
    font: inherit;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 180ms cubic-bezier(.16, 1, .3, 1),
        background-color 180ms cubic-bezier(.16, 1, .3, 1),
        color 180ms cubic-bezier(.16, 1, .3, 1);
}

.cw-explore__retry:hover {
    background: var(--cw-explore-accent);
    color: #f7f8fb;
}

.cw-explore__retry:focus-visible {
    outline: 3px solid var(--cw-explore-focus);
    outline-offset: 3px;
}

.cw-explore__retry:active {
    transform: translateY(1px) scale(.98);
}

.cw-explore__sentinel {
    width: 100%;
    height: 1px;
    pointer-events: none;
}

@media (prefers-reduced-transparency: reduce) {
    :where(body.home, body.page-template-page-home-php) .creawith-header.is-stuck {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .cw-explore__status[data-state="loading"] .cw-explore__skeleton span {
        animation: cw-explore-breathe 1.15s cubic-bezier(.16, 1, .3, 1) infinite alternate;
    }

    .cw-explore__status[data-state="loading"] .cw-explore__skeleton span:nth-child(2) {
        animation-delay: 100ms;
    }

    .cw-explore__status[data-state="loading"] .cw-explore__skeleton span:nth-child(3) {
        animation-delay: 200ms;
    }
}

@keyframes cw-explore-breathe {
    from { opacity: .42; transform: scaleY(.72); }
    to { opacity: 1; transform: scaleY(1); }
}

@media (max-width: 767px) {
    .cw-explore__status {
        min-height: 96px;
        padding-inline: 0;
    }
}
