/* Direction Suisse — pages légales (mentions légales, CGV, confidentialité)
   Chargée APRÈS style.css. Texte long : ligne courte, titres numérotés par le navigateur
   (on peut retirer un article sans renuméroter à la main), tableaux qui s'empilent sur mobile.
   Aucun angle arrondi, aucune couleur hors blanc, noir, rouge et gris de style.css. */

/* ---------- Mise en page : repère + titre en haut, sommaire à gauche, texte à droite ---------- */
.legal__grille { row-gap: clamp(28px, 4vw, 56px); }
.legal__entete { grid-column: 4 / -1; min-width: 0; }
.legal__sommaire { grid-column: 1 / span 3; min-width: 0; align-self: start; }
.legal__texte { grid-column: 4 / -1; min-width: 0; counter-reset: article; }

/* « Confidentialité. » en 40 px ne tient pas sur un téléphone : titre un peu plus petit que sur les pages à formulaire */
.legal .titre-page { font-size: clamp(2rem, 1.2rem + 4vw, 4.25rem); overflow-wrap: break-word; }
.legal .chapeau { margin-bottom: 20px; }
.legal__maj { font-size: 0.875rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.legal__maj time { color: var(--rouge); }

/* ---------- Sommaire ---------- */
.legal__sommaire h2 { font-family: var(--texte); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.4; max-width: none; margin-bottom: 8px; }
.legal__sommaire ol { counter-reset: sommaire; border-top: var(--filet) solid var(--noir); }
.legal__sommaire li { counter-increment: sommaire; border-bottom: 1px solid var(--gris-clair); }
/* 44 px au moins : chaque ligne du sommaire est une zone à toucher */
.legal__sommaire a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 0; text-decoration: none; font-size: 0.9375rem; font-weight: 500; line-height: 1.3; }
.legal__sommaire a::before { content: counter(sommaire, decimal-leading-zero); flex: none; width: 2.2em; font-family: var(--titre); font-weight: 700; font-size: 0.8125rem; color: var(--rouge); }
/* L'annexe n'est pas un article : pas de numéro, ni ici ni dans le texte */
.legal__sommaire li.legal__sommaire-annexe { counter-increment: none; }
.legal__sommaire li.legal__sommaire-annexe a::before { content: "+"; }
.legal__sommaire a:hover { text-decoration: underline; text-decoration-thickness: 2px; }

@media (min-width: 861px) {
  /* Le sommaire suit la lecture. S'il est plus haut que l'écran, il défile tout seul. */
  .legal__sommaire { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; padding-right: 8px; }
}
@media (max-width: 860px) {
  .legal__entete, .legal__sommaire, .legal__texte { grid-column: 1 / -1; }
}

/* ---------- L'essentiel : le résumé en tête de page ---------- */
.legal__essentiel { border: var(--filet) solid var(--noir); padding: clamp(18px, 2.4vw, 32px); margin-bottom: clamp(36px, 5vw, 64px); max-width: 76ch; }
.legal__essentiel h2 { font-family: var(--texte); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.4; color: var(--rouge); max-width: none; }

/* ---------- Articles ---------- */
.legal__article { counter-increment: article; border-top: var(--filet) solid var(--noir); padding-block: clamp(24px, 3vw, 40px) clamp(28px, 4vw, 52px); scroll-margin-top: 16px; }
.legal__article > h2 { font-family: var(--titre); font-weight: 700; font-size: clamp(1.375rem, 1.1rem + 1.1vw, 2rem); line-height: 1.1; letter-spacing: -0.03em; max-width: 30ch; text-wrap: balance; }
.legal__article > h2::before { content: counter(article, decimal-leading-zero); display: block; margin-bottom: 8px; font-size: 1rem; letter-spacing: -0.01em; color: var(--rouge); }
.legal__annexe { counter-increment: none; }
.legal__annexe > h2::before { content: "Annexe"; font-family: var(--texte); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.legal__texte h3 { font-family: var(--titre); font-weight: 700; font-size: 1.125rem; line-height: 1.25; letter-spacing: -0.015em; margin-top: 1.9em; max-width: 60ch; }

/* style.css grossit le paragraphe qui suit un h2 de section : ici tout le texte garde la même taille */
.legal__texte p, .legal__article > h2 + p { margin-top: 0.95em; max-width: 68ch; font-size: inherit; line-height: 1.6; }
.legal__texte strong { font-weight: 600; }
.legal__texte a { overflow-wrap: anywhere; }

.legal__texte ul, .legal__texte ol { margin-top: 0.95em; max-width: 68ch; display: grid; gap: 0.55em; }
.legal__texte ul > li { position: relative; padding-left: 1.5em; }
.legal__texte ul > li::before { content: "–"; position: absolute; left: 0; color: var(--rouge); font-weight: 700; }
.legal__texte ol { counter-reset: etape; }
.legal__texte ol > li { counter-increment: etape; position: relative; padding-left: 2.2em; }
.legal__texte ol > li::before { content: counter(etape) "."; position: absolute; left: 0; font-family: var(--titre); font-weight: 700; color: var(--rouge); }
.legal__texte li > ul { margin-top: 0.55em; }

/* Fiche d'identité : libellé à gauche, valeur à droite ; l'un sous l'autre sur téléphone */
.legal__fiche { margin: 1.2em 0 0; max-width: 76ch; border-top: 1px solid var(--gris-clair); }
.legal__fiche > div { display: grid; grid-template-columns: minmax(0, 11em) minmax(0, 1fr); gap: 4px 20px; padding: 12px 0; border-bottom: 1px solid var(--gris-clair); }
.legal__fiche dt { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gris); padding-top: 0.2em; }
.legal__fiche dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .legal__fiche > div { grid-template-columns: 1fr; } }

