/* ============================================================
   CAD90.COM — styles.css  v3
   Concept : Document imprimé — registre chromatique unique
   Fond papier #f4f1ec partout : header, sidebar, footer, page.
   Typographie noire franche. Accent bordeaux #8b1a1a.
   Zéro fond sombre → zéro problème de contraste.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Serif:ital,wght@0,400;0,600;1,400&family=IBM+Plex+Sans:wght@300;400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ────────────────────────────────────────────────────────────
   TOKENS
   ──────────────────────────────────────────────────────────── */
:root {
  /* Surface unique — papier */
  --paper:      #f4f1ec;
  --paper-dark: #ede9e2;  /* séparateurs, zones légèrement plus sombres */
  --paper-rule: #d8d3ca;  /* lignes de règle */

  /* Typographie */
  --ink-1: #111111;   /* titres, texte principal fort */
  --ink-2: #333333;   /* corps de texte courant */
  --ink-3: #555555;   /* secondaire, légendes */
  --ink-4: #888888;   /* très secondaire, labels uppercase */
  --ink-5: #bbbbbb;   /* décoratif, séparateurs légers */

  /* Accent unique */
  --red:       #8b1a1a;
  --red-light: #f9f0f0;

  /* Sidebar */
  --side-w:    240px;
  --side-rule: #d8d3ca;

  /* Header */
  --header-h:  56px;

  /* Fonts */
  --serif: 'IBM Plex Serif', Georgia, serif;
  --sans:  'IBM Plex Sans', 'Helvetica Neue', sans-serif;
  --mono:  'IBM Plex Mono', 'Courier New', monospace;

  /* Espacement */
  --s1:  4px;
  --s2:  8px;
  --s3:  12px;
  --s4:  16px;
  --s5:  20px;
  --s6:  24px;
  --s8:  32px;
  --s10: 40px;
  --s12: 48px;
  --s16: 64px;

  --t: 150ms ease;
}

/* ────────────────────────────────────────────────────────────
   RESET
   ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.65;
  color: var(--ink-2);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img  { max-width: 100%; height: auto; display: block; }
a    { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ── Accessibilité ── */
.skip-link {
  position: absolute;
  top: -60px; left: var(--s4);
  padding: var(--s2) var(--s4);
  background: var(--ink-1);
  color: var(--paper);
  font-size: .85rem;
  font-weight: 500;
  z-index: 9999;
  transition: top var(--t);
}
.skip-link:focus { top: var(--s3); }

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

/* ────────────────────────────────────────────────────────────
   HEADER
   Fond papier, bordure basse règle, nav sobre
   ──────────────────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--paper);
  border-bottom: 1px solid var(--paper-rule);
  z-index: 300;
  display: flex;
  align-items: center;
  padding: 0 var(--s8);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

/* Logo — PNG seul, fallback texte via JS si PNG absent */
.site-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: 36px;
}

.site-logo img {
  height: 34px;
  width: auto;
  display: block;
}

.logo-fallback {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink-1);
  letter-spacing: -.01em;
}
.logo-fallback span { color: var(--red); }

/* Navigation principale */
.main-nav {
  display: flex;
  align-items: center;
}

.main-nav a {
  font-size: .875rem;
  font-weight: 400;
  color: var(--ink-3);
  padding: 0 var(--s4);
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  transition: color var(--t), border-color var(--t);
  letter-spacing: .005em;
}

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

.main-nav a.active {
  color: var(--ink-1);
  font-weight: 500;
  border-bottom-color: var(--red);
}

/* Mobile toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px; height: 36px;
  background: none;
  border: none;
  padding: 6px;
}

.nav-toggle span {
  display: block;
  width: 22px; height: 1.5px;
  background: var(--ink-2);
  transition: all 220ms ease;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Drawer mobile */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-h); left: 0; right: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--paper-rule);
  padding: var(--s3) var(--s8);
  z-index: 290;
  flex-direction: column;
}

