/* Product cards on touch screens (phones, tablets).
   On desktop the action icons appear on hover. On a touch screen the first tap only "hovers" the card
   (iOS shows the icons instead of following the link), so:
   - the icons (cart, quick view, wishlist) are always shown, in a row under the image, like the category page cards;
   - the whole card opens the product page. */
@media (hover: none) {
    .modern-card .product_action_box {
        position: relative;
        inset: auto;
        left: auto;
        top: auto;
        z-index: 3;
        display: block;
        width: auto;
        margin: 0;
        padding: 8px 5px;
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;
        background: #fff;
        border-radius: 0;
        box-shadow: none;
        backdrop-filter: none;
    }
    .modern-card .product_action_box ul { justify-content: center; gap: 6px; }
    .modern-card .product_action_box li { opacity: 1; visibility: visible; transform: none; transition: none; margin: 0; }
    .modern-card .product_action_box li a {
        width: 36px;
        height: 36px;
        border: 1px solid #e7dfec;
        background: #fff;
        color: #5c386f;
        box-shadow: 0 2px 6px rgb(0 0 0 / 4%);
        font-size: 16px;
    }
    .modern-card .product_action_box li a:hover { background: #fff; color: #5c386f; }
    .modern-card .product_action_box li a:active { background: #70438f; color: #fff; }

    /* Whole card = link to the product (the title link is stretched over the card). */
    :is(.modern-card, .category-product-card) .product_title a::after {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 1;
    }
    /* The icons and labels stay above the stretched link. */
    :is(.modern-card, .category-product-card) .product_action_box { z-index: 3; }

    /* A tap leaves the card in :hover state: cancel the desktop hover effects
       (icons shifted left by translate(-50%), second image sliding in, card lift, image zoom, red title). */
    .modern-card:hover .product_action_box { transform: none; }
    :is(.product, .product_wrap):hover .product_img .product_hover_img { opacity: 0; transform: translateX(100%); z-index: -1; }
    .modern-card:hover { transform: none; }
    .modern-card:hover .product_img img { transform: none; }
    .modern-card .product_title a:hover { color: inherit; }
}

/* Mobile: compact text and spacing on EVERY product card (sliders, tabs, merchandising sections,
   category grid, related products...). "body" + 2 classes beats style.css (.modern-card .product_title a). */
@media (max-width: 767px) {
    body :is(.modern-card, .category-product-card) .product_info { padding: 10px 10px 12px; }
    body :is(.modern-card, .category-product-card) .sp-merch-badge { margin-bottom: 5px; }
    body :is(.modern-card, .category-product-card) .sp-merch-rank-note { margin-bottom: 4px; }
    body :is(.modern-card, .category-product-card) .product_title { margin: 0 0 4px; font-size: 12px; line-height: 1.3; min-height: 2.6em; }
    body :is(.modern-card, .category-product-card) .product_title a { margin: 0; font-size: inherit; line-height: inherit; }
    body :is(.modern-card, .category-product-card) .product_price { margin: 0; line-height: 1.35; }
    body :is(.modern-card, .category-product-card) .on_sale { margin-top: 5px; padding: 3px 8px; font-size: 10px; line-height: 1.3; }
    body :is(.modern-card, .category-product-card) .rating_wrap { margin: 6px 0 0; }
}

/* Mobile: tighter card bottom (the cards were too tall in the 2-column carousels and grids).
   Same slots as product-card-consistency.css (badge / title / price / free space / rating), smaller gaps.
   "body" raises specificity above product-card-consistency.css, which loads later. */
@media (max-width: 767px) {
    /* Flex column instead of the grid of product-card-consistency.css: in Safari (WebKit) the grid's "1fr" free row
       was counted in the card's own height, so every card of a carousel grew (bigger after each reload).
       Alignment kept by fixed heights: badge slot (27px), title (2 lines), rating pushed to the bottom. */
    body :is(.homepage-products-showcase__slider, .related-products-section .releted_product_slider, .category-premium-page .shop_container.grid) .product_info {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        padding: 10px 10px 12px;
    }
    body :is(.homepage-products-showcase__slider, .related-products-section .releted_product_slider, .category-premium-page .shop_container.grid) .product_info > * { flex: none; }
    body :is(.homepage-products-showcase__slider, .related-products-section .releted_product_slider, .category-premium-page .shop_container.grid) .product_info .sp-merch-badge { align-self: center; }
    /* Badge slot kept empty on cards without a badge when another card of the section has one. */
    body :is(.homepage-products-showcase__slider, .related-products-section .releted_product_slider, .category-premium-page .shop_container.grid):has(.sp-merch-badge) .product_info:not(:has(.sp-merch-badge)) { padding-top: 37px; }
    body :is(.homepage-products-showcase__slider, .related-products-section .releted_product_slider, .category-premium-page .shop_container.grid) .sp-merch-badge { margin: 0 0 5px; }
    body :is(.homepage-products-showcase__slider, .related-products-section .releted_product_slider, .category-premium-page .shop_container.grid) .product_title { margin: 0 0 4px; font-size: 12px; line-height: 1.3; min-height: 2.6em; }
    /* Title always takes 2 lines of space, so prices stay aligned whether the name fits on 1 or 2 lines. */
    body :is(.homepage-products-showcase__slider, .related-products-section .releted_product_slider, .category-premium-page .shop_container.grid) .product_title a { font-size: inherit; line-height: inherit; }
    body :is(.homepage-products-showcase__slider, .related-products-section .releted_product_slider, .category-premium-page .shop_container.grid) .product_price { margin: 0; line-height: 1.35; }
    body :is(.homepage-products-showcase__slider, .related-products-section .releted_product_slider, .category-premium-page .shop_container.grid) .on_sale { margin-top: 5px; padding: 3px 8px; font-size: 10px; line-height: 1.3; }
    body :is(.homepage-products-showcase__slider, .related-products-section .releted_product_slider, .category-premium-page .shop_container.grid) .rating_wrap { align-self: center; margin: auto 0 0; padding-top: 6px; }
}
/* "Produits similaires" on mobile: related-products.css hid the action icons and used its own title style;
   show the icons and use the same layout as the other card sections. */
@media (max-width: 767px) {
    body .related-products-section .releted_product_slider .product_title { display: block; overflow: visible; -webkit-line-clamp: unset; }
}
@media (max-width: 767px) and (hover: none) {
    body .related-products-section .releted_product_slider .modern-card .product_action_box { display: block; }
}
@media (max-width: 767px) and (hover: none) {
    .modern-card .product_action_box { padding: 6px 5px 0; }
    .modern-card .product_action_box li a { width: 34px; height: 34px; }
}

/* Mobile: product section titles a bit smaller ("Les nouveautés Boutique Chogan", "Nos Parfums Chogan",
   "Nos meilleures ventes"...): 24px -> 21px. Kept here so the product sections change together. */
@media (max-width: 767px) {
    body [data-block-id="product-collections"] .heading_tab_header > .heading_s2 h2,
    body .sp-merch-heading h2 { font-size: 21px; }
}
