/*
 * Helia Product Page — fiche produit WooCommerce (mobile-first).
 * Chargé uniquement sur is_product(). Ne modifie aucun fichier du thème parent.
 * Contrastes vérifiés WCAG AA : CTA #9A5430 / blanc = 5.7:1 ; texte #1c1917 / #fff = 17:1.
 */

.single-product {
    --hpp-cta: #9a5430;
    --hpp-cta-hover: #7f4524;
    --hpp-ink: #1c1917;
    --hpp-muted: #57534e;
    --hpp-line: #e7e5e4;
    --hpp-surface: #faf8f5;
    --hpp-ok: #166534;
    --hpp-warn: #9a3412;
    --hpp-radius: 14px;
    --hpp-focus: 0 0 0 3px #fff, 0 0 0 5px #1c1917;
}

/* ── Anciens blocs remplacés (réassurance, urgence factice, barre mobile historique) ── */
.single-product .hc-cro-powerhouse,
.single-product .helia-trust-box,
.single-product .helia-trust-badges,
.single-product .hc-product-trust,
.single-product .hc-single-rating-stock,
.single-product .hc-sticky-mobile-bar {
    display: none !important;
}

/* ── Hiérarchie : titre, prix ── */
.single-product div.product .product_title {
    color: var(--hpp-ink);
    font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.1rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.single-product div.product p.price,
.single-product div.product span.price {
    color: var(--hpp-ink);
    font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2rem);
    font-weight: 800;
    margin-bottom: 1rem;
}

.single-product div.product p.price del,
.single-product div.product span.price del {
    color: var(--hpp-muted);
    font-size: 0.65em;
    font-weight: 500;
}

.single-product div.product p.price ins,
.single-product div.product span.price ins {
    color: var(--hpp-cta);
    text-decoration: none;
}

/* ── Stock honnête ── */
.hpp-stock {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--hpp-ok);
}

.hpp-stock--low {
    color: var(--hpp-warn);
}

.hpp-stock__dot {
    flex: none;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
}

.hpp-no-reviews {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
}

.hpp-no-reviews a {
    color: var(--hpp-muted);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ── CTA « Ajouter au panier » ──
 * !important : le thème enfant force .woocommerce button.button en !important (BUTTONS).
 * Sélecteurs plus spécifiques pour que le CTA garde un contraste AA. */
.single-product .summary > p.stock {
    display: none; /* simple/externe : remplacé par .hpp-stock (variations : message WooCommerce conservé) */
}

.hpp-stock--out {
    color: var(--hpp-warn);
}

.single-product form.cart:not(.variations_form):not(.grouped_form),
.single-product form.cart .woocommerce-variation-add-to-cart,
.single-product form.cart .ct-cart-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.75rem;
    width: 100%;
}

.single-product.woocommerce form.cart button.single_add_to_cart_button {
    flex: 1 1 100%;
    order: 2;
    min-height: 3.5rem;
    padding: 0.9rem 1.5rem !important;
    border: 0 !important;
    border-radius: var(--hpp-radius) !important;
    background: var(--hpp-cta) !important;
    color: #fff !important;
    font-size: 1.0625rem;
    font-weight: 700 !important;
    letter-spacing: 0.01em;
    box-shadow: 0 8px 20px rgba(154, 84, 48, 0.28) !important;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
}

.single-product.woocommerce form.cart button.single_add_to_cart_button:hover {
    background: var(--hpp-cta-hover) !important;
    color: #fff !important;
    transform: translateY(-1px);
}

.single-product.woocommerce form.cart button.single_add_to_cart_button:focus-visible,
.hpp-sticky__btn:focus-visible,
.hpp-faq__item summary:focus-visible,
.hpp-no-reviews a:focus-visible {
    outline: 2px solid transparent; /* visible en mode contraste élevé */
    outline-offset: 2px;
    box-shadow: var(--hpp-focus) !important;
}

.single-product.woocommerce form.cart button.single_add_to_cart_button.loading {
    opacity: 0.7;
    cursor: progress;
}

.single-product form.cart .quantity {
    order: 1;
}

/* ── Réassurance ── */
.hpp-trust {
    margin: 1.25rem 0;
    padding: 1rem;
    border: 1px solid var(--hpp-line);
    border-radius: var(--hpp-radius);
    background: var(--hpp-surface);
}

.hpp-trust__delivery {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--hpp-ink);
}