.mobile-nav.open { display: flex; }

.mobile-nav a {
  font-size: .9rem;
  color: var(--ink-3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--paper-rule);
  transition: color var(--t);
}
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a:hover,
.mobile-nav a.active {
  color: var(--ink-1);
}
.mobile-nav a.active { font-weight: 500; }

/* ────────────────────────────────────────────────────────────
   LAYOUT
   ──────────────────────────────────────────────────────────── */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: var(--header-h);
}

.page-body {
  display: flex;
  flex: 1;
}

.page-content {
  flex: 1;
  min-width: 0;
}

/* ────────────────────────────────────────────────────────────
   SIDEBAR
   Même fond papier, bordure droite règle
   ──────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--side-w);
  min-width: var(--side-w);
  background: var(--paper);
  border-right: 1px solid var(--side-rule);
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-inner {
  padding: var(--s8) 0 var(--s16);
}

.sidebar-group {
  padding-bottom: var(--s6);
}

.sidebar-group + .sidebar-group {
  border-top: 1px solid var(--paper-rule);
  padding-top: var(--s6);
}

.sidebar-group-label {
  display: block;
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 0 var(--s6) var(--s3);
}

.sidebar-nav a {
  display: block;
  font-size: .825rem;
  font-weight: 400;
  color: var(--ink-3);
  padding: 7px var(--s6);
  border-left: 2px solid transparent;
  line-height: 1.4;
  transition: color var(--t), border-color var(--t), background var(--t);
}

.sidebar-nav a:hover {
  color: var(--ink-1);
  background: var(--paper-dark);
}

.sidebar-nav a.active {
  color: var(--ink-1);
  font-weight: 500;
  border-left-color: var(--red);
  background: var(--red-light);
}

/* ────────────────────────────────────────────────────────────
   FOOTER
   Même fond papier — séparation par bordure haute uniquement
   Textes noirs lisibles, zéro problème de contraste
   ──────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--paper);
  border-top: 1px solid var(--paper-rule);
}

.footer-main {
  display: grid;
  grid-template-columns: 260px 1fr 1fr;
  gap: var(--s16);
  padding: var(--s12) var(--s8);
  max-width: 1440px;
  margin: 0 auto;
  border-bottom: 1px solid var(--paper-rule);
}

/* Logo footer — PNG seul, fallback via JS */
.footer-logo {
  display: block;
  margin-bottom: var(--s5);
  width: fit-content;
}

.footer-logo img {
  height: 30px;
  width: auto;
  display: block;
}

.footer-tagline {
  font-size: .825rem;
  color: var(--ink-3);        /* #555555 sur #f4f1ec → ratio ~7:1 ✓ */
  line-height: 1.75;
  max-width: 220px;
}

.footer-col-title {
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-4);        /* #888888 sur #f4f1ec → ratio ~4.6:1 ✓ */
  margin-bottom: var(--s5);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--paper-rule);
}

.footer-col-links li + li {
  margin-top: var(--s3);
}

.footer-col-links a {
  font-size: .825rem;
  color: var(--ink-3);        /* #555555 → ratio ~7:1 ✓ */
  transition: color var(--t);
  line-height: 1.4;
}

.footer-col-links a:hover {
  color: var(--ink-1);        /* #111111 → ratio ~16:1 ✓ */
}

.footer-bottom-bar {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--s4) var(--s8);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s3);
  font-size: .775rem;
  color: var(--ink-4);        /* #888888 sur #f4f1ec → ratio ~4.6:1 ✓ */
}

.footer-bottom-bar .sep { color: var(--paper-rule); }

/* ────────────────────────────────────────────────────────────
   INDEX — INTRO
   ──────────────────────────────────────────────────────────── */
.intro-strip {
  padding: var(--s12) var(--s10);
  border-bottom: 1px solid var(--paper-rule);
  max-width: 1100px;
}

