/*
 * WizShop — PLP (product listing) skeleton styles.
 *
 * Class names mirror the constants in skeletons/plp-skeleton.js —
 * keep this file and that file in sync.
 */

/*
 * Side gutters (override on :root or host: --wiz-plp-skeleton-padding-inline)
 * Defaults mirror common Elementor section padding: generous desktop → tight mobile.
 */
.wiz-plp-skeleton {
    --wiz-plp-skeleton-padding-inline: 32px;
    /* Toolbar filter row — unified control height */
    --wiz-plp-skeleton-toolbar-block-height: 30px;
    --wiz-plp-skeleton-toolbar-margin-top: 40px;
    --wiz-plp-skeleton-head-gap: 32px;
    /* Shared by filter/toolbar blocks + product image skeleton */
    --wiz-plp-skeleton-outline-color: rgba(0, 0, 0, 0.07);

    display: flex;
    flex-direction: column;
    gap: var(--wiz-plp-skeleton-section-gap, 0);
    width: 100%;
    max-width: var(--wiz-plp-skeleton-max-width, 2800px);
    margin-inline: var(--wiz-plp-skeleton-margin-inline, auto);
    padding-inline: var(--wiz-plp-skeleton-padding-inline);
    padding-block: var(--wiz-plp-skeleton-padding-block, 0);
    box-sizing: border-box;
}

.wiz-plp-skeleton__page-head {
    display: flex;
    flex-direction: column;
    gap: var(--wiz-plp-skeleton-head-gap, 32px);
    width: 100%;
    margin-bottom: var(--wiz-plp-skeleton-page-head-margin-bottom, 8px);
    padding-bottom: var(--wiz-plp-skeleton-page-head-padding-bottom, 40px);
    box-sizing: border-box;
}

/* Category Page Extra Skeletons (Carousel & Chips) */
.wiz-plp-skeleton__category-carousel {
    display: flex;
    gap: 24px;
    margin-inline: calc(-1 * var(--wiz-plp-skeleton-padding-inline, 32px));
    padding-inline: var(--wiz-plp-skeleton-padding-inline, 32px);
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
    padding-block: 8px;
    justify-content: center;
}

.wiz-plp-skeleton__category-carousel::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.wiz-plp-skeleton__category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    width: 130px;
    text-align: center;
}

.wiz-plp-skeleton__category-card-img {
    width: 100%;
    aspect-ratio: 3 / 4;
    /* border-radius: 8px; */
    /* box-shadow: inset 0 0 0 1px var(--wiz-plp-skeleton-outline-color); */
}

.wiz-plp-skeleton__category-card-label {
    width: 80%;
    height: 12px;
    /* border-radius: 2px; */
}

.wiz-plp-skeleton__category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    justify-content: center;
}

.wiz-plp-skeleton__category-chip {
    height: 36px;
    /* border-radius: 4px; */
    /* box-shadow: inset 0 0 0 1px var(--wiz-plp-skeleton-outline-color); */
}

/* Give chips varying widths */
.wiz-plp-skeleton__category-chip:nth-child(3n+1) {
    width: 80px;
}
.wiz-plp-skeleton__category-chip:nth-child(3n+2) {
    width: 110px;
}
.wiz-plp-skeleton__category-chip:nth-child(3n+3) {
    width: 95px;
}

/* Category page toolbar adjustment: override the 120px margin-top */
.wiz-plp-skeleton__page-head--category .wiz-plp-skeleton__toolbar {
    margin-top: 0;
}

/* ── Collection / Landing Page hero banner ───────────────────────────────
 * Full-grey text panel + 3 image panels. Title/desc are lighter slots so
 * the copy area still reads as text on the grey field.
 */
