/* =====================================================================
   ds-v2-legal.css — Pages légales (CGV, CGU, mentions légales,
   politique de confidentialité) en Direction Artistique 2.0.

   Ce fichier se charge APRÈS ds-v2.css et ds-v2-pages.css et n'intervient
   que sur les pages légales (tout est scopé sous .lgl-*). Il n'utilise que
   les tokens --v2-* définis dans ds-v2.css.

   Trois contraintes dictent la plupart des règles ci-dessous :
   - styles.css (DA 1, chargé globalement) impose « ul { list-style:none;
     margin:0; padding:0 } » et une couleur sur h1..h6/a : il faut donc
     tout re-déclarer explicitement, au niveau classe, pour reprendre la main ;
   - ds-v2.css neutralise les marges de p/h2/h3 sous .nhp-main via :where() ;
   - le header pill est fixe : les ancres ont besoin d'un scroll-margin-top.
   ===================================================================== */

/* =====================================================================
   1. Colonne de lecture
   ===================================================================== */

/* Largeur de ligne confortable pour de la prose juridique (~78 caractères).
   Le .nhp-wrap parent gère déjà les gouttières et le centrage. */
.lgl-doc {
    max-width: 78ch;
    font-family: var(--v2-font-sans);
    font-size: var(--v2-fs-body);
    line-height: 1.75;
    color: var(--v2-ink-soft);
}

/* Chapô introductif, juste sous le sommaire. */
.lgl-intro {
    font-size: var(--v2-fs-lead);
    line-height: 1.6;
    color: var(--v2-ink-soft);
    margin: 0 0 clamp(28px, 4vw, 44px);
}

/* =====================================================================
   2. Sommaire cliquable
   ===================================================================== */

.lgl-toc {
    background: var(--v2-steel-100);
    border: 1px solid var(--v2-steel-200);
    border-left: 3px solid var(--v2-green);
    border-radius: var(--v2-r);
    padding: clamp(20px, 3vw, 28px) clamp(18px, 3vw, 30px);
    margin: 0 0 clamp(30px, 4.5vw, 48px);
    box-shadow: var(--v2-sh-1);
}

.lgl-toc-head {
    display: block;
    font-family: var(--v2-font-mono);
    font-size: var(--v2-fs-eyebrow);
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--v2-ink-soft);
    margin: 0 0 var(--v2-s4);
}

/* Deux colonnes dès qu'il y a la place ; une seule sur mobile. */
.lgl-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2px clamp(16px, 3vw, 34px);
}

.lgl-toc-list li { margin: 0; }

.lgl-toc-link {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 7px 8px 7px 0;
    color: var(--v2-ink);
    font-size: 0.95rem;
    line-height: 1.4;
    text-decoration: none;
    border-radius: var(--v2-r-sm);
    transition: color 0.2s var(--v2-ease), transform 0.2s var(--v2-ease);
}
.lgl-toc-link:hover,
.lgl-toc-link:focus-visible {
    color: var(--v2-green-deep);
    transform: translateX(3px);
}
.lgl-toc-link:focus-visible {
    outline: 2px solid var(--v2-green);
    outline-offset: 2px;
}

/* Numéro en mono : rappelle le badge des titres de section. */
.lgl-toc-num {
    flex: none;
    min-width: 2.1em;
    font-family: var(--v2-font-mono);
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--v2-green-deep);
}

/* =====================================================================
   3. Sections et titres
   ===================================================================== */

/* Décalage d'ancre : le header pill flotte au-dessus du contenu. */
.lgl-sec {
    scroll-margin-top: clamp(96px, 13vw, 132px);
    padding-top: clamp(26px, 4vw, 40px);
    margin-top: clamp(26px, 4vw, 40px);
    border-top: 1px solid var(--v2-steel-200);
}
.lgl-sec:first-of-type {
    padding-top: 0;
    margin-top: 0;
    border-top: 0;
}

.lgl-h2 {
    display: flex;
    align-items: baseline;
    gap: clamp(10px, 1.6vw, 16px);
    font-family: var(--v2-font-display);
    font-size: clamp(1.32rem, 2.4vw, 1.72rem);
    font-weight: 600;
    line-height: 1.18;
    letter-spacing: -0.01em;
    color: var(--v2-ink);
    margin: 0 0 var(--v2-s4);
}