.intro-label {
  display: inline-block;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: var(--s5);
}

.intro-headline {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 2.8vw, 2.3rem);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink-1);
  max-width: 620px;
  margin-bottom: var(--s5);
}

.intro-rule {
  width: 32px;
  height: 2px;
  background: var(--paper-rule);
  margin-bottom: var(--s8);
}

.intro-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s10);
  align-items: start;
}

.intro-text p {
  font-size: .95rem;
  color: var(--ink-2);
  line-height: 1.85;
  margin-bottom: var(--s4);
}
.intro-text p:last-child { margin-bottom: 0; }

/* Liste liens éditoriaux */
.intro-links {
  border-top: 1px solid var(--paper-rule);
}

.intro-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s4) 0;
  border-bottom: 1px solid var(--paper-rule);
  color: var(--ink-2);
  transition: color var(--t);
}
.intro-link-item:hover { color: var(--ink-1); }

.link-title {
  font-size: .9rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink-1);
}

.link-desc {
  font-size: .78rem;
  color: var(--ink-4);
  margin-top: 2px;
}

.link-arrow {
  font-size: .75rem;
  color: var(--ink-5);
  flex-shrink: 0;
  margin-left: var(--s4);
  transition: transform var(--t), color var(--t);
}
.intro-link-item:hover .link-arrow {
  transform: translateX(3px);
  color: var(--red);
}

/* ────────────────────────────────────────────────────────────
   SECTIONS CONTENU
   ──────────────────────────────────────────────────────────── */
.content-section {
  padding: var(--s12) var(--s10);
  max-width: 1100px;
  border-bottom: 1px solid var(--paper-rule);
}
.content-section:last-child { border-bottom: none; }

.section-eyebrow {
  display: inline-block;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: var(--s3);
}

.section-heading {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1.8vw, 1.4rem);
  font-weight: 600;
  color: var(--ink-1);
  line-height: 1.25;
  margin-bottom: var(--s8);
  padding-bottom: var(--s4);
  border-bottom: 1px solid var(--paper-rule);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s10);
  align-items: start;
}

.prose p {
  font-size: .95rem;
  color: var(--ink-2);
  line-height: 1.85;
  margin-bottom: var(--s4);
}
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--ink-1); font-weight: 600; }

.content-figure {
  border: 1px solid var(--paper-rule);
}
.content-figure img { width: 100%; height: auto; }
.content-figure figcaption {
  padding: var(--s3) var(--s4);
  font-size: .75rem;
  color: var(--ink-4);
  border-top: 1px solid var(--paper-rule);
  line-height: 1.5;
  background: var(--paper-dark);
}

.advisory {
  margin-top: var(--s6);
  padding: var(--s4) var(--s5);
  border-left: 2px solid var(--ink-2);
  background: var(--paper-dark);
  font-size: .875rem;
  color: var(--ink-2);
  line-height: 1.75;
}
.advisory strong { color: var(--ink-1); }

/* ────────────────────────────────────────────────────────────
   RESPONSIVE
   ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .intro-body,
  .two-col { grid-template-columns: 1fr; }
  .footer-main { grid-template-columns: 1fr 1fr; gap: var(--s10); }
}

@media (max-width: 768px) {
  .main-nav  { display: none; }
  .nav-toggle { display: flex; }
  .sidebar   { display: none; }

  .intro-strip,
  .content-section { padding: var(--s10) var(--s5); }

  .footer-main {
    grid-template-columns: 1fr;
    gap: var(--s8);
    padding: var(--s10) var(--s5);
  }

  .footer-bottom-bar {
    padding: var(--s4) var(--s5);
    flex-wrap: wrap;
    text-align: center;
  }

  .site-header { padding: 0 var(--s5); }
  .mobile-nav  { padding: var(--s3) var(--s5); }
}

@media (max-width: 480px) {
  .intro-headline { font-size: 1.5rem; }
}

/* ────────────────────────────────────────────────────────────
   COMPOSANTS PARTAGÉS — pages internes
   ──────────────────────────────────────────────────────────── */

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--s2);
  list-style: none;
  font-size: .78rem;
  color: var(--ink-4);
  margin-bottom: var(--s6);
}
.breadcrumb a {
  color: var(--ink-4);
  transition: color var(--t);
}
.breadcrumb a:hover { color: var(--ink-1); }
.breadcrumb li[aria-current="page"] { color: var(--ink-2); }