.wiz-plp-skeleton__collection-banner {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.wiz-plp-skeleton__collection-banner-hero {
    display: grid;
    /* Text ~60% | images ~40% */
    grid-template-columns: 1.7fr 0.35fr 1fr 0.35fr;
    gap: 8px;
    width: 100%;
    height: clamp(180px, 24vw, 260px);
    overflow: hidden;
    background: transparent;
}

.wiz-plp-skeleton__collection-banner-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 14px;
    padding: clamp(20px, 3vw, 40px) clamp(16px, 3vw, 40px);
    box-sizing: border-box;
    min-width: 0;
    border-radius: 2px;
    overflow: hidden;
}

/* Lighter text slots on the grey panel — title + desc lines. */
.wiz-plp-skeleton__collection-banner-title,
.wiz-plp-skeleton__collection-banner-desc {
    position: relative;
    z-index: 1;
    background: var(--wiz-skeleton-overlay-bg, #ffffff);
    border-radius: 4px;
    opacity: 0.72;
}

.wiz-plp-skeleton__collection-banner-title {
    width: min(200px, 50%);
    height: 28px;
}

.wiz-plp-skeleton__collection-banner-desc {
    height: 10px;
}

.wiz-plp-skeleton__collection-banner-desc--lg {
    width: min(300px, 85%);
}

.wiz-plp-skeleton__collection-banner-desc--sm {
    width: min(220px, 65%);
}

.wiz-plp-skeleton__collection-banner-panel {
    width: 100%;
    height: 100%;
    min-width: 0;
    border-radius: 2px;
}

.wiz-plp-skeleton__page-head--collection {
    gap: 28px;
}

.wiz-plp-skeleton__page-head--collection .wiz-plp-skeleton__toolbar {
    margin-top: 0;
}

@media (max-width: 1024px) {
    .wiz-plp-skeleton__collection-banner-hero {
        grid-template-columns: 1.55fr 0.32fr 0.9fr 0.32fr;
        height: 200px;
        gap: 6px;
    }
    .wiz-plp-skeleton__collection-banner-title {
        height: 24px;
    }
}

@media (max-width: 768px) {
    .wiz-plp-skeleton__collection-banner-hero {
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-rows: auto 140px;
        height: auto;
        gap: 6px;
    }
    .wiz-plp-skeleton__collection-banner-text {
        grid-column: 1 / -1;
        min-height: 0;
        padding: 16px 4px 12px;
        gap: 10px;
    }
    .wiz-plp-skeleton__collection-banner-panel--strip:first-of-type {
        grid-column: 1;
    }
    .wiz-plp-skeleton__collection-banner-panel--main {
        grid-column: 2;
    }
    .wiz-plp-skeleton__collection-banner-panel--strip:last-of-type {
        grid-column: 3;
    }
    .wiz-plp-skeleton__collection-banner-title {
        width: 45%;
        height: 20px;
    }
}

@media (max-width: 768px) {
    .wiz-plp-skeleton__category-card {
        width: 100px;
        gap: 8px;
    }
    .wiz-plp-skeleton__category-card-label {
        height: 10px;
    }
}

/* Toolbar — Filters (icon + label) · Category · NEW · SALE · BESTSELLER | Show · Sort */
.wiz-plp-skeleton__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--wiz-plp-skeleton-toolbar-gap, 16px);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    row-gap: var(--wiz-plp-skeleton-toolbar-row-gap, 12px);
    min-height: var(--wiz-plp-skeleton-toolbar-min-height, 30px);
    /* margin-top: 120px; */
}

.wiz-plp-skeleton__toolbar-cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: var(--wiz-plp-skeleton-toolbar-cluster-gap, 12px);
    row-gap: 10px;
    min-width: 0;
    max-width: 100%;
}

.wiz-plp-skeleton__toolbar-cluster--right {
    margin-left: auto;
}

.wiz-plp-skeleton__toolbar-filters {
    display: flex;
    align-items: center;
    column-gap: var(--wiz-plp-skeleton-toolbar-filters-inner-gap, 10px);
    flex-shrink: 0;
}