/* Numéro de section : pastille mono discrète, alignée sur la ligne de base. */
.lgl-h2-num {
    flex: none;
    font-family: var(--v2-font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--v2-green-deep);
    background: rgba(45, 148, 70, 0.09);
    border: 1px solid rgba(45, 148, 70, 0.22);
    border-radius: var(--v2-r-sm);
    padding: 4px 8px;
    line-height: 1;
    transform: translateY(-0.18em);
}

.lgl-h3 {
    font-family: var(--v2-font-display);
    font-size: clamp(1.04rem, 1.5vw, 1.16rem);
    font-weight: 600;
    line-height: 1.32;
    letter-spacing: 0;
    color: var(--v2-ink);
    margin: clamp(22px, 3vw, 30px) 0 var(--v2-s3);
}
.lgl-h3 .lgl-h3-num {
    font-family: var(--v2-font-mono);
    font-size: 0.82em;
    font-weight: 500;
    color: var(--v2-green-deep);
    margin-right: 0.55em;
}

/* =====================================================================
   4. Texte courant, listes, liens
   ===================================================================== */

.lgl-doc p {
    margin: 0 0 1.05em;
    line-height: 1.75;
}
.lgl-doc p:last-child { margin-bottom: 0; }

.lgl-doc strong,
.lgl-doc b {
    color: var(--v2-ink);
    font-weight: 600;
}

/* styles.css met « list-style: none » sur tous les ul du site : on rétablit. */
.lgl-list {
    list-style: none;
    margin: 0 0 1.05em;
    padding: 0;
}
.lgl-list > li {
    position: relative;
    padding-left: 1.55em;
    margin: 0 0 0.55em;
    line-height: 1.7;
}
.lgl-list > li::before {
    content: "";
    position: absolute;
    left: 0.25em;
    top: 0.72em;
    width: 7px;
    height: 1px;
    background: var(--v2-green);
}
.lgl-list > li:last-child { margin-bottom: 0; }

/* Liste numérotée (compteur CSS : pas de puce native à reformater). */
.lgl-list--num {
    counter-reset: lglitem;
}
.lgl-list--num > li::before {
    counter-increment: lglitem;
    content: counter(lglitem) ".";
    background: none;
    width: auto;
    height: auto;
    top: 0;
    left: 0;
    font-family: var(--v2-font-mono);
    font-size: 0.8em;
    color: var(--v2-green-deep);
}

/* Liens dans la prose : ds-v2.css les remet en « color: inherit » sans
   soulignement, il faut donc les redéclarer pour rester identifiables. */
.lgl-doc a:not(.lgl-toc-link):not(.lgl-btn) {
    color: var(--v2-green-deep);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(28, 110, 52, 0.4);
    transition: text-decoration-color 0.2s var(--v2-ease), color 0.2s var(--v2-ease);
}
.lgl-doc a:not(.lgl-toc-link):not(.lgl-btn):hover {
    text-decoration-color: currentColor;
}
.lgl-doc a:focus-visible {
    outline: 2px solid var(--v2-green);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Coordonnées en mono (téléphone, e-mail, référence). */
.lgl-mono {
    font-family: var(--v2-font-mono);
    font-size: 0.94em;
    letter-spacing: 0.01em;
}

/* =====================================================================
   5. Carte d'identité (couples libellé / valeur)
   ===================================================================== */

.lgl-id {
    display: grid;
    grid-template-columns: minmax(140px, 15em) 1fr;
    gap: 0;
    margin: 0 0 1.2em;
    padding: 0;
    background: var(--v2-steel-100);
    border: 1px solid var(--v2-steel-200);
    border-radius: var(--v2-r);
    overflow: hidden;
}
.lgl-id dt,
.lgl-id dd {
    margin: 0;
    padding: 11px clamp(14px, 2vw, 18px);
    border-top: 1px solid var(--v2-steel-200);
    line-height: 1.55;
}
.lgl-id > dt:first-of-type,
.lgl-id > dt:first-of-type + dd { border-top: 0; }
.lgl-id dt {
    font-family: var(--v2-font-mono);
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--v2-ink-soft);
    background: rgba(21, 19, 15, 0.025);
}
.lgl-id dd { color: var(--v2-ink); }

