/* ═══════════════════════════════════════════════════════════════════
   CRAFTLAB — feuille de style unique

   Organisation (garder cet ordre, tout tient dans ce fichier
   tant que le site reste petit) :

     1. Tokens
     2. Reset
     3. Primitives (layout, typographie de base)
     4. Composants
     5. Utilitaires
     6. Responsive

   Charte CRAFTLAB (logo) : sarcelle #559489, noir, blanc.
   La direction reste atelier + bureau d'études, mais l'accent
   n'est plus le bleu cordeau : c'est la sarcelle de la marque,
   posée sur du blanc. La sarcelle pure ne passe AA que sur de
   grands aplats ; pour le petit texte on utilise --trace-deep,
   une sarcelle assombrie. Le jaune atelier reste un signal hors
   charte : il ne sert QUE pour le focus clavier.
   ═══════════════════════════════════════════════════════════════════ */


/* ── 0. Police ──────────────────────────────────────────────────────
   Archivo, servie en local (pas de CDN : l'audience est à Madagascar).
   Les .ttf d'origine pèsent ~120 Ko pièce : on ne sert que des WOFF2
   sous-ensemblés au latin (~17 Ko pièce), regénérés depuis fonts/*.ttf.

   Seules les 2 graisses réellement utilisées sont chargées :
     600 → .cta, .card__more et les numéros de la frise « Méthode »
     700 → h1/h2/h3 et .pay__head
   Aucun italique n'est utilisé : ne pas charger les fichiers Italic.
   Le corps de texte reste sur la pile système (--font-body) : c'est ce qui
   permet de tenir le budget de 150 Ko.

   font-display: swap → le texte s'affiche immédiatement dans la pile
   système puis bascule sur Archivo. Pas de texte invisible sur lien lent. */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}


/* ── 1. Tokens ──────────────────────────────────────────────────── */

:root {
  /* Couleur — charte : sarcelle, noir, blanc */
  --ink:        #000000;   /* noir de marque — texte, wordmark, fonds sombres */
  --ink-soft:   #4d5b57;   /* texte secondaire — graphite tiré vers la sarcelle */
  --panel:      #f4f6f5;   /* blanc cassé — fond de page   #f4f6f5       */
  --panel-pure: #ffffff;   /* blanc pur — surfaces surélevées (cartes) */
  --steel:      #bcc9c4;   /* filets, bordures, séparateurs       */
  --trace:      #559489;   /* sarcelle CRAFTLAB — accent graphique, grands aplats */
  --trace-deep: #34675c;   /* sarcelle assombrie — texte accent (liens, AA sur blanc) */
  --signal:     #f2b705;   /* jaune atelier — focus clavier seul (hors charte) */

  /* Typographie */
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body:    system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --step--1: clamp(0.83rem, 0.79rem + 0.2vw, 0.94rem);
  --step-0:  clamp(1rem,    0.95rem + 0.25vw, 1.13rem);
  --step-1:  clamp(1.25rem, 1.15rem + 0.5vw,  1.5rem);
  --step-2:  clamp(1.56rem, 1.4rem + 0.8vw,   2rem);
  --step-3:  clamp(1.95rem, 1.7rem + 1.3vw,   2.66rem);
  --step-4:  clamp(2.44rem, 2rem + 2.2vw,     3.55rem);

  /* Espacement — échelle unique, pas d'exception */
  --space-2xs: 0.25rem;
  --space-xs:  0.5rem;
  --space-s:   1rem;
  --space-m:   1.5rem;
  --space-l:   2.5rem;
  --space-xl:  4rem;
  --space-2xl: 6rem;

  /* Layout */
  --measure: 62ch;      /* longueur de ligne max en lecture */
  --gutter:  var(--space-m);
  --wrapper: 68rem;
  --header-h: 3rem;     /* décalage des ancres : cale le séparateur juste sous
                           l'en-tête (~81px) sans laisser voir la section du dessus */

  /* Divers */
  --radius: 2px;        /* quasi nul : on fabrique des angles droits */
  --border: 1px solid var(--steel);
}


