/* ============================================================================
   LA PAGE QUE VOIT LE CLIENT DE L'ARTISAN
   ============================================================================
   Monde visuel du produit (DESIGN.md) : papier chaud jamais blanc pur, cartes à
   bord franc de 2 px, ombres EN APLAT sans flou, boutons en pilule, orange
   chantier pour ce qui engage.

   ⚠️ AUCUNE POLICE EXTERNE, et c'est une contrainte produit : cette page
   s'ouvre sur un téléphone en 4G moyenne, souvent dehors, en plein soleil
   calédonien. Fond clair, contraste maximal, aucune requête à un tiers.

   ⚠️ AUCUNE RESSOURCE EXTERNE TOUT COURT. Une page qui porte le nom et
   l'adresse du client d'un artisan ne va rien chercher chez personne : pas de
   police, pas d'icône, pas de mesure d'audience.
   ========================================================================== */

:root {
  --papier: #FFF8EC;
  --encre: #18120D;
  --encre2: #4A423B;
  --filet: #E7DCC9;
  --orange: #CC3808;
  --orange-pale: #FFE4D1;
  --vert: #16A34A;
  --rouge: #D64545;
  --pile: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* ⚠️ SANS CETTE LIGNE, « hidden » NE CACHE RIEN — défaut vu à l'écran le
   2026-09-01, sur la toute première page servie en production.
   Le navigateur cache un élément `hidden` par une règle de SA feuille de style
   (`display: none`). Dès qu'une règle À NOUS pose un `display` sur ce même
   élément — `.ligneTotal { display: flex }`, `.filigrane { display: flex }` —
   la nôtre gagne, et l'élément reste affiché alors que tout le code le croit
   caché. Résultat vu : les lignes « Remise », « TGC » et « Acompte » écrites
   sans montant sur un devis qui n'en a pas, et le filigrane « Signez ici »
   posé par-dessus la signature du client.
   `styles.css` (l'application) porte la même ligne depuis longtemps — c'est en
   la cherchant qu'on a compris pourquoi elle existait.
   ⚠️ Le corpus vérifie désormais le `display` CALCULÉ, jamais l'attribut :
   l'attribut était `true` dans les deux cas, il ne prouvait rien. */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 20px 16px 64px;
  background: var(--papier);
  color: var(--encre);
  font: 500 17px/1.5 var(--pile);
  -webkit-text-size-adjust: 100%;
}

main { max-width: 720px; margin: 0 auto; }

/* ── L'attente et le refus ──────────────────────────────────────────────── */
.etat { max-width: 520px; margin: 18vh auto; text-align: center; }
.etat h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 10px; }
.rond {
  width: 34px; height: 34px; margin: 0 auto 16px;
  border: 3px solid var(--filet); border-top-color: var(--orange);
  border-radius: 50%; animation: tourne 900ms linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }
/* WCAG : le mouvement disparaît, l'information reste. */
@media (prefers-reduced-motion: reduce) {
  .rond { animation: none; border-top-color: var(--filet); }
  * { transition: none !important; }
}