/* =====================================================================
   6. Encadrés (points d'attention)
   ===================================================================== */

.lgl-note {
    background: var(--v2-steel-100);
    border: 1px solid var(--v2-steel-200);
    border-left: 3px solid var(--v2-green);
    border-radius: var(--v2-r);
    padding: clamp(15px, 2.2vw, 20px) clamp(16px, 2.4vw, 22px);
    margin: 1.3em 0;
}
.lgl-note p { margin-bottom: 0.7em; }
.lgl-note > *:last-child { margin-bottom: 0; }

/* Variante « attention » : clause ferme (non-remboursement, forclusion…). */
.lgl-note--warn {
    background: rgba(217, 98, 43, 0.045);
    border-color: rgba(217, 98, 43, 0.22);
    border-left-color: var(--v2-ember);
}

.lgl-note-title {
    display: block;
    font-family: var(--v2-font-mono);
    font-size: var(--v2-fs-eyebrow);
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--v2-ink-soft);
    margin-bottom: var(--v2-s2);
}
.lgl-note--warn .lgl-note-title { color: var(--v2-ember); }

/* =====================================================================
   7. Tableaux (durées de conservation, finalités / bases légales…)
   ===================================================================== */

/* Le conteneur scrolle horizontalement : la page, elle, ne bouge jamais. */
.lgl-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1.2em 0 1.4em;
    border: 1px solid var(--v2-steel-200);
    border-radius: var(--v2-r);
    background: var(--v2-steel-100);
}

.lgl-table {
    width: 100%;
    min-width: 460px;
    border-collapse: collapse;
    font-size: 0.93rem;
    line-height: 1.6;
}
.lgl-table caption {
    caption-side: top;
    text-align: left;
    padding: 12px clamp(12px, 2vw, 16px) 0;
    font-family: var(--v2-font-mono);
    font-size: var(--v2-fs-eyebrow);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--v2-ink-soft);
}
.lgl-table th,
.lgl-table td {
    padding: 11px clamp(12px, 2vw, 16px);
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--v2-steel-200);
}
.lgl-table thead th {
    font-family: var(--v2-font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--v2-ink-soft);
    background: rgba(21, 19, 15, 0.03);
    white-space: nowrap;
}
.lgl-table tbody th {
    font-weight: 600;
    color: var(--v2-ink);
}
.lgl-table tbody tr:last-child th,
.lgl-table tbody tr:last-child td { border-bottom: 0; }

/* =====================================================================
   8. Pied de page du document
   ===================================================================== */

.lgl-foot {
    margin-top: clamp(34px, 5vw, 54px);
    padding-top: clamp(18px, 2.6vw, 26px);
    border-top: 1px solid var(--v2-steel-200);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--v2-s3);
}

.lgl-updated {
    font-family: var(--v2-font-mono);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    color: var(--v2-ink-soft);
    margin: 0;
}

.lgl-foot-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--v2-s4);
    font-size: 0.88rem;
}

/* =====================================================================
   9. Responsive
   ===================================================================== */

@media (max-width: 720px) {
    .lgl-toc-list { grid-template-columns: 1fr; }

    /* Carte d'identité : libellé au-dessus de la valeur. */
    .lgl-id { grid-template-columns: 1fr; }
    .lgl-id dt { border-top: 1px solid var(--v2-steel-200); padding-bottom: 4px; }
    .lgl-id dd { border-top: 0; padding-top: 0; }
    .lgl-id > dt:first-of-type { border-top: 0; }

    .lgl-h2 {
        flex-direction: column;
        gap: var(--v2-s2);
    }
    .lgl-h2-num {
        align-self: flex-start;
        transform: none;
    }

    .lgl-foot { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    .lgl-toc-link { transition: none; }
    .lgl-toc-link:hover,
    .lgl-toc-link:focus-visible { transform: none; }
}

/* =====================================================================
   10. Impression — un document légal doit rester imprimable proprement
   ===================================================================== */

@media print {
    .lgl-toc,
    .lgl-foot-links { display: none; }
    .lgl-doc { max-width: none; color: #000; }
    .lgl-sec { break-inside: avoid-page; }
    .lgl-h2, .lgl-h3 { break-after: avoid-page; }
    .lgl-note, .lgl-table-wrap { break-inside: avoid; }
}