/* Bloc de commande / code inline */
.cmd-block {
  background: var(--paper-dark);
  border: 1px solid var(--paper-rule);
  border-left: 3px solid var(--ink-2);
  padding: var(--s4) var(--s5);
  margin: var(--s5) 0;
  font-family: var(--mono);
  font-size: .875rem;
  color: var(--ink-1);
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
}

code {
  font-family: var(--mono);
  font-size: .875em;
  background: var(--paper-dark);
  padding: 1px 5px;
  border: 1px solid var(--paper-rule);
  color: var(--ink-1);
}

/* Avertissement / alerte */
.alert {
  padding: var(--s4) var(--s5);
  border-left: 3px solid var(--red);
  background: var(--red-light);
  font-size: .875rem;
  color: var(--ink-2);
  line-height: 1.75;
  margin: var(--s5) 0;
}
.alert strong { color: var(--red); }

/* Table de paramètres */
.params-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  margin: var(--s6) 0;
}
.params-table th {
  text-align: left;
  font-weight: 600;
  font-size: .75rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: var(--s3) var(--s4);
  border-bottom: 2px solid var(--paper-rule);
  background: var(--paper-dark);
}
.params-table td {
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--paper-rule);
  color: var(--ink-2);
  vertical-align: top;
}
.params-table tr:last-child td { border-bottom: none; }
.params-table td:first-child { font-weight: 500; color: var(--ink-1); white-space: nowrap; }

/* Étapes numérotées (tutoriel) */
.step-list {
  counter-reset: steps;
  display: flex;
  flex-direction: column;
  gap: var(--s10);
  margin-top: var(--s8);
}

.step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: var(--s5);
  align-items: start;
}

.step-number {
  counter-increment: steps;
  width: 32px;
  height: 32px;
  border: 1px solid var(--paper-rule);
  background: var(--paper-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 600;
  color: var(--ink-3);
  flex-shrink: 0;
  margin-top: 2px;
}

.step-body h3 {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-1);
  margin-bottom: var(--s4);
  line-height: 1.3;
}

.step-body .prose p { margin-bottom: var(--s3); }

/* Sous-étapes (liste dans une étape) */
.sub-steps {
  display: flex;
  flex-direction: column;
  gap: var(--s8);
  margin-top: var(--s6);
  padding-left: var(--s5);
  border-left: 1px solid var(--paper-rule);
}

.sub-step-title {
  font-size: .825rem;
  font-weight: 600;
  color: var(--ink-1);
  margin-bottom: var(--s3);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Navigation de page (ancres tutoriel) */
.page-toc {
  background: var(--paper-dark);
  border: 1px solid var(--paper-rule);
  padding: var(--s5) var(--s6);
  margin-bottom: var(--s8);
  max-width: 440px;
}
.page-toc-title {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: var(--s3);
}
.page-toc ol {
  list-style: decimal;
  padding-left: var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.page-toc ol a {
  font-size: .85rem;
  color: var(--ink-3);
  transition: color var(--t);
}
.page-toc ol a:hover { color: var(--red); }

/* Liste à puces propre */
.bullet-list {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  margin: var(--s4) 0;
}
.bullet-list li {
  font-size: .95rem;
  color: var(--ink-2);
  line-height: 1.65;
  padding-left: var(--s5);
  position: relative;
}
.bullet-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--ink-4);
  font-size: .8rem;
}
.bullet-list li strong { color: var(--ink-1); }