/* ==========================================================================
   Backend Bridges — Design system
   Style « papier » : fond crème quadrillé, encre vert profond, accent safran,
   titres en serif, étiquettes en JetBrains Mono.
   ========================================================================== */

:root {
  --paper: #F9F8F3;
  --card: #FFFFFF;
  --subtle: #F1EFE6;
  --ink: #0B241E;
  --ink-mid: #163A31;
  --ink-muted: #4A5E58;
  --line: #DEDAD0;
  --line-strong: #C2BDB0;
  /* Safran : décoratif (pastilles, bordures). --accent : boutons et liens,
     plus foncé pour garder le contraste du texte blanc et du petit texte. */
  --saffron: #D96B1B;
  --saffron-light: #FDF3EB;
  --saffron-border: #F3D1B8;
  --accent: #B5530F;
  --accent-hover: #9C4610;
  --accent-text: #A84D0C;
  --ok: #137347;
  --ok-bg: #E7F4ED;
  --serif: "Iowan Old Style", "Palatino Linotype", "URW Palladio L", P052, Georgia, serif;
  --shadow-sm: 0 2px 6px rgba(11, 36, 30, 0.04);
  --shadow-md: 0 12px 32px -8px rgba(11, 36, 30, 0.08), 0 2px 6px rgba(11, 36, 30, 0.04);
  --shadow-lg: 0 24px 48px -12px rgba(11, 36, 30, 0.14);
}

html { -webkit-font-smoothing: antialiased; }

body {
  background-color: var(--paper);
  color: var(--ink-mid);
  overflow-x: hidden;
  background-image:
    linear-gradient(to right, rgba(11, 36, 30, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(11, 36, 30, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* ---------- Titres en serif ----------
   !important : les pages portent encore font-bold / font-extrabold de Tailwind,
   qui alourdiraient la serif. */
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500 !important;
  letter-spacing: -0.02em !important;
  color: var(--ink);
}

/* Le quadrillage est désormais sur body ; ces calques restent neutres. */
.bg-grid { background: none; }
.glow { background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(217, 107, 27, 0.06), transparent 64%); }
.glow-ok { background: none; }

/* ---------- Révélation au scroll ----------
   L'animation n'est appliquée que si JavaScript est actif : sans JS, le
   contenu reste visible. Le script inline en tête de page pose la classe .js. */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Cartes ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.card-hover { transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease; }
.card-hover:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ---------- Étiquette mono, en pastille safran ---------- */
.kicker {
  display: inline-flex;
  align-items: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-text);
  background: var(--saffron-light);
  border: 1px solid var(--saffron-border);
  padding: 4px 10px;
  border-radius: 4px;
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 15px;
  padding: 0.8rem 1.5rem;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 0 rgba(11, 36, 30, 0.15);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-ghost {
  background: var(--card);
  border-color: var(--line-strong);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { border-color: var(--ink); background: var(--subtle); }

/* ---------- Pipeline ---------- */
.pipeline-node {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--card);
  color: var(--ink);
  padding: 0.5rem 0.75rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
  white-space: nowrap;
}
.pipeline-node--accent { border-color: var(--saffron-border); color: var(--accent-text); background: var(--saffron-light); }
.pipeline-node--ok { border-color: #b7dcc7; color: var(--ok); background: var(--ok-bg); }
.pipeline-arrow { color: var(--accent-text); font-family: 'JetBrains Mono', monospace; }

/* ---------- Aperçu du document généré ----------
   Cadre sombre « encre » sous une feuille légèrement inclinée, qui se
   redresse au survol. L'ombre est portée par .doc-sheet. */
.doc-frame {
  background: var(--ink);
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 16px 16px;
  border: 1px solid var(--ink-mid);
  border-radius: 0.75rem;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  display: flex;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}
.doc-sheet {
  position: relative;
  width: min(100%, 400px);
  background: #fff;
  border-radius: 4px;
  transform: rotate(-1.4deg);
  transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.3, 1);
  box-shadow: 0 34px 70px -22px rgba(0, 0, 0, 0.6), 0 6px 18px rgba(0, 0, 0, 0.35);
}
.doc-frame:hover .doc-sheet { transform: rotate(0deg) scale(1.02); }
.doc-sheet-inner { overflow: hidden; border-radius: 4px; }

.doc-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--saffron-border);
  background: var(--saffron-light);
  color: var(--accent-text);
  border-radius: 999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.doc-tag::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--saffron);
}

.doc-facts { display: grid; gap: 0.7rem; margin-top: 1.75rem; }
.doc-facts li {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  color: var(--ink-muted);
  font-size: 14.5px;
  line-height: 1.6;
}
.doc-facts li::before {
  content: '→';
  flex: none;
  color: var(--accent-text);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.doc-facts strong { color: var(--ink); font-weight: 600; }

.doc-caption {
  margin-top: 1.25rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-muted);
}

@media (prefers-reduced-motion: reduce) {
  .doc-sheet { transform: none; transition: none; }
}

