:root {
  --noir: #000;
  --blanc: #fff;
  --papier: #f4f3ef;
  --trait: #dcdad3;
  --gris: #5d5a54;
  --bois: #e6cfa5;
  --fuchsia: #d81e7c;
  --fuchsia-fonce: #b3125f;
  --jaune: #f4b81c;
  --vert: #14573a;
  --vert-vif: #1f8a55;
  --rouge: #c8202b;
  --titre: "Bricolage Grotesque", "Arial Narrow", sans-serif;
  --texte: "Albert Sans", system-ui, sans-serif;
  --marge: clamp(1rem, 4vw, 3.5rem);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--texte);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--noir);
  background: var(--blanc);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--fuchsia); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

h1, h2 {
  font-family: var(--titre);
  font-stretch: 78%;
  font-weight: 800;
  line-height: .95;
  letter-spacing: -.02em;
  text-wrap: balance;
}
h2 { font-size: clamp(2.1rem, 5vw, 3.6rem); }
h3 { font-family: var(--titre); font-stretch: 85%; font-weight: 700; font-size: 1.35rem; line-height: 1.15; }

/* Bandeau et en-tête */
.bandeau {
  background: var(--noir); color: var(--blanc);
  text-align: center; font-size: .875rem; padding: .55rem var(--marge);
}
.entete {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .8rem var(--marge);
  background: var(--blanc);
  border-bottom: 1px solid var(--trait);
}
.logo {
  font-family: var(--titre); font-stretch: 78%; font-weight: 800;
  font-size: 1.85rem; letter-spacing: -.03em; line-height: 1;
  text-decoration: none; display: inline-flex; align-items: flex-start;
}
.logo-perle {
  width: .34em; height: .34em; margin: .06em .05em 0;
  border-radius: 50%; background: var(--fuchsia);
  box-shadow: inset -.05em -.05em 0 rgba(0,0,0,.25);
}
.menu { display: flex; gap: 1.4rem; margin-left: auto; }
.menu a { text-decoration: none; font-weight: 500; font-size: .95rem; padding: .3rem 0; border-bottom: 2px solid transparent; }
.menu a:hover { border-bottom-color: var(--noir); }
.btn-panier {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--noir); color: var(--blanc);
  border: 0; border-radius: 999px; padding: .55rem .7rem .55rem 1rem; font-weight: 600; font-size: .95rem;
}
.compteur {
  min-width: 1.6rem; height: 1.6rem; padding: 0 .4rem; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--jaune); color: var(--noir); font-size: .85rem; font-weight: 600;
}

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border-radius: 999px; padding: .85rem 1.5rem;
  font-weight: 600; text-decoration: none; border: 2px solid transparent;
}
.btn-plein { background: var(--fuchsia); color: var(--blanc); }
.btn-plein:hover { background: var(--fuchsia-fonce); }
.btn-contour { border-color: currentColor; background: transparent; }
.btn-noir { background: var(--noir); color: var(--blanc); }
.btn-noir:hover { background: #2a2a2a; }
.btn-large { width: 100%; }

/* Hero */
.hero {
  background: var(--vert); color: var(--blanc);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(1.5rem, 4vw, 4rem); align-items: center;
  padding: clamp(2.5rem, 6vw, 5rem) var(--marge);
}
.hero h1 {
  font-size: clamp(2.8rem, 6.6vw, 5.8rem);
  color: var(--bois);
}
.hero-texte p { margin-top: 1.5rem; max-width: 34rem; font-size: 1.125rem; color: #e9efe9; }
.hero-actions { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: .8rem; }
.hero-photos {
  display: grid; grid-template-columns: 1.55fr 1fr; grid-template-rows: 1fr 1fr; gap: .9rem;
}
.hp { padding: 0; border: 0; background: var(--bois); overflow: hidden; }
.hp img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1; transition: transform .4s ease; }
.hp:hover img { transform: scale(1.04); }
.hp-1 { grid-row: 1 / 3; border-radius: 14rem 14rem 1.2rem 1.2rem; }
.hp-1 img { aspect-ratio: auto; }
.hp-2 { border-radius: 50%; }
.hp-3 { border-radius: 1.2rem; }

.frise { line-height: 0; background: var(--noir); }

/* Boutique */
.boutique { padding: clamp(3rem, 7vw, 5.5rem) var(--marge) clamp(3rem, 6vw, 5rem); scroll-margin-top: 4rem; }
.boutique-tete { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem 2rem; }
.recherche input {
  width: min(22rem, 80vw); font: inherit;
  padding: .7rem 1.1rem; border-radius: 999px;
  border: 1.5px solid var(--noir); background: var(--blanc);
}

/* Filtres : des perles enfilées sur un cordon */
.cordon {
  position: relative; display: flex; gap: 1.1rem; align-items: center;
  margin: 2rem calc(var(--marge) * -1) 0; padding: .6rem var(--marge);
  overflow-x: auto; scrollbar-width: none;
}
.cordon::-webkit-scrollbar { display: none; }
.cordon::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 3px;
  min-width: 100%; background: var(--noir); transform: translateY(-50%);
}
.perle {
  position: relative; flex: none;
  border: 0; border-radius: 999px; padding: .7rem 1.35rem;
  font-weight: 600; font-size: .95rem; white-space: nowrap;
  background: var(--c); color: var(--t, var(--noir));
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.14), inset 0 3px 0 rgba(255,255,255,.28);
  transition: transform .15s ease;
}
.perle small { font-weight: 500; opacity: .8; margin-left: .3rem; font-size: .85em; }
.perle:hover { transform: translateY(-2px); }
.perle[aria-pressed="true"] { outline: 3px solid var(--noir); outline-offset: 3px; }
.perle[aria-pressed="true"]:focus-visible { outline-color: var(--fuchsia); }

