.a4w-fragrances {
    --cols: 5;
    margin: 24px 0;
    text-align: center;
}

.a4w-fragrances__title {
    font-size: 1.25rem;
    font-weight: 500;
    text-align: center;
    margin: 0 0 20px;
    letter-spacing: 0.02em;
}

.a4w-fragrances__grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    gap: 20px 12px;
}

.a4w-fragrances__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: default;
}

.a4w-fragrances__media {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    overflow: hidden;
}

.a4w-fragrances__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.a4w-fragrances__hover-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #f5f5f5;
    color: #222;
    font-size: 0.85rem;
    line-height: 1.35;
    text-align: center;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.a4w-fragrances__item:has(.a4w-fragrances__hover-text) {
    cursor: help;
}

.a4w-fragrances__item:hover .a4w-fragrances__hover-text,
.a4w-fragrances__item:focus-within .a4w-fragrances__hover-text {
    opacity: 1;
}

.a4w-fragrances__label {
    display: inline-flex;
    gap: 4px;
    font-size: 0.9rem;
    line-height: 1.25;
    flex-wrap: wrap;
    justify-content: center;
}

.a4w-fragrances__name {
    font-weight: 500;
}

.a4w-fragrances__qty {
    color: #666;
    white-space: nowrap;
}

.a4w-fragrances__qty-sep {
    margin-right: 2px;
    color: #999;
}

.a4w-fragrances__toggle {
    margin-top: 18px;
    padding: 10px 22px;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    letter-spacing: 0.05em;
}

.a4w-fragrances__toggle:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* Responsive columns */
@media (max-width: 991px) { .a4w-fragrances { --cols: 4; } }
@media (max-width: 767px) { .a4w-fragrances { --cols: 3; } }
@media (max-width: 479px) { .a4w-fragrances { --cols: 2; } }

/* Truncation: hide items past 3 rows when the section is not expanded */
.a4w-fragrances:not(.is-expanded) .a4w-fragrances__item:nth-child(n+16) {
    display: none;
}

@media (max-width: 991px) {
    .a4w-fragrances:not(.is-expanded) .a4w-fragrances__item:nth-child(n+13) {
        display: none;
    }
}

@media (max-width: 767px) {
    .a4w-fragrances:not(.is-expanded) .a4w-fragrances__item:nth-child(n+10) {
        display: none;
    }
}

@media (max-width: 479px) {
    .a4w-fragrances:not(.is-expanded) .a4w-fragrances__item:nth-child(n+7) {
        display: none;
    }
}

/* Mobile : carrousel horizontal swipeable au lieu de la grille */
@media (max-width: 767px) {
    .a4w-fragrances__grid {
        display: flex;
        grid-template-columns: none;
        gap: 12px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
        scroll-padding-left: 4px;
    }

    .a4w-fragrances__grid::-webkit-scrollbar {
        display: none;
    }

    .a4w-fragrances__item,
    .a4w-fragrances:not(.is-expanded) .a4w-fragrances__item:nth-child(n+10),
    .a4w-fragrances:not(.is-expanded) .a4w-fragrances__item:nth-child(n+7) {
        display: flex;
        flex: 0 0 38%;
        scroll-snap-align: start;
    }

    .a4w-fragrances__toggle {
        display: none;
    }
}