/* ── L'en-tête ─────────────────────────────────────────────────────────── */
.entete { text-align: center; margin: 4px 0 22px; }
.pastille {
  display: inline-block; margin: 0 0 10px; padding: 5px 14px;
  background: var(--orange-pale); color: var(--orange);
  border-radius: 999px; font-size: 12px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.entete h1 {
  margin: 0; font-size: clamp(28px, 7vw, 40px); font-weight: 900;
  letter-spacing: -0.03em; line-height: 1.05;
}
.entreprise { margin: 8px 0 2px; font-weight: 700; font-size: 18px; }

/* ── Les cartes ────────────────────────────────────────────────────────── */
.carte {
  background: #fff; border: 2px solid var(--encre); border-radius: 18px;
  padding: 18px 18px 20px; margin: 0 0 16px;
  box-shadow: 0 4px 0 var(--encre);   /* en aplat, jamais de flou : c'est le tampon */
}
.carte h2 {
  margin: 0 0 12px; font-size: 13px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--encre2);
}
.fort { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.discret { color: var(--encre2); margin: 4px 0 0; }
.petit { font-size: 14px; }

/* ── Le détail, en blocs plutôt qu'en tableau ──────────────────────────────
   Un tableau à quatre colonnes sur un écran de 360 px oblige à faire glisser
   horizontalement, ou à écrire en 11 px. Ni l'un ni l'autre ne se lit en plein
   soleil sur un chantier. Chaque poste devient donc un bloc : sa désignation
   en grand, son calcul en petit dessous, son montant à droite. */
.lignes { margin: 0; }
.poste {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 12px 0; border-top: 1px solid var(--filet);
}
.poste:first-child { border-top: 0; padding-top: 0; }
.poste .quoi { flex: 1 1 auto; min-width: 0; }
.poste .designation { font-weight: 700; }
.poste .calcul { color: var(--encre2); font-size: 14px; margin-top: 2px; }
.poste .montant { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.piece {
  margin: 16px 0 6px; font-size: 12px; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--orange);
}

/* ── Les totaux ────────────────────────────────────────────────────────── */
.totaux { padding-top: 14px; }
.ligneTotal {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; padding: 7px 0;
}
.ligneTotal b { font-variant-numeric: tabular-nums; font-weight: 800; }
.ligneTotal.grand {
  border-top: 2px solid var(--encre); margin-top: 8px; padding-top: 14px;
}
.ligneTotal.grand span { font-size: 17px; font-weight: 700; }
/* Le prix est la pièce maîtresse : jamais partagée avec un titre. */
.ligneTotal.grand b { font-size: clamp(28px, 8vw, 40px); letter-spacing: -0.03em; }
.ligneTotal.accent { color: var(--orange); font-weight: 700; }

.mentions { margin-top: 10px; color: var(--encre2); font-size: 14px; }
.mentions p { margin: 6px 0; }

/* ── La signature ──────────────────────────────────────────────────────── */
.signature { border-color: var(--orange); box-shadow: 0 4px 0 var(--orange); }
.champ { display: block; margin: 14px 0 12px; }
.champ span {
  display: block; font-size: 13px; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--encre2); margin-bottom: 6px;
}
.champ input {
  width: 100%; padding: 13px 14px; font: 600 18px var(--pile); color: var(--encre);
  background: var(--papier); border: 2px solid var(--encre); border-radius: 12px;
}
.champ input:focus { outline: 3px solid var(--orange); outline-offset: 1px; }

.cadre { position: relative; }
#canvasSign {
  display: block; width: 100%; height: 190px; touch-action: none;
  background: #fff; border: 2px dashed var(--encre); border-radius: 12px;
}
.filigrane {
  position: absolute; inset: 0; margin: 0; display: flex;
  align-items: center; justify-content: center;
  color: #C9BCA6; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; pointer-events: none;
}

.actions { display: flex; gap: 10px; margin-top: 14px; }
.actions.colonne { flex-direction: column; }
button, .principal {
  font: 800 17px var(--pile); border-radius: 999px; padding: 15px 22px;
  border: 2px solid var(--encre); cursor: pointer; text-align: center;
  text-decoration: none; display: block;
  transition: transform 150ms, box-shadow 150ms;
}
.principal {
  flex: 1 1 auto; background: var(--orange); color: #fff;
  box-shadow: 0 4px 0 var(--encre);
}
.fantome { background: transparent; color: var(--encre); box-shadow: 0 4px 0 var(--filet); }
.principal:hover, .fantome:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--encre); }
.principal:active, .fantome:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--encre); }
button:disabled { opacity: 0.5; cursor: default; transform: none; }

.erreur {
  margin: 12px 0 0; padding: 11px 14px; border-radius: 12px;
  background: #FDECEC; border: 2px solid var(--rouge); color: #7A1F1F; font-weight: 600;
}

/* ── Le devis signé ────────────────────────────────────────────────────── */
.signee { border-color: var(--vert); box-shadow: 0 4px 0 var(--vert); text-align: center; }
.signee .coche {
  margin: 0 auto 8px; width: 46px; height: 46px; line-height: 44px;
  border-radius: 50%; background: var(--vert); color: #fff; font-size: 26px; font-weight: 800;
}
.signee h2 { color: var(--vert); font-size: 22px; text-transform: none; letter-spacing: -0.01em; }

.pied { margin-top: 26px; text-align: center; color: var(--encre2); font-size: 13px; }

/* ── L'impression, qui EST le « télécharger en PDF » ───────────────────────
   Décidé en conception : pas de visualiseur PDF embarqué, pas de PDF stocké —
   le navigateur sait déjà faire une belle page. Ce qui ne s'imprime pas : le
   cadre de signature (on n'imprime pas un formulaire) et les boutons. */
@media print {
  body { padding: 0; background: #fff; }
  .carte { box-shadow: none; border-width: 1px; page-break-inside: avoid; }
  .signature, .actions, .pied .petit { display: none; }
  .signee { border-color: #333; box-shadow: none; }
}