/* ── 2. Reset ───────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html { -webkit-text-size-adjust: 100%; }

html:focus-within { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink);
  background: var(--panel);
  -webkit-font-smoothing: antialiased;
}

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

input, button, textarea, select { font: inherit; color: inherit; }

ul[class], ol[class] { list-style: none; padding: 0; }

@media (prefers-reduced-motion: reduce) {
  html:focus-within { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* ── 3. Primitives ──────────────────────────────────────────────── */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }

p { max-width: var(--measure); text-wrap: pretty; }

a { color: var(--trace-deep); }

/* Focus visible partout — le seul usage du jaune atelier */
:focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  left: var(--space-s);
  top: -100%;
  z-index: 30;   /* au-dessus de l'en-tête sticky (z-index 20) */
  padding: var(--space-xs) var(--space-s);
  background: var(--ink);
  color: var(--panel);
  text-decoration: none;
}
.skip-link:focus { top: var(--space-s); }

/* Cible du lien d'évitement : ne pas la coller sous l'en-tête sticky */
#contenu { scroll-margin-top: var(--header-h); }


/* ── 4. Composants ──────────────────────────────────────────────── */

/* En-tête — figé en haut, fond translucide « verre » (flou d'arrière-plan).
   Repli opaque d'abord pour les navigateurs sans color-mix/backdrop-filter. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m);
  padding: var(--space-s) var(--gutter);
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 75%, transparent);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  backdrop-filter: blur(10px) saturate(1.4);
  border-bottom: var(--border);
}

.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.logo img {
  height: 3rem;   /* ~48px ; largeur dérivée via l'attribut width/height */
  width: auto;
}

/* Bouton hamburger — masqué en desktop, affiché sous 40rem. Trois barres
   qui se muent en croix à l'ouverture (transitions coupées si
   prefers-reduced-motion, via la règle globale). */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  background: none;
  border: 1px solid var(--steel);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
}

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block;
  width: 1.25rem;
  height: 2px;
  background: currentColor;
}

.nav-toggle__bars { position: relative; }

.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  transition: transform 0.2s ease;
}
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after  { top: 6px; }

.site-header.is-open .nav-toggle__bars { background: transparent; }
.site-header.is-open .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.site-header.is-open .nav-toggle__bars::after  { transform: translateY(-6px) rotate(-45deg); }

.nav ul {
  display: flex;
  gap: var(--space-m);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav a {
  color: var(--ink-soft);
  font-size: var(--step--1);
  text-decoration: none;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav a:hover { color: var(--ink); }

/* Hero — texte à gauche, visuel à droite dès 56rem ; empilé en dessous.
   Le <h1> reste l'élément dominant : le visuel l'accompagne, il ne le
   remplace pas (pas de photo pleine largeur avec voile sombre). */
.hero {
  max-width: var(--wrapper);
  margin-inline: auto;
  padding: var(--space-2xl) var(--gutter);
}

.hero__lede {
  margin-top: var(--space-m);
  font-size: var(--step-1);
  color: var(--ink-soft);
}

.hero .cta { margin-top: var(--space-l); }

.hero__visual { margin-top: var(--space-xl); }

.hero__visual img {
  width: 100%;
  height: auto;            /* neutralise l'attribut height="500" du HTML,
                              sinon il l'emporte et aspect-ratio est ignoré */
  max-width: 22rem;        /* empilé : le visuel ne doit pas écraser le texte */
  margin-inline: auto;
  aspect-ratio: 4 / 5;     /* ratio figé = zéro décalage de mise en page */
  object-fit: cover;       /* une future photo remplira le cadre sans déformer */
  background: var(--panel-pure);
  border: var(--border);
  border-radius: var(--radius);
}

@media (min-width: 56rem) {
  .hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;   /* le texte garde la main */
    gap: var(--space-2xl);
    align-items: center;
  }
  .hero__visual { margin-top: 0; }
  .hero__visual img { max-width: none; }
}

/* Sections — une seule règle de rythme vertical, pas de surcharge
   par section (c'est là que les specificity wars commencent) */
.section {
  max-width: var(--wrapper);
  margin-inline: auto;
  padding: var(--space-xl) var(--gutter);
  scroll-margin-top: var(--header-h);   /* ne pas passer sous l'en-tête sticky */
  border-top: var(--border);
}

.eyebrow {
  margin-bottom: var(--space-xs);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--trace-deep);
}

