/* Layout : catalogue de manufacture — liste de fiches compactes, une fiche détaillée par article (#id), bouton volant en bas à droite */
:root {
  --sol:      #E3E7D8;
  --fiche:    #FBFBF5;
  --encre:    #1D2318;
  --loden:    #4A5A3B;
  --gris:     #69735E;
  --trait:    #C6CCB6;
  --blaze:    #E2560A;
  --blaze-f:  #FCE3D3;
  --exemple:  #E9ECDF;
  --hachure:  #D5DAC6;
  --sur-loden:#FFFFFF;

  --f-titre:  "Ultra", "Rockwell Extra Bold", Georgia, serif;
  --f-texte:  "Libre Caslon Text", Georgia, "Times New Roman", serif;
  --f-ref:    "Courier Prime", "Courier New", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sol: #131911; --fiche: #1D2519; --encre: #E6EADB; --loden: #9FB384; --gris: #9AA48D;
    --trait: #36412E; --blaze: #FF7A2E; --blaze-f: #3A2416; --exemple: #252E20; --hachure: #2A3324;
    --sur-loden: #131911; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --sol: #131911; --fiche: #1D2519; --encre: #E6EADB; --loden: #9FB384; --gris: #9AA48D;
  --trait: #36412E; --blaze: #FF7A2E; --blaze-f: #3A2416; --exemple: #252E20; --hachure: #2A3324;
  --sur-loden: #131911; color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  background: var(--sol);
  color: var(--encre);
  font-family: var(--f-texte);
  font-size: 17px;
  line-height: 1.5;
}

.cadre {
  max-width: 600px;
  margin: 0 auto;
  padding-block: max(20px, env(safe-area-inset-top, 0px)) 120px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

a { color: inherit; }

/* ---------- En-tête ---------- */
.entete { display: grid; gap: 10px; margin-bottom: 26px; }
.entete__sur {
  margin: 0;
  font-family: var(--f-ref); font-weight: 700; font-size: 12.5px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--loden);
  display: flex; flex-wrap: wrap; gap: 4px 10px;
}
.entete__sur span + span::before { content: "·"; margin-right: 10px; color: var(--blaze); }
.entete h1 {
  margin: 0; font-family: var(--f-titre); font-weight: 400;
  font-size: clamp(36px, 11vw, 56px); line-height: 0.98; text-wrap: balance;
}
.entete h1 em { font-style: normal; color: var(--blaze); }
.entete__chapo { margin: 4px 0 0; max-width: 34em; }
.mode-emploi { font-size: 15px; color: var(--gris); margin: 0; max-width: 34em; }

/* ---------- Éléments communs ---------- */
.ref { font-family: var(--f-ref); font-size: 12.5px; color: var(--gris); }
.ref b { color: var(--loden); }

