/* ================================================================
   HEAR THE LIGHT — Pages légales
   (mentions-legales.html, cgv.html, cgu.html, confidentialite.html)
   L'idée forte, une seule : le sommaire est un petit spectre. Chaque
   article est un faisceau fin ; celui que l'on lit s'allume et ses
   voisins s'éclairent un peu, comme un égaliseur. Tout le reste est
   calme : une colonne de texte de ~68 caractères, beaucoup d'air.
   Règles projet : animations toujours actives, mobile uniquement dans
   @media (max-width: 768px). Couleurs : jetons de palette uniquement.
   ================================================================ */

.lg { position: relative; z-index: 2; }

/* ── En-tête ──────────────────────────────────────────────────── */
.lg-head {
  position: relative;
  padding-top: calc(var(--nav-h) + clamp(56px, 9vw, 150px));
  padding-bottom: clamp(40px, 5vw, 72px);
}
.lg-head::before {
  content: '';
  position: absolute; z-index: -1; pointer-events: none;
  left: 0; top: 0; width: min(820px, 80vw); height: 100%;
  background: radial-gradient(55% 50% at 18% 72%, color-mix(in srgb, var(--light) 9%, transparent), transparent 70%);
}
.lg-title {
  --tune-to: 78;
  max-width: 15ch;
  margin-left: -.04em;
  hyphens: manual;
}
.lg-meta {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 46ch);
  justify-content: start;
  align-items: start;
  gap: 16px clamp(32px, 6vw, 96px);
  margin-top: clamp(28px, 3.5vw, 48px);
}
.lg-updated { margin: 0; font-size: 14px; color: var(--muted); white-space: nowrap; }
.lg-note {
  margin: 0;
  padding-left: 16px;
  border-left: 2px solid var(--light);
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.lg-note__switch {
  display: inline-flex; align-items: center;
  min-height: 32px; margin-top: 4px; padding: 0;
  border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--fg);
  text-decoration: underline; text-decoration-color: var(--light);
  text-underline-offset: 4px; text-decoration-thickness: 1px;
}
.lg-note__switch:hover { color: var(--light); }
html[lang="en"] .lg-note__switch[data-htl-lang="en"],
html:not([lang="en"]) .lg-note__switch[data-htl-lang="fr"] { display: none; }

/* Les quatre documents, côte à côte */
.lg-docs {
  display: flex; flex-wrap: wrap; gap: 4px 28px;
  margin-top: clamp(36px, 4vw, 56px);
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 14px; font-weight: 500;
}
.lg-docs a { color: var(--muted); padding: 4px 0; transition: color .25s; }
.lg-docs a:hover { color: var(--fg); }
.lg-docs a[aria-current="page"] {
  color: var(--fg);
  text-decoration: underline; text-decoration-color: var(--light);
  text-underline-offset: 6px; text-decoration-thickness: 2px;
}

/* ── Corps : sommaire + texte ─────────────────────────────────── */
.lg-layout {
  display: grid;
  grid-template-columns: minmax(190px, 260px) minmax(0, 68ch);
  justify-content: start;
  align-items: start;
  gap: clamp(40px, 7vw, 128px);
  padding-bottom: clamp(80px, 10vw, 160px);
}

/* Sommaire (le « spectre ») */
.lg-toc {
  position: sticky;
  top: calc(var(--nav-h) + 28px);
  max-height: calc(100vh - var(--nav-h) - 56px);
  overflow-y: auto;
  scrollbar-width: none;
}
.lg-toc::-webkit-scrollbar { display: none; }
.lg-toc__sum {
  list-style: none;
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 18px;
  font-size: 13px; font-weight: 500; color: var(--muted);
  pointer-events: none;
}
.lg-toc__sum::-webkit-details-marker { display: none; }
.lg-toc__count { font-variant-numeric: tabular-nums; }
.lg-toc__chev { display: none; width: 16px; height: 16px; margin-left: auto; transition: transform .4s var(--ease-out); }
.lg-toc__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.lg-toc__list a {
  display: grid;
  grid-template-columns: 14px 24px minmax(0, 1fr);
  align-items: center;
  min-height: 34px;
  font-size: 14px; line-height: 1.3;
  color: var(--muted);
  transition: color .3s;
}
.lg-toc__list a::before {
  content: '';
  justify-self: start;
  width: 2px; height: 10px; border-radius: 2px;
  background: var(--line);
  transition: height .5s var(--ease-out), background-color .4s, box-shadow .5s var(--ease-out);
}
.lg-toc__n {
  font-family: var(--font-display); font-weight: 700; font-size: 12px;
  font-variation-settings: 'wdth' 70; font-variant-numeric: tabular-nums;
  color: var(--muted); opacity: .7;
}
.lg-toc__list a:hover { color: var(--fg); }
.lg-toc__list a:hover::before { height: 16px; background: var(--fg); }
/* Le faisceau voisin s'éclaire un peu (égaliseur) */
.lg-toc__list li:has(+ li > a.is-current) > a::before,
.lg-toc__list li:has(> a.is-current) + li > a::before {
  height: 16px;
  background: color-mix(in srgb, var(--light) 45%, var(--line));
}
.lg-toc__list a.is-current { color: var(--fg); }
.lg-toc__list a.is-current::before {
  height: 26px;
  background: var(--light);
  box-shadow: 0 0 14px var(--light), 0 0 2px var(--light);
}
.lg-toc__list a.is-current .lg-toc__n { color: var(--light); opacity: 1; }

