/* =========================================================
   CE QU'ON VEND — le catalogue et les fiches produit
   ---------------------------------------------------------
   Chargé APRÈS assets/carnet.css : n'utilise que ses jetons
   (--ground, --surface, --band, --citron…). Aucune couleur en
   dur, sauf la petite palette des cinq temps de la chaîne
   « site », déclarée ci-dessous avec sa version sombre.
   ========================================================= */

/* Les cinq temps de la chaîne de sites (Comprendre → Livrer) :
   des teintes qui répondent aux pastilles 🔵🟡🟣🟢🟠 du texte,
   lisibles en texte sur --surface dans les deux thèmes. */
:root {
  --temps-1: #1F5C9E;  /* bleu    — 6,6:1 sur blanc */
  --temps-2: #7A5B00;  /* or      — 6,4:1 */
  --temps-3: #6A3D9A;  /* violet  — 7,6:1 */
  --temps-4: #2A7430;  /* vert    — 5,6:1 */
  --temps-5: #A4460E;  /* orange  — 5,7:1 */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --temps-1: #8DB9EE; --temps-2: #EDCB62; --temps-3: #C6A8F0; --temps-4: #8FD17E; --temps-5: #F4A56E;
  }
}
:root[data-theme="dark"] {
  --temps-1: #8DB9EE; --temps-2: #EDCB62; --temps-3: #C6A8F0; --temps-4: #8FD17E; --temps-5: #F4A56E;
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Remise à zéro limitée au contenu (jamais la barre commune) */
:where(.page) *, :where(.page) *::before, :where(.page) *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ---------------------------------------------------------
   La colonne de page — c'est elle qui porte les marges
   latérales, jamais le body (la barre commune reste pleine
   largeur).
   --------------------------------------------------------- */
.page {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 28px) clamp(72px, 10vw, 120px);
  font: 400 16px/1.65 var(--body);
  color: var(--ink);
}
.page a { color: inherit; }
.page :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---------------------------------------------------------
   1. LE BANDEAU SAPIN — le lien retour + le chapeau
   --------------------------------------------------------- */
/* Pleine largeur sans débordement : le fond est peint par une
   border-image qui déborde de 100vmax à gauche et à droite (débordement
   « d'encre », il ne crée jamais de défilement horizontal). Une seule
   peinture : pas de liseré au bord bas, contrairement à box-shadow. */
.retour,
.chapeau {
  background: var(--band);
  border-image: linear-gradient(var(--band), var(--band)) fill 0 / 0 / 0 100vmax;
}

/* « ← Le catalogue » : discret, en haut du bandeau */
.retour {
  display: block;
  width: fit-content;
  padding: clamp(18px, 3vw, 26px) 0 4px;
  color: var(--band-ink-2);
  font: 600 14px/1.2 var(--body);
  text-decoration: none;
  transition-property: color;
  transition-duration: .15s;
}
.page .retour { color: var(--band-ink-2); }
.retour:focus-visible { outline-color: var(--citron); }

.chapeau {
  display: block;
  padding: clamp(28px, 5vw, 48px) 0 clamp(24px, 4vw, 40px);
  color: var(--band-ink);
}
/* sous le lien retour, le bandeau continue sans couture */
.retour + .chapeau { padding-top: 14px; border-image-outset: 1px 100vmax 0; }

.chapeau .sur {
  font: 600 12px/1.2 var(--body);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--citron);
  margin-bottom: 14px;
}
.chapeau h1 {
  font: 800 clamp(30px, 5.5vw, 48px)/1.04 var(--display);
  letter-spacing: -.02em;
  text-wrap: balance;
  color: var(--band-ink);
}
.chapeau .cmd {
  display: inline-block;
  margin-top: 16px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--citron);
  color: var(--on-citron);
  font: 500 14px/1.2 var(--mono);
}
.chapeau p {
  margin-top: 16px;
  max-width: 62ch;
  color: var(--band-ink-2);
  font: 400 17px/1.6 var(--body);
  text-wrap: pretty;
}
.chapeau p + p { margin-top: 12px; }
.chapeau p b, .chapeau p strong { color: var(--band-ink); font-weight: 600; background: none; }

/* ---------------------------------------------------------
   2. LE CORPS
   --------------------------------------------------------- */