.wiz-plp-skeleton__toolbar-filter-icon {
    width: var(--wiz-plp-skeleton-toolbar-icon-width, 22px);
    height: var(--wiz-plp-skeleton-toolbar-block-height, 30px);
    max-height: var(--wiz-plp-skeleton-toolbar-block-height, 30px);
    border-radius: 0;
    border: none;
    flex-shrink: 0;
    align-self: center;
    box-shadow: none;
}

.wiz-plp-skeleton__toolbar-filter-label {
    width: var(--wiz-plp-skeleton-toolbar-filter-label-width, 72px);
    height: var(--wiz-plp-skeleton-toolbar-block-height, 30px);
    border-radius: 0;
    border: none;
    flex-shrink: 0;
    box-shadow: none;
}

/* Left filter cluster — no pill/corner radius, no inset outline (shimmer only) */
.wiz-plp-skeleton__toolbar-cluster--left .wiz-plp-skeleton__toolbar-block {
    border-radius: 0;
    border: none;
    box-shadow: none;
}

.wiz-plp-skeleton__toolbar-cluster--left .wiz-plp-skeleton__toolbar-block--pill,
.wiz-plp-skeleton__toolbar-cluster--left .wiz-plp-skeleton__toolbar-block--pill-sale,
.wiz-plp-skeleton__toolbar-cluster--left .wiz-plp-skeleton__toolbar-block--pill-lg {
    border-radius: 0;
}

/* Right cluster (Show · Sort) — flat shimmers, no outline */
.wiz-plp-skeleton__toolbar-cluster--right .wiz-plp-skeleton__toolbar-block {
    border-radius: 0;
    border: none;
    box-shadow: none;
}

.wiz-plp-skeleton__toolbar-block {
    height: var(--wiz-plp-skeleton-toolbar-block-height, 30px);
    border-radius: var(--wiz-plp-skeleton-toolbar-radius, 6px);
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px var(--wiz-plp-skeleton-outline-color);
}

.wiz-plp-skeleton__toolbar-block--category {
    width: var(--wiz-plp-skeleton-toolbar-category-width, 128px);
}

.wiz-plp-skeleton__toolbar-block--pill {
    width: var(--wiz-plp-skeleton-toolbar-pill-new-width, 52px);
    border-radius: 9999px;
}

.wiz-plp-skeleton__toolbar-block--pill-sale {
    width: var(--wiz-plp-skeleton-toolbar-pill-sale-width, 52px);
    border-radius: 9999px;
}

.wiz-plp-skeleton__toolbar-block--pill-lg {
    width: var(--wiz-plp-skeleton-toolbar-pill-bestseller-width, 124px);
    border-radius: 9999px;
}

.wiz-plp-skeleton__toolbar-block--show {
    width: var(--wiz-plp-skeleton-toolbar-show-width, 200px);
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.wiz-plp-skeleton__toolbar-block--sort {
    width: var(--wiz-plp-skeleton-toolbar-sort-width, 268px);
    max-width: min(268px, 100%);
    min-width: 0;
    box-sizing: border-box;
}

/*
 * Tablet / mobile — hide filter toolbar skeleton (desktop-only chrome).
 */
@media (max-width: 1024px) {
    .wiz-plp-skeleton {
        --wiz-plp-skeleton-head-gap: 20px;
        --wiz-plp-skeleton-page-head-padding-bottom: 28px;
    }

    .wiz-plp-skeleton__toolbar {
        display: none;
    }
}

@media (max-width: 768px) {
    .wiz-plp-skeleton {
        --wiz-plp-skeleton-head-gap: 16px;
        --wiz-plp-skeleton-page-head-padding-bottom: 24px;
    }
}

@media (max-width: 480px) {
    .wiz-plp-skeleton {
        --wiz-plp-skeleton-page-head-padding-bottom: 20px;
    }
}

/*
 * Grid gap — 38px between cards (override --wiz-plp-skeleton-gap / _gap_x / _gap_y).
 */
.wiz-plp-skeleton__grid {
    display: grid;
    grid-template-columns: repeat(var(--wiz-plp-skeleton-columns, 4), 1fr);
    column-gap: var(--wiz-plp-skeleton-gap-x, var(--wiz-plp-skeleton-gap, 38px));
    row-gap: var(--wiz-plp-skeleton-gap-y, var(--wiz-plp-skeleton-gap, 38px));
    width: 100%;
    box-sizing: border-box;
}

/* Portrait product image + tight text stack (full / mid / short lines) */
.wiz-plp-skeleton__card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--wiz-plp-skeleton-card-stack-gap, 12px);
    background: var(--wiz-plp-skeleton-card-bg, transparent);
    border: var(--wiz-plp-skeleton-card-border, none);
    border-radius: var(--wiz-plp-skeleton-card-radius, 0);
    padding: var(--wiz-plp-skeleton-card-padding, 0);
    overflow: hidden;
    box-sizing: border-box;
}