/* Paragraphe d'intro qui suit directement le titre de section (Financement,
   Contact) : le reset colle le texte au titre, on rétablit un peu d'air. */
.section h2 + p { margin-top: var(--space-m); }

/* Grille de cartes */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-m);
  margin-top: var(--space-l);
}

.card {
  display: flex;
  flex-direction: column;
  padding: var(--space-m);
  background: var(--panel-pure);
  border: var(--border);
  border-radius: var(--radius);
}

.card h3 { margin-bottom: var(--space-xs); line-height: 1.5; }
.card p  {
  color: var(--ink-soft);
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;   /* césure FR (lang="fr") : évite les rivières en justifié */
  margin-bottom: var(--space-m);   /* écart minimum garanti avant le bouton :
                                      la marge auto du bouton absorbe le reste,
                                      donc les boutons restent alignés en bas */
}

/* Bouton « En savoir plus » — noir, texte blanc. Poussé en bas de carte
   (margin-top:auto) pour aligner les boutons entre cartes de hauteurs
   égales. Ouvre le modal « bientôt disponible ». */
.card__more {
  align-self: start;
  margin-top: var(--space-m);
  margin-top: auto;
  padding: var(--space-2xs) var(--space-s);
  background: var(--ink);
  color: var(--panel-pure);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.card__more:hover {
  background: var(--trace-deep);
  border-color: var(--trace-deep);
}

/* Appareils avec survol (souris) : le bouton reste caché jusqu'au survol
   de la carte ou au focus clavier. En tactile (hover:none), il est
   toujours visible — sinon il serait inatteignable. */
@media (hover: hover) and (pointer: fine) {
  .card__more {
    opacity: 0;
    transform: translateY(4px);
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
  }
  .card:hover .card__more,
  .card:focus-within .card__more {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
}

/* Étapes numérotées */
.steps {
  counter-reset: step;
  display: grid;
  gap: var(--space-m);
  margin-top: var(--space-l);
  padding: 0;
  list-style: none;
}

.steps > li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 3rem 1fr;
  column-gap: var(--space-s);
  row-gap: var(--space-2xs);
  padding-block: var(--space-s);
  border-top: 1px solid var(--steel);
}

/* Le ::before occupe la colonne 1 (row 1) ; titre et texte doivent
   rester dans la colonne 2, sinon le <p> retombe sous le numéro. */
.steps > li > * { grid-column: 2; }

.steps > li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;   /* aligné sur une graisse déjà chargée : évite de
                         tirer un 3e fichier Archivo pour 4 nombres */
  font-variant-numeric: tabular-nums;
  color: var(--trace);   /* grand texte : la sarcelle vive passe AA (3:1) */
}

/* Facilité de paiement — frise chronologique
   Verticale sur mobile, horizontale dès la tablette. Marqueurs carrés
   (esprit plan/atelier, angles droits). Le trait sarcelle se dessine
   au défilement quand JS ajoute .pay__timeline--animated puis
   .is-visible ; sinon il est plein d'emblée (voir js/main.js). */
.pay { margin-top: var(--space-l); }

.pay__timeline {
  position: relative;
  display: grid;
  gap: var(--space-l);
  margin: var(--space-xl) 0 0;
  padding: 0;
  list-style: none;
}