/* Encadrés : textes officiels recopiés (la loi demande un « encadré » pour les garanties légales) et points à ne pas manquer */
.legal__encadre { border: var(--filet) solid var(--noir); padding: clamp(16px, 2.2vw, 28px); margin-top: 1.4em; max-width: 76ch; }
.legal__encadre > :first-child { margin-top: 0; }
.legal__encadre--rouge { border-color: var(--rouge); }
/* « .legal__texte p » fixe la taille de tout paragraphe : ces deux-là doivent peser plus lourd que lui */
.legal__texte .legal__encadre-titre { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.4; }
.legal__texte .legal__encadre--rouge .legal__encadre-titre { color: var(--rouge); }
.legal__formulaire { font-family: var(--texte); white-space: normal; }
.legal__formulaire p { margin-top: 0.8em; }
.legal__texte .legal__source { font-size: 0.875rem; line-height: 1.5; color: var(--gris); }

/* Information que seul Greg peut donner : bien visible tant qu'elle manque */
/* Marge colorée faite d'une ombre et non d'un remplissage : un remplissage répété à chaque ligne faisait déborder la cellule de 2 px sur téléphone */
.a-completer { background: var(--rouge); color: var(--blanc); padding: 2px 0; margin-inline: 5px; box-shadow: 5px 0 0 var(--rouge), -5px 0 0 var(--rouge); font-weight: 600; box-decoration-break: clone; -webkit-box-decoration-break: clone; overflow-wrap: anywhere; }

/* ---------- Tableaux ---------- */
.legal__tableau { width: 100%; max-width: 100%; margin-top: 1.4em; border-collapse: collapse; font-size: 0.9375rem; line-height: 1.45; table-layout: fixed; }
.legal__tableau caption { text-align: left; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding-bottom: 10px; }
.legal__tableau th, .legal__tableau td { text-align: left; vertical-align: top; padding: 14px 16px 14px 0; border-top: 1px solid var(--gris-clair); overflow-wrap: anywhere; hyphens: auto; }
.legal__tableau thead th { border-top: var(--filet) solid var(--noir); border-bottom: var(--filet) solid var(--noir); font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.legal__tableau tbody th { font-weight: 600; hyphens: manual; }
/* Largeurs de colonnes : la colonne la plus bavarde reçoit le plus de place (table-layout: fixed lit la première ligne) */
.legal__tableau--traitements thead th:nth-child(1) { width: 17%; }
.legal__tableau--traitements thead th:nth-child(2) { width: 31%; }
.legal__tableau--traitements thead th:nth-child(3) { width: 23%; }
.legal__tableau--prestataires thead th:nth-child(1) { width: 17%; }
.legal__tableau--prestataires thead th:nth-child(2) { width: 18%; }
.legal__tableau--prestataires thead th:nth-child(3) { width: 22%; }
.legal__tableau--prestataires thead th:nth-child(4) { width: 14%; }
.legal__tableau tbody tr:last-child > * { border-bottom: var(--filet) solid var(--noir); }

@media (max-width: 760px) {
  /* Sur téléphone, chaque ligne devient une fiche : pas de défilement horizontal. Les rôles ARIA posés dans le HTML gardent le tableau lisible au lecteur d'écran. */
  .legal__tableau, .legal__tableau tbody, .legal__tableau tr, .legal__tableau th, .legal__tableau td, .legal__tableau caption { display: block; width: 100%; }
  .legal__tableau thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .legal__tableau tbody tr { border-top: var(--filet) solid var(--noir); padding: 14px 0 10px; }
  .legal__tableau tbody tr:last-child { border-bottom: var(--filet) solid var(--noir); }
  .legal__tableau tbody tr:last-child > * { border-bottom: 0; }
  .legal__tableau tbody th, .legal__tableau tbody td { border-top: 0; padding: 4px 0; hyphens: manual; }
  .legal__tableau tbody th { font-family: var(--titre); font-size: 1.125rem; letter-spacing: -0.015em; padding-bottom: 8px; }
  .legal__tableau tbody td::before { content: attr(data-titre); display: block; margin-top: 8px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gris); }
}

/* ---------- Bas de page : passer d'une page légale à l'autre ---------- */
.legal__suite { margin-top: clamp(28px, 4vw, 48px); border-top: var(--filet) solid var(--noir); padding-top: 20px; display: flex; flex-wrap: wrap; gap: 8px 28px; }
.legal__suite a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }

/* ---------- Impression : les CGV doivent pouvoir être gardées et reproduites ---------- */
@media print {
  .entete .nav, .lien-evitement, .legal__sommaire, .legal__suite, .pied__liens { display: none !important; }
  .legal__entete, .legal__texte, .section__repere { grid-column: 1 / -1; }
  .section { padding-block: 12px; }
  .legal__article { break-inside: auto; padding-block: 14px; }
  .legal__article > h2 { break-after: avoid; }
  .legal__encadre, .legal__tableau tr { break-inside: avoid; }
  .pied { background: none; color: #000; padding-block: 16px 0; }
  .pied__avis { font-size: 0.9375rem; }
  .pied__editeur { color: #000; border-top-color: #000; }
  .a-completer { background: none; color: #000; border: 1px solid #000; }
  a { text-decoration: none; }
}
