/* ============================================================
   Axi — feuille de style
   Palette et typographies définies dans le branding validé.
   ============================================================ */

:root {
  --papier:        #F0EFE6;
  --papier-fonce:  #E4E1D2;
  --encre:         #1E1712;
  --encre-douce:   #6B5C4D;
  --noyer:         #5A3E2B;
  --noyer-fonce:   #2E1F15;
  --accent:        #D9A441;
  --alerte:        #B23B3B;
  --ligne:         #D8D3C4;

  --r:  10px;
  --r-l: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--papier);
  color: var(--encre);
  font-family: "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  /* Grain discret, pour éviter l'aplat numérique parfait */
  background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px);
  background-size: 3px 3px;
}

img, svg { max-width: 100%; display: block; }

button, input, select { font-family: inherit; font-size: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* ---------- Logotype ---------- */

.logo {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -.03em;
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
}
/* Le point du "i" devient une pastille : étiquette de prix / jeton de caisse */
.logo .dot {
  width: .42em;
  height: .42em;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  transform: translateY(-.85em);
  margin-left: 1px;
}
.logo--sur-noyer { color: var(--papier); }

/* ---------- Ossature ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  max-width: 720px;
  margin: 0 auto;
}
.topbar .retour {
  background: none; border: none; cursor: pointer;
  color: var(--encre-douce); font-size: .875rem;
  padding: 6px 2px;
}
.topbar .retour:hover { color: var(--encre); }

.vue { max-width: 560px; margin: 0 auto; padding: 0 20px 64px; }
.vue--large { max-width: 720px; }
.vue[hidden] { display: none; }

h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.65rem;
  line-height: 1.15;
  letter-spacing: -.01em;
  margin: 4px 0 6px;
}
.sous-titre {
  color: var(--encre-douce);
  font-size: .9rem;
  margin: 0 0 28px;
  line-height: 1.5;
}

.etiquette {
  font-family: "IBM Plex Mono", monospace;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--encre-douce);
}

/* ---------- Accueil : hero illustré ---------- */

.hero {
  position: relative;
  max-width: 720px;
  margin: 0 auto 28px;
  border-radius: var(--r-l);
  overflow: hidden;
  background: var(--noyer-fonce);
}
.hero svg { width: 100%; height: auto; display: block; }

.hero-texte {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 28px 24px 26px;
  background: linear-gradient(to top, rgba(46,31,21,.94) 42%, rgba(46,31,21,0));
}
.hero-texte h1 {
  color: #fff;
  font-size: clamp(1.7rem, 7vw, 2.5rem);
  line-height: 1.02;
  letter-spacing: -.025em;
  font-weight: 700;
  margin: 0;
  text-wrap: balance;
}
.hero-texte .marque {
  font-family: "Space Grotesk", sans-serif;
  color: var(--accent);
}

/* ---------- Cartes d'action ---------- */

.actions { display: grid; gap: 14px; max-width: 720px; margin: 0 auto; padding: 0 20px 56px; }

.carte-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  text-align: left;
  padding: 22px;
  border: 1px solid var(--ligne);
  border-radius: var(--r-l);
  background: #fff;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.carte-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(46,31,21,.09);
}
.carte-action h2 {
  font-family: "Fraunces", serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin: 4px 0 4px;
}
.carte-action p { margin: 0; font-size: .875rem; color: var(--encre-douce); }
.carte-action .fleche { font-size: 1.4rem; color: var(--accent); transition: transform .15s ease; }
.carte-action:hover .fleche { transform: translateX(4px); }

.carte-action--sombre {
  background: var(--noyer-fonce);
  border-color: var(--noyer-fonce);
  color: var(--papier);
}
.carte-action--sombre p { color: rgba(240,239,230,.72); }
.carte-action--sombre .etiquette { color: rgba(240,239,230,.6); }

/* ---------- Boutons ---------- */

.btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 15px 18px;
  border-radius: var(--r);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s ease, background .15s ease;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--accent  { background: var(--accent); color: var(--noyer-fonce); }