.resultat { margin-top: 1.5rem; color: var(--gris); font-size: .95rem; }
.grille {
  margin-top: 1.25rem;
  display: grid; gap: 2.2rem 1.4rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr));
}
.carte { display: flex; flex-direction: column; }
.carte-photo {
  position: relative; padding: 0; border: 0; background: var(--papier);
  border-radius: 1rem; overflow: hidden; display: block; width: 100%;
}
.carte-photo img { width: 100%; aspect-ratio: 1; object-fit: cover; transition: transform .4s ease; }
.carte-photo:hover img { transform: scale(1.04); }
.etiquette {
  position: absolute; left: .7rem; top: .7rem;
  background: var(--blanc); border-radius: 999px; padding: .2rem .7rem;
  font-size: .8rem; font-weight: 600;
}
.carte-infos { padding-top: .85rem; display: grid; grid-template-columns: 1fr auto; gap: .15rem .8rem; align-items: start; }
.carte-nom {
  font-family: var(--titre); font-stretch: 85%; font-weight: 700; font-size: 1.15rem; line-height: 1.2;
  background: none; border: 0; padding: 0; text-align: left;
}
.carte-nom:hover { text-decoration: underline; text-underline-offset: 3px; }
.carte-resume { grid-column: 1; color: var(--gris); font-size: .92rem; }
.carte-prix { grid-column: 1; margin-top: .3rem; font-weight: 600; }
.ajout {
  grid-column: 2; grid-row: 1 / 4; align-self: center;
  width: 2.9rem; height: 2.9rem; border-radius: 50%;
  border: 2px solid var(--noir); background: var(--blanc);
  display: grid; place-items: center; transition: background .15s, color .15s;
}
.ajout:hover { background: var(--noir); color: var(--blanc); }
.vide { grid-column: 1 / -1; padding: 3rem 0; text-align: center; color: var(--gris); }
.vide button { margin-top: 1rem; }

