/* ============================================================
   PAGES JURIDIQUES — legal.css
   Mentions légales, CGV, confidentialité, cookies.
   S'appuie sur les variables et composants de site.css
   (.btn, .eyebrow, .icon-badge).
   ============================================================ */

[hidden] { display: none !important; }

/* `overflow-x: hidden` sur html ET body casse position: sticky (sommaire).
   `clip` coupe pareil sans créer de conteneur de défilement. */
html:root,
html body { overflow-x: clip; }

@keyframes lgUp {
  from { opacity: 0; transform: translateY(16px); }
}

@keyframes lgToast {
  from { opacity: 0; transform: translate(-50%, 12px); }
}

.lg-in {
  animation: lgUp .7s cubic-bezier(.22, .61, .36, 1) both;
  animation-delay: calc(var(--i, 0) * .08s);
}

.lg-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   EN-TÊTE
   ============================================================ */
.lg-hero {
  padding: clamp(48px, 6vw, 88px) 0 clamp(28px, 4vw, 44px);
  background:
    radial-gradient(circle at 82% 30%, rgba(60, 140, 220, .1), transparent 30rem),
    radial-gradient(circle at 98% 0%, rgba(129, 114, 221, .07), transparent 22rem);
}

.lg-hero h1 {
  max-width: 20ch;
  margin-bottom: .35em;
  font-size: clamp(2.3rem, 4.4vw, 3.7rem);
  line-height: 1.05;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.lg-hero .lede { max-width: 62ch; margin: 0; }

.lg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.lg-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: .8rem;
  font-weight: 600;
}

.lg-pill svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--blue-deep);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.lg-actions .btn { min-height: 46px; padding: 10px 20px; font-size: .88rem; }

/* --- Sélecteur de documents --- */
.lg-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 38px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.lg-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  color: var(--ink-soft);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .2s ease, background .2s ease, color .2s ease, transform .2s ease;
}

.lg-tab svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .8;
}

.lg-tab:hover {
  border-color: var(--blue);
  color: var(--blue-deep);
  transform: translateY(-1px);
}

.lg-tab[aria-current="page"] {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
  color: white;
  box-shadow: 0 14px 28px -16px rgba(23, 63, 105, .7);
}

.lg-tab:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* ============================================================
   CORPS DU DOCUMENT
   ============================================================ */
.lg-doc { padding: clamp(32px, 4vw, 56px) 0 clamp(72px, 9vw, 120px); }

.lg-layout {
  display: grid;
  grid-template-columns: minmax(230px, 290px) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: start;
}

/* --- Sommaire --- */
.lg-aside {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.lg-progress {
  height: 3px;
  margin-bottom: 18px;
  overflow: hidden;
  background: var(--line);
  border-radius: 999px;
}

.lg-progress i {
  display: block;
  height: 100%;
  background: var(--blue-deep);
  transform: scaleX(var(--p, 0));
  transform-origin: left;
}

.lg-toc summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 12px;
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
  cursor: pointer;
}

.lg-toc summary::-webkit-details-marker { display: none; }

.lg-toc summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--blue-deep);
  border-bottom: 2px solid var(--blue-deep);
  transform: rotate(45deg);
  transition: transform .25s ease;
}

.lg-toc[open] summary::after { transform: rotate(-135deg); }
.lg-toc summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 8px; }

