/* ==========================================================================
   Cherubs Toys - Universal Resilient Shimmer & Performance Engine
   Zero-CLS Placeholders, Guaranteed Visual Visibility, Zero Image Blanking
   ========================================================================== */

/* 1. Global Shimmer Keyframes */
@keyframes cherubsShimmerWave {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

@keyframes cherubsTopBarProgress {
    0% {
        width: 0%;
        opacity: 1;
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
        opacity: 0;
    }
}

/* 2. Top Viewport Shimmer Progress Indicator */
#cherubsTopShimmerBar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #0284c7, #38bdf8, #f472b6, #ea8e00);
    background-size: 200% 100%;
    z-index: 9999999;
    pointer-events: none;
    transition: width 0.3s ease, opacity 0.4s ease;
    box-shadow: 0 1px 6px rgba(2, 132, 199, 0.4);
}

#cherubsTopShimmerBar.animating {
    animation: cherubsTopBarProgress 1.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 3. Universal Skeleton Shimmer Containers */
.cherubs-shimmer-wrap,
.product-grid-item .product-element-top,
.cherubs-mature-card-wrapper .cherubs-card-thumb-wrap,
.cherubs-mature-card-wrapper .cherubs-card-media-stage,
.cherubs-video-thumb-wrap,
.cherubs-main-img-wrap,
.cherubs-thumb-item,
.cherubs-mob-thumb-item,
.cherubs-mob-rel-img-wrap,
.category-grid-item .category-image-wrap,
.woocommerce-product-gallery__image {
    position: relative;
    background-color: #f1f5f9;
}

/* 4. Skeleton Shimmer Sweep Effect (Overlay - Never Hides the Image) */
.cherubs-shimmer-wrap:not(.loaded):not(.is-loaded)::after,
.product-grid-item .product-element-top:not(.loaded):not(.is-loaded)::after,
.cherubs-mature-card-wrapper .cherubs-card-thumb-wrap:not(.loaded):not(.is-loaded)::after,
.cherubs-mature-card-wrapper .cherubs-card-media-stage:not(.loaded):not(.is-loaded)::after,
.cherubs-video-thumb-wrap:not(.loaded):not(.is-loaded)::after,
.cherubs-main-img-wrap:not(.loaded):not(.is-loaded)::after,
.cherubs-thumb-item:not(.loaded):not(.is-loaded)::after,
.cherubs-mob-thumb-item:not(.loaded):not(.is-loaded)::after,
.cherubs-mob-rel-img-wrap:not(.loaded):not(.is-loaded)::after,
.category-grid-item .category-image-wrap:not(.loaded):not(.is-loaded)::after,
.woocommerce-product-gallery__image:not(.loaded):not(.is-loaded)::after {
    content: '';
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(241, 245, 249, 0) 0%,
        rgba(255, 255, 255, 0.75) 50%,
        rgba(241, 245, 249, 0) 100%
    );
    background-size: 200% 100%;
    transform: translateX(-100%);
    animation: cherubsShimmerWave 1.4s infinite cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.3s ease;
}

/* 5. Once Loaded: Remove Shimmer & Make Background Transparent */
.cherubs-shimmer-wrap.loaded,
.cherubs-shimmer-wrap.is-loaded,
.product-element-top.loaded,
.cherubs-card-media-stage.loaded,
.cherubs-card-thumb-wrap.loaded,
.cherubs-main-img-wrap.loaded,
.cherubs-thumb-item.loaded,
.cherubs-mob-thumb-item.loaded,
.cherubs-mob-rel-img-wrap.loaded,
.category-image-wrap.loaded,
.woocommerce-product-gallery__image.loaded {
    background-color: transparent !important;
}

.cherubs-shimmer-wrap.loaded::after,
.cherubs-shimmer-wrap.is-loaded::after,
.product-element-top.loaded::after,
.cherubs-card-media-stage.loaded::after,
.cherubs-card-thumb-wrap.loaded::after,
.cherubs-main-img-wrap.loaded::after,
.cherubs-thumb-item.loaded::after,
.cherubs-mob-thumb-item.loaded::after,
.cherubs-mob-rel-img-wrap.loaded::after,
.category-image-wrap.loaded::after,
.woocommerce-product-gallery__image.loaded::after {
    opacity: 0 !important;
    animation: none !important;
    display: none !important;
    pointer-events: none !important;
}