/* Texte */
.lg-doc { min-width: 0; }
.lg-sec {
  padding: clamp(32px, 3.6vw, 48px) 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--nav-h) + 16px);
}
.lg-sec:first-child { padding-top: 0; border-top: 0; }
.lg-sec__t {
  display: flex; align-items: baseline; gap: 16px;
  margin: 0 0 18px;
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(22px, 2vw, 28px); line-height: 1.08;
  font-variation-settings: 'wdth' 96;
  letter-spacing: -.005em;
  text-wrap: balance;
}
.lg-sec__n {
  flex: none;
  font-size: .62em; font-weight: 700;
  font-variation-settings: 'wdth' 70;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  transform: translateY(-.12em);
}
.lg-sec__body {
  font-size: 17px; line-height: 1.68;
  color: color-mix(in srgb, var(--fg) 82%, var(--bg));
  overflow-wrap: break-word;
}
.lg-sec__body p { margin: 0 0 14px; }
.lg-sec__body > :last-child { margin-bottom: 0; }
.lg-sec__body strong { color: var(--fg); font-weight: 600; }
.lg-sec__body em { font-style: italic; }
.lg .lg-sec__body a,
.lg .lg-end a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--light) 70%, transparent);
  text-underline-offset: 3px; text-decoration-thickness: 1px;
  overflow-wrap: anywhere;
  transition: text-decoration-color .25s, color .25s;
}
.lg .lg-sec__body a:hover,
.lg .lg-end a:hover { color: var(--light); text-decoration-color: var(--light); }
.lg-sec__body ul { list-style: none; margin: 4px 0 16px; padding: 0; display: grid; gap: 10px; }
.lg-sec__body li { position: relative; padding-left: 22px; }
.lg-sec__body li::before {
  content: '';
  position: absolute; left: 2px; top: .52em;
  width: 2px; height: .8em; border-radius: 2px;
  background: var(--light);
}

/* Fin de document */
.lg-end {
  margin-top: clamp(24px, 3vw, 40px);
  padding-top: clamp(32px, 4vw, 56px);
  border-top: 1px solid var(--line);
}
.lg-end__t {
  margin: 0 0 10px;
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(26px, 2.6vw, 40px); line-height: 1;
  font-variation-settings: 'wdth' 84;
}
.lg-end p { margin: 0; font-size: 17px; color: var(--muted); }

/* ================================================================
   MOBILE (≤ 768px)
   ================================================================ */
@media (max-width: 768px) {
  .lg-head { padding-top: calc(var(--nav-h) + 48px); padding-bottom: 32px; }
  .lg-head::before { width: 100%; }
  .lg-title { font-size: clamp(36px, 10.5vw, 56px); max-width: none; hyphens: auto; }
  .lg-meta { grid-template-columns: 1fr; gap: 14px; margin-top: 24px; }
  .lg-updated { white-space: normal; }
  .lg-note__switch { min-height: 44px; }
  .lg-docs { gap: 0 22px; margin-top: 28px; padding-top: 12px; }
  .lg-docs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }

  .lg-layout { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-bottom: 96px; }

  .lg-toc {
    position: static; max-height: none; overflow: visible;
    border-radius: var(--r-media);
    background: var(--bg-2);
    box-shadow: inset 0 0 0 1px var(--line);
  }
  .lg-toc__sum {
    pointer-events: auto; cursor: pointer;
    min-height: 52px; margin: 0; padding: 0 18px;
    font-size: 15px; color: var(--fg);
  }
  .lg-toc__chev { display: block; }
  .lg-toc[open] .lg-toc__chev { transform: rotate(180deg); }
  .lg-toc__list { padding: 0 18px 14px; gap: 0; }
  .lg-toc__list a { min-height: 44px; font-size: 15px; }
  .lg-toc__list a.is-current::before { height: 20px; }

  .lg-sec { padding: 28px 0; }
  .lg-sec__t { gap: 12px; font-size: 22px; }
  .lg-sec__body { font-size: 16px; line-height: 1.65; }
  .lg-end p { font-size: 16px; }
}

