/* ==========================================================================
   RESSOURCES — Lecture premium
   Mini-blog IA santé · kemil.fr
   Design system : aimi.css (Onest, teal #0D9488, --s*, --t-*, --r-*, --mono)
   Stratégie : éditorial technique — hiérarchie nette, composants qui cassent
   le mur de texte, mobile-first, accessible AA.
   ========================================================================== */

/* ── Import IBM Plex Mono (manquant dans aimi.css, déclaré mais pas chargé) ── */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,400;0,500;1,400&display=swap');

/* ==========================================================================
   1. TYPOGRAPHIE DE LECTURE
   ========================================================================== */

.prose {
  font-size: 1.0625rem;       /* 17px — confortable sur desktop */
  line-height: 1.78;
  color: var(--ink-soft);
  max-width: 70ch;            /* largeur de ligne idéale lecture */
}

/* ── h1 : titre article ──────────────────────────────────────────────────── */
.prose h1, .article-title {
  font-size: clamp(2.1rem, 5.5vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
  color: var(--ink);
  font-weight: 800;
  margin: var(--s3) 0 var(--s4);
}

/* ── h2 : section principale ─────────────────────────────────────────────── */
.prose h2 {
  font-size: clamp(1.3rem, 3vw, 1.5rem);
  line-height: 1.22;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-weight: 700;
  margin: var(--s12) 0 var(--s4);
  padding-left: var(--s4);
  border-left: 3px solid var(--accent);
  position: relative;
}

/* ── h3 : sous-section ───────────────────────────────────────────────────── */
.prose h3 {
  font-size: 1.1rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--ink);
  font-weight: 700;
  margin: var(--s8) 0 var(--s3);
}

/* Petit tiret teal devant h3 */
.prose h3::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 2px;
  background: var(--accent);
  vertical-align: middle;
  margin-right: var(--s2);
  border-radius: 2px;
  position: relative;
  top: -1px;
}

/* ── Paragraphes ─────────────────────────────────────────────────────────── */
.prose p {
  margin: 0 0 var(--s5);
}

/* Premier paragraphe après h2 légèrement mis en avant */
.prose h2 + p,
.prose h3 + p {
  color: var(--ink-soft);
}

/* ── Inline : strong, em, code, liens ───────────────────────────────────── */
.prose strong {
  color: var(--ink);
  font-weight: 700;
}

.prose em {
  font-style: italic;
  color: var(--muted);
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 150ms ease, text-decoration-color 150ms ease;
}
.prose a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}
.prose a:focus-visible {
  outline: 3px solid var(--accent-line);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Code inline */
.prose code {
  font-family: var(--mono);
  font-size: 0.875em;
  font-weight: 500;
  background: var(--fill);
  color: var(--accent);
  padding: 0.15em 0.4em;
  border-radius: 5px;
  border: 1px solid var(--line);
  white-space: nowrap;
}

/* ── Séparateur de section ───────────────────────────────────────────────── */
.prose hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, var(--accent-line), var(--line) 60%, transparent);
  margin: var(--s10) 0;
  border-radius: 1px;
}

/* ── Listes ──────────────────────────────────────────────────────────────── */
.prose ul,
.prose ol {
  margin: 0 0 var(--s5);
  padding-left: 0;
  list-style: none;
}

.prose li {
  position: relative;
  padding-left: 1.6em;
  margin-bottom: var(--s3);
  line-height: 1.65;
}

/* Puce ul : carré teal */
.prose ul > li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 1.5px;
  flex-shrink: 0;
}

/* Numéro ol : teal, police monospace */
.prose ol {
  counter-reset: prose-ol;
}
.prose ol > li {
  counter-increment: prose-ol;
}
.prose ol > li::before {
  content: counter(prose-ol);
  position: absolute;
  left: 0;
  top: 0.05em;
  font-family: var(--mono);
  font-size: 0.78em;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  width: 1.4em;
  height: 1.4em;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Listes imbriquées */
.prose ul ul,
.prose ol ul {
  margin-top: var(--s2);
  margin-bottom: 0;
}
.prose ul ul > li::before {
  background: transparent;
  border: 1.5px solid var(--accent);
}

/* ── Dernier bloc CTA (après dernier <hr>) ────────────────────────────────── */
.prose > hr:last-of-type ~ p {
  background: linear-gradient(135deg, var(--accent-soft), rgba(34, 211, 238, 0.06));
  border: 1px solid var(--accent-line);
  border-radius: var(--r-lg);
  padding: var(--s5) var(--s6);
  font-style: normal;
  color: var(--ink);
  margin-top: var(--s2);
}
.prose > hr:last-of-type ~ p em {
  font-style: normal;
}

/* ==========================================================================
   2. TABLES
   ========================================================================== */

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-sm);
  line-height: 1.55;
  border-radius: var(--r-md);
  overflow: hidden;            /* clip border-radius sur thead */
  box-shadow: var(--sh-sm), 0 0 0 1px var(--line);
  margin: var(--s6) 0 var(--s8);
}

/* Wrapper scroll horizontal sur mobile — ajouté autour des tables par le moteur de rendu */
.prose .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--s6) 0 var(--s8);
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm), 0 0 0 1px var(--line);
}
.prose .table-wrap table {
  margin: 0;
  box-shadow: none;
}