.btn--accent:hover:not(:disabled) { filter: brightness(1.06); }
.btn--sombre  { background: var(--noyer-fonce); color: var(--papier); }
.btn--sombre:hover:not(:disabled) { filter: brightness(1.35); }
.btn--clair   { background: #fff; color: var(--encre); border-color: var(--ligne); }
.btn--clair:hover:not(:disabled) { background: var(--papier-fonce); }
.btn--lien {
  width: auto; padding: 0; background: none; border: none;
  color: var(--encre-douce); text-decoration: underline;
  font-weight: 500; font-size: .85rem; cursor: pointer;
}

.pile { display: grid; gap: 12px; }

/* ---------- Blocs / formulaires ---------- */

.bloc {
  background: #fff;
  border: 1px solid var(--ligne);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 14px;
}
.bloc > .etiquette { display: block; margin-bottom: 14px; }

.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grille--3 { grid-template-columns: 1fr 1fr 1fr; }
.pleine-largeur { grid-column: 1 / -1; }

label.champ { display: block; }
label.champ > span {
  display: block;
  font-size: .72rem;
  color: var(--encre-douce);
  margin-bottom: 5px;
}
input, select {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--ligne);
  border-radius: 8px;
  background: #fff;
  color: var(--encre);
}
input[type="range"] { padding: 0; border: none; accent-color: var(--accent); }

.ligne-produit {
  border: 1px solid var(--ligne);
  border-radius: 8px;
  padding: 13px;
  margin-bottom: 12px;
}
.ligne-produit-tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.ligne-produit-tete .detecte {
  font-family: "IBM Plex Mono", monospace;
  font-size: .7rem;
  color: var(--encre-douce);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.retirer {
  background: none; border: none; cursor: pointer;
  color: var(--alerte); font-size: .75rem; white-space: nowrap;
}
.retirer:hover { text-decoration: underline; }

/* ---------- Recherche & filtres ---------- */

.champ-recherche { position: relative; margin-bottom: 14px; }
.champ-recherche input { padding: 14px; }

.suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--ligne);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(46,31,21,.1);
  max-height: 190px;
  overflow-y: auto;
  list-style: none;
  margin: 0; padding: 0;
}
.suggestions li button {
  width: 100%; text-align: left;
  padding: 10px 12px; border: none; background: none;
  cursor: pointer; font-size: .875rem;
}
.suggestions li button:hover { background: var(--papier); }

.bascule { display: flex; gap: 8px; margin-bottom: 12px; }
.bascule button {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--ligne);
  background: #fff;
  color: var(--encre-douce);
  border-radius: 8px;
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
}
.bascule button[aria-pressed="true"] {
  background: var(--noyer-fonce);
  border-color: var(--noyer-fonce);
  color: var(--papier);
}

