/* Pages légales (/mentions-legales, /confidentialite) : colonne de lecture, titres du carnet, tableau des données.
   Chargé après tokens.css, composants.css, style.css et accueil.css (en-tête, logo et pied de page viennent d'accueil.css).
   Tailles en rem, jamais sous 0,9375rem (15 px) : le texte courant fait 1,125rem (18 px), le tableau 0,9375rem. */

.legal {
  max-width: 44rem; margin: 0 auto; padding: var(--space-2) var(--space-5) var(--space-7);
  font-size: var(--text-body); line-height: 1.6;
}
.legal a { color: var(--ink); text-underline-offset: 4px; overflow-wrap: anywhere; }
.legal a:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

/* Lien de retour : cible de 3rem de haut, en haut et en bas de la page. */
.retour { margin: 0; }
.retour a { display: inline-flex; align-items: center; min-height: 3rem; font-weight: 700; }
.retour-bas { margin-top: var(--space-6); }

.legal h1 { margin: var(--space-3) 0 var(--space-3); font-size: var(--text-display); line-height: 1.1; text-wrap: balance; }
.legal-intro { margin: 0 0 var(--space-3); font-size: 1.1875rem; }
.legal-maj { margin: 0 0 var(--space-5); font-size: var(--text-body-sm); }

/* Sommaire : liste d'ancres. */
.sommaire { margin: 0 0 var(--space-6); padding: var(--space-4) 1.125rem; background: var(--sky); border: var(--border-regular) solid var(--ink); border-radius: var(--radius-field); }
.sommaire h2 { margin: 0 0 var(--space-2); font-size: var(--text-title-sm); }
.sommaire ol { margin: 0; padding-left: 1.5rem; }
.sommaire li { margin: 0; }
.sommaire a { display: inline-flex; align-items: center; min-height: 2.75rem; font-weight: 700; }

.bloc-legal { margin: 0 0 var(--space-6); }
.bloc-legal h2 { margin: 0 0 var(--space-2); font-size: var(--text-title-sm); line-height: 1.2; scroll-margin-top: var(--space-4); }
.bloc-legal p { margin: 0 0 var(--space-3); }
.bloc-legal ul { margin: 0 0 var(--space-3); padding-left: 1.5rem; display: flex; flex-direction: column; gap: var(--space-2); }
.bloc-legal h2:target { text-decoration: underline wavy var(--peach); text-underline-offset: 6px; }

/* Tableau des données envoyées : quatre colonnes sur grand écran, une carte par ligne sur téléphone (pas de défilement horizontal). */
.tableau-donnees { width: 100%; margin: var(--space-3) 0; border-collapse: collapse; font-size: var(--text-body-sm); line-height: 1.5; background: var(--paper); }
.tableau-donnees th, .tableau-donnees td { padding: var(--space-3); border: var(--border-regular) solid var(--ink); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.tableau-donnees thead th { background: var(--cream); font-weight: 700; }
.tableau-donnees tbody th { font-weight: 700; }

@media (max-width: 47.9375rem) {
  .tableau-donnees, .tableau-donnees tbody, .tableau-donnees tr, .tableau-donnees th, .tableau-donnees td { display: block; width: 100%; }
  /* L'en-tête visuel disparaît (lu par les lecteurs d'écran) : chaque cellule répète son titre. */
  .tableau-donnees thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tableau-donnees tr { margin: 0 0 var(--space-4); border: var(--border-regular) solid var(--ink); border-radius: var(--radius-field); box-shadow: 3px 4px 0 var(--ground); overflow: hidden; }
  .tableau-donnees th, .tableau-donnees td { border: 0; border-bottom: 1px solid var(--ink); }
  .tableau-donnees tr > :last-child { border-bottom: 0; }
  .tableau-donnees tbody th { background: var(--cream); }
  .tableau-donnees td::before, .tableau-donnees tbody th::before {
    content: attr(data-label); display: block; margin-bottom: 0.125rem; font-weight: 700; font-size: var(--text-body-sm);
  }
  .tableau-donnees td::before { color: var(--ink); opacity: 0.85; }
  /* La première colonne est le nom de la ligne : pas de titre répété. */
  .tableau-donnees tbody th::before { content: none; }
}

@media (min-width: 60rem) {
  .legal { padding-bottom: 5rem; }
  .legal h1 { font-size: 3rem; }
}

@media print {
  .entete, .pied, .retour, .sommaire { display: none; }
  .legal { max-width: none; padding: 0; }
}