/* Si le moteur ne wrap pas, on applique le scroll directement sur table */
.prose table {
  display: table;
}
/* Conteneur scroll natif si pas de .table-wrap */
.prose :not(.table-wrap) > table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Header */
.prose thead tr {
  background: linear-gradient(90deg, rgba(13, 148, 136, 0.08), rgba(34, 211, 238, 0.05));
}
.prose thead th {
  padding: var(--s3) var(--s4);
  text-align: left;
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1.5px solid var(--accent-line);
  white-space: nowrap;
}

/* Lignes corps */
.prose tbody tr {
  border-bottom: 1px solid var(--line);
  transition: background 120ms ease;
}
.prose tbody tr:last-child {
  border-bottom: none;
}
.prose tbody tr:nth-child(even) {
  background: var(--fill);
}
.prose tbody tr:hover {
  background: var(--accent-soft);
}

.prose td {
  padding: var(--s3) var(--s4);
  color: var(--ink-soft);
  vertical-align: top;
  line-height: 1.5;
}

/* Première colonne : légèrement plus contrastée */
.prose td:first-child {
  font-weight: 600;
  color: var(--ink);
}

/* ==========================================================================
   3. BLOCS DE CODE  <pre class="code"><code>
   ========================================================================== */

.prose pre.code {
  position: relative;
  background: #0F1117;        /* dark navy — plus premium que noir pur */
  border-radius: var(--r-md);
  padding: var(--s5) var(--s5) var(--s5) var(--s6);
  margin: var(--s6) 0 var(--s8);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--sh-lg), inset 0 1px 0 rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  tab-size: 2;
}

.prose pre.code code {
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.7;
  color: #e2e8f0;             /* gris clair lisible */
  background: none;
  border: none;
  padding: 0;
  white-space: pre;
  display: block;
}

/* Label de langage optionnel : .code[data-lang="json"] */
.prose pre.code[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: var(--s3);
  right: var(--s4);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.22);
  pointer-events: none;
}

/* Barre de couleur gauche : indicateur visuel */
.prose pre.code::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--cyan));
  border-radius: var(--r-md) 0 0 var(--r-md);
}

/* Coloration syntaxique minimale (CSS-only, tokens colorés) */
.prose pre.code .s,
.prose pre.code .string  { color: #86efac; }  /* vert : strings */
.prose pre.code .n,
.prose pre.code .number  { color: #93c5fd; }  /* bleu : nombres */
.prose pre.code .k,
.prose pre.code .keyword { color: #f9a8d4; }  /* rose : mots-clés */
.prose pre.code .c,
.prose pre.code .comment { color: #6b7280; font-style: italic; }

/* ==========================================================================
   4. SCHÉMAS MERMAID  <pre class="mermaid">
   ========================================================================== */

.prose pre.mermaid {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s8) var(--s6);
  margin: var(--s6) 0 var(--s8);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  /* Avant rendu Mermaid : masquer le source brut */
  font-size: 0;
  line-height: 0;
  color: transparent;
}

/* Une fois que Mermaid a rendu le SVG dans le <pre>, le SVG prend l'espace */
.prose pre.mermaid svg {
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  display: block;
}

/* Label discret au-dessus du diagramme */
.prose pre.mermaid[data-label]::before {
  content: attr(data-label);
  display: block;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--s4);
  line-height: 1;
}

/* ==========================================================================
   5. CALLOUTS — info et warn
   ========================================================================== */

/* Base commune */
.prose blockquote.callout {
  position: relative;
  border-radius: var(--r-md);
  padding: var(--s4) var(--s5) var(--s4) calc(var(--s5) + 24px + var(--s3));
  margin: var(--s6) 0 var(--s8);
  font-size: var(--t-sm);
  line-height: 1.65;

  /* Callout INFO : teal */
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.07), rgba(34, 211, 238, 0.04));
  border: 1px solid var(--accent-line);
  border-left: 4px solid var(--accent);
  color: var(--ink-soft);
}

/* Icône info (SVG inline via content — cercle i) */
.prose blockquote.callout::before {
  content: '';
  position: absolute;
  left: var(--s5);
  top: var(--s4);
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-color: var(--accent);
  border-radius: 50%;
  /* Icône « i » dessinée en CSS mask */
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='8'/%3E%3Cline x1='12' y1='12' x2='12' y2='16'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='8'/%3E%3Cline x1='12' y1='12' x2='12' y2='16'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

/* Callout WARN : ambre */
.prose blockquote.callout.callout--warn {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(251, 191, 36, 0.04));
  border-color: rgba(245, 158, 11, 0.25);
  border-left-color: #F59E0B;
  color: var(--ink-soft);
}

.prose blockquote.callout.callout--warn::before {
  background-color: #F59E0B;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
}

/* Titre du callout (premier <strong> ou <p><strong>) */
.prose blockquote.callout > p:first-child > strong:first-child,
.prose blockquote.callout > strong:first-child {
  display: block;
  font-size: var(--t-sm);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--accent);
  margin-bottom: var(--s2);
}
.prose blockquote.callout.callout--warn > p:first-child > strong:first-child,
.prose blockquote.callout.callout--warn > strong:first-child {
  color: #B45309;
}

.prose blockquote.callout p {
  margin: 0 0 var(--s2);
}
.prose blockquote.callout p:last-child {
  margin-bottom: 0;
}

