/**
 * Featured Products carousel sections (home page).
 *
 * Owns the compact header row and the track. The section ground comes from
 * .fp-style-minimal in featured-products.css and the card from product-card.css — do not restyle
 * .fp-product-card here.
 *
 * Desktop (≥768px) and mobile (≤767px) are independent: each is a grid unless
 * the section carries is-carousel-desktop / is-carousel-mobile, in which case
 * the track becomes a native scroll-snap row. The browser owns the swipe,
 * momentum and snapping; featured-carousel.js only drives the desktop arrows.
 */

.casablanca-fc {
    /* Same gaps as the shared grid rhythm in product-card.css. */
    --fc-gap-x: clamp(10px, 1.6vw, 24px);
    --fc-gap-y: clamp(18px, 2.4vw, 32px);
    --fc-cols: var(--fc-cols-desktop, 5);
}

/* ── Header: title at the start, "Voir tout" at the end, always one row ──
 * The title truncates rather than wraps; the link never shrinks. Same inline
 * padding as the viewport so both edges line up with the cards. */

.casablanca-fc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 clamp(16px, 1.8vw, 24px);
    padding: 0 10px;
}

.casablanca-fc-title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: var(--casablanca-font-secondary);
    font-size: clamp(15px, 1.25vw, 20px);
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--fpm-ink, #1a1a1a);
}

.casablanca-fc-view-all {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-inline-start: auto;
    padding: 6px 0;
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--fpm-ink, #1a1a1a);
    text-decoration: none;
}

.casablanca-fc-view-all span {
    padding-bottom: 3px;
    border-bottom: 1px solid currentColor;
}

.casablanca-fc-view-all svg {
    width: var(--casablanca-icon-size-xs);
    height: var(--casablanca-icon-size-xs);
    flex-shrink: 0;
    margin-bottom: 3px;
}

.casablanca-fc-view-all:focus-visible {
    outline: 2px solid var(--casablanca-brand);
    outline-offset: 3px;
}

.casablanca-fc-viewport {
    position: relative;
    padding: 0 10px;
}

.casablanca-fc-track {
    display: grid;
    grid-template-columns: repeat(var(--fc-cols), minmax(0, 1fr));
    gap: var(--fc-gap-y) var(--fc-gap-x);
    margin: 0;
    padding: 0;
    list-style: none;
}

.casablanca-fc-slide {
    min-width: 0;
    margin: 0;
}

@media (max-width: 1023px) {
    .casablanca-fc {
        --fc-cols: var(--fc-cols-tablet, 3);
    }
}

@media (max-width: 767px) {
    .casablanca-fc {
        --fc-cols: var(--fc-cols-mobile, 2);
    }

    .casablanca-fc-viewport {
        padding: 0 5px;
    }

    .casablanca-fc-header {
        gap: 10px;
        margin-bottom: 14px;
        padding: 0 5px;
    }

    .casablanca-fc-title {
        font-size: 14px;
        letter-spacing: 0.08em;
    }

    .casablanca-fc-view-all {
        gap: 2px;
        padding: 4px 0;
        font-size: 10px;
        letter-spacing: 0.08em;
    }

    .casablanca-fc-view-all svg {
        width: var(--casablanca-icon-size-xs);
        height: var(--casablanca-icon-size-xs);
    }
}

/* ── Carousel: desktop / tablet ───────────────────────────────────────── */

@media (min-width: 768px) {
    .casablanca-fc.is-carousel-desktop .casablanca-fc-track {
        display: flex;
        gap: var(--fc-gap-x);
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .casablanca-fc.is-carousel-desktop .casablanca-fc-slide {
        flex: 0 0 calc((100% - (var(--fc-cols) - 1) * var(--fc-gap-x)) / var(--fc-cols));
        scroll-snap-align: start;
    }
}

/* ── Carousel: mobile ─────────────────────────────────────────────────
 * The next card peeks in from the edge so the row reads as swipeable. */

@media (max-width: 767px) {
    .casablanca-fc.is-carousel-mobile .casablanca-fc-track {
        display: flex;
        gap: var(--fc-gap-x);
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .casablanca-fc.is-carousel-mobile .casablanca-fc-slide {
        flex: 0 0 calc((100% - var(--fc-cols) * var(--fc-gap-x)) / (var(--fc-cols) + 0.3));
        scroll-snap-align: start;
    }
}

.casablanca-fc-track::-webkit-scrollbar {
    display: none;
}

.casablanca-fc-track:focus-visible {
    outline: 2px solid var(--casablanca-brand);
    outline-offset: 4px;
}

/* ── Arrows (desktop carousel only) ───────────────────────────────────
 * Printed [hidden]; featured-carousel.js reveals them only when the row
 * actually overflows. Vertically centred on the image, not the whole card. */

.casablanca-fc-nav {
    position: absolute;
    top: calc((100% - 56px) / 2);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    color: #1a1a1a;
    background: #fff;
    border: 1px solid rgba(26, 26, 26, 0.12);
    border-radius: 50%;
    cursor: pointer;
    transform: translateY(-50%);
}

.casablanca-fc-prev {
    inset-inline-start: 0;
}

.casablanca-fc-next {
    inset-inline-end: 0;
}

.casablanca-fc-nav:focus-visible {
    outline: 2px solid var(--casablanca-brand);
    outline-offset: 2px;
}

.casablanca-fc-nav:disabled {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 767px) {
    .casablanca-fc-nav {
        display: none;
    }
}
