/* Pages légales de l'espace client (src/modules/aide.ts, textes de src/legal) : lecture longue à la charte
   (design/CHARTE.md), sommaire, tableaux lisibles, crochets à compléter surlignés, impression propre.
   Thème clair uniquement. Chargée en plus de style.css sur ces cinq pages seulement. */

/* Sans compte, la colonne publique fait 520 px : trop étroit pour un texte juridique et ses tableaux. À 1120 px, il
   reste environ 800 px à droite du sommaire (232 px + 32 px de gouttière) : les tableaux à six colonnes des CGV
   tiennent sans défilement horizontal sur ordinateur. */
.public--legal { max-width: 1120px; }

.legal-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }

/* ---------- Sommaire ---------- */
.legal-toc {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-field);
  padding: 16px 20px; box-shadow: var(--shadow-1);
}
.legal-toc__title { font-size: .8125rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--soft); margin: 0 0 8px; }
.legal-toc__list { margin: 0; padding-left: 20px; font-size: .9rem; line-height: 1.5; }
/* Sommaire des textes légaux : leurs titres sont déjà numérotés, la liste ne l'est pas (le guide garde ses numéros). */
.legal-toc__list--plain { list-style: none; padding-left: 0; }
.legal-toc__list li + li { margin-top: 4px; }
.legal-toc__list a { color: var(--ink); font-weight: 500; text-decoration: none; transition: color .15s ease; }
.legal-toc__list a:hover { color: var(--ember-d); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Corps du texte : largeur de lecture d'environ 72 caractères pour la prose seulement ----------
   Les tableaux échappent à cette contrainte et prennent toute la colonne (six colonnes ne tiennent pas dans 72ch). */
.legal { min-width: 0; font-size: 1rem; line-height: 1.65; color: var(--ink); overflow-wrap: anywhere; }
.legal > p, .legal > ul, .legal > ol, .legal > h2, .legal > h3 { max-width: 72ch; }
/* Titres d'article en Inter Tight, sans capitales : le zéro barré d'Orbitron se lit « Ø » (« ARTICLE 1Ø ») et des
   titres longs en capitales gênent une lecture juridique longue. La terracotta des titres est conservée. */
.legal h2 {
  font-family: "Inter Tight", system-ui, sans-serif; font-size: 1.25rem; font-weight: 700; line-height: 1.3;
  text-transform: none; letter-spacing: 0; font-variant-numeric: tabular-nums; color: var(--title);
  margin: 36px 0 12px; scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.legal > h2:first-child { margin-top: 0; }
.legal h3 { font-size: 1rem; font-weight: 700; color: var(--ink); margin: 22px 0 6px; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.legal p { margin: 0 0 14px; }
.legal ul, .legal ol { margin: 0 0 14px; padding-left: 24px; }
.legal li { margin: 4px 0; }
.legal li > ul, .legal li > ol { margin: 4px 0 0; }
.legal hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.legal a { overflow-wrap: anywhere; }

/* Tableaux : boîte blanche rayon 14 px, défilement horizontal sur petit écran, texte à la ligne dans les cellules. */
.legal-table { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-field); background: #fff; margin: 0 0 18px; }
.legal-table table { min-width: 640px; font-size: .9rem; }
.legal-table th { white-space: normal; background: #f7f1e7; vertical-align: bottom; }
.legal-table td { line-height: 1.5; }
.legal-table tr:hover td { background: #fffaf6; }

/* Crochets « [À COMPLÉTER …] » : surlignés en tonalité « attention » pour rester visibles jusqu'à leur remplacement. */
mark.legal-todo {
  background: var(--warn-bg); color: var(--warn); border-radius: 4px; padding: 0 4px; font-weight: 600;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}

/* ---------- Navigation entre les cinq documents, en bas de page ---------- */
.legal-nav { border-top: 1px solid var(--line); padding-top: 20px; }
.legal-nav__title { font-size: .9rem; font-weight: 600; color: var(--soft); margin: 0 0 10px; }
.legal-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.legal-nav a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-field);
  color: var(--ink); font-weight: 500; font-size: .92rem; text-decoration: none;
  transition: border-color .15s ease, color .15s ease;
}
.legal-nav a:hover { border-color: var(--ember); color: var(--ember-d); text-decoration: none; }
.legal-nav a[aria-current="page"] { background: var(--beige); border-color: var(--beige); color: var(--title); font-weight: 700; }

/* ---------- Grand écran : sommaire collant à gauche du texte ---------- */
@media (min-width: 1024px) {
  .legal-page { grid-template-columns: 232px minmax(0, 1fr); gap: 32px; }
  .legal-toc { position: sticky; top: calc(var(--topbar-h) + 24px); max-height: calc(100vh - var(--topbar-h) - 48px); overflow-y: auto; }
}

/* ---------- Impression et enregistrement en PDF ---------- */
@media print {
  .page-head__actions, .legal-nav, .alert { display: none !important; }
  .public, .content { max-width: none; padding: 0; }
  .legal-page { display: block; }
  .legal-toc { border: 0; box-shadow: none; padding: 0; margin: 0 0 24px; }
  .legal { font-size: 11pt; line-height: 1.5; }
  .legal > p, .legal > ul, .legal > ol, .legal > h2, .legal > h3 { max-width: none; }
  .legal h2 { break-after: avoid; font-size: 13pt; }
  .legal-table { border: 0; overflow: visible; }
  .legal-table table { min-width: 0; font-size: 9.5pt; }
  .legal-table tr { break-inside: avoid; }
  .legal a { color: inherit; text-decoration: none; }
  mark.legal-todo { background: none; color: inherit; border: 1px solid currentColor; }
}

/* =============================================================
   Revue design 2 du 20/09/2026.
   - Tableaux : « overflow-wrap: anywhere » (hérité de .legal) laissait la première colonne se réduire à quelques
     lettres (« Catégorie / s de / personne / s »). Les cellules ne coupent plus qu'un mot trop long pour elles, et la
     colonne des libellés garde une largeur lisible ; sur petit écran le tableau défile dans son cadre.
   - Navigation du bas et sommaire : cibles tactiles de 44 px sous 860 px.
   ============================================================= */
.legal-table th, .legal-table td { overflow-wrap: break-word; vertical-align: top; }
.legal-table td:first-child, .legal-table th:first-child { min-width: 9.5em; }
.legal-table td:first-child { font-weight: 600; color: var(--ink); }
.legal-table { margin: 0 0 24px; }
@media (max-width: 860px) {
  .legal-nav a { min-height: 44px; }
  .legal-toc__list a { display: inline-flex; align-items: center; min-height: 44px; }
  .legal-toc__list li + li { margin-top: 0; }
}