/* 6. GUARANTEED VISIBILITY: Images are ALWAYS Visible (Never opacity: 0) */
.cherubs-shimmer-wrap img,
.product-element-top img,
.cherubs-card-media-stage img,
.cherubs-main-img-wrap img,
.cherubs-thumb-item img,
.cherubs-mob-thumb-item img,
.elementor-image img,
.cherubs-shimmer-img {
    position: relative;
    z-index: 2;
    opacity: 1 !important;
    transition: opacity 0.25s ease;
}

/* Video reels thumbnail must remain absolute to fill the 9:14 aspect ratio container without gaps */
.cherubs-video-thumb-wrap .cherubs-video-thumb-img,
.cherubs-video-thumb-wrap img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    z-index: 2;
}

/* ==========================================================================
   7. Carousels Display Harmony (Pre-Shimmer Native Restoration)
   Ensures Shop by Animal & Shop by Character retain their intended native UI:
   - Shop by Animal: untouched native cards with full-bleed photos & yellow border
   - Shop by Character: circular plushie avatars on purple pattern with crisp white text
   - Zero outer box deformation, zero awkward whitespace
   ========================================================================== */

/* A. Reset any broad wrapper defaults so Shop by Animal remains untouched */
.wd-nested-carousel .wd-carousel-item {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* B. Shop by Character (Widget 3e00970): Circular Avatars on Doodle Background */
.elementor-element-3e00970 .wd-carousel-item {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 10px !important;
}

.elementor-element-3e00970 .wd-carousel-item .e-con-inner {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
}

.elementor-element-3e00970 .elementor-widget-image {
    width: auto !important;
    margin: 0 auto !important;
    display: block !important;
}

.elementor-element-3e00970 .elementor-widget-image .elementor-widget-container {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}

.elementor-element-3e00970 .elementor-widget-image img {
    width: clamp(200px, 18vw, 300px) !important;
    height: clamp(200px, 18vw, 300px) !important;
    max-width: clamp(200px, 18vw, 300px) !important;
    max-height: clamp(200px, 18vw, 300px) !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 3px solid rgba(255, 255, 255, 0.85) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25) !important;
    display: block !important;
    margin: 0 auto !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}

.elementor-element-3e00970 .wd-carousel-item:hover .elementor-widget-image img {
    transform: scale(1.06) !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35) !important;
}

.elementor-element-3e00970 .elementor-widget-heading {
    margin-top: 10px !important;
    margin-bottom: 0 !important;
    width: 100% !important;
    text-align: center !important;
}

.elementor-element-3e00970 .elementor-widget-heading .elementor-widget-container {
    padding: 0 !important;
    margin: 0 !important;
}

.elementor-element-3e00970 .elementor-heading-title,
.elementor-element-3e00970 .elementor-heading-title a {
    color: #ffffff !important;
    font-family: inherit !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    text-align: center !important;
    display: block !important;
    text-decoration: none !important;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.4) !important;
    letter-spacing: -0.2px !important;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .elementor-element-3e00970 .elementor-widget-image img {
        width: clamp(160px, 20vw, 220px) !important;
        height: clamp(160px, 20vw, 220px) !important;
        max-width: clamp(160px, 20vw, 220px) !important;
        max-height: clamp(160px, 20vw, 220px) !important;
    }
    .elementor-element-3e00970 .elementor-heading-title,
    .elementor-element-3e00970 .elementor-heading-title a {
        font-size: 18px !important;
    }
}

@media (max-width: 767px) {
    .elementor-element-3e00970 .wd-carousel-item {
        padding: 0 6px !important;
    }
    .elementor-element-3e00970 .elementor-widget-image img {
        width: 140px !important;
        height: 140px !important;
    }
    .elementor-element-3e00970 .elementor-heading-title,
    .elementor-element-3e00970 .elementor-heading-title a {
        font-size: 16px !important;
    }
}

/* 8. Skeleton Placeholder Lines */
.cherubs-skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: #e2e8f0;
    position: relative;
    overflow: hidden;
    margin-bottom: 8px;
}

.cherubs-skeleton-line::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    animation: cherubsShimmerWave 1.4s infinite;
}

.cherubs-skeleton-line.w-80 { width: 80%; }
.cherubs-skeleton-line.w-60 { width: 60%; }
.cherubs-skeleton-line.w-40 { width: 40%; }
.cherubs-skeleton-line.title { height: 18px; margin-bottom: 10px; }

/* 9. AJAX Loading Shimmer Overlay on Cart & Checkout */
.blockUI.blockOverlay {
    background: rgba(255, 255, 255, 0.75) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
}