/* Rail (gris) + trait de progression (sarcelle), verticaux par défaut */
.pay__timeline::before,
.pay__timeline::after {
  content: "";
  position: absolute;
  left: calc(0.45rem - 1px);
  top: 0;
  width: 2px;
}
.pay__timeline::before { bottom: 0; background: var(--steel); }
.pay__timeline::after  { height: 100%; background: var(--trace); }

.pay__timeline--animated::after { height: 0; transition: height 1.1s ease; }
.pay__timeline--animated.is-visible::after { height: 100%; }

.pay__step {
  position: relative;
  padding-left: calc(0.9rem + var(--space-m));
}

.pay__step::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.2rem;
  width: 0.9rem;
  height: 0.9rem;
  background: var(--panel);
  border: 2px solid var(--trace);
  border-radius: var(--radius);
}

.pay__when {
  display: block;
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--trace-deep);
}
.pay__head {
  display: block;
  margin-top: var(--space-2xs);
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.pay__head sup { font-size: 0.5em; }
.pay__note {
  display: block;
  margin-top: var(--space-xs);
  color: var(--ink-soft);
}

.pay__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-m);
  margin-top: var(--space-xl);
}
.pay__fine {
  margin: 0;
  max-width: var(--measure);
  font-size: var(--step--1);
  color: var(--ink-soft);
}

/* Frise horizontale dès la tablette : marqueurs centrés sur chaque
   colonne, trait courant du 1er au dernier marqueur (1/6 → 5/6). */
@media (min-width: 48rem) {
  .pay__timeline { grid-template-columns: repeat(3, 1fr); }

  .pay__timeline::before {
    left: calc(100% / 6);
    right: calc(100% / 6);
    top: calc(0.45rem - 1px);
    bottom: auto;
    width: auto;
    height: 2px;
  }
  .pay__timeline::after {
    left: calc(100% / 6);
    top: calc(0.45rem - 1px);
    width: calc(200% / 3);
    height: 2px;
  }
  .pay__timeline--animated::after {
    width: 0;
    height: 2px;
    transition: width 1.1s ease;
  }
  .pay__timeline--animated.is-visible::after {
    width: calc(200% / 3);
    height: 2px;
  }

  .pay__step {
    padding-left: 0;
    padding-top: calc(0.9rem + var(--space-m));
    text-align: center;
  }
  .pay__step::before {
    left: 50%;
    top: 0;
    transform: translateX(-50%);
  }
}