.lg-toc ol {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.lg-toc a {
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: .87rem;
  line-height: 1.4;
  text-decoration: none;
  transition: background .2s ease, color .2s ease;
}

.lg-toc a::before {
  content: counter(toc, decimal-leading-zero);
  counter-increment: toc;
  padding-top: 2px;
  color: #98a6b4;
  font-size: .74rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.lg-toc a:hover { background: var(--blue-pale); color: var(--ink); }

.lg-toc a.is-active {
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-weight: 600;
}

.lg-toc a.is-active::before { color: var(--blue-deep); }
.lg-toc a:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

/* Sans JavaScript, pas de sommaire : le document se lit normalement */
.lg-layout:not(.is-enhanced) { grid-template-columns: minmax(0, 1fr); }
.lg-layout:not(.is-enhanced) .lg-aside { display: none; }

/* ============================================================
   TEXTE
   ============================================================ */
.lg-body {
  min-width: 0;
  max-width: 800px;
  counter-reset: sec;
}

.lg-sec {
  counter-increment: sec;
  counter-reset: sub;
  margin-bottom: clamp(36px, 5vw, 56px);
  padding-top: 0; /* annule le padding global de `section` (site.css) */
  padding-bottom: clamp(36px, 5vw, 56px);
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 96px;
}

.lg-sec:last-of-type { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }

.lg-sec h2 {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin: 0 0 22px;
  font-size: clamp(1.5rem, 2.4vw, 1.95rem);
  line-height: 1.2;
  letter-spacing: -.025em;
}

.lg-sec h2::before {
  content: counter(sec, decimal-leading-zero);
  flex-shrink: 0;
  padding: 4px 10px;
  background: var(--blue-soft);
  border-radius: 9px;
  color: var(--blue-deep);
  font: 600 .88rem var(--font-display);
  letter-spacing: 0;
  transform: translateY(-3px);
}

.lg-anchor {
  margin-left: 4px;
  color: var(--blue);
  font-size: .8em;
  font-weight: 500;
  text-decoration: none;
  opacity: 0;
  transition: opacity .2s ease;
}

.lg-sec h2:hover .lg-anchor,
.lg-anchor:focus-visible { opacity: 1; }

@media (hover: none) {
  .lg-anchor { display: none; }
}

.lg-sec h3 {
  margin: 30px 0 10px;
  font-size: 1.1rem;
  letter-spacing: -.01em;
}

/* Documents en « articles » (CGV) : les sous-titres sont numérotés */
.lg-body--articles .lg-sec h3 { counter-increment: sub; }

.lg-body--articles .lg-sec h3::before {
  content: counter(sec) "." counter(sub);
  margin-right: 10px;
  color: var(--blue-deep);
  font-size: .88em;
  font-weight: 600;
}

.lg-sec p {
  max-width: none;
  margin: 0 0 14px;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--ink-soft);
}

.lg-sec p strong,
.lg-sec li strong { color: var(--ink); font-weight: 600; }

.lg-sec ul,
.lg-sec ol { margin: 0 0 16px; padding: 0; }

.lg-sec ul li,
.lg-sec ol li {
  position: relative;
  margin-bottom: 8px;
  padding-left: 26px;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink-soft);
}

.lg-sec ul li::before {
  content: "";
  position: absolute;
  top: .72em;
  left: 6px;
  width: 6px;
  height: 6px;
  background: var(--blue);
  border-radius: 50%;
}

.lg-sec ol { counter-reset: item; }

.lg-sec ol li::before {
  content: counter(item) ".";
  counter-increment: item;
  position: absolute;
  left: 0;
  color: var(--blue-deep);
  font-weight: 600;
}

.lg-sec a { color: var(--blue-deep); }
.lg-sec a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 4px; }

.lg-sec address { font-style: normal; }

/* --- À compléter : impossible à rater --- */
mark.lg-todo {
  padding: 1px 8px;
  background: #fff1bf;
  border: 1px dashed #d69b27;
  border-radius: 6px;
  color: #6a4b00;
  font-weight: 600;
}

/* --- L'essentiel --- */
.lg-brief {
  position: relative;
  margin: 0 0 clamp(40px, 5vw, 60px);
  padding: 28px 30px;
  overflow: hidden;
  color: white;
  background:
    radial-gradient(circle at 92% 0%, rgba(129, 114, 221, .38), transparent 15rem),
    radial-gradient(circle at 0% 100%, rgba(60, 140, 220, .3), transparent 15rem),
    linear-gradient(165deg, #1d4c7b, #173f69 60%, #12335a);
  border-radius: 22px;
  box-shadow: 0 30px 70px -40px rgba(23, 63, 105, .75);
}

.lg-brief h2 {
  margin: 0 0 16px;
  color: white;
  font-size: 1.15rem;
  letter-spacing: -.01em;
}

.lg-brief ul { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }

.lg-brief li {
  position: relative;
  padding-left: 32px;
  font-size: .96rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, .92);
}

.lg-brief li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 20px;
  height: 20px;
  background: rgba(111, 211, 163, .2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238ee3b8' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 12.5l4 4L19 7'/%3E%3C/svg%3E") center / 12px no-repeat;
  border-radius: 50%;
}

.lg-brief strong { color: white; }
.lg-brief a { color: white; text-decoration-color: rgba(255, 255, 255, .5); }

/* --- Encadrés --- */
.lg-note {
  margin: 20px 0;
  padding: 18px 22px;
  background: var(--blue-pale);
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 6px 16px 16px 6px;
}