.photo {
  aspect-ratio: 3 / 2;
  width: 100%;
  max-width: 100%;
  border: 2px solid var(--encre);
  background: repeating-linear-gradient(135deg, var(--hachure) 0 8px, var(--fiche) 8px 16px);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo__vide {
  font-family: var(--f-ref); font-size: 12px; color: var(--gris);
  background: var(--fiche); padding: 3px 8px; text-align: center;
}

.montant {
  font-family: var(--f-titre); color: var(--blaze);
  font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1;
}

.btn {
  appearance: none; border: 2px solid var(--encre); background: var(--blaze); color: #fff;
  font-family: var(--f-ref); font-weight: 700; font-size: 16px; letter-spacing: 0.04em;
  text-transform: uppercase; min-height: 52px; padding: 12px 16px; width: 100%;
  cursor: pointer; text-align: center; text-decoration: none; display: block;
}
.btn:active { transform: translateY(1px); }
.btn--neutre {
  background: transparent; color: var(--gris); border-color: transparent;
  text-transform: none; letter-spacing: 0; font-weight: 400; min-height: 44px;
}

.dons { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.dons__titre {
  font-family: var(--f-ref); font-weight: 700; font-size: 12.5px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--loden); margin: 4px 0 0;
}
.don {
  background: var(--blaze-f); padding: 9px 12px; border-left: 3px solid var(--blaze);
  min-width: 0; overflow-wrap: anywhere;
}
.don--exemple { background: var(--exemple); border-left-color: var(--gris); }
.don__qui { font-family: var(--f-ref); font-weight: 700; font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; }
.don__badge { font-weight: 400; color: var(--gris); }
.don__mot { margin: 2px 0 0; font-size: 16px; font-style: italic; }

/* ---------- Liste ---------- */
.liste { list-style: none; margin: 0; padding: 0; display: grid; }

.carte {
  background: var(--fiche); border: 2px solid var(--encre);
  padding: 12px; display: grid; gap: 12px;
}
.carte__lien { display: grid; gap: 10px; text-decoration: none; }
.carte__visuel { position: relative; }
.carte__visuel .photo { border-width: 1px; }
.etiquette {
  position: absolute; left: 10px; bottom: 10px;
  background: var(--blaze); color: #fff; border: 2px solid var(--encre);
  font-family: var(--f-titre); font-size: clamp(22px, 7vw, 30px); line-height: 1;
  padding: 6px 10px 5px; transform: rotate(-2deg);
  font-variant-numeric: tabular-nums; white-space: nowrap;
  box-shadow: 2px 2px 0 var(--encre);
}
.carte__texte { display: grid; gap: 4px; min-width: 0; }
.carte__nom { margin: 0; font-weight: 700; font-size: 20px; line-height: 1.2; text-wrap: balance; }
.carte__lien:hover .carte__nom { text-decoration: underline; text-underline-offset: 3px; }
.carte__etat { font-family: var(--f-ref); font-size: 12.5px; color: var(--loden); }
.carte__actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.carte__actions .btn { min-height: 48px; font-size: 15px; }
.carte__voir {
  font-family: var(--f-ref); font-size: 14px; font-weight: 700; color: var(--loden);
  text-decoration: underline; text-underline-offset: 3px; padding: 12px 4px; white-space: nowrap;
}

.chute {
  list-style: none; display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; font-family: var(--f-ref); font-size: 13px; color: var(--loden);
}
.chute::before {
  content: ""; width: 0; height: 0; flex: none;
  border-left: 7px solid transparent; border-right: 7px solid transparent;
  border-top: 10px solid var(--blaze);
}

/* ---------- Fiche détaillée ---------- */
.retour {
  appearance: none; background: none; border: 0; padding: 10px 0; margin-bottom: 10px;
  font-family: var(--f-ref); font-weight: 700; font-size: 14px; color: var(--loden);
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.detail { background: var(--fiche); border: 2px solid var(--encre); padding: 16px; display: grid; gap: 14px; }
.detail__tete {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  border-bottom: 1px solid var(--trait); padding-bottom: 8px;
}
.detail h2 { margin: 0; font-weight: 700; font-size: 26px; line-height: 1.15; text-wrap: balance; }
.detail .montant { font-size: clamp(36px, 11vw, 52px); }
.detail__mention { font-family: var(--f-ref); font-size: 12px; color: var(--gris); margin-top: 4px; }
.detail__desc { margin: 0; font-size: 17px; }

.jauge { display: grid; gap: 4px; }
.jauge__barre { height: 12px; background: var(--sol); border: 1px solid var(--trait); overflow: hidden; }
.jauge__rempli { height: 100%; background: var(--loden); min-width: 2px; }
.jauge__texte {
  font-family: var(--f-ref); font-size: 13px; display: flex;
  justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.jauge__texte b { color: var(--loden); }

.form { display: grid; gap: 8px; border-top: 1px dashed var(--trait); padding-top: 12px; }
.form label { font-family: var(--f-ref); font-size: 13px; color: var(--gris); }
.form input, .form textarea {
  width: 100%; font-family: var(--f-texte); font-size: 17px; color: var(--encre);
  background: var(--fiche); border: 1px solid var(--gris); padding: 11px 12px;
}
.form textarea { min-height: 92px; resize: vertical; }
.form__erreur { margin: 0; font-size: 14.5px; color: var(--blaze); }

.voisins { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.voisin {
  border: 1px solid var(--trait); background: var(--fiche); padding: 10px 12px;
  text-decoration: none; display: grid; gap: 2px; min-width: 0;
}
.voisin--suiv { text-align: right; grid-column: 2; }
.voisin__sens { font-family: var(--f-ref); font-size: 12px; color: var(--loden); font-weight: 700; }
.voisin__nom { font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }

/* ---------- Compteur ---------- */
.compteur {
  margin-top: 36px; border: 2px solid var(--encre); background: var(--fiche);
  padding: 16px; display: grid; gap: 4px;
}
.compteur__titre {
  margin: 0; font-family: var(--f-ref); font-weight: 700; font-size: 12.5px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--loden);
}
.compteur__n {
  font-family: var(--f-titre); font-size: clamp(40px, 13vw, 60px); line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.compteur__verdict { margin: 0; font-style: italic; }

.pied { margin-top: 24px; font-family: var(--f-ref); font-size: 12.5px; color: var(--gris); display: grid; gap: 6px; }
.pied p { margin: 0; }

/* ---------- Bouton volant ---------- */
.pouet {
  position: fixed; z-index: 20;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  appearance: none; border: 2px solid var(--encre);
  background: var(--loden); color: var(--sur-loden);
  font-family: var(--f-ref); font-weight: 700; font-size: 15px;
  min-height: 56px; padding: 10px 18px 10px 14px; border-radius: 999px;
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  box-shadow: 3px 3px 0 var(--encre);
  max-width: calc(100vw - 32px);
}
.pouet svg { flex: none; }
.pouet:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--encre); }
.pouet.secoue { animation: secoue 0.5s ease-in-out; }
@keyframes secoue {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-6deg); } 40% { transform: rotate(5deg); }
  60% { transform: rotate(-3deg); } 80% { transform: rotate(2deg); }
}

.bulle {
  position: fixed; z-index: 19; pointer-events: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--loden); opacity: 0.55;
  animation: monte 1.1s ease-out forwards;
}
@keyframes monte {
  from { transform: translate(0, 0) scale(0.4); opacity: 0.6; }
  to   { transform: translate(var(--dx), -90px) scale(2.2); opacity: 0; }
}

.toast {
  position: fixed; z-index: 21;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  background: var(--encre); color: var(--fiche);
  font-family: var(--f-ref); font-size: 14px; padding: 8px 12px;
  max-width: calc(100vw - 32px);
}

button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid var(--blaze); outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .pouet.secoue { animation: none; }
  .bulle { display: none; }
}

/* Base (hors démo) */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.form__envoi[disabled] { opacity: 0.6; cursor: wait; }