/* Liens à l'intérieur des callouts */
.prose blockquote.callout a {
  color: var(--accent);
  font-weight: 600;
}
.prose blockquote.callout.callout--warn a {
  color: #B45309;
}

/* ==========================================================================
   6. COMPOSANTS SUPPLÉMENTAIRES RECOMMANDÉS
   ========================================================================== */

/* ── 6a. Fiche « En bref » (callout enrichi) ──────────────────────────────
   Convention HTML :
   <blockquote class="callout callout--summary">
     <strong>En bref</strong>
     <ul><li>…</li></ul>
   </blockquote>
   ──────────────────────────────────────────────────────────────────────── */

.prose blockquote.callout.callout--summary {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.10), rgba(34, 211, 238, 0.06));
  border-left-color: var(--accent);
  padding-top: var(--s5);
  padding-bottom: var(--s5);
}

.prose blockquote.callout.callout--summary > p:first-child > strong:first-child,
.prose blockquote.callout.callout--summary > strong:first-child {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--s3);
}

/* Listes à l'intérieur du callout summary — réutilise les styles prose ul */
.prose blockquote.callout ul {
  margin: 0;
  padding-left: 0;
}
.prose blockquote.callout li {
  padding-left: 1.4em;
  margin-bottom: var(--s2);
  font-size: var(--t-sm);
  line-height: 1.6;
}
.prose blockquote.callout li::before {
  top: 0.52em;
  width: 5px;
  height: 5px;
}

/* ── 6b. Liste « Étapes / Recette » numérotée ────────────────────────────
   Convention HTML :
   <ol class="steps">
     <li><strong>Titre étape</strong><br>Description…</li>
   </ol>
   ──────────────────────────────────────────────────────────────────────── */

.prose ol.steps {
  counter-reset: steps;
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: var(--s6) 0 var(--s8);
  border-left: 2px solid var(--line);
  padding-left: 0;
}

.prose ol.steps > li {
  counter-increment: steps;
  padding-left: var(--s8);
  padding-bottom: var(--s6);
  position: relative;
  margin-bottom: 0;
}

.prose ol.steps > li:last-child {
  padding-bottom: 0;
}

/* Pastille numérotée */
.prose ol.steps > li::before {
  content: counter(steps);
  position: absolute;
  left: calc(-1 * var(--s4) - 1px);       /* centrée sur la bordure gauche */
  top: 0;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--sh-accent);
  border: 3px solid var(--bg);
}

/* Titre de l'étape */
.prose ol.steps > li > strong:first-child {
  display: block;
  font-size: var(--t-base);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--s2);
  padding-top: 6px;           /* aligne visuellement avec la pastille */
}

/* ── 6c. Séparateur de chapitre avec label ────────────────────────────────
   Convention HTML :
   <hr class="section-divider" data-label="Partie 2">
   ou sans label : <hr class="section-divider">
   ──────────────────────────────────────────────────────────────────────── */

.prose hr.section-divider {
  position: relative;
  border: none;
  height: 1px;
  background: var(--line);
  margin: var(--s12) 0;
  overflow: visible;
}

.prose hr.section-divider[data-label]::before {
  content: attr(data-label);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  padding: 0 var(--s4);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* ==========================================================================
   7. RESPONSIVE — mobile-first adjustments
   ========================================================================== */

@media (max-width: 640px) {
  .prose {
    font-size: 1rem;
    line-height: 1.72;
    max-width: 100%;
  }

  .prose h1 {
    font-size: 1.75rem;
    letter-spacing: -0.03em;
  }

  .prose h2 {
    font-size: 1.2rem;
    margin-top: var(--s10);
    padding-left: var(--s3);
    border-left-width: 3px;
  }

  .prose h3 {
    font-size: 1.05rem;
    margin-top: var(--s6);
  }

  /* Tables : toujours scrollable */
  .prose table,
  .prose :not(.table-wrap) > table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: var(--t-xs);
  }

  .prose thead th,
  .prose td {
    padding: var(--s2) var(--s3);
  }

  /* Blocs de code : padding réduit */
  .prose pre.code {
    padding: var(--s4);
    border-radius: var(--r-sm);
    font-size: 0.8rem;
  }

  /* Callouts : padding réduit */
  .prose blockquote.callout {
    padding: var(--s3) var(--s4) var(--s3) calc(var(--s4) + 20px + var(--s2));
  }

  /* Steps : pastille plus petite */
  .prose ol.steps > li {
    padding-left: var(--s7, 1.75rem);
    padding-bottom: var(--s5);
  }
  .prose ol.steps > li::before {
    width: 26px;
    height: 26px;
    font-size: 0.72rem;
    left: calc(-13px - 1px);
  }
}

/* ==========================================================================
   8. ACCESSIBILITÉ
   ========================================================================== */