/* Atelier */
.atelier { background: var(--papier); padding: clamp(3rem, 7vw, 5.5rem) var(--marge); scroll-margin-top: 4rem; }
.matieres { margin-top: 2.5rem; display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.matieres img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 1rem; }
.matieres h3 { margin-top: 1.1rem; }
.matieres p { margin-top: .5rem; color: #33312d; max-width: 38ch; }

/* Commander */
.commander { padding: clamp(3rem, 7vw, 5.5rem) var(--marge); scroll-margin-top: 4rem; }
.etapes { counter-reset: e; margin-top: 2.5rem; display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.etapes li { counter-increment: e; border-top: 3px solid var(--noir); padding-top: 1rem; }
.etapes li::before {
  content: counter(e);
  display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  font-family: var(--titre); font-weight: 800; font-size: 1.3rem;
  margin-bottom: 1rem; box-shadow: inset 0 -4px 0 rgba(0,0,0,.14);
}
.etapes li:nth-child(1)::before { background: var(--fuchsia); color: var(--blanc); }
.etapes li:nth-child(2)::before { background: var(--jaune); }
.etapes li:nth-child(3)::before { background: var(--vert-vif); color: var(--blanc); }
.etapes p { margin-top: .5rem; color: #33312d; max-width: 36ch; }
.note-main { margin-top: 2.5rem; color: var(--gris); max-width: 60ch; }

/* Pied */
.pied {
  background: var(--noir); color: var(--blanc);
  padding: 3.5rem var(--marge) 1.5rem;
  display: grid; gap: 2.5rem; grid-template-columns: 1.4fr 1fr 1fr;
}
.pied h2 { font-family: var(--texte); font-stretch: 100%; font-size: 1rem; font-weight: 600; letter-spacing: 0; line-height: 1.4; color: var(--bois); }
.pied ul { margin-top: .8rem; display: grid; gap: .45rem; }
.pied a { text-decoration: none; }
.pied a:hover { text-decoration: underline; text-underline-offset: 3px; }
.pied-marque p { margin-top: .8rem; color: #cfcbc2; }
.logo-clair { font-size: 2.4rem; }
.copyright { grid-column: 1 / -1; border-top: 1px solid #333; padding-top: 1.2rem; color: #a8a49b; font-size: .875rem; }
.a-completer { color: #a8a49b; }

/* Fenêtres */
dialog { border: 0; padding: 0; color: var(--noir); }
dialog::backdrop { background: rgba(0,0,0,.55); }
.fermer {
  width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 0;
  background: var(--papier); display: grid; place-items: center;
}
.fermer:hover { background: var(--trait); }

.fiche { width: min(62rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); border-radius: 1.4rem; }
.fiche > .fermer { position: absolute; right: 1rem; top: 1rem; z-index: 2; background: var(--blanc); }
.fiche-corps { display: grid; grid-template-columns: 1.05fr 1fr; }
.fiche-photo { background: var(--papier); }
.fiche-photo img { width: 100%; height: 100%; max-height: calc(100dvh - 2rem); object-fit: cover; }
.fiche-texte { padding: clamp(1.5rem, 4vw, 3rem); align-self: center; }
.fiche-texte h2 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); margin-top: .6rem; }
.fiche-matiere { display: inline-block; background: var(--bois); border-radius: 999px; padding: .2rem .8rem; font-size: .875rem; font-weight: 600; }
.fiche-prix { margin-top: .9rem; font-size: 1.25rem; font-weight: 600; }
.fiche-desc { margin-top: 1rem; color: #33312d; }
.fiche-details { margin-top: 1.2rem; display: grid; gap: .35rem; }
.fiche-details li { padding-left: 1.2rem; position: relative; }
.fiche-details li::before { content: ""; position: absolute; left: 0; top: .55em; width: .5rem; height: .5rem; border-radius: 50%; background: var(--fuchsia); }
.fiche-ref { margin-top: 1rem; color: var(--gris); font-size: .9rem; }
.fiche-achat { margin-top: 1.6rem; display: flex; gap: .8rem; flex-wrap: wrap; }
.fiche-achat .btn { flex: 1 1 12rem; }

.qte { display: inline-flex; align-items: center; border: 2px solid var(--noir); border-radius: 999px; }
.qte button { width: 2.5rem; height: 2.7rem; border: 0; background: none; font-size: 1.2rem; font-weight: 600; border-radius: 999px; }
.qte button:hover { background: var(--papier); }
.qte output { min-width: 1.8rem; text-align: center; font-weight: 600; }

.panier {
  margin: 0 0 0 auto; height: 100dvh; max-height: none;
  width: min(27rem, 100vw); max-width: none;
  display: none; flex-direction: column;
}
.panier[open] { display: flex; animation: glisse .25s ease; }
@keyframes glisse { from { transform: translateX(100%); } }
.panier-tete { display: flex; justify-content: space-between; align-items: center; padding: 1.2rem 1.4rem; border-bottom: 1px solid var(--trait); }
.panier-tete h2 { font-size: 1.9rem; }
.panier-corps { flex: 1; overflow-y: auto; padding: .4rem 1.4rem; }
.panier-pied { padding: 1.2rem 1.4rem 1.5rem; border-top: 1px solid var(--trait); display: grid; gap: .7rem; }
.panier-pied:empty { display: none; }
.ligne { display: grid; grid-template-columns: 5rem 1fr; gap: .9rem; padding: 1rem 0; border-bottom: 1px solid var(--trait); }
.ligne img { width: 5rem; height: 5rem; object-fit: cover; border-radius: .7rem; }
.ligne-nom { font-family: var(--titre); font-stretch: 85%; font-weight: 700; line-height: 1.2; }
.ligne-ref { color: var(--gris); font-size: .875rem; }
.ligne-bas { margin-top: .55rem; display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.ligne .qte button { width: 2.1rem; height: 2.1rem; }
.retirer { background: none; border: 0; padding: .3rem 0; text-decoration: underline; text-underline-offset: 3px; font-size: .9rem; color: var(--gris); }
.retirer:hover { color: var(--noir); }
.panier-vide { padding: 3rem 0; text-align: center; }
.panier-vide p { color: var(--gris); margin: .5rem 0 1.4rem; }
.total { display: flex; justify-content: space-between; font-weight: 600; font-size: 1.1rem; }
.total-note { color: var(--gris); font-size: .9rem; }
.btn-whatsapp { background: #128c4b; color: var(--blanc); }
.btn-whatsapp:hover { background: #0e733d; }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; z-index: 50;
  transform: translate(-50%, 1rem); opacity: 0; pointer-events: none;
  background: var(--noir); color: var(--blanc);
  padding: .75rem 1.3rem; border-radius: 999px; font-weight: 500;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 2rem); text-align: center;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 60rem) {
  .menu { display: none; }
  .btn-panier { margin-left: auto; }
  .hero { grid-template-columns: 1fr; }
  .pied { grid-template-columns: 1fr 1fr; }
  .pied-marque { grid-column: 1 / -1; }
}
@media (max-width: 44rem) {
  .fiche-corps { grid-template-columns: 1fr; }
  .fiche-photo img { aspect-ratio: 4 / 3; height: auto; }
  .grille { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.6rem .8rem; }
  .carte-infos { grid-template-columns: 1fr; }
  .ajout { grid-column: 1; grid-row: auto; width: 100%; height: 2.6rem; border-radius: 999px; margin-top: .5rem; }
  .carte-nom { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Gestion (propriétaire uniquement) ---------- */
[hidden] { display: none !important; }
.sans-photo { display: grid; place-items: center; width: 100%; aspect-ratio: 1; background: var(--bois); color: #5a4a2c; font-size: .9rem; }
.ligne .sans-photo { width: 5rem; height: 5rem; border-radius: .7rem; }
.carte.masquee .carte-photo img { opacity: .45; }
.etiquette-masque { top: auto; bottom: .7rem; background: var(--noir); color: var(--blanc); }
.carte-gestion { margin-top: .7rem; display: flex; gap: .5rem; }
.carte-gestion button {
  flex: 1; padding: .5rem .6rem; border-radius: .6rem; font-size: .9rem; font-weight: 600;
  background: var(--jaune); border: 0;
}
.carte-gestion button:last-child { background: var(--papier); color: var(--rouge); }
.carte-gestion button:hover { filter: brightness(.94); }

.avec-gestion { padding-bottom: 6rem; }
.gestion {
  position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 30;
  width: max-content; max-width: calc(100vw - 1.5rem);
  background: var(--noir); color: var(--blanc);
  border: 3px solid var(--jaune); border-radius: 1.2rem; padding: .7rem .9rem;
  display: grid; gap: .55rem;
}
.gestion-titre { font-weight: 600; font-size: .9rem; }
.gestion-titre span { font-weight: 400; color: #cfcbc2; }
.gestion-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.gestion-actions button {
  border: 0; border-radius: 999px; padding: .5rem .95rem; font-weight: 600; font-size: .9rem;
  background: var(--jaune); color: var(--noir);
}
.gestion-actions button:hover { filter: brightness(.93); }
.gestion-actions #btn-apercu, .gestion-actions #btn-sortir { background: transparent; color: var(--blanc); box-shadow: inset 0 0 0 2px #777; }
.gestion.reduit .gestion-titre, .gestion.reduit [data-g]:not(#btn-apercu) { display: none; }
main, .bandeau { transition: opacity .25s ease; }
.chargement main, .chargement .bandeau { opacity: 0; }

.edition { width: min(40rem, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem); border-radius: 1.4rem; }
.edition form { display: flex; flex-direction: column; max-height: calc(100dvh - 1.5rem); }
.edition .panier-tete h2 { font-size: 1.7rem; }
.edition-corps { overflow-y: auto; padding: 1.2rem 1.4rem; display: grid; gap: 1rem; }
.edition-corps h3 { margin-top: .6rem; padding-top: 1rem; border-top: 1px solid var(--trait); }
.edition-corps h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.edition-pied { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .7rem; padding: 1rem 1.4rem; border-top: 1px solid var(--trait); }
.edition-erreur { flex: 1 1 100%; color: var(--rouge); font-weight: 500; }
.edition-erreur:empty { display: none; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-danger { background: var(--rouge); }
.btn-danger:hover { background: #a51922; }
.champ { display: grid; gap: .3rem; min-width: 0; }
.champ > span { font-weight: 600; font-size: .92rem; }
.champ small, .aide, .ligne-cat small { color: var(--gris); font-size: .875rem; }
.champ input, .champ textarea, .champ select, .ligne-cat input[type=text] {
  font: inherit; width: 100%; padding: .65rem .8rem;
  border: 1.5px solid #8f8b83; border-radius: .6rem; background: var(--blanc); color: var(--noir);
}
.champ textarea { resize: vertical; line-height: 1.45; }
.champ input[type=file] { padding: .45rem; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.trois { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.coche { display: flex; align-items: center; gap: .6rem; font-weight: 500; }
.coche input { width: 1.2rem; height: 1.2rem; accent-color: var(--fuchsia); }
.champ-photo { display: grid; grid-template-columns: 7rem 1fr; gap: 1rem; align-items: center; }
.apercu-photo { width: 7rem; height: 7rem; border-radius: .8rem; overflow: hidden; background: var(--papier); }
.apercu-photo img { width: 100%; height: 100%; object-fit: cover; }
.lignes { display: grid; gap: .9rem; }
.ligne-cat { display: grid; grid-template-columns: 2.8rem 1fr auto auto auto; gap: .4rem; align-items: center; }
.ligne-cat small { grid-column: 2 / -1; }
.ligne-cat input[type=color] { width: 2.8rem; height: 2.8rem; padding: 0; border: 1.5px solid #8f8b83; border-radius: .6rem; background: none; }
.ligne-cat button { height: 2.8rem; min-width: 2.8rem; padding: 0 .7rem; border-radius: .6rem; border: 1.5px solid var(--noir); background: var(--blanc); font-weight: 600; }
.ligne-cat button:disabled { opacity: .35; cursor: default; }
@media (max-width: 34rem) {
  .deux, .trois { grid-template-columns: 1fr; }
  .ligne-cat { grid-template-columns: 2.8rem 1fr auto auto; }
  .ligne-cat [data-e="retirer-cat"] { grid-column: 2 / -1; }
}

/* ---------- Page de connexion ---------- */
.page-connexion { min-height: 100dvh; display: grid; place-items: center; background: var(--vert); padding: 1.5rem; }
.connexion { width: min(26rem, 100%); background: var(--blanc); border-radius: 1.4rem; padding: 2rem; display: grid; gap: 1.1rem; }
.connexion h1 { font-size: 2.2rem; }
.connexion .message { color: var(--rouge); font-weight: 500; }
.connexion .message:empty { display: none; }
.connexion .retour { color: var(--gris); font-size: .95rem; }