/* ================================================================
   CORRECTEUR MOBILE M2 (≤ 768 px) : pastille « article en cours »
   + sommaire en feuille du bas (js/legal-toc-mobile.js). PC inchangé.
   ================================================================ */
.lg-pill, .lg-sheet, .lg-sheet-veil { display: none; }
@media (max-width: 768px) {
  .lg-toc__n, .lg-sec__n { font-size: 14px; }

  .lg-pill {
    position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 870;
    display: inline-flex; align-items: center; gap: 8px;
    max-width: calc(100% - 140px); min-height: 44px; padding: 0 14px 0 16px;
    border: 0; border-radius: var(--r-pill); cursor: pointer;
    background: color-mix(in srgb, var(--bg-2) 88%, transparent); color: var(--fg);
    box-shadow: inset 0 0 0 1px var(--line), 0 16px 40px -18px rgba(0, 0, 0, .6);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    font: inherit; font-size: 14px; font-weight: 600;
    opacity: 0; transform: translateY(14px); pointer-events: none;
    transition: opacity .35s var(--ease-out), transform .45s var(--ease-out);
  }
  .lg-pill.is-on { opacity: 1; transform: none; pointer-events: auto; }
  .lg-pill__n { color: var(--light); font-variant-numeric: tabular-nums; flex: none; }
  .lg-pill__t { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .lg-pill svg { width: 16px; height: 16px; flex: none; color: var(--muted); }

  .lg-sheet-veil {
    display: block; position: fixed; inset: 0; z-index: 960;
    background: color-mix(in srgb, var(--bg) 60%, transparent);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    opacity: 0; pointer-events: none; transition: opacity .3s var(--ease-out);
  }
  .lg-sheet-veil.is-open { opacity: 1; pointer-events: auto; }
  .lg-sheet {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 961;
    max-height: 72svh; overflow: auto; overscroll-behavior: contain;
    padding: 0 20px calc(18px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-2); color: var(--fg);
    border-radius: var(--r-media) var(--r-media) 0 0;
    box-shadow: inset 0 1px 0 var(--line), 0 -30px 80px -40px rgba(0, 0, 0, .7);
    transform: translateY(102%); visibility: hidden;
    transition: transform .45s var(--ease-out), visibility 0s linear .45s;
  }
  .lg-sheet.is-open { transform: none; visibility: visible; transition: transform .45s var(--ease-out), visibility 0s; }
  .lg-sheet__head {
    position: sticky; top: 0; z-index: 1;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 18px 0 10px; background: var(--bg-2);
  }
  .lg-sheet__head::before { content: ''; position: absolute; left: 50%; top: 8px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--line); }
  .lg-sheet__t { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 22px; font-variation-settings: 'wdth' 84; }
  .lg-sheet__close { width: 44px; height: 44px; border: 0; border-radius: 50%; display: grid; place-items: center; background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
  .lg-sheet__close svg { width: 18px; height: 18px; }
  .lg-sheet .lg-toc__list { padding: 0; gap: 0; }
  .lg-sheet .lg-toc__list a { min-height: 48px; font-size: 16px; }
  html.lg-sheet-on { overflow: hidden; }
}


/* Téléphone couché (vérification finale 30/11) — (pointer: coarse) et hauteur ≤ 520 px :
   le titre ne prend plus tout l'écran. Aucun PC à souris n'est concerné. */
@media (pointer: coarse) and (max-height: 520px) {
  .lg-head { padding-top: calc(var(--nav-h) + 28px); padding-bottom: 28px; }
  .lg-title { font-size: clamp(32px, 6vw, 48px); max-width: none; }
}