/* Focus visible sur tous les interactifs dans .prose */
.prose a:focus-visible,
.prose button:focus-visible {
  outline: 3px solid var(--accent-line);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* Respect de prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .prose *,
  .prose *::before,
  .prose *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   9. MERMAID — override des couleurs SVG générées
   Mermaid injecte du style inline, on over-ride via les classes SVG.
   ========================================================================== */

/* Fond du conteneur SVG Mermaid */
.prose pre.mermaid .mermaid-svg,
.prose pre.mermaid svg {
  background: transparent !important;
}

/* Nœuds : fond clair */
.prose pre.mermaid .node rect,
.prose pre.mermaid .node circle,
.prose pre.mermaid .node polygon,
.prose pre.mermaid .node path {
  fill: rgba(13, 148, 136, 0.08) !important;
  stroke: var(--accent) !important;
  stroke-width: 1.5px !important;
}

/* Labels des nœuds */
.prose pre.mermaid .nodeLabel,
.prose pre.mermaid .label {
  font-family: var(--font) !important;
  fill: var(--ink) !important;
  color: var(--ink) !important;
}

/* Flèches */
.prose pre.mermaid .edgePath path {
  stroke: var(--accent) !important;
  stroke-width: 1.5px !important;
}
.prose pre.mermaid .arrowheadPath {
  fill: var(--accent) !important;
}

/* Labels d'arêtes */
.prose pre.mermaid .edgeLabel {
  background-color: var(--bg) !important;
  color: var(--muted) !important;
  font-family: var(--font) !important;
  font-size: 0.75rem !important;
}

/* ==========================================================================
   10. MOCKUP — aperçu de livrable
   Simule une "capture d'écran" du résultat concret d'une automatisation.
   Structure :
     <div class="mockup mockup--email">
       <div class="mockup__bar">Titre optionnel</div>
       <div class="mockup__body"><!-- markdown rendu --></div>
     </div>
   Variantes : mockup--email · mockup--fiche · mockup--digest · mockup--qa
   ========================================================================== */

/* ── Tokens locaux du composant ─────────────────────────────────────────── */
.mockup {
  --mk-bar-bg    : var(--bg-alt, #f5f7f9);
  --mk-bar-h     : 38px;
  --mk-body-bg   : var(--card, #ffffff);
  --mk-border    : var(--line, rgba(0,0,0,0.09));
  --mk-radius    : var(--r-lg, 14px);
  --mk-dot-size  : 10px;
  --mk-dot-gap   : 6px;
  --mk-shadow    : 0 2px 6px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.08);
  --mk-font-size : var(--t-sm, 0.875rem);  /* ~14px — effet "contenu écran" */
  --mk-lh        : 1.65;
  --mk-p-gap     : 0.75em;                 /* espacement entre paragraphes */
  --mk-li-gap    : 0.45em;                 /* espacement entre items de liste */
}

/* ── Conteneur principal ─────────────────────────────────────────────────── */
.mockup {
  position: relative;
  border: 1px solid var(--mk-border);
  border-radius: var(--mk-radius);
  background: var(--mk-body-bg);
  box-shadow: var(--mk-shadow);
  overflow: hidden;
  margin: var(--s8) 0 var(--s10);
  /* Légère rotation ≈ 0 + un fond très subtil pour l'effet "posé" */
  isolation: isolate;
}

/* Ligne teal fine en haut — signature visuelle cohérente avec le design system */
.mockup::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--cyan, #22D3EE) 60%, transparent);
  z-index: 1;
  border-radius: var(--mk-radius) var(--mk-radius) 0 0;
}

/* ── Barre de titre (façon fenêtre) ─────────────────────────────────────── */
.mockup__bar {
  display: flex;
  align-items: center;
  gap: var(--mk-dot-gap);
  min-height: var(--mk-bar-h);
  padding: 0 var(--s5);
  background: var(--mk-bar-bg);
  border-bottom: 1px solid var(--mk-border);
  position: relative;
}

/* 3 dots macOS — dessinés en CSS pur, aucun élément HTML supplémentaire */
.mockup__bar::before {
  content: '';
  display: block;
  flex-shrink: 0;
  width:  calc(var(--mk-dot-size) * 3 + var(--mk-dot-gap) * 2);
  height: var(--mk-dot-size);
  /* 3 cercles via radial-gradient répété — rouge / jaune / vert macOS */
  background:
    radial-gradient(circle, #FF5F57 50%, transparent 51%) 0                                              50% / var(--mk-dot-size) var(--mk-dot-size) no-repeat,
    radial-gradient(circle, #FEBC2E 50%, transparent 51%) calc(var(--mk-dot-size) + var(--mk-dot-gap))  50% / var(--mk-dot-size) var(--mk-dot-size) no-repeat,
    radial-gradient(circle, #28C840 50%, transparent 51%) calc((var(--mk-dot-size) + var(--mk-dot-gap)) * 2) 50% / var(--mk-dot-size) var(--mk-dot-size) no-repeat;
}

/* Texte du titre — centré, léger, monospace */
.mockup__bar span,
.mockup__bar:not(:empty)::after {
  /* On positionne le texte en absolu pour qu'il reste centré
     indépendamment des dots à gauche */
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted, #94a3b8);
  white-space: nowrap;
  pointer-events: none;
  max-width: 55%;             /* évite que le titre écrase les dots */
  overflow: hidden;
  text-overflow: ellipsis;
}

/*
  Le moteur rend le titre directement comme texte dans .mockup__bar
  (pas dans un <span>). On cible donc le texte via la pseudo-class
  :not(:empty) et ::after n'est pas applicable ici — on stylise
  directement le nœud texte en ciblant la barre elle-même.
*/
.mockup__bar {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted, #94a3b8);
  /* Décalage à gauche pour laisser de la place aux dots (3×10px + 2×6px = 42px)
     + padding gauche existant (var(--s5) ≈ 20px) = ~62px total */
  padding-left: calc(42px + var(--s5) + var(--s3));
  padding-right: var(--s5);
  text-align: center;
  /* Le texte n'est pas centré nativement (flex + padding asymétrique).
     On compense avec justify-content. */
  justify-content: center;
}

/* ── Corps du livrable ───────────────────────────────────────────────────── */
.mockup__body {
  padding: var(--s6) var(--s8);   /* --s7 n'existe pas dans l'échelle → padding invalide → 0 (texte rogné) */
  font-size: var(--mk-font-size);
  line-height: var(--mk-lh);
  color: var(--ink-soft);
  /* Hauteur max avec scroll si contenu très long */
  max-height: 520px;
  overflow-y: auto;
  overflow-x: hidden;
  /* Scrollbar discrète */
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.mockup__body::-webkit-scrollbar {
  width: 4px;
}
.mockup__body::-webkit-scrollbar-track {
  background: transparent;
}
.mockup__body::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 2px;
}

/* ── Typographie INTÉRIEURE — reset complet depuis zéro ─────────────────── */
/* aimi.css remet tout à 0 ; on redéfinit ici pour le contexte "écran réduit" */

.mockup__body p {
  margin: 0 0 var(--mk-p-gap);
  color: var(--ink-soft);
  font-size: inherit;
  line-height: var(--mk-lh);
}
.mockup__body p:last-child {
  margin-bottom: 0;
}

.mockup__body strong {
  font-weight: 700;
  color: var(--ink);
}

.mockup__body em {
  font-style: italic;
  color: var(--muted);
}

/* Listes : bullets simples, compacts */
.mockup__body ul,
.mockup__body ol {
  margin: 0 0 var(--mk-p-gap);
  padding-left: 0;
  list-style: none;
}
.mockup__body ul:last-child,
.mockup__body ol:last-child {
  margin-bottom: 0;
}

.mockup__body li {
  position: relative;
  padding-left: 1.4em;
  margin-bottom: var(--mk-li-gap);
  line-height: var(--mk-lh);
  color: var(--ink-soft);
}

/* Puce ul : trait teal fin — plus délicat que le carré du prose */
.mockup__body ul > li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.58em;
  width: 14px;
  height: 1.5px;
  background: var(--accent);
  border-radius: 1px;
}

/* ol : numéro monospace teal sans badge — plus sobre qu'en prose */
.mockup__body ol {
  counter-reset: mk-ol;
}
.mockup__body ol > li {
  counter-increment: mk-ol;
}
.mockup__body ol > li::before {
  content: counter(mk-ol) '.';
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--mono);
  font-size: 0.78em;
  font-weight: 600;
  color: var(--accent);
  line-height: var(--mk-lh);
}

/* Table compacte dans un mockup */
.mockup__body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  line-height: 1.45;
  margin: var(--mk-p-gap) 0;
  border: 1px solid var(--mk-border);
  border-radius: var(--r-sm, 6px);
  overflow: hidden;
}
.mockup__body thead tr {
  background: rgba(13, 148, 136, 0.06);
}
.mockup__body thead th {
  padding: 0.35em 0.65em;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--mk-border);
  white-space: nowrap;
}
.mockup__body tbody tr {
  border-bottom: 1px solid var(--mk-border);
}
.mockup__body tbody tr:last-child {
  border-bottom: none;
}
.mockup__body tbody tr:nth-child(even) {
  background: var(--fill);
}
.mockup__body td {
  padding: 0.35em 0.65em;
  color: var(--ink-soft);
  vertical-align: top;
}
.mockup__body td:first-child {
  font-weight: 600;
  color: var(--ink);
}