/* ---------- Prose (pages légales) ---------- */
.prose-legal h2 {
  color: var(--ink);
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 0.875rem;
}
.prose-legal h3 {
  color: var(--ink);
  font-size: 1.125rem;
  margin-top: 1.75rem;
  margin-bottom: 0.625rem;
}
.prose-legal p { color: var(--ink-muted); line-height: 1.75; margin-bottom: 1rem; }
.prose-legal ul { color: var(--ink-muted); line-height: 1.75; margin-bottom: 1rem; padding-left: 1.25rem; list-style: disc; }
.prose-legal li { margin-bottom: 0.5rem; }
.prose-legal a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.prose-legal a:hover { color: var(--ink); }
.prose-legal strong { color: var(--ink); font-weight: 600; }
.prose-legal dl { display: grid; grid-template-columns: 10rem 1fr; gap: 0.625rem 1.25rem; margin-bottom: 1.5rem; }
.prose-legal dt { color: var(--ink); font-weight: 500; }
.prose-legal dd { color: var(--ink-muted); }

@media (max-width: 640px) {
  .prose-legal dl { grid-template-columns: 1fr; gap: 0.25rem; }
  .prose-legal dd { margin-bottom: 0.75rem; }
}

/* ---------- Accessibilite : focus clavier visible partout ---------- */
:where(a, button, summary, input, textarea):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 0.375rem;
}

/* ---------- FAQ en <details>, accessible au clavier sans JS ---------- */
.faq-item { border-bottom: 1px solid var(--line-strong); }
.faq-item:first-child { border-top: 1px solid var(--line-strong); }
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 44px;
  padding: 1.25rem 0;
  color: var(--ink);
  font-weight: 600;
  font-size: 1.0625rem;
  cursor: pointer;
  list-style: none;
}
.faq-item summary:hover { color: var(--accent-text); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary svg {
  flex: none;
  box-sizing: content-box;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  transition: transform 0.25s ease, background-color 0.25s ease;
}
.faq-item[open] summary svg { transform: rotate(45deg); background: var(--ink); color: var(--paper); border-color: var(--ink); }
.faq-item p { padding: 0 0 1.25rem; color: var(--ink-muted); font-size: 15px; line-height: 1.7; max-width: 68ch; }
/* Le bloc « Pour les curieux » est une FAQ seule : on garde un cadre. */
.faq-item > div { color: var(--ink-muted); }

/* ---------- Fil d'Ariane ---------- */
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.crumbs li { display: inline-flex; align-items: center; gap: 0.5rem; }
.crumbs li + li::before { content: '/'; color: var(--line-strong); }
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current] { color: var(--ink); }

/* ---------- Liste « ce qui est livré » avec coche ---------- */
.check-list { display: grid; gap: 0.75rem; }
.check-list li {
  position: relative;
  padding-left: 1.75rem;
  color: var(--ink-mid);
  font-size: 15px;
  line-height: 1.65;
}
.check-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.3em;
  width: 1.1rem;
  height: 1.1rem;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23137347' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

/* Schemas de flux : un libelle long passe a la ligne sur mobile. */
.flow .pipeline-node { white-space: normal; }
@media (prefers-reduced-motion: reduce) {
  .faq-item summary svg { transition: none; }
}

/* ---------- Pages services : exclusions, outils, schéma, vidéo ---------- */
.check-list--no li { color: var(--ink-muted); }
.check-list--no li::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234A5E58' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");
}
.tool-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tool-chips li {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  color: var(--ink);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
}
.flux-figure img { display: block; width: 100%; height: auto; }
.demo-video { display: block; width: 100%; height: auto; border-radius: 0.75rem; border: 1px solid var(--ink-mid); background: var(--ink); box-shadow: var(--shadow-lg); }

/* ---------- Registre de l'accueil (visuel du hero) ---------- */
.ledger {
  position: relative;
  background: var(--ink);
  border: 1px solid var(--ink-mid);
  border-radius: 0.75rem;
  padding: 20px;
  color: var(--paper);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.ledger::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 16px 16px;
  pointer-events: none;
}
.ledger-top {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.5px;
  letter-spacing: 0.04em;
}
.ledger-dot {
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: #2CE59B;
  box-shadow: 0 0 0 3px rgba(44, 229, 155, 0.2);
  animation: ledger-pulse 2.5s infinite;
}
@keyframes ledger-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) { .ledger-dot { animation: none; } }
.ledger-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--card);
  color: var(--ink);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.ledger-row:last-of-type { margin-bottom: 0; }
.ledger-tag { display: block; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); }
.ledger-title { font-weight: 600; font-size: 14px; }
.badge-ok, .badge-warn {
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: #FEF5E7; color: #8A4A0E; }
.ledger-note {
  position: relative;
  margin-top: 14px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  color: rgba(249, 248, 243, 0.7);
}

/* Les boutons « Réserver un échange » visent le calendrier lui-même :
   la marge le garde visible sous la barre de navigation fixe. */
#cal-inline { scroll-margin-top: 6rem; }