/* titre de section — pastille citron comme sur le dossier Reis */
.page > h2 {
  margin: clamp(44px, 7vw, 64px) 0 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font: 700 clamp(22px, 3vw, 26px)/1.2 var(--display);
  letter-spacing: -.01em;
  text-wrap: balance;
  color: var(--ink);
}
/* le premier titre sous le bandeau n'a pas besoin de filet */
.page > .chapeau + h2 { margin-top: clamp(32px, 5vw, 44px); padding-top: 0; border-top: 0; }
.page > h2::before,
.section__t h2::before {
  content: "";
  display: inline-block;
  width: 11px; height: 11px;
  border-radius: 3px;
  background: var(--citron);
  box-shadow: 0 0 0 2px var(--band);
  margin-right: 11px;
  vertical-align: .08em;
}

.page > p {
  margin: 14px 0;
  max-width: 68ch;
  font-size: 17px;
  line-height: 1.65;
  text-wrap: pretty;
}
.page > p.note { color: var(--ink-2); font-size: 16px; margin: 0 0 18px; }

/* gras dans la prose : surligné citron */
.page > p b, .page > p strong,
.fiche p b, .fiche p strong {
  font-weight: 600;
  color: var(--ink);
  background: linear-gradient(transparent 56%, var(--surligne) 56%);
  padding: 0 2px;
  border-radius: 2px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.page code {
  font-family: var(--mono);
  font-size: .84em;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 5px;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------
   Le schéma « Comment ça s'emboîte »
   --------------------------------------------------------- */
.schema {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(18px, 4vw, 32px) clamp(14px, 3vw, 28px);
  font-family: var(--body);
}
.etage { display: flex; flex-direction: column; align-items: center; gap: 6px; }

.boite {
  max-width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ground);
  text-align: center;
}
.boite .t { font: 700 17px/1.3 var(--display); color: var(--ink); text-wrap: balance; }
.boite .s { margin-top: 4px; font: 400 14px/1.45 var(--body); color: var(--ink-2); text-wrap: pretty; }

/* le chef d'orchestre : un morceau de sapin, la commande en citron */
.boite.chef { background: var(--band); border-color: var(--band); padding: 14px 22px; }
.boite.chef .t { font: 500 17px/1.3 var(--mono); color: var(--citron); }
.boite.chef .s { color: var(--band-ink-2); }

.fleche {
  padding: 4px 0;
  text-align: center;
  color: var(--ink-3);
  font: 400 18px/1 var(--body);
}
.fleche small {
  display: block;
  margin-top: 5px;
  font: 600 11.5px/1.3 var(--body);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.rangee { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }

/* une case du schéma */
.puce {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font: 500 14px/1.2 var(--body);
  text-align: left;
}
.puce b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
@media (max-width: 640px) { .deux { grid-template-columns: 1fr; } }
.colonne {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
}
.colonne .lab {
  margin-bottom: 10px;
  font: 600 12px/1.35 var(--body);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ---------------------------------------------------------
   Les cinq temps de la chaîne « site »
   --------------------------------------------------------- */
.phase { --temps: var(--ink-2); display: flex; gap: 14px; align-items: flex-start; margin: 8px 0; text-align: left; }
.phase:nth-child(1) { --temps: var(--temps-1); }
.phase:nth-child(2) { --temps: var(--temps-2); }
.phase:nth-child(3) { --temps: var(--temps-3); }
.phase:nth-child(4) { --temps: var(--temps-4); }
.phase:nth-child(5) { --temps: var(--temps-5); }
.phase__nom {
  flex: 0 0 9.5rem;
  padding-top: 9px;
  font: 700 12px/1.4 var(--body);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--temps);
}
.phase__p { flex: 1; min-width: 0; }
.phase .rangee { justify-content: flex-start; }
.phase .puce { border-color: color-mix(in srgb, var(--temps) 38%, var(--line)); }
.phase .puce b { color: var(--temps); }
.jalon {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--citron);
  color: var(--on-citron);
  font: 600 12px/1.2 var(--body);
  white-space: nowrap;
}
@media (max-width: 640px) {
  .phase { display: block; margin: 14px 0; }
  .phase__nom { padding: 0 0 6px; }
}

/* ---------------------------------------------------------
   Les 14 étapes (fiche CRM) : onglets + panneau
   --------------------------------------------------------- */
.chaine { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pas {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font: 600 14px/1.2 var(--body);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition-property: background-color, border-color, box-shadow, color, transform;
  transition-duration: .15s;
}
.pas .n { min-width: 1.2em; font: 500 12px/1 var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pas .marque { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.pas[aria-selected="true"] { background: var(--band); border-color: var(--citron); box-shadow: 0 0 0 1px var(--citron) inset; color: var(--band-ink); }
.pas[aria-selected="true"] .n { color: var(--citron); }
.pas[aria-selected="true"] .marque { background: var(--citron); }
.pas:active { transform: scale(.97); }

.detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(18px, 3.5vw, 28px);
}
.detail__n {
  margin-bottom: 8px;
  font: 600 12px/1.2 var(--body);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.detail__t { font: 700 clamp(20px, 2.6vw, 23px)/1.25 var(--display); letter-spacing: -.01em; color: var(--ink); text-wrap: balance; }
.detail p { margin: 12px 0; max-width: 68ch; font-size: 16px; color: var(--ink-2); }
.detail dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.detail dt {
  padding-top: 2px;
  font: 600 12px/1.5 var(--body);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.detail dd { color: var(--ink); min-width: 0; }
@media (max-width: 560px) {
  .detail dl { grid-template-columns: 1fr; gap: 2px; }
  .detail dd { margin-bottom: 10px; }
}

/* ---------------------------------------------------------
   Les fiches (agents, savoir-faire, ce qui rend la chaîne différente)
   --------------------------------------------------------- */
.fiches { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr)); gap: 12px; }
/* quatre fiches : deux par deux plutôt que trois plus une orpheline */
.fiches:has(> .fiche:nth-child(4):last-child) { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.fiche {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
}
.fiche__nom { margin-bottom: 8px; font: 700 19px/1.25 var(--display); letter-spacing: -.01em; color: var(--ink); text-wrap: balance; }
.fiche p { margin: 6px 0; font-size: 15.5px; line-height: 1.6; color: var(--ink-2); text-wrap: pretty; }
.fiche p i { font-style: italic; color: var(--ink); }
.fiche__ou {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font: 600 12px/1.4 var(--body);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}
.fiche > p:last-of-type { margin-bottom: 14px; }
/* quand l'étiquette suit directement le titre, elle devient un surtitre */
.fiche__nom + .fiche__ou { order: -1; margin: 0 0 6px; padding-top: 0; border-top: 0; }
.fiche > p:last-of-type:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------
   Les tableaux
   --------------------------------------------------------- */
.tableau-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.page table { width: 100%; border-collapse: collapse; font: 400 15.5px/1.55 var(--body); color: var(--ink); }
.page th, .page td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.page th {
  font: 600 12px/1.4 var(--body);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.page td:first-child { min-width: 11rem; font-weight: 600; }
.page td b { font-weight: 600; }
.page th.n, .page td.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .page th, .page td { padding: 10px 8px; }
  .page td:first-child { min-width: 0; }
}

/* ---------------------------------------------------------
   L'encadré important — un seul par page, en sapin
   --------------------------------------------------------- */
.souligne {
  margin: 26px 0;
  padding: 20px 22px;
  border-radius: 14px;
  background: var(--band);
  color: var(--band-ink);
}
.souligne p { margin: 10px 0; max-width: 68ch; font-size: 16.5px; line-height: 1.6; color: var(--band-ink-2); }
.souligne p:first-child { margin-top: 0; }
.souligne p:last-child { margin-bottom: 0; }
.souligne b, .souligne strong { color: var(--citron); font-weight: 600; background: none; }

/* ---------------------------------------------------------
   Pied de page
   --------------------------------------------------------- */
.page > .pied {
  margin-top: clamp(56px, 9vw, 88px);
  padding-top: 18px;
  border-top: 1px solid var(--line);
  max-width: none;
  font: 400 14px/1.7 var(--body);
  color: var(--ink-3);
}

/* ---------------------------------------------------------
   Survol à la souris — et son équivalent au doigt
   --------------------------------------------------------- */
@media (hover: hover) {
  .retour:hover { color: var(--band-ink); text-decoration: underline; text-decoration-color: var(--citron); text-decoration-thickness: 2px; text-underline-offset: 4px; }
  .pas:hover { border-color: var(--ink-3); color: var(--ink); }
  .pas[aria-selected="true"]:hover { border-color: var(--citron); color: var(--band-ink); }
}
@media (hover: none) {
  .retour:active { color: var(--band-ink); }
  .pas:not([aria-selected="true"]):active { border-color: var(--ink-3); color: var(--ink); }
}
@media (prefers-reduced-motion: reduce) {
  .retour, .pas { transition: none; }
  .pas:active { transform: none; }
}