.rayon-ligne { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.rayon-valeur {
  font-family: "IBM Plex Mono", monospace;
  font-size: .85rem;
  width: 62px;
  text-align: right;
}

/* ---------- Résultats de comparaison : carte « ticket » ---------- */

.ticket {
  background: #fff;
  border: 1px solid var(--ligne);
  border-bottom: none;
  border-radius: var(--r) var(--r) 0 0;
  padding: 20px 20px 22px;
}
/* Bord inférieur en dents de scie, façon ticket déchiré */
.ticket-dents {
  height: 12px;
  background: #fff;
  border-left: 1px solid var(--ligne);
  border-right: 1px solid var(--ligne);
  -webkit-mask-image: linear-gradient(-45deg, transparent 0 33%, #000 33% 100%),
                      linear-gradient( 45deg, transparent 0 33%, #000 33% 100%);
  mask-image: linear-gradient(-45deg, transparent 0 33%, #000 33% 100%),
              linear-gradient( 45deg, transparent 0 33%, #000 33% 100%);
  -webkit-mask-size: 14px 12px;
  mask-size: 14px 12px;
  -webkit-mask-repeat: repeat-x;
  mask-repeat: repeat-x;
  -webkit-mask-position: bottom;
  mask-position: bottom;
  margin-bottom: 24px;
}

.resultats { list-style: none; margin: 16px 0 0; padding: 0; }
.resultats li {
  display: flex;
  align-items: baseline;
  gap: 0;
  padding: 9px 0;
}
.resultat-nom { min-width: 0; }
.resultat-nom .magasin {
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.resultat-nom .lieu { font-size: .75rem; color: var(--encre-douce); }
.resultat-nom .fanion {
  font-family: "IBM Plex Mono", monospace;
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  margin-left: 7px;
}
/* Ligne à pointillés entre le libellé et le prix, comme sur un ticket */
.pointilles {
  flex: 1;
  border-bottom: 1px dotted #B9B3A0;
  margin: 0 9px;
  transform: translateY(-4px);
  min-width: 14px;
}
.resultat-prix {
  font-family: "IBM Plex Mono", monospace;
  font-size: .88rem;
  white-space: nowrap;
}
.resultats li.meilleur .magasin,
.resultats li.meilleur .resultat-prix { color: #8A6410; }
.resultats li.meilleur .resultat-prix { font-weight: 600; }

/* ---------- États ---------- */

.chargement {
  background: #fff;
  border: 1px solid var(--ligne);
  border-radius: var(--r);
  padding: 34px 22px;
  text-align: center;
}
.rouet {
  width: 30px; height: 30px;
  margin: 0 auto 16px;
  border: 3px solid var(--ligne);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tourne .8s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }

.progression {
  height: 5px;
  background: var(--papier-fonce);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 16px;
}
.progression span {
  display: block; height: 100%; width: 0;
  background: var(--accent);
  transition: width .3s ease;
}

.message {
  padding: 11px 13px;
  border-radius: 8px;
  font-size: .85rem;
  margin-bottom: 14px;
}
.message--erreur {
  background: rgba(178,59,59,.08);
  border: 1px solid rgba(178,59,59,.3);
  color: var(--alerte);
}
.message--info {
  background: rgba(217,164,65,.12);
  border: 1px solid rgba(217,164,65,.4);
  color: #7A5A12;
}
.message--alerte {
  background: rgba(217,164,65,.16);
  border: 1px solid rgba(217,164,65,.55);
  color: #6E4F0C;
}
.message--succes {
  background: rgba(63,122,86,.1);
  border: 1px solid rgba(63,122,86,.35);
  color: #2F6F4F;
}
.message ul { margin: 8px 0 0; padding-left: 18px; }
.message li { margin-bottom: 5px; line-height: 1.45; }
.message li:last-child { margin-bottom: 0; }
.message strong { display: block; margin-bottom: 2px; }

/* Ligne dont les chiffres ne se recoupent pas */
.ligne-produit.signalee {
  border-color: rgba(217,164,65,.75);
  background: rgba(217,164,65,.06);
}
.ligne-anomalie {
  font-size: .75rem;
  color: #6E4F0C;
  margin: 8px 0 0;
  line-height: 1.4;
}

/* Boîte de confirmation (doublon détecté) */
.dialogue {
  position: fixed;
  inset: 0;
  background: rgba(30,23,18,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  z-index: 60;
}
.dialogue[hidden] { display: none; }
.dialogue-boite {
  background: var(--papier);
  border-radius: var(--r-l);
  padding: 24px;
  max-width: 380px;
  width: 100%;
}
.dialogue-boite h2 {
  font-family: "Fraunces", serif;
  font-size: 1.15rem;
  margin: 0 0 8px;
}
.dialogue-boite p { font-size: .875rem; color: var(--encre-douce); line-height: 1.5; margin: 0 0 18px; }
.dialogue-actions { display: grid; gap: 9px; }

.vide {
  text-align: center;
  color: var(--encre-douce);
  font-size: .875rem;
  padding: 34px 10px;
}

.apercu-scan {
  border-radius: 8px;
  border: 1px solid var(--ligne);
  margin-bottom: 14px;
  max-height: 210px;
  object-fit: cover;
  width: 100%;
}

@media (max-width: 420px) {
  .grille--3 { grid-template-columns: 1fr 1fr; }
  .grille--3 > :last-child { grid-column: 1 / -1; }
}