/* ── Variante EMAIL ──────────────────────────────────────────────────────────
   La barre prend l'aspect d'un client mail minimal :
   icône enveloppe + expéditeur à gauche, sujet centré.
   Usage : class="mockup mockup--email"
   Le texte de .mockup__bar devient le "sujet" de l'email.
   ──────────────────────────────────────────────────────────────────────────── */

.mockup--email {
  --mk-bar-bg   : #f0fdfa;   /* teal très désaturé — référence client mail */
  --mk-bar-h    : 44px;
}

/* Réinitialise les dots macOS — on ne les veut pas pour l'email */
.mockup--email .mockup__bar::before {
  /* Icône enveloppe via mask SVG */
  width: 18px;
  height: 14px;
  background-color: var(--accent);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='4' width='20' height='16' rx='2'/%3E%3Cpath d='M2 7l10 7 10-7'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='4' width='20' height='16' rx='2'/%3E%3Cpath d='M2 7l10 7 10-7'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  /* Recalcule la largeur — plus petite que les 3 dots */
  background-size: contain;
}

.mockup--email .mockup__bar {
  padding-left: calc(18px + var(--s5) + var(--s3));
  color: var(--ink);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}

/* (étiquette "De :" retirée — collisionnait avec le titre centré) */
.mockup--email .mockup__bar::after { content: none; }

/* Corps email : légère couleur de fond papier */
.mockup--email .mockup__body {
  background: #fdfffe;
  padding: var(--s6) var(--s8);
}

/* ── Variante FICHE ──────────────────────────────────────────────────────────
   Rendu type "carte structurée" — en-tête avec icône fichier.
   ──────────────────────────────────────────────────────────────────────────── */