.lg-note > strong {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-display);
  font-size: .92rem;
  color: var(--blue-deep);
}

.lg-note p { margin: 0 0 8px; font-size: .96rem; }
.lg-note p:last-child { margin-bottom: 0; }

.lg-note--warn { background: var(--amber-bg); border-color: rgba(214, 155, 39, .4); border-left-color: var(--amber); }
.lg-note--warn > strong { color: #8a5a00; }
.lg-note--ok { background: var(--green-bg); border-color: rgba(41, 150, 101, .3); border-left-color: var(--green); }
.lg-note--ok > strong { color: #1f6b47; }

/* --- Fiche d'identité --- */
.lg-dl { margin: 0 0 20px; border-top: 1px solid var(--line); }

.lg-dl > div {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  gap: 6px 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.lg-dl dt {
  font-size: .86rem;
  font-weight: 600;
  color: var(--muted);
}

.lg-dl dd {
  margin: 0;
  font-size: .98rem;
  line-height: 1.65;
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* --- Tableaux --- */
.lg-table-wrap {
  margin: 20px 0 24px;
  overflow-x: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.lg-table { width: 100%; border-collapse: collapse; font-size: .9rem; }

.lg-table th,
.lg-table td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.6;
  color: var(--ink-soft);
}

.lg-table thead th {
  background: var(--blue-pale);
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}

.lg-table tbody tr:last-child td,
.lg-table tbody tr:last-child th { border-bottom: 0; }

.lg-table tbody th { font-weight: 600; color: var(--ink); }

.lg-table code {
  padding: 2px 8px;
  background: var(--blue-soft);
  border-radius: 6px;
  color: var(--blue-dark);
  font: 600 .82rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* --- Historique des versions --- */
.lg-versions {
  margin-top: clamp(40px, 5vw, 64px);
  padding: 4px 24px;
  background: var(--blue-pale);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.lg-versions summary {
  padding: 18px 0;
  font-family: var(--font-display);
  font-size: .98rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.lg-versions summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 8px; }

.lg-versions ul { margin: 0; padding: 0 0 18px; list-style: none; }

.lg-versions li {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 4px 18px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: .9rem;
  line-height: 1.6;
  color: var(--muted);
}

.lg-versions li b { color: var(--ink); }

/* --- Formulaire type (annexe CGV) --- */
.lg-form-type {
  margin: 20px 0;
  padding: 24px 26px;
  background: white;
  border: 1.5px dashed var(--line-strong);
  border-radius: 16px;
}

.lg-form-type p { margin: 0 0 12px; font-size: .95rem; }
.lg-form-type p:last-child { margin: 0; }

/* --- Outil « mes cookies » --- */
.lg-tool {
  margin: 20px 0 24px;
  padding: 24px 26px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
}

.lg-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
}

.lg-status i {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  background: #98a6b4;
  border-radius: 50%;
}

.lg-status.is-on i { background: var(--green); box-shadow: 0 0 0 5px rgba(41, 150, 101, .16); }
.lg-status.is-off i { background: var(--coral); box-shadow: 0 0 0 5px rgba(239, 95, 119, .16); }

.lg-sec .lg-live { margin: 0 0 18px; padding: 0; list-style: none; }

.lg-sec .lg-live li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  font-size: .92rem;
  color: var(--ink-soft);
}

.lg-sec .lg-live li::before { display: none; }
.lg-sec .lg-live li:first-child { border-top: 0; }
.lg-sec .lg-live li small { color: var(--muted); font-size: .8rem; }
.lg-sec .lg-live code { font: 600 .84rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--blue-dark); }

.lg-sec .lg-tool-title {
  margin: 20px 0 8px;
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
}

.lg-sec .lg-tool-title:first-of-type { margin-top: 0; }

/* ============================================================
   BAS DE PAGE
   ============================================================ */
.lg-cta {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(60px, 8vw, 96px) 0;
  color: white;
  background:
    radial-gradient(circle at 82% 18%, rgba(129, 114, 221, .34), transparent 30rem),
    radial-gradient(circle at 8% 100%, rgba(60, 140, 220, .25), transparent 28rem),
    #173f69;
}

.lg-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, rgba(255, 255, 255, .035), transparent 35%, rgba(255, 255, 255, .025));
  pointer-events: none;
}

.lg-cta .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px 32px;
}

