/* ==========================================================================
   Panier de commande
   Chargé sur toutes les pages : le bouton du panier vit dans l'en-tête, et le
   tiroir doit pouvoir s'ouvrir depuis n'importe où.
   ========================================================================== */

/* ---------------------------------------------------------------- bouton d'ajout */
.btn-panier {
  display: inline-flex; align-items: center; gap: .6rem;
  background: var(--gold); color: #fff; border-color: var(--gold);
}
.btn-panier:hover { background: var(--gold-d); border-color: var(--gold-d); }
.btn-panier svg { width: 18px; height: 18px; flex: none; }
.btn-panier.ajoute { background: var(--ox); border-color: var(--ox); }

/* ---------------------------------------------------------------- accès au panier */
.panier-ouvrir {
  position: relative; display: inline-grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%; color: inherit;
  border: 1px solid rgba(255, 255, 255, .35); background: none; cursor: pointer;
}
#topbar.compact .panier-ouvrir { border-color: rgba(52, 16, 9, .25); }
.panier-ouvrir svg { width: 19px; height: 19px; }
.panier-compte {
  position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px;
  display: grid; place-items: center; padding: 0 4px;
  background: var(--red, #da2916); color: #fff; border-radius: 10px;
  font-size: .7rem; font-weight: 700; line-height: 1;
}

/* ---------------------------------------------------------------- tiroir */
#panier-voile {
  position: fixed; inset: 0; z-index: 998; background: rgba(20, 8, 4, .5);
  backdrop-filter: blur(2px);
}
/* `display: flex` ci-dessous bat la regle [hidden] du navigateur : sans cette
   ligne le tiroir s'affiche en permanence, y compris au chargement. */