.mockup--fiche {
  --mk-bar-bg: var(--fill, #f8fafc);
}

.mockup--fiche .mockup__bar::before {
  width: 14px;
  height: 17px;
  background-color: var(--accent);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.mockup--fiche .mockup__bar {
  padding-left: calc(14px + var(--s5) + var(--s3));
}

/* ── Variante DIGEST ─────────────────────────────────────────────────────────
   Rendu type "newsletter" — barre plus large, accent cyan.
   ──────────────────────────────────────────────────────────────────────────── */

.mockup--digest {
  --mk-bar-bg: rgba(34, 211, 238, 0.06);
  --mk-bar-h : 42px;
}

.mockup--digest .mockup__bar::before {
  width: 17px;
  height: 17px;
  background-color: var(--cyan, #22D3EE);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2z'/%3E%3Cpath d='M16 2v4'/%3E%3Cpath d='M8 10h8'/%3E%3Cpath d='M8 14h5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2z'/%3E%3Cpath d='M16 2v4'/%3E%3Cpath d='M8 10h8'/%3E%3Cpath d='M8 14h5'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.mockup--digest .mockup__bar {
  padding-left: calc(17px + var(--s5) + var(--s3));
  color: var(--ink);
}

/* ── Variante Q&A ────────────────────────────────────────────────────────────
   Rendu type "conversation / chatbot" — icône bulle.
   ──────────────────────────────────────────────────────────────────────────── */

.mockup--qa {
  --mk-bar-bg: var(--bg-alt, #f5f7f9);
}

.mockup--qa .mockup__bar::before {
  width: 17px;
  height: 16px;
  background-color: var(--accent);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.mockup--qa .mockup__bar {
  padding-left: calc(17px + var(--s5) + var(--s3));
}

/* Blocs Q et A dans le corps — structure de conversation lisible */
.mockup--qa .mockup__body .qa-q,
.mockup--qa .mockup__body p:nth-child(odd):not(:last-child) {
  font-weight: 600;
  color: var(--ink);
}

/* ── Responsive mobile ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .mockup {
    margin: var(--s6) 0 var(--s8);
    border-radius: var(--r-md, 10px);
  }

  .mockup__bar {
    min-height: 32px;
    font-size: 0.68rem;
    padding-left: calc(42px + var(--s4) + var(--s2));
    padding-right: var(--s4);
  }

  .mockup__body {
    padding: var(--s4) var(--s5);
    max-height: 380px;
    font-size: 0.825rem;
  }

  .mockup--email .mockup__bar::after {
    display: none;   /* supprime le "De :" sur petit écran — trop serré */
  }

  .mockup--email .mockup__body {
    padding: var(--s4) var(--s5);
  }

  /* Table intérieure : scroll horizontal */
  .mockup__body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Dark mode ───────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  .mockup {
    --mk-bar-bg : rgba(255,255,255,0.04);
    --mk-body-bg: var(--card, #1a1f2e);
    --mk-border : rgba(255,255,255,0.08);
    --mk-shadow : 0 2px 6px rgba(0,0,0,0.25), 0 8px 24px rgba(0,0,0,0.35);
  }

  .mockup--email {
    --mk-bar-bg: rgba(13, 148, 136, 0.08);
  }

  .mockup--email .mockup__body {
    background: var(--card, #1a1f2e);
  }

  .mockup--digest {
    --mk-bar-bg: rgba(34, 211, 238, 0.05);
  }

  /* Les dots macOS gardent leurs couleurs réelles en dark — ils sont reconnaissables */
}

/* ── Accessibilité : reduced-motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .mockup,
  .mockup * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   11. CTA — encadré d'appel à l'action avec bouton (conteneur :::cta)
   ========================================================================== */
.mockup--cta {
  box-shadow: none;
  border: 1px solid var(--accent-line);
  background: linear-gradient(135deg, var(--accent-soft), rgba(34, 211, 238, 0.06));
}
.mockup--cta::before { display: none; }            /* pas de liseré fenêtre */
.mockup--cta .mockup__bar { display: none; }       /* pas de barre fenêtre */
.mockup--cta .mockup__body {
  background: transparent;
  padding: var(--s6) var(--s6);
  font-size: var(--t-base);
  color: var(--ink-soft);
  line-height: 1.6;
}
.mockup--cta .mockup__body p { margin: 0 0 var(--s4); }
.mockup--cta .mockup__body p:last-child { margin-bottom: 0; }
.mockup--cta .mockup__body strong { color: var(--ink); }
/* CTA primaire (Réserver) — bouton plein teal */
.mockup--cta .mockup__body a {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  font-size: var(--t-sm);
  padding: var(--s3) var(--s5);
  border: 1px solid transparent;        /* aligne la hauteur avec le secondaire */
  border-radius: var(--r-pill);
  text-decoration: none;
  transition: background 150ms ease, transform 150ms ease;
}
.mockup--cta .mockup__body a:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.mockup--cta .mockup__body a:focus-visible {
  outline: 3px solid var(--accent-line);
  outline-offset: 2px;
}

/* CTA secondaire (Faites le diagnostic) — vert translucide, plus discret */
.mockup--cta .mockup__body a[href*="/aimi/c/"] {
  background: rgba(13, 148, 136, 0.12);
  color: var(--accent);
  border-color: rgba(13, 148, 136, 0.30);
}
.mockup--cta .mockup__body a[href*="/aimi/c/"]:hover {
  background: rgba(13, 148, 136, 0.20);
}

/* ==========================================================================
   ===== Bibliothèque / index =====
   Page /ressources — grille filtrée, hero compact, section "Commencer ici"
   Mobile-first · Tokens valides : --s1..s6, s8, s10, s12, s16, s20, s24
   ========================================================================== */

/* ── Layout shells ───────────────────────────────────────────────────────── */

.lib-shell {
  max-width: 1160px;
  margin: 0 auto;
  padding-left: var(--s5);
  padding-right: var(--s5);
}

/* ── HERO ─────────────────────────────────────────────────────────────────── */

.lib-hero {
  background: var(--aurora);
  border-bottom: 1px solid var(--line);
  padding: var(--s10) 0 var(--s8);
}

.lib-hero__inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 var(--s5);
}

.lib-hero__title {
  font-size: clamp(2rem, 5.5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
  color: var(--ink);
  margin: var(--s2) 0 var(--s4);
}

.lib-hero__title-dim {
  color: var(--muted);
}

.lib-hero__sub {
  font-size: var(--t-md);
  color: var(--ink-soft);
  line-height: 1.6;
  max-width: 560px;
  margin-bottom: var(--s5);
}

.lib-hero__stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  font-size: var(--t-sm);
  color: var(--muted);
}

.lib-stat strong {
  color: var(--ink);
  font-weight: 700;
}

.lib-stat-sep {
  color: var(--line-strong);
}

/* ── TOOLBAR ─────────────────────────────────────────────────────────────── */

.lib-toolbar-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: var(--s3) 0;
}

.lib-toolbar {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

/* ── Search ─────────────────────────────────────────────────────────────── */

.lib-search-wrap {
  position: relative;
  max-width: 400px;
}

.lib-search-icon {
  position: absolute;
  left: var(--s3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
  display: block;
}

.lib-search {
  width: 100%;
  height: 40px;
  padding: 0 var(--s8) 0 calc(var(--s3) + 16px + var(--s2));
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--bg);
  font-family: var(--font);
  font-size: var(--t-sm);
  color: var(--ink);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  -webkit-appearance: none;
}

.lib-search::placeholder {
  color: var(--faint);
}

.lib-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-line);
}

.lib-search:focus-visible {
  outline: none; /* gestion via box-shadow ci-dessus */
}

/* Clear button inside search */
.lib-search-clear {
  position: absolute;
  right: var(--s3);
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fill);
  border: none;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.lib-search-clear:hover {
  background: var(--fill-hover);
  color: var(--ink);
}

.lib-search-clear:focus-visible {
  outline: 3px solid var(--accent-line);
  outline-offset: 2px;
}

/* ── Pills (filtres) ─────────────────────────────────────────────────────── */

.lib-filter-group {
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.lib-pills {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--s1);
  overflow-x: auto;
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* IE */
  padding-bottom: 2px;            /* espace pour le focus ring */
}

.lib-pills::-webkit-scrollbar {
  display: none;                  /* Chrome/Safari */
}

.lib-pill {
  flex-shrink: 0;
  height: 32px;
  padding: 0 var(--s3);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--bg);
  font-family: var(--font);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 100ms ease;
  touch-action: manipulation;
}

.lib-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.lib-pill--active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.lib-pill--active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.lib-pill:focus-visible {
  outline: 3px solid var(--accent-line);
  outline-offset: 2px;
}

.lib-pill:active {
  transform: scale(0.96);
}

/* Niveau pills — taille légèrement réduite, monospace pour les codes */
.lib-pill--level {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

/* ── SECTION FEATURED ────────────────────────────────────────────────────── */

.lib-featured {
  padding: var(--s10) 0 var(--s8);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--line);
}

.lib-section-head {
  margin-bottom: var(--s6);
}

.lib-section-eyebrow {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: var(--s2);
}

.lib-section-title {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1.15;
  margin-bottom: var(--s2);
}

.lib-section-sub {
  font-size: var(--t-sm);
  color: var(--muted);
  line-height: 1.55;
}

/* Featured grid — 4 cols desktop, 2 tablet, 1 mobile */
.lib-featured-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s3);
}

