/* ==========================================================================
   Forma Ferroviaires · base : jetons, remise à zéro, typographie
   ========================================================================== */

:root {
  /* Couleurs : anthracite/bleu nuit dominant, jaune signal, sarcelle en secondaire */
  --night: #0d151e;
  --ink: #131e29;
  --steel-900: #1b2836;
  --steel-800: #243444;
  --steel-700: #33475a;
  --steel-500: #647789;
  --steel-400: #8797a6;
  --steel-300: #b3bec8;
  --steel-200: #d5dbe0;
  --steel-100: #e9ecee;
  --paper: #f3f1eb;
  --paper-2: #e8e5dc;
  --white: #fff;
  --signal: #f5b41a;
  --signal-600: #d99a00;
  --signal-ink: #1a1405;
  --teal: #0f6e6c;
  --teal-300: #59c3bb;
  --rail-red: #b4231b;
  --night-2: #0a1017;
  --signal-hover: #ffc642;
  --go: #3ccf7d;
  --error-bg: #fff6f5;
  --todo-bg-1: #fff4cf;
  --todo-bg-2: #ffe9a3;
  --todo-border: #8a5c00;
  --todo-ink: #4d3300;

  --text: #18222c;
  --text-muted: #4a5866;
  --line: #cfd6dc;
  --focus: var(--teal);
  --accent: var(--signal);

  /* Typographie */
  --font-display: 'Lexend', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  /* Échelle typographique : texte courant à 18 px (lisibilité), titres Lexend resserrés */
  --fs-xs: 0.875rem;
  --fs-sm: 1rem;
  --fs-base: 1.125rem;
  --fs-md: 1.25rem;
  --fs-lg: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --fs-xl: clamp(1.5rem, 1.2rem + 1.3vw, 2.125rem);
  --fs-2xl: clamp(1.875rem, 1.35rem + 2.3vw, 3rem);
  --fs-3xl: clamp(2.125rem, 1.3rem + 3.6vw, 4rem);

  /* Espacements */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;
  --s-9: 6rem;
  --section: clamp(3.5rem, 2rem + 6vw, 7rem);

  --gutter: 1rem;
  --wrap: 78rem;
  --radius: 2px;
  --header-h: 4.25rem;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  /* Durées : la sortie est toujours plus courte que l'entrée */
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --dur-4: 600ms;
  --shadow-plate: 0 1px 0 rgb(13 21 30 / 0.06), 0 14px 28px -18px rgb(13 21 30 / 0.45);
}

@media (min-width: 48em) {
  :root { --gutter: 1.5rem; }
}
@media (min-width: 80em) {
  :root { --gutter: 2rem; --header-h: 4.75rem; }
}
@media (min-width: 96em) {
  :root { --wrap: 84rem; }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}
html:has(.subnav) { scroll-padding-top: calc(var(--header-h) + 3rem + 1rem); }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.65;
  color: var(--text);
  background: var(--paper);
  overflow-x: clip;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
p, ul, ol, dl, figure, h1, h2, h3, h4 { margin: 0; }
ul, ol { padding: 0; }
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }
main:focus { outline: none; }

h1, h2, h3, h4,
.h-display {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); line-height: 1.25; }
h4 { font-size: var(--fs-md); line-height: 1.3; }
p { text-wrap: pretty; }
strong, b { font-weight: 600; }
small { font-size: var(--fs-xs); }

/* Accessibilité ------------------------------------------------------ */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.on-dark, .band--night, .site-footer, .topbar, .hero, .drawer, .cta-band, .devis { --focus: var(--signal); }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--signal);
  color: var(--signal-ink);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 0.5rem; }

/* Pictogrammes (sprite) ------------------------------------------------ */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon, .illus {
  width: 1.5rem; height: 1.5rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--xs { width: 1rem; height: 1rem; stroke-width: 3; }
.icon--sm { width: 1.125rem; height: 1.125rem; stroke-width: 3; }
.icon--lg { width: 3rem; height: 3rem; }
.illus { width: 100%; height: auto; stroke-width: 1.6; }
.a { stroke: var(--accent); }
.af { fill: var(--accent); }

/* Placeholder de contenu manquant ---------------------------------------- */
.todo {
  display: inline;
  padding: 0.08em 0.4em;
  border: 1px dashed var(--todo-border);
  border-radius: var(--radius);
  background: repeating-linear-gradient(-45deg, var(--todo-bg-1) 0 6px, var(--todo-bg-2) 6px 12px);
  color: var(--todo-ink);
  font-family: var(--font-body);
  font-size: 0.82em;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.5;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  overflow-wrap: anywhere;
}
.todo--xs { font-size: 0.75rem; padding: 0 0.3em; }

/* Mouvement réduit ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