.wiz-plp-skeleton__card__media {
    position: relative;
    width: 100%;
    aspect-ratio: var(--wiz-plp-skeleton-media-ratio, 1 / 1);
    border-radius: var(--wiz-plp-skeleton-image-radius, 2px);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px var(--wiz-plp-skeleton-outline-color);
    box-sizing: border-box;
    /* Resting grey under everything — visible if shimmer hasn't kicked
     * in yet (e.g. first paint, reduced-motion). */
    background-color: var(--wiz-plp-skeleton-shimmer-base, #e4e6ea);
}

/* Belt-and-suspenders shimmer painted DIRECTLY on the media wrapper.
 * The wrapper always has correct dimensions (aspect-ratio + width: 100%),
 * so this guarantees a sweep is visible even if the inner __media-fill
 * ever collapses (e.g. a layout / ancestor sizing quirk). The visible
 * fill above keeps showing its own shimmer when it's sized correctly. */
.wiz-plp-skeleton__card__media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        var(--wiz-plp-skeleton-shimmer-base, #e4e6ea) 0%,
        var(--wiz-plp-skeleton-shimmer-highlight, #f0f2f5) 50%,
        var(--wiz-plp-skeleton-shimmer-base, #e4e6ea) 100%
    );
    background-size: 200% 100%;
    animation: wiz-plp-skeleton-shimmer 1.4s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.wiz-plp-skeleton__card__media-fill {
    position: absolute;
    inset: 0;
    border-radius: 0;
    border-color: #836B5C33;
    border-width: 1px;
    border-style: solid;
    /* Sits above the wrapper's ::after sweep (which is at z-index 0).
     * The fill itself is transparent except for the 1px border — the
     * shimmer always comes from the wrapper ::after. Kept at z-index
     * 1 so the border draws cleanly over the sweep instead of being
     * smeared by it. The .wiz-plp-skeleton__shimmer class is
     * deliberately NOT applied to this element (see plp-skeleton.js)
     * — adding it would re-introduce a second animated layer that
     * does the same visual work. */
    z-index: 1;
}

.wiz-plp-skeleton__card__media-icon {
    position: absolute;
    top: var(--wiz-plp-skeleton-media-icon-offset, 12px);
    right: var(--wiz-plp-skeleton-media-icon-offset, 12px);
    width: var(--wiz-plp-skeleton-media-icon-size, 28px);
    height: var(--wiz-plp-skeleton-media-icon-size, 28px);
    border-radius: 50%;
    background: var(--wiz-plp-skeleton-media-icon-bg, rgba(255, 255, 255, 0.75));
    /* Always on top of both the fill and the wrapper ::after sweep. */
    z-index: 2;
}

.wiz-plp-skeleton__card__lines {
    display: flex;
    flex-direction: column;
    gap: var(--wiz-plp-skeleton-text-line-gap, 8px);
    width: 100%;
    padding-top: var(--wiz-plp-skeleton-text-block-padding-top, 2px);
}

.wiz-plp-skeleton__card__line-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--wiz-plp-skeleton-line-row-gap, 8px);
    width: 100%;
}

/* Product card text stack — sharp rectangles, fixed row heights (design ref) */
.wiz-plp-skeleton__card__line {
    height: var(--wiz-plp-skeleton-line-height, 10px);
    border-radius: 0;
    max-width: 100%;
}

.wiz-plp-skeleton__card__line-row--r1 .wiz-plp-skeleton__card__line {
    height: 24px;
    border-radius: 0;
}

.wiz-plp-skeleton__card__line--plp-r2 {
    height: 20px;
    width: 80%;
    border-radius: 0;
}

.wiz-plp-skeleton__card__line-row--r3 .wiz-plp-skeleton__card__line {
    height: 24px;
    border-radius: 0;
}

.wiz-plp-skeleton__card__line--plp-r4 {
    height: 30px;
    width: 60%;
    border-radius: 0;
}

.wiz-plp-skeleton__card__line--full {
    width: 100%;
}

.wiz-plp-skeleton__card__line--mid {
    width: var(--wiz-plp-skeleton-line-mid-width, 55%);
}

.wiz-plp-skeleton__card__line--short {
    width: var(--wiz-plp-skeleton-line-short-width, 30%);
}

.wiz-plp-skeleton__card__line--xshort {
    width: var(--wiz-plp-skeleton-line-xshort-width, 30%);
}

/*
 * Class-only selector on wiz-plp-skeleton__shimmer matches inside PDP
 * (embedded PLP cards) — no wiz-plp-skeleton ancestor required.
 */
.wiz-plp-skeleton__shimmer {
    background: linear-gradient(
        90deg,
        var(--wiz-plp-skeleton-shimmer-base, #e4e6ea) 0%,
        var(--wiz-plp-skeleton-shimmer-highlight, #f0f2f5) 50%,
        var(--wiz-plp-skeleton-shimmer-base, #e4e6ea) 100%
    );
    background-size: 200% 100%;
    animation: wiz-plp-skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes wiz-plp-skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .wiz-plp-skeleton__shimmer,
    .wiz-plp-skeleton__card__media::after { animation: none; }
}

/*
 * Full-screen route overlay (#wiz-skeleton-overlay): index.js offsets content
 * below the site header. Keep chrome sticky while the grid scrolls so filter/sort
 * shimmers stay on-screen.
 */
.wiz-plp-skeleton.wiz-plp-skeleton--overlay .wiz-plp-skeleton__page-head {
    position: sticky;
    top: 0;
    z-index: 3;
    padding-bottom: var(
        --wiz-plp-skeleton-overlay-head-pad-bottom,
        var(--wiz-plp-skeleton-page-head-padding-bottom, 40px)
    );
    margin-bottom: var(--wiz-plp-skeleton-overlay-head-margin-bottom, 4px);
    background-color: var(
        --wiz-plp-skeleton-overlay-chrome-bg,
        var(--wiz-skeleton-overlay-bg, #ffffff)
    );
}

@media (max-width: 1024px) {
    .wiz-plp-skeleton {
        --wiz-plp-skeleton-padding-inline: 24px;
    }
    .wiz-plp-skeleton__grid {
        --wiz-plp-skeleton-columns: 3;
        --wiz-plp-skeleton-gap: 24px;
    }
}
@media (max-width: 768px) {
    .wiz-plp-skeleton {
        --wiz-plp-skeleton-padding-inline: 16px;
    }
    .wiz-plp-skeleton__grid {
        --wiz-plp-skeleton-columns: 2;
        --wiz-plp-skeleton-gap: 24px;
    }
}
@media (max-width: 480px) {
    .wiz-plp-skeleton {
        --wiz-plp-skeleton-padding-inline: 12px;
    }
    .wiz-plp-skeleton__grid {
        --wiz-plp-skeleton-columns: 2;
        --wiz-plp-skeleton-gap: 16px;
    }
}