/* Featured card */
.lib-feat-card {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  padding: var(--s4) var(--s4) var(--s3);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

.lib-feat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--cyan) 60%, transparent);
  opacity: 0;
  transition: opacity 200ms ease;
}

.lib-feat-card:hover {
  border-color: var(--accent);
  box-shadow: var(--sh-md);
  transform: translateY(-2px);
}

.lib-feat-card:hover::before {
  opacity: 1;
}

.lib-feat-card:focus-visible {
  outline: 3px solid var(--accent-line);
  outline-offset: 3px;
}

.lib-feat-card__dept {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1.3;
}

.lib-feat-card__title {
  font-size: var(--t-sm);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
  flex: 1;
}

.lib-feat-card__arrow {
  align-self: flex-end;
  color: var(--muted);
  transition: color 150ms ease, transform 150ms ease;
}

.lib-feat-card:hover .lib-feat-card__arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* ── GRILLE PRINCIPALE ───────────────────────────────────────────────────── */

.lib-main {
  padding-top: var(--s8);
  padding-bottom: var(--s16);
}

/* Barre résultats */
.lib-results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s5);
  min-height: 32px;
  gap: var(--s4);
}

.lib-results-count {
  font-size: var(--t-sm);
  color: var(--muted);
  font-weight: 600;
}

