/* ═══════════════════════════════════════════════════════════════════════════
   Fiche produit
   ───────────────────────────────────────────────────────────────────────────
   Deux colonnes : les photos à gauche, qui restent en vue pendant qu'on fait
   défiler les options à droite. La description longue et les mesures passent
   dans des blocs repliables, après la décision d'achat.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ══════════════════════════════ Fil d'Ariane ══════════════════════════════ */

.fil {
    display: flex;
    align-items: center;
    gap: var(--e-2);
    flex-wrap: wrap;
    padding-block: var(--e-5) var(--e-6);
    font-size: var(--t-mini);
    color: var(--encre-500);
}
.fil a { border-bottom: 1px solid transparent; transition: border-color var(--transition); }
.fil a:hover, .fil a:focus-visible { border-bottom-color: currentColor; }
.fil span[aria-hidden] { color: var(--encre-500); }
.fil [aria-current] { color: var(--encre-900); }
/* Cibles tactiles de 44 px : liens du fil d'Ariane, "Voir les CGV" (passé sur
   sa propre ligne, un lien au milieu d'une phrase ne peut pas faire 44 px). */
@media (max-width: 860px), (pointer: coarse) {
    .fil { padding-block: var(--e-2) var(--e-3); }
    .fil a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 2px; }
}

/* ════════════════════════════════ Ossature ════════════════════════════════ */

.produit {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
    gap: clamp(32px, 4.5vw, 72px);
    align-items: start;
    padding-bottom: var(--e-8);
}

/* ════════════════════════════════ Galerie ═════════════════════════════════ */

.produit-galerie {
    position: sticky;
    /* Sous l'en-tête collant, avec une marge d'air. */
    top: calc(var(--header-h) + var(--e-5));
    display: flex;
    flex-direction: column;
    gap: var(--e-3);
}

.galerie-principale {
    margin: 0;
    aspect-ratio: 1;
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--papier-2);
    border: 1px solid var(--filet-fin);
}
.galerie-principale img { width: 100%; height: 100%; object-fit: cover; }

/* Légende sous la grande photo ("Exemple de réalisation"). */
.galerie-legende {
    margin: calc(var(--e-2) * -1) 0 0;
    font-size: var(--t-mini);
    font-style: italic;
    color: var(--encre-500);
}

.galerie-vignettes {
    display: flex;
    gap: var(--e-3);
    flex-wrap: wrap;
}
/* Pas de rangée vide quand le produit n'a qu'une photo. */
.galerie-vignettes:empty { display: none; }

/* Un vrai <button>, pas une image cliquable : l'ancienne version n'était pas
   atteignable au clavier, donc inutilisable sans souris. */
.vignette {
    width: 78px;
    height: 78px;
    padding: 0;
    border: 1px solid var(--filet);
    border-radius: var(--r-sm);
    overflow: hidden;
    background: var(--papier-2);
    transition: border-color var(--transition), opacity var(--transition);
    opacity: .72;
}
.vignette img { width: 100%; height: 100%; object-fit: cover; }
.vignette:hover { opacity: 1; }
.vignette[aria-pressed="true"] {
    opacity: 1;
    border-color: var(--prune);
    box-shadow: 0 0 0 1px var(--prune);
}

/* ═══════════════════════════════ Colonne droite ═══════════════════════════ */

.produit-infos > .badge { margin-bottom: var(--e-4); }

.produit-nom {
    font-size: var(--t-h1);
    font-weight: 400;
    margin-bottom: var(--e-3);
}

.produit-accroche {
    font-size: 1.05rem;
    color: var(--encre-500);
    margin-bottom: var(--e-5);
}

.produit-prix {
    display: flex;
    align-items: baseline;
    gap: var(--e-3);
    flex-wrap: wrap;
    font-family: var(--police-titre);
    font-size: 1.9rem;
    font-weight: 500;
    color: var(--encre-900);
    margin-bottom: 0;
}
.produit-prix-note {
    font-family: var(--police-texte);
    font-size: var(--t-mini);
    font-weight: 400;
    color: var(--encre-500);
}

/* ─────────────────────────────── Blocs de choix ──────────────────────────── */

.choix { margin-bottom: var(--e-6); }
.choix .label { display: flex; align-items: baseline; gap: var(--e-2); }

/* Le nom de la couleur choisie, à côté du libellé : la pastille seule ne dit
   pas de quelle teinte il s'agit. */
