/* =========================================================
   Spliff Image Page Produit – v1.0.2
   Prefix: spsd-
   ========================================================= */

.spsd-slider {
    display: flex;
    align-items: center;
    width: 100%;
    height: 480px;
    position: relative;
    user-select: none;
    box-sizing: border-box;
}

/* ── Arrows (round, white bg, shadow – same as spliff-product-slider) ── */
.spsd-arrow {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    padding: 0;
    margin: 0 12px;
    z-index: 2;
    transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.spsd-arrow:hover {
    background: #f5f5f5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}
.spsd-arrow svg {
    width: 18px;
    height: 18px;
    fill: #222;
}

/* ── Main card (left) ── */
.spsd-main {
    flex: 0 0 45%;
    width: 45%;
    height: 100%;
    padding: 0 6px 0 0;
    box-sizing: border-box;
}
.spsd-card--main {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.spsd-card--main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Thumbnail cards (right) ── */
.spsd-thumbs {
    flex: 0 0 45%;
    width: 45%;
    height: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 0 0 0 6px;
    box-sizing: border-box;
    overflow: hidden;
}

/*
 * Thumb sizing:
 * 2 full cards + 30% of 3rd visible.
 * 2W + 0.3W + 2*gap = 100%  →  W = (100% - 24px) / 2.3
 * Parent overflow:hidden clips the 3rd card naturally.
 */
.spsd-card--thumb {
    flex: 0 0 calc((100% - 24px) / 2.3);
    min-width: calc((100% - 24px) / 2.3);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Images show in full (contain), not cropped */
.spsd-card--thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ── Hidden cards (4th+) ── */
.spsd-card--hidden {
    display: none !important;
}

/* ── Shared card styles ── */
.spsd-card {
    background-color: #e8e8e8;
    border-radius: 16px;
    overflow: hidden;
}

/* ── Transitions ── */
.spsd-slider img {
    transition: opacity 0.25s ease;
}
.spsd-slider img.spsd-fade {
    opacity: 0;
}

/* ── 1 image: hide arrows & thumbs ── */
.spsd-slider[data-total="1"] .spsd-arrow,
.spsd-slider[data-total="1"] .spsd-thumbs {
    display: none;
}
.spsd-slider[data-total="1"] .spsd-main {
    flex: 0 0 90%;
    width: 90%;
    margin: 0 auto;
}

/* ── 2 images: 1 thumb, bigger ── */
.spsd-slider[data-total="2"] .spsd-card--thumb {
    flex: 0 0 80%;
    min-width: 80%;
}

/* ── 3 images: 2 thumbs fill space evenly ── */
.spsd-slider[data-total="3"] .spsd-card--thumb {
    flex: 0 0 calc((100% - 12px) / 2);
    min-width: calc((100% - 12px) / 2);
}

/* ══════════════════════════════════════════════════════════════
   MOBILE – 2-row layout
   Row 1: main image (centered, full width)
   Row 2: [arrow-left] [thumbnails] [arrow-right]
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    .spsd-slider {
        flex-wrap: wrap;
        height: auto !important;
        gap: 12px;
        justify-content: center;
    }

    /* Main image: full-width row on top, with padding for visible border-radius */
    .spsd-main {
        order: -1;
        flex: 0 0 100%;
        width: 100%;
        height: auto;
        padding: 0 20px;
        box-sizing: border-box;
        display: flex;
        justify-content: center;
    }

    .spsd-card--main {
        width: 100%;
        height: auto;
    }

    .spsd-card--main img {
        width: 100%;
        height: auto;
        object-fit: cover;
    }

    /* Arrows: smaller on mobile */
    .spsd-arrow {
        width: 32px;
        height: 32px;
        margin: 0 4px;
    }
    .spsd-arrow svg {
        width: 14px;
        height: 14px;
    }

    /* Thumbnails: fill remaining space in bottom row */
    .spsd-thumbs {
        flex: 1;
        width: auto;
        height: auto;
        gap: 6px;
        padding: 0;
        align-items: center;
    }

    /* Square thumbnails on mobile */
    .spsd-card--thumb {
        flex: 0 0 calc((100% - 12px) / 2.3);
        min-width: calc((100% - 12px) / 2.3);
        aspect-ratio: 1 / 1;
    }

    .spsd-card--thumb img {
        object-fit: cover;
    }

    /* 1 image: main takes full space */
    .spsd-slider[data-total="1"] .spsd-main {
        flex: 0 0 100%;
        width: 100%;
    }
}