.lib-reset-btn {
  font-family: var(--font);
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--s1) var(--s2);
  border-radius: var(--r-sm);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 150ms ease;
  touch-action: manipulation;
}

.lib-reset-btn:hover {
  color: var(--accent-hover);
}

.lib-reset-btn:focus-visible {
  outline: 3px solid var(--accent-line);
  outline-offset: 2px;
}

/* Grid — 3 cols desktop, 2 tablet, 1 mobile */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s4);
  align-items: start;
}

/* ── Carte article ──────────────────────────────────────────────────────── */

.lib-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: var(--s5);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}

/* Liseré teal en haut au hover — signature design system */
.lib-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--cyan) 60%, transparent);
  opacity: 0;
  transition: opacity 200ms ease;
}

.lib-card:hover {
  border-color: var(--accent);
  box-shadow: var(--sh-md);
  transform: translateY(-3px);
}

.lib-card:hover::before {
  opacity: 1;
}

.lib-card:focus-visible {
  outline: 3px solid var(--accent-line);
  outline-offset: 3px;
  border-radius: var(--r-lg);
}

/* Carte masquée par le filtre — display:none évite les trous dans la grille */
.lib-card--hidden {
  display: none;
}

/* Flagship card : légère brillance supplémentaire */
.lib-card--flagship {
  border-color: var(--accent-line);
  background: linear-gradient(145deg, #fff 70%, rgba(13,148,136,0.03));
}

/* Badge "Cas phare" */
.lib-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--r-pill);
  padding: 3px var(--s2);
  margin-bottom: var(--s3);
  align-self: flex-start;
  line-height: 1;
}

.lib-card__badge svg {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  fill: var(--accent);
}

/* Tags département + niveau */
.lib-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1);
  margin-bottom: var(--s3);
}

.lib-card__tag {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px var(--s2);
  border-radius: var(--r-pill);
  line-height: 1.3;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lib-card__tag--dept {
  background: rgba(13,148,136,0.08);
  color: var(--accent);
  border: 1px solid var(--accent-line);
}

.lib-card__tag--level {
  font-family: var(--mono);
  background: var(--fill);
  color: var(--muted);
  border: 1px solid var(--line-strong);
}

/* Titre de la carte */
.lib-card__title {
  font-size: var(--t-base);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  letter-spacing: -0.015em;
  margin: 0 0 var(--s2);
}

/* Description */
.lib-card__desc {
  font-size: var(--t-sm);
  color: var(--ink-soft);
  line-height: 1.58;
  flex: 1;
  margin: 0;

  /* Clamp à 3 lignes — évite les hauteurs variables extrêmes */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* CTA inline */
.lib-card__cta {
  display: block;
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--accent);
  margin-top: var(--s4);
  transition: color 150ms ease, gap 150ms ease;
}

.lib-card:hover .lib-card__cta {
  color: var(--accent-hover);
}

/* ── État vide ───────────────────────────────────────────────────────────── */

.lib-empty {
  text-align: center;
  padding: var(--s16) var(--s5);
}

.lib-empty__icon {
  color: var(--faint);
  margin: 0 auto var(--s4);
  width: 40px;
  height: 40px;
}

.lib-empty__icon svg {
  width: 40px;
  height: 40px;
}

.lib-empty__title {
  font-size: var(--t-md);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--s2);
}

.lib-empty__sub {
  font-size: var(--t-sm);
  color: var(--muted);
  line-height: 1.6;
}

.lib-empty__reset {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: inherit;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
  touch-action: manipulation;
}

.lib-empty__reset:hover {
  color: var(--accent-hover);
}

.lib-empty__reset:focus-visible {
  outline: 3px solid var(--accent-line);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────────── */

/* Tablet : 768px */
@media (max-width: 1024px) {
  .lib-featured-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .lib-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile : 640px */
@media (max-width: 640px) {
  .lib-hero {
    padding: var(--s8) 0 var(--s6);
  }

  .lib-hero__title {
    font-size: 1.85rem;
  }

  .lib-hero__sub {
    font-size: var(--t-base);
  }

  .lib-toolbar-wrap {
    padding: var(--s2) 0;
  }

  .lib-search-wrap {
    max-width: 100%;
  }

  .lib-featured-grid {
    grid-template-columns: 1fr;
  }

  .lib-grid {
    grid-template-columns: 1fr;
    gap: var(--s3);
  }

  .lib-card__desc {
    -webkit-line-clamp: 4;
  }

  .lib-section-head {
    margin-bottom: var(--s5);
  }

  /* Pills : scroll horizontal natif, fade sur le bord droit */
  .lib-pills {
    position: relative;
  }
}

/* ── Accessibilité : focus global bibliothèque ───────────────────────────── */

.lib-pill:focus-visible,
.lib-search:focus-visible,
.lib-card:focus-visible,
.lib-feat-card:focus-visible,
.lib-reset-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ── reduced-motion ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .lib-card,
  .lib-card::before,
  .lib-feat-card,
  .lib-feat-card::before,
  .lib-feat-card__arrow,
  .lib-pill,
  .lib-search {
    transition-duration: 0.01ms !important;
  }
}