.hpp-trust__list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hpp-trust__item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.hpp-icon {
    flex: none;
    color: var(--hpp-cta);
}

.hpp-trust__text {
    display: flex;
    flex-direction: column;
    font-size: 0.8125rem;
    line-height: 1.35;
    color: var(--hpp-muted);
}

.hpp-trust__text strong {
    color: var(--hpp-ink);
    font-size: 0.875rem;
}

/* ── FAQ ── */
.hpp-faq {
    /* Variables du conteneur Blocksy, avec repli si le thème parent change. */
    width: var(--theme-container-width, min(100% - 2rem, 1290px));
    max-width: var(--theme-normal-container-max-width, 1290px);
    margin: 2.5rem auto;
}

.hpp-section-title {
    margin: 0 0 1rem;
    font-size: clamp(1.25rem, 1.1rem + 0.8vw, 1.6rem);
    color: var(--hpp-ink);
}

.hpp-faq__item {
    border-bottom: 1px solid var(--hpp-line);
}

.hpp-faq__item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 3rem;
    padding: 0.75rem 0;
    font-weight: 600;
    color: var(--hpp-ink);
    cursor: pointer;
    list-style: none;
}

.hpp-faq__item summary::-webkit-details-marker {
    display: none;
}

.hpp-faq__item summary::after {
    content: "+";
    flex: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--hpp-cta);
}

.hpp-faq__item[open] summary::after {
    content: "\2212";
}

.hpp-faq__answer {
    padding: 0 0 1rem;
    color: var(--hpp-muted);
    line-height: 1.6;
}

.hpp-faq__answer p {
    margin: 0;
}

/* ── Produits similaires : défilement horizontal sur mobile, grille ensuite ── */
.single-product .related.products > h2 {
    font-size: clamp(1.25rem, 1.1rem + 0.8vw, 1.6rem);
    color: var(--hpp-ink);
}

@media (max-width: 767px) {
    .single-product .related.products ul.products {
        display: flex;
        gap: 1rem;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 0.75rem;
        -webkit-overflow-scrolling: touch;
    }

    .single-product .related.products ul.products > li.product {
        flex: 0 0 70%;
        max-width: 70%;
        scroll-snap-align: start;
    }
}

/* ── Bandeau cookies : en haut sur mobile pour ne pas masquer la barre d'achat ── */
@media (max-width: 767px) {
    .single-product #helia-rgpd-cookie-banner {
        top: 0.75rem !important;
        bottom: auto !important;
        right: 0.75rem !important;
        left: 0.75rem !important;
        max-width: none !important;
    }
}

/* ── Barre d'achat collante (mobile) ── */
.hpp-sticky {
    position: fixed;
    inset: auto 0 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--hpp-line);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    visibility: hidden; /* hors écran = hors tabulation */
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
}

/* Boutons flottants du site (chatbot #heliabot-bubble, cookies #hc-cookie-manage) : au-dessus de la barre. */
@media (max-width: 767px) {
    .hpp-sticky-on #heliabot-bubble,
    .hpp-sticky-on #hc-cookie-manage {
        bottom: calc(var(--hpp-sticky-h, 0px) + 0.75rem) !important;
    }
}

.hpp-sticky[hidden] {
    display: none;
}

.hpp-sticky.is-visible {
    transform: translateY(0);
    visibility: visible;
    transition-delay: 0s;
}

.hpp-sticky__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.hpp-sticky__name {
    overflow: hidden;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--hpp-ink);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hpp-sticky__price {
    font-weight: 800;
    color: var(--hpp-ink);
}

.hpp-sticky__btn {
    flex: none;
    min-height: 3rem;
    padding: 0.75rem 1.25rem;
    border: 0;
    border-radius: 999px;
    background: var(--hpp-cta);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.hpp-sticky__btn:hover {
    background: var(--hpp-cta-hover);
}

@media (min-width: 768px) {
    .hpp-sticky {
        display: none !important;
    }

    .hpp-trust__list {
        grid-template-columns: 1fr 1fr;
    }

    .single-product.woocommerce form.cart button.single_add_to_cart_button {
        flex: 1 1 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hpp-sticky,
    .single-product.woocommerce form.cart button.single_add_to_cart_button {
        transition: none !important;
    }

    .single-product.woocommerce form.cart button.single_add_to_cart_button:hover {
        transform: none;
    }
}