/* Bouton d'action */
.cta {
  display: inline-block;
  padding: var(--space-xs) var(--space-m);
  background: var(--ink);
  color: var(--panel);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.cta:hover {
  background: var(--trace-deep);
  border-color: var(--trace-deep);
  color: var(--panel-pure);   /* blanc sur sarcelle foncée : AA respecté */
}

/* Formulaire */
.form {
  display: grid;
  gap: var(--space-s);
  max-width: 34rem;
  margin-top: var(--space-l);
}

.field { display: grid; gap: var(--space-2xs); }

.field label {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.field input,
.field textarea {
  padding: var(--space-xs);
  background: var(--panel-pure);
  border: var(--border);
  border-radius: var(--radius);
}

.field textarea { resize: vertical; }

.form .cta { justify-self: start; }

.form__status {
  min-height: 1.6em;
  font-size: var(--step--1);
  color: var(--ink-soft);
}

.form__status[data-state="error"] { color: #b3261e; }
.form__status[data-state="ok"]    { color: var(--trace-deep); }

.honeypot {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Contact — deux canaux côte à côte : WhatsApp | ou | formulaire.
   Empile sous 48rem, le séparateur passant alors à l'horizontale. */
.contact {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-l);
  align-items: stretch;
  margin-top: var(--space-l);
}

.contact__col { display: flex; flex-direction: column; }
.contact__col h3 { margin-bottom: var(--space-2xs); }
.contact__col > p { color: var(--ink-soft); }

.contact__wa-icon {
  width: 3rem;
  height: 3rem;
  margin-bottom: var(--space-s);
}
.contact__col--wa .cta { align-self: start; margin-top: var(--space-m); }

/* Dans une colonne, le formulaire occupe toute la largeur disponible */
.contact .form { max-width: none; margin-top: var(--space-m); }

/* Séparateur « ou » : filet + pastille centrée qui masque le trait */
.contact__sep {
  position: relative;
  display: grid;
  place-items: center;
}
.contact__sep::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--steel);
}
.contact__sep span {
  position: relative;
  padding: var(--space-xs) 0;
  background: var(--panel);
  font-size: var(--step--1);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

@media (max-width: 48rem) {
  .contact { grid-template-columns: 1fr; }
  .contact__sep::before {
    top: 50%;
    bottom: auto;
    left: 0;
    right: 0;
    width: auto;
    height: 1px;
  }
  .contact__sep span { padding: 0 var(--space-s); }
}

/* Pied de page */
.site-footer {
  padding: var(--space-l) var(--gutter);
  border-top: var(--border);
  color: var(--ink-soft);
  font-size: var(--step--1);
}

/* Modal « bientôt disponible » — <dialog> natif.
   Centré par le navigateur en mode showModal() ; le bloc [open]
   force un centrage fixe pour le repli (navigateurs sans showModal). */
.modal {
  width: min(30rem, calc(100vw - 2 * var(--gutter)));
  padding: 0;   /* le padding est sur .modal__box : un clic sur le fond
                   du <dialog> reste distinct d'un clic dans le contenu */
  border: var(--border);
  border-radius: var(--radius);
  background: var(--panel-pure);
  color: var(--ink);
}

.modal__box { padding: var(--space-l); }

.modal[open] {
  position: fixed;
  inset: 0;
  margin: auto;   /* centre le bloc, y compris en repli non-modal */
}

.modal::backdrop { background: rgba(20, 23, 26, 0.55); }

.modal__title { font-size: var(--step-2); }

.modal__text {
  margin-top: var(--space-s);
  color: var(--ink-soft);
}

.modal .cta { margin-top: var(--space-l); }

/* Confiance — bande de logos clients (preuve sociale). Bande compacte,
   plus légère qu'une section. Logos en pastilles rondes, couleurs d'origine. */
.trust {
  max-width: var(--wrapper);
  margin-inline: auto;
  padding: var(--space-l) var(--gutter);
  border-top: var(--border);
  text-align: center;
}

/* L'eyebrow est un <p> : il hérite du max-width 62ch global, qui le cale à
   gauche sur desktop. On le libère pour que text-align:center le centre. */
.trust .eyebrow { max-width: none; }

.trust__list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-l);
  margin-top: var(--space-m);
  padding: 0;
  list-style: none;
}

.trust__logo {
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  background: var(--panel-pure);
  object-fit: cover;   /* images déjà carrées et cadrées pour le cercle */
}


/* ── 5. Utilitaires ─────────────────────────────────────────────── */

.visually-hidden:not(:focus):not(:active) {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}


/* ── 6. Responsive ──────────────────────────────────────────────── */

@media (max-width: 40rem) {
  /* En-tête compact et figé : logo + hamburger sur une ligne ; la nav
     devient un panneau déroulant sous la barre, ouvert via .is-open
     (piloté par js/main.js). */
  .nav-toggle { display: inline-flex; }

  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    background: var(--panel);
    border-bottom: var(--border);
  }
  .site-header.is-open .nav { display: block; }

  .nav ul {
    flex-direction: column;
    gap: 0;
    padding: var(--space-2xs) var(--gutter) var(--space-xs);
  }
  .nav li + li { border-top: 1px solid var(--steel); }
  .nav a {
    display: block;
    padding: var(--space-s) 0;
    font-size: var(--step-0);
  }

  .hero { padding-block: var(--space-xl); }
}

@media (max-width: 896px) {
  .desktop-only {
    display: none;
  }
}
