/* ============================================================================
   style.css — Nya-Boutique V2 (site visiteur). Mobile d'abord, grille 2×2, en-tête 20vh avec image de couverture.
   La couleur principale vient de config.js (variable --brand).
   ============================================================================ */
:root {
  --brand: #2563eb;
  --brand-dark: color-mix(in srgb, var(--brand) 62%, #000);
  --brand-soft: color-mix(in srgb, var(--brand) 10%, #fff);
  --ink: #0f172a; --text: #334155; --muted: #64748b; --line: #e5e9f2; --bg: #f3f5fa; --card: #fff;
  --amber: #f59e0b; --deal: #e11d48; --wa: #12a84f; --wa-dark: #0c8a3e;
  --r-sm: 10px; --r-md: 16px; --r-lg: 22px;
  --sh-1: 0 1px 2px rgba(15,23,42,.05), 0 2px 8px rgba(15,23,42,.06);
  --sh-2: 0 8px 22px rgba(15,23,42,.12);
  --page-w: 760px;             /* largeur maximale de la page : 760 px sur mobile, 1280 px sur ordinateur (voir @media en fin de fichier) */
  --top-h: 92px;               /* hauteur de la zone fixe : recalculée par app.js */
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Plus Jakarta Sans', 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:where(a, button, input, textarea):focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* ───────── Zone fixe (V2) : en-tête de 20vh avec image de couverture ─────────
   • .site-header : hauteur EXACTE de 20vh (1,2 / 6 de l'écran), fixé en haut pendant le défilement.
   • .header-cover : l'image de couverture choisie par le vendeur (object-fit: cover = remplit tout l'en-tête).
   • .header-shade : filtre sombre en dégradé par-dessus l'image → lisibilité garantie du nom et du panier.
   • .header-bar (logo, nom, panier) : premier plan, au-dessus du filtre.
   • .ticker (bande d'annonces) : barre séparée AU-DESSUS de l'en-tête, jamais sur l'image. */
.top-fixed { position: fixed; inset: 0 0 auto 0; z-index: 50; }
.site-header {
  position: relative; height: 20vh; overflow: hidden; display: flex; flex-direction: column; color: #fff;
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 100%);          /* repli sans image */
  border-radius: 0 0 var(--r-lg) var(--r-lg); box-shadow: 0 8px 24px rgba(10,31,68,.25);
}
.header-cover { position: absolute; inset: 0; z-index: 0; }
.header-cover img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.header-shade {                                    /* léger filtre quand il n'y a pas d'image… */
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(8,15,32,.10) 0%, rgba(8,15,32,.28) 100%);
}
.header-shade::after {                              /* filtre FORT : il apparaît en fondu avec l'image de couverture */
  content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity .7s ease;
  background: linear-gradient(180deg, rgba(8,15,32,.62) 0%, rgba(8,15,32,.40) 40%, rgba(8,15,32,.78) 100%);
}
.site-header.has-cover .header-shade::after { opacity: 1; }

/* Bande défilante : barre séparée, au-dessus de l'en-tête de couverture */
.ticker {                                           /* barre PLEINE au-dessus de l'image : elle ne recouvre plus la couverture */
  position: relative; flex: none; height: 30px; overflow: hidden; display: flex; align-items: center;
  background: var(--brand-dark); color: #fff; font-size: .78rem; font-weight: 600;
}
.ticker-track { display: flex; width: max-content; will-change: transform; animation: nb-defile var(--dur, 30s) linear infinite; }
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track { animation-play-state: paused; }
.ticker-set { display: flex; flex: none; align-items: center; }
.ticker-item { display: inline-flex; align-items: center; white-space: nowrap; padding: 0 22px; color: inherit; text-decoration: none; }
.ticker-item::after { content: '◆'; margin-left: 44px; color: var(--amber); font-size: .6rem; }
a.ticker-item { text-decoration: underline; text-underline-offset: 3px; }
@keyframes nb-defile { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .ticker { overflow-x: auto; }
  .ticker-track { animation: none; }
}

/* Nom de la boutique + panier, superposés à l'image */
.header-bar {
  position: relative; z-index: 2; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 14px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.brand-logo {
  flex: none; width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: #fff; color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem;
  border: 2px solid rgba(255,255,255,.7);
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.header-bar .brand-logo { width: 46px; height: 46px; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.brand-name {
  font-weight: 800; font-size: 1.2rem; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 2px 10px rgba(0,0,0,.6);
}
.cart-btn {
  position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; color: #fff;
  background: rgba(8,15,32,.38); border: 1px solid rgba(255,255,255,.55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); box-shadow: 0 4px 14px rgba(0,0,0,.35);
  display: inline-flex; align-items: center; justify-content: center; transition: transform .15s;
}
.cart-btn:active { transform: scale(.94); }
.cart-btn.bump { animation: nb-bump .4s; }
@keyframes nb-bump { 40% { transform: scale(1.18); } }
.cart-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--deal); color: #fff; font-size: .7rem; font-weight: 800; line-height: 20px; text-align: center;
  border: 2px solid #0f172a;
}
/* Écrans très bas (téléphone en paysage) : tout rapetisse un peu pour que 20vh suffise */
@media (max-height: 520px) {
  .ticker { height: 24px; font-size: .72rem; }
  .header-bar .brand-logo, .cart-btn { width: 36px; height: 36px; }
  .brand-name { font-size: 1rem; }
}

main { padding: calc(var(--top-h) + 12px) 12px 28px; max-width: var(--page-w); margin: 0 auto; }

/* ───────── Grille : 2×2 sur mobile, 3 puis 4 colonnes sur grand écran (voir la fin du fichier) ───────── */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.card {
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--sh-1); overflow: hidden; color: inherit; text-decoration: none; transition: transform .2s, box-shadow .2s;
}
@media (hover: hover) { .card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); } }
.card:active { transform: scale(.985); }
.card-img { position: relative; aspect-ratio: 1 / 1; background: #eef1f8; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s; }
.card-img img.ok { opacity: 1; }
.badge-promo {
  position: absolute; top: 8px; left: 8px; background: var(--deal); color: #fff; font-size: .7rem; font-weight: 800;
  padding: 3px 8px; border-radius: 999px; box-shadow: 0 3px 8px rgba(225,29,72,.35);
}
.card-body { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 4px; }
.card-name {
  margin: 0; font-size: .86rem; font-weight: 700; color: var(--ink); line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em;
}
.card-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.price { font-weight: 800; color: #2563eb; font-size: .95rem; }          /* prix actuel : bleu */
.price-old { color: #dc2626; font-size: .76rem; font-weight: 600; text-decoration: line-through; text-decoration-color: #dc2626; text-decoration-thickness: 1.5px; }   /* vrai prix : barré en rouge */
.skeleton .card-img, .skeleton .sk-line { background: linear-gradient(90deg, #e9edf5 25%, #f5f7fb 50%, #e9edf5 75%); background-size: 200% 100%; animation: nb-sk 1.2s linear infinite; }
.sk-line { height: 12px; border-radius: 6px; margin: 4px 0; }
@keyframes nb-sk { to { background-position: -200% 0; } }
#sentinel { height: 1px; }

.state-msg { text-align: center; padding: 40px 16px; color: var(--muted); }
.state-msg button { margin-top: 12px; }

/* ───────── Vue détail ───────── */
#detail-view { padding-bottom: 96px; }          /* place pour le bouton flottant */
.gallery { position: relative; }
.g-main {
  position: relative; aspect-ratio: 1 / 1; width: 100%; background: #eef1f8; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--line); touch-action: pan-y;
}
.g-main img { width: 100%; height: 100%; object-fit: contain; }
.g-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.88); color: var(--ink); box-shadow: var(--sh-1); display: inline-flex; align-items: center; justify-content: center;
}
.g-prev { left: 8px; } .g-next { right: 8px; }
.g-count { position: absolute; right: 10px; bottom: 10px; background: rgba(15,23,42,.65); color: #fff; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.g-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.g-thumb { aspect-ratio: 1/1; padding: 0; border: 2px solid transparent; border-radius: var(--r-sm); overflow: hidden; background: #eef1f8; opacity: .6; }
.g-thumb img { width: 100%; height: 100%; object-fit: cover; }
.g-thumb.active { border-color: var(--brand); opacity: 1; }

.d-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 16px; margin-top: 12px; }
.d-name { margin: 0 0 6px; font-size: 1.2rem; font-weight: 800; color: var(--ink); line-height: 1.25; }
.d-price { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 10px; }
.d-price .price { font-size: 1.35rem; }
.d-price .price-old { font-size: .95rem; }
.d-price .badge-promo { position: static; }
.d-desc { margin: 0 0 4px; white-space: pre-line; line-height: 1.55; overflow-wrap: anywhere; }
.d-h { margin: 14px 0 6px; font-size: .95rem; font-weight: 800; color: var(--ink); }
.features { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.features li { position: relative; padding-left: 22px; line-height: 1.4; overflow-wrap: anywhere; }
.features li::before { content: '✓'; position: absolute; left: 0; top: 0; color: var(--wa); font-weight: 800; }

.actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 14px; }
.actions .btn-order { grid-column: 1 / -1; }
.btn {
  min-height: 46px; border-radius: 999px; border: 0; font-weight: 800; font-size: .95rem; padding: 0 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .15s, filter .2s;
}
.btn:active { transform: scale(.97); }
.btn-order { background: linear-gradient(135deg, #1fbf6a, var(--wa)); color: #fff; box-shadow: 0 8px 18px rgba(18,168,79,.3); }
.btn-add { background: var(--brand-soft); color: var(--brand-dark); border: 2px solid var(--brand); }
.btn-add.done { background: var(--brand); color: #fff; }
.btn-share { width: 46px; padding: 0; background: #fff; color: var(--brand); border: 2px solid var(--line); }
.btn-wa { background: linear-gradient(135deg, #2be074, var(--wa)); color: #fff; width: 100%; min-height: 50px; box-shadow: 0 10px 22px rgba(18,168,79,.32); }

.more-info { border-left: 4px solid var(--amber); }
.more-info h2 { margin: 0 0 8px; font-size: 1rem; font-weight: 800; color: var(--ink); }
.more-info p { margin: 0; white-space: pre-line; line-height: 1.6; overflow-wrap: anywhere; }

.all-btn {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 40;
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 20px; border: 0; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 800; font-size: .92rem; box-shadow: var(--sh-2); white-space: nowrap;
  animation: nb-up .3s ease-out;
}
@keyframes nb-up { from { opacity: 0; transform: translate(-50%, 14px); } }

/* ───────── Pied de page : infos de la boutique ───────── */
.shop-info {
  margin-top: 26px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 18px 16px;
}
.shop-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.shop-head .brand-logo { width: 46px; height: 46px; background: var(--brand-soft); border-color: var(--line); }
.shop-head h2 { margin: 0; font-size: 1.1rem; color: var(--ink); font-weight: 800; }
.shop-row { display: flex; align-items: flex-start; gap: 9px; margin: 8px 0; line-height: 1.45; overflow-wrap: anywhere; }
.shop-row svg { flex: none; margin-top: 2px; color: var(--brand); }
.shop-desc { margin: 8px 0 4px; white-space: pre-line; line-height: 1.55; }
.shop-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.shop-links a { display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 16px; border-radius: 999px; font-weight: 700; font-size: .88rem; text-decoration: none; }
.link-wa { background: var(--wa); color: #fff; }
.link-map { background: var(--brand-soft); color: var(--brand-dark); }
.copyright { margin-top: 14px; text-align: center; color: var(--muted); font-size: .76rem; }

/* ───────── Fenêtre panier ───────── */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10,22,48,.6); backdrop-filter: blur(5px); }
.modal-box {
  position: relative; width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column;
  background: #fff; border-radius: 26px 26px 0 0; box-shadow: var(--sh-2); animation: nb-sheet .28s ease-out;
}
@keyframes nb-sheet { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 700px) { .modal { align-items: center; } .modal-box { border-radius: 26px; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.modal-head h2 { margin: 0; font-size: 1.15rem; font-weight: 800; color: var(--ink); }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: #f1f5f9; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.modal-body { padding: 4px 18px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.cart-empty { padding: 30px 0; text-align: center; color: var(--muted); }
.cart-list { list-style: none; margin: 0; padding: 0; }
.cart-item { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-item img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: #eef1f8; }
.ci-name { font-weight: 700; color: var(--ink); font-size: .9rem; line-height: 1.25; overflow-wrap: anywhere; }
.ci-price { color: var(--muted); font-size: .8rem; }
.qty { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; }
.qty button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.qty span { min-width: 20px; text-align: center; font-weight: 800; color: var(--ink); }
.ci-remove { border: 0; background: transparent; color: var(--muted); width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; }
.cart-total { display: flex; justify-content: space-between; align-items: center; padding: 14px 0 6px; font-size: 1.05rem; color: var(--ink); }
.cart-total strong { color: var(--brand); font-size: 1.2rem; }
.order-form { display: grid; gap: 6px; margin-top: 8px; }
.order-note { margin: 0 0 6px; padding: 10px 12px; border-radius: var(--r-sm); background: #ecfdf5; border-left: 4px solid var(--wa); color: #065f46; font-size: .84rem; }
.order-form label { font-weight: 700; font-size: .82rem; color: var(--ink); margin-top: 4px; }
.order-form input {
  width: 100%; border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; font-size: 16px; background: #fbfcfe; color: var(--ink);
}
.order-form input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); outline: none; background: #fff; }
.form-error { margin: 4px 0 0; color: var(--deal); font-weight: 700; font-size: .85rem; }
.order-form .btn-wa { margin-top: 10px; }

.toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 200;
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px; font-size: .88rem; font-weight: 600; box-shadow: var(--sh-2);
  max-width: calc(100vw - 32px); text-align: center;
}

@media (min-width: 700px) {
  main { padding-left: 20px; padding-right: 20px; }
  .grid { gap: 14px; }
  .card-name { font-size: .95rem; }
  .brand-name { font-size: 1.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ── Position GPS du client (commande) ── */
.geo-row { margin: 2px 0 4px; }
.btn-geo { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1.5px dashed #2563eb; background: #eff6ff; color: #1d4ed8; font: inherit; font-weight: 700; font-size: .88rem; cursor: pointer; }
.btn-geo:disabled { opacity: .6; cursor: wait; }
.geo-status { margin: 6px 0 0; font-size: .8rem; color: #475569; }
.geo-status.ok { color: #047857; font-weight: 700; }
.geo-status.ko { color: #b91c1c; }
.geo-status button { background: none; border: 0; padding: 0 0 0 6px; color: #1d4ed8; text-decoration: underline; font: inherit; cursor: pointer; }

/* ───────── V2 : fondus + en-tête FLUIDE (repli progressif au défilement) ─────────
   Les rubriques ci-dessous sont pilotées par <html data-entete="fixe|fluide"> (config.js › enteteMode) et par --p (0 = déplié → 1 = replié). */
.header-cover img { position: absolute; inset: 0; opacity: 0; transition: opacity .7s ease; }     /* l'image apparaît en fondu (plus de « clic » brutal) */
.header-cover img.pret { opacity: 1; }

:root[data-entete="fluide"] { --top-h: calc(20vh + var(--tick-h, 0px)); }   /* la page reste calée sur la hauteur DÉPLIÉE (bande + 20vh) : aucun saut pendant le repli */
.site-header { --p: 0; --h-full: 20vh; --h-min: min(64px, 20vh); }
:root[data-entete="fluide"] .site-header {
  height: calc(var(--h-full) - (var(--h-full) - var(--h-min)) * var(--p));                         /* 20vh → 64 px, proportionnel au défilement */
}
:root[data-entete="fluide"] .header-bar .brand-logo, :root[data-entete="fluide"] .cart-btn {
  width: calc(46px - 12px * var(--p)); height: calc(46px - 12px * var(--p));
}
:root[data-entete="fluide"] .brand-name { font-size: calc(1.2rem - .2rem * var(--p)); }
:root[data-entete="fluide"] .header-cover img { transform: translate3d(0, calc(var(--p) * -9%), 0) scale(1.12); will-change: transform; }   /* léger effet de profondeur */
@media (min-width: 700px) { :root[data-entete="fluide"] .brand-name { font-size: calc(1.4rem - .25rem * var(--p)); } }
@media (max-height: 520px) {
  :root[data-entete="fluide"] .header-bar .brand-logo, :root[data-entete="fluide"] .cart-btn { width: calc(36px - 6px * var(--p)); height: calc(36px - 6px * var(--p)); }
}

/* ───────── Ordinateur : page élargie + grille qui s'adapte à l'écran ─────────
   Mobile (< 700 px)  : 2 colonnes (2×2), page de 760 px max — inchangé.
   Tablette (≥ 700 px): 3 colonnes · Ordinateur (≥ 1024 px) : 4 colonnes · page jusqu'à 1280 px.
   La fiche produit passe en 2 colonnes : photos à gauche (qui restent visibles au défilement), informations à droite. */
@media (min-width: 700px) {
  :root { --page-w: 1280px; }
  main { padding-left: 24px; padding-right: 24px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .header-bar { padding: 0 max(14px, calc((100vw - var(--page-w)) / 2 + 24px)); }
  .card-name { font-size: 1rem; }
  .price { font-size: 1.05rem; }
  .promo-text { max-width: 60%; padding-left: 28px; }
  #detail-view:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0 28px; align-items: start; max-width: 1060px; margin: 0 auto; }
  #detail-view .gallery { grid-column: 1; grid-row: 1 / span 3; position: sticky; top: calc(var(--top-h) + 12px); }
  :root[data-entete="fluide"] #detail-view .gallery { top: calc(var(--tick-h, 0px) + 84px); }                 /* en-tête replié : 64 px + marge */
  #detail-view .d-card { grid-column: 2; margin-top: 0; }
  #detail-view .d-card + .d-card { margin-top: 14px; }
}
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