.choix-valeur {
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--encre-900);
}

.choix-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--e-2);
}

/* ── Tailles ── */

.btn-taille {
    min-width: 52px;
    min-height: 44px;
    padding: 0 var(--e-3);
    border: 1px solid var(--filet);
    border-radius: var(--r-sm);
    background: var(--blanc);
    color: var(--encre-700);
    font-size: var(--t-petit);
    font-weight: 600;
    transition: border-color var(--transition), background-color var(--transition),
                color var(--transition);
}
.btn-taille:hover { border-color: var(--prune-300); }
.btn-taille[aria-pressed="true"] {
    background: var(--prune);
    border-color: var(--prune);
    color: var(--clair);
}

/* ── Couleurs ── */

.choix-couleurs { gap: var(--e-3); }

/* La bordure est systématique : sans elle, une pastille blanche sur fond clair
   serait tout simplement invisible. */
.btn-couleur {
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--filet);
    border-radius: 50%;
    transition: box-shadow var(--transition), transform var(--transition);
}
.btn-couleur:hover { transform: scale(1.06); }

/* L'anneau de sélection est détaché de la pastille : posé dessus, il se
   confondrait avec les teintes claires. */
.btn-couleur[aria-pressed="true"] {
    box-shadow: 0 0 0 2px var(--papier), 0 0 0 4px var(--prune);
}

/* ── Aperçu du motif ── */

.design-apercu {
    display: flex;
    align-items: center;
    gap: var(--e-4);
    margin-top: var(--e-4);
    padding: var(--e-4);
    background: var(--papier-2);
    border: 1px solid var(--filet);
    border-radius: var(--r-md);
}

.design-apercu-cadre {
    flex-shrink: 0;
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    background: var(--blanc);
    border: 1px solid var(--filet-fin);
    border-radius: var(--r-sm);
    overflow: hidden;
}
/* Cadre vide quand il n'y a pas de visuel : il garde la place et évite que le
   bloc se décale au changement de motif. */
.design-apercu-cadre:has(img[hidden]) { background: var(--papier-2); }

.design-apercu-img { max-width: 100%; max-height: 100%; object-fit: contain; }

.design-apercu-note {
    font-size: var(--t-mini);
    color: var(--encre-500);
    margin: 0;
}

/* ─────────────────────────────── Actions ────────────────────────────────── */

.produit-actions {
    display: flex;
    flex-direction: column;
    gap: var(--e-3);
    margin-top: var(--e-6);
}

/* ─────────────────────────── Détails repliables ──────────────────────────── */

.produit-details { margin-top: var(--e-7); }

.produit-details details {
    border-top: 1px solid var(--filet);
    padding-block: var(--e-2);
}
.produit-details details:last-of-type { border-bottom: 1px solid var(--filet); }

.produit-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--e-3);
    min-height: 52px;
    cursor: pointer;
    list-style: none;
    font-family: var(--police-titre);
    font-size: 1.05rem;
    color: var(--encre-900);
}
.produit-details summary::-webkit-details-marker { display: none; }

/* Chevron dessiné au pseudo-élément : il pivote à l'ouverture, ce qui rend
   l'état visible sans texte supplémentaire. */
.produit-details summary::after {
    content: "";
    width: 11px;
    height: 11px;
    flex-shrink: 0;
    border-right: 1.5px solid var(--encre-500);
    border-bottom: 1.5px solid var(--encre-500);
    transform: rotate(45deg) translate(-3px, -3px);
    transition: transform var(--transition);
}
.produit-details details[open] summary::after {
    transform: rotate(-135deg) translate(-3px, -3px);
}

.produit-details details > :not(summary) {
    font-size: var(--t-petit);
    color: var(--encre-500);
    padding-bottom: var(--e-4);
    max-width: 58ch;
}

/* Le bouton plein passe toujours en premier, quel que soit l'ordre du HTML. */
.produit-actions .btn-plein { order: -1; }

/* ─────────────────────────── Livraison et rassurance ─────────────────────── */