.lg-cta h2 { max-width: 520px; margin: 0 0 6px; color: white; font-size: clamp(1.6rem, 2.8vw, 2.2rem); }
.lg-cta p { max-width: 52ch; margin: 0; color: rgba(255, 255, 255, .78); }

.lg-btn-light {
  background: white;
  border-color: white;
  color: var(--blue-dark);
  box-shadow: 0 18px 38px -16px rgba(4, 16, 32, .6);
}

.lg-btn-light:hover { background: #f0f7fd; color: var(--blue-dark); }

.lg-btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, .38);
  color: white;
}

.lg-btn-ghost:hover { background: rgba(255, 255, 255, .09); border-color: white; color: white; }
.lg-cta a:focus-visible { outline-color: white; }

.lg-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  padding: 11px 20px;
  background: var(--ink);
  border-radius: 999px;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .6);
  color: white;
  font-size: .86rem;
  font-weight: 600;
  transform: translateX(-50%);
  animation: lgToast .3s ease;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1020px) {
  .lg-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }

  .lg-aside {
    position: static;
    max-height: none;
    padding: 6px 12px 10px;
    overflow: visible;
    background: var(--blue-pale);
    border: 1px solid var(--line);
    border-radius: 18px;
  }

  .lg-progress { display: none; }
  .lg-toc summary { padding-top: 12px; }
}

@media (max-width: 760px) {
  .lg-dl > div { grid-template-columns: 1fr; gap: 2px; }

  /* Tableaux : chaque ligne devient une fiche */
  .lg-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .lg-table,
  .lg-table tbody,
  .lg-table tr,
  .lg-table td,
  .lg-table th { display: block; width: 100%; }

  .lg-table tr { padding: 8px 0; border-bottom: 1px solid var(--line-strong); }
  .lg-table tbody tr:last-child { border-bottom: 0; }

  .lg-table td,
  .lg-table th {
    padding: 6px 18px;
    border: 0;
  }

  .lg-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .lg-versions li { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .lg-hero .lg-actions { flex-direction: column; align-items: stretch; }
  .lg-hero .lg-actions .btn { width: 100%; }

  /* Sélecteur : une seule ligne défilante */
  .lg-switch {
    flex-wrap: nowrap;
    margin-right: calc(var(--gutter) * -1);
    padding-right: var(--gutter);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .lg-switch::-webkit-scrollbar { display: none; }
  .lg-tab { flex-shrink: 0; }

  .lg-brief { padding: 24px 22px; }
  .lg-sec h2 { gap: 12px; }

  .lg-cta .button-row { width: 100%; flex-direction: column; align-items: stretch; }
  .lg-cta .btn { width: 100%; }
}

/* ============================================================
   IMPRESSION / ENREGISTREMENT EN PDF
   ============================================================ */
@media print {
  @page { margin: 18mm 16mm; }

  nav,
  footer,
  #menuIcon,
  #fullscreen,
  .lg-switch,
  .lg-aside,
  .lg-actions,
  .lg-cta,
  .lg-anchor,
  .lg-toast,
  .lg-tool .btn { display: none !important; }

  html body { background: white !important; color: #111; font-size: 11pt; }
  main { padding-top: 0 !important; }

  .lg-hero { padding: 0 0 12pt; background: none; }
  .lg-hero h1 { font-size: 24pt; }
  .lg-doc { padding: 0; }
  .lg-layout { display: block; }
  .lg-body { max-width: none; }

  .lg-sec { margin-bottom: 18pt; padding-bottom: 0; border-bottom: 0; }
  .lg-sec h2 { break-after: avoid; font-size: 15pt; }
  .lg-sec h3 { break-after: avoid; }
  .lg-sec p,
  .lg-sec li { font-size: 10.5pt; line-height: 1.55; color: #111; }
  .lg-sec h2::before { background: none; border: 1px solid #999; color: #111; }

  .lg-brief,
  .lg-note,
  .lg-table-wrap,
  .lg-dl > div,
  .lg-form-type { break-inside: avoid; }

  .lg-brief { color: #111; background: #f2f2f2 !important; box-shadow: none; border: 1px solid #bbb; }
  .lg-brief h2, .lg-brief li, .lg-brief strong { color: #111; }
  .lg-brief li::before { background-color: #ddd; }

  .lg-table-wrap { overflow: visible; box-shadow: none; }
  .lg-versions[open] ul { display: block; }

  .lg-sec a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; color: #444; word-break: break-all; }
  mark.lg-todo { background: #ffe58a !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
