/* Use the storefront theme by default. A vertical can override any of these four colors. */
:root {
    --catalog-icon-ink: var(--text-primary);
    --catalog-icon-fill: color-mix(in srgb, var(--brand-primary) 32%, var(--surface-card));
    --catalog-icon-accent: color-mix(in srgb, var(--brand-accent) 46%, var(--surface-card));
    --catalog-icon-paper: var(--surface-card);
}

.catalog-icon-slot,
.catalog-icon {
    display: block;
    width: 100%;
    height: 100%;
    flex: none;
}

.mobile-cat-chip .catalog-icon-slot,
.mobile-cat-chip .catalog-icon {
    width: 22px;
    height: 22px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { --catalog-placeholder-filter: invert(.88) hue-rotate(180deg); }
}
:root[data-theme="dark"] { --catalog-placeholder-filter: invert(.88) hue-rotate(180deg); }

/* Keep the broken-image glyph hidden and reserve the same space in every catalog view. */
.catalog-icon-slot:not(:has(> .is-ready)),
.categories-section .category-skeleton .skeleton-circle,
.explore-page-body .category-skeleton-list .category-skeleton-icon {
    border-radius: 50%;
    background: #f7f6f3 url('/icons/product-placeholder-pencil.webp') center / 82% auto no-repeat;
    filter: var(--catalog-placeholder-filter, none);
    animation: none;
}

.catalog-icon-slot > img:not(.is-ready) {
    opacity: 0;
}

/* Keep the label and hit area still while the product lifts inside its slot. */
#categoryGrid .category-item:hover,
#categoryGrid .category-item:hover .category-icon {
    transform: none;
}

@keyframes catalog-photo-sway {
    0%, 100% { rotate: 0deg; }
    30% { rotate: -3deg; }
    70% { rotate: 2deg; }
}

@media (prefers-reduced-motion: no-preference) {
    #categoryGrid .category-item img.catalog-icon {
        transform-origin: center;
        transition: translate 220ms ease-out, scale 220ms ease-out, filter 220ms ease-out;
    }

    #categoryGrid .category-item:focus-visible img.catalog-icon {
        translate: 0 -0.5px;
        scale: 1.025;
        animation: catalog-photo-sway 1.8s ease-in-out 2;
    }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    #categoryGrid .category-item:hover img.catalog-icon {
        translate: 0 -0.5px;
        scale: 1.025;
        animation: catalog-photo-sway 1.8s ease-in-out infinite;
    }
}

@media (hover: none) and (prefers-reduced-motion: no-preference) {
    #categoryGrid .category-item:active img.catalog-icon {
        translate: 0 -0.5px;
        scale: .94;
    }
}

.category-load-status {
    grid-column: 1 / -1;
    flex: 1 0 100%;
    margin: 0;
    padding: 12px 0;
    text-align: center;
    color: var(--text-secondary);
}
.category-load-status button {
    min-height: 44px;
    padding: 0 12px;
    font: inherit;
    font-weight: 600;
    color: var(--brand-primary);
    background: transparent;
    border: 0;
    text-decoration: underline;
    cursor: pointer;
}