.produit-livraison {
    display: flex;
    align-items: flex-start;
    gap: var(--e-3);
    margin: var(--e-4) 0 0;
    padding: var(--e-3) var(--e-4);
    background: var(--papier-2);
    border: 1px solid var(--filet);
    border-radius: var(--r-sm);
    font-size: var(--t-mini);
    color: var(--encre-700);
}
.produit-livraison::before {
    content: "";
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    background: var(--prune);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7h11v9H3z'/%3E%3Cpath d='M14 10h4l3 3v3h-7'/%3E%3Ccircle cx='7' cy='18' r='1.8'/%3E%3Ccircle cx='17' cy='18' r='1.8'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7h11v9H3z'/%3E%3Cpath d='M14 10h4l3 3v3h-7'/%3E%3Ccircle cx='7' cy='18' r='1.8'/%3E%3Ccircle cx='17' cy='18' r='1.8'/%3E%3C/svg%3E") center / contain no-repeat;
}
.produit-livraison:empty { display: none; }

.produit-rassurance {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: var(--e-2) var(--e-4);
    margin-top: var(--e-4);
    font-size: var(--t-mini);
    color: var(--encre-500);
}
/* Coche dessinée en CSS, pas un caractère. */
.produit-rassurance li { display: inline-flex; align-items: center; gap: 7px; }
.produit-rassurance li::before {
    content: "";
    width: 9px;
    height: 5px;
    border-left: 1.6px solid var(--succes);
    border-bottom: 1.6px solid var(--succes);
    transform: rotate(-45deg) translateY(-2px);
}

/* ───────────────────────────── Barre d'achat ─────────────────────────────── */

.barre-achat {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--e-4);
    padding: var(--e-3) var(--marge) calc(var(--e-3) + env(safe-area-inset-bottom));
    background: rgba(250, 247, 241, .96);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--filet);
    box-shadow: 0 -8px 24px rgba(74, 56, 46, .08);
    animation: barre-monte 320ms var(--courbe-douce);
}
@keyframes barre-monte { from { transform: translateY(100%); } to { transform: none; } }
.barre-achat-infos { display: flex; flex-direction: column; min-width: 0; }
.barre-achat-nom { font-size: var(--t-mini); color: var(--encre-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre-achat-prix { font-family: var(--police-titre); font-size: 1.15rem; color: var(--encre-900); }

/* ═══════════════════════════ Points de rupture ═══════════════════════════ */

@media (max-width: 860px) {
    .produit { grid-template-columns: 1fr; gap: var(--e-6); }
    /* Collante, la galerie recouvrirait les options une fois sur une colonne. */
    .produit-galerie { position: static; }
    .galerie-principale { aspect-ratio: 4 / 3; }
    .vignette { width: 64px; height: 64px; }
}

@media (max-width: 560px) {
    .produit-prix { font-size: 1.6rem; }
    .design-apercu { flex-direction: column; align-items: flex-start; }
}

/* Mode sombre : la barre d'achat collante reprend le fond de page. */
html[data-theme="dark"] .barre-achat { background: rgba(24, 20, 19, .96); box-shadow: 0 -8px 24px rgba(0, 0, 0, .4); }

/* Rappel de l'absence de rétractation, sous la date de livraison. */
/* Modes de livraison et tarifs de l'article. */
.produit-frais { margin: var(--e-4) 0 var(--e-5); }
.produit-frais-liste { list-style: none; margin: 0 0 var(--e-2); padding: 0; border-top: 1px solid var(--filet-fin); }
.produit-frais-liste li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 2px var(--e-4);
    padding: var(--e-2) 0;
    border-bottom: 1px solid var(--filet-fin);
    font-size: var(--t-petit);
}
.produit-frais-liste strong { color: var(--encre-900); }
.produit-frais-note { flex-basis: 100%; font-size: var(--t-mini); color: var(--encre-500); }

/* Barre "Personnaliser" fixe sur téléphone : la page garde sa hauteur en
   réserve pour que le pied de page ne passe pas dessous. */
body.avec-barre-achat { padding-bottom: 76px; }

.produit-avis { margin-top: var(--e-8); padding-top: var(--e-7); border-top: 1px solid var(--filet); }
.produit-avis-titre { font-size: var(--t-h3); margin-bottom: var(--e-5); }

.produit-retractation { margin: var(--e-2) 0 var(--e-4); }
.produit-retractation a { color: var(--prune); border-bottom: 1px solid currentColor; }
@media (max-width: 860px), (pointer: coarse) {
    .produit-retractation a {
        display: flex;
        align-items: center;
        width: fit-content;
        min-height: 44px;
        font-weight: 600;
        border-bottom: 0;
        text-decoration: underline;
        text-underline-offset: 3px;
    }
}