#panier-tiroir[hidden], #panier-voile[hidden] { display: none; }
#panier-tiroir {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 999;
  width: min(430px, 100%); background: var(--cream-2);
  display: flex; flex-direction: column;
  box-shadow: -18px 0 50px rgba(20, 8, 4, .3);
  animation: paTiroir .32s cubic-bezier(.2, .8, .3, 1);
}
@keyframes paTiroir { from { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { #panier-tiroir { animation: none; } }

.pa-tete {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.3rem 1.4rem; border-bottom: 1px solid var(--line);
}
.pa-tete h2 { font-size: 1.3rem; }
.pa-fermer {
  background: none; border: 0; font-size: 1.7rem; line-height: 1;
  cursor: pointer; color: var(--muted); padding: .2rem .5rem;
}
.pa-fermer:hover { color: var(--ink); }

.pa-liste { list-style: none; margin: 0; padding: .6rem 1.4rem; overflow-y: auto; flex: 1; }
.cmd-liste { list-style: none; margin: 0; padding: 0; }
.pa-ligne {
  display: grid; grid-template-columns: 64px 1fr auto auto auto;
  gap: .8rem; align-items: center; padding: .9rem 0;
  border-bottom: 1px solid var(--line);
}
/* Aucun fond derrière la vignette : les visuels produit sont détourés (WebP à canal
   alpha, coins transparents vérifiés). Un `background: #fff` y dessinait un carré
   blanc et annulait tout le bénéfice du détourage. Pas de border-radius non plus —
   il n'y a pas de boîte à arrondir, seulement la silhouette du bocal. */
.pa-ligne img { background: none; object-fit: contain; }
.pa-txt { min-width: 0; }
.pa-nom { display: block; font-weight: 600; font-size: .92rem; line-height: 1.3; }
.pa-pu { display: block; font-size: .8rem; color: var(--muted); }
.pa-qte { display: flex; align-items: center; gap: .1rem; }
.pa-qte button {
  width: 26px; height: 26px; border: 1px solid var(--line); background: #fff;
  cursor: pointer; font-size: 1rem; line-height: 1; color: var(--ink); border-radius: 4px;
}
.pa-qte button:hover { border-color: var(--gold); color: var(--gold-d); }
.pa-qte span { min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; }
.pa-total { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pa-suppr {
  background: none; border: 0; cursor: pointer; color: var(--muted);
  font-size: 1.2rem; line-height: 1; padding: 0 .2rem;
}
.pa-suppr:hover { color: var(--red, #da2916); }

.pa-vide { padding: 2.5rem 1.4rem; text-align: center; color: var(--muted); }
.cmd-recap .panier-vide { padding: 1.6rem 0; color: var(--muted); }

.pa-pied { padding: 1.2rem 1.4rem 1.5rem; border-top: 1px solid var(--line); background: var(--cream); }
.pa-somme { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; }
.pa-somme b { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.pa-pied .btn { width: 100%; text-align: center; }
.pa-note { font-size: .8rem; color: var(--muted); margin-top: .8rem; line-height: 1.45; }

/* ---------------------------------------------------------------- page commande */
.cmd-grid {
  display: grid; grid-template-columns: 1.05fr .95fr;
  gap: clamp(1.8rem, 4vw, 3.2rem); align-items: start;
}
@media (max-width: 860px) { .cmd-grid { grid-template-columns: 1fr; } }

.cmd-recap { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 1.5rem; }

.cmd-modes { display: grid; gap: .7rem; margin: 1.2rem 0 .4rem; }
.cmd-mode {
  display: flex; gap: .7rem; align-items: flex-start;
  border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1rem; cursor: pointer;
}
.cmd-mode:has(input:checked) { border-color: var(--gold); background: rgba(199, 154, 62, .07); }
.cmd-mode input { margin-top: .25rem; accent-color: var(--gold); }
.cmd-mode b { display: block; font-size: .96rem; }
.cmd-mode small { color: var(--muted); font-size: .84rem; }
.cmd-mode.desactive { opacity: .6; }
.cmd-mode-detail {
  font-size: .86rem; color: var(--muted); background: var(--cream);
  border-left: 3px solid var(--gold); padding: .7rem .9rem; margin-bottom: 1.2rem;
}

/* Sur téléphone, la grille à 5 colonnes ne tient pas : les boutons de quantité
   passaient par-dessus le nom du produit. On repasse sur deux lignes. */
@media (max-width: 460px) {
  .pa-ligne {
    grid-template-columns: 56px 1fr auto;
    grid-template-areas: "img nom suppr" "img qte total";
    row-gap: .5rem;
  }
  .pa-ligne img { grid-area: img; width: 56px; height: 56px; }
  .pa-txt { grid-area: nom; }
  .pa-qte { grid-area: qte; }
  .pa-total { grid-area: total; text-align: right; }
  .pa-suppr { grid-area: suppr; align-self: start; }
}

/* Ajout direct depuis une carte du catalogue. Discret par défaut pour ne pas
   parasiter la grille, franc au survol — la carte reste d'abord un lien vers la
   fiche produit. Absent des grilles compactes (aperçus) et des produits sans prix. */
.p-panier {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  width: 100%; margin-top: .9rem; padding: .6rem .8rem;
  border: 1px solid rgba(199, 154, 62, .55); border-radius: var(--r);
  background: none; color: var(--gold-d); cursor: pointer;
  font-size: .82rem; font-weight: 600; letter-spacing: .02em;
  transition: background .2s, color .2s, border-color .2s;
}
.p-panier svg { width: 16px; height: 16px; flex: none; }
.p-panier:hover { background: var(--gold); border-color: var(--gold); color: #fff; }
.p-panier.ajoute { background: var(--ox); border-color: var(--ox); color: #fff; }

/* Alerte panier vide sur /commander, doublée par la désactivation du bouton
   d'envoi (panier.js) : un formulaire valide ne doit pas pouvoir partir sans
   produit. */
.cmd-alerte {
  background: rgba(218, 41, 22, .08); border-left: 3px solid var(--red, #da2916);
  padding: .8rem 1rem; margin-bottom: 1rem; font-size: .9rem;
}
.cmd-alerte a { color: var(--ox); border-bottom: 1px solid currentColor; }
.c-form button[type="submit"]:disabled { opacity: .45; cursor: not-allowed; }

/* ---------------------------------------------------------------- boutique à venir */
/* Les boutons d'achat restent CLIQUABLES tant que `panierActif` est à false
   (data.mjs) : ils ouvrent #modale-bientot, qui renvoie au téléphone et à
   l'e-mail. Un bouton mort (pointer-events:none, comme avant) se lit comme un
   bug et fait repartir le visiteur ; celui-ci amène une commande. */
.btn-bientot {
  background: var(--gold); color: #fff; border-color: var(--gold);
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
}
.btn-bientot:hover { background: var(--gold-d); border-color: var(--gold-d); }
.btn-bientot svg { width: 18px; height: 18px; flex-shrink: 0; }
.bq-btn.bq-bientot { cursor: pointer; }

/* ---------------------------------------------------------------- la fenêtre */
.modale-bientot {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center; padding: 1.2rem;
  background: rgba(31, 18, 13, .62);
}
/* Indispensable : `display:grid` ci-dessus l'emporte sur l'attribut [hidden],
   et la fenêtre resterait affichée en permanence. */
.modale-bientot[hidden] { display: none; }
body.modale-ouverte { overflow: hidden; }

.mb-boite {
  position: relative; width: 100%; max-width: 470px; text-align: center;
  background: var(--cream-3); color: var(--ink, #341009);
  padding: clamp(1.8rem, 5vw, 2.6rem) clamp(1.3rem, 4vw, 2.4rem) clamp(1.4rem, 4vw, 2rem);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
  border-top: 3px solid var(--gold);
  animation: mb-entree .26s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes mb-entree { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }

.mb-fermer {
  position: absolute; top: .5rem; right: .5rem; width: 40px; height: 40px;
  background: none; border: 0; cursor: pointer; font-size: 1.6rem; line-height: 1;
  color: var(--muted); transition: color .2s, transform .2s;
}
.mb-fermer:hover { color: var(--ox); transform: rotate(90deg); }

.mb-ico {
  display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto .9rem;
  border-radius: 50%; background: rgba(199, 154, 62, .16); color: var(--gold-d);
}
.mb-ico svg { width: 26px; height: 26px; }

.mb-boite h2 { font-size: clamp(1.25rem, 3.4vw, 1.55rem); margin-bottom: .6rem; }
.mb-boite p { color: var(--muted); line-height: 1.65; font-size: .95rem; }

.mb-actions { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; margin: 1.4rem 0 1.1rem; }
.mb-actions .btn { flex: 1 1 auto; justify-content: center; }
/* .btn-ghost est prévu pour un fond sombre (bordure et texte blancs) : sur le
   crème de la fenêtre il serait invisible. On repasse sur l'oxblood. */
.mb-actions .btn-ghost { border-color: var(--ox); color: var(--ox); }
.mb-actions .btn-ghost:hover { background: var(--ox); color: var(--cream-2); }

.mb-pied { font-size: .84rem; border-top: 1px solid rgba(52, 16, 9, .12); padding-top: .9rem; }

@media (prefers-reduced-motion: reduce) {
  .mb-boite { animation: none; }
  .mb-fermer:hover { transform: none; }
}
