/* Documents juridiques — largeur navbar + lecture liquid glass */
.legal-doc {
  --legal-toc-w: clamp(15.5rem, 17vw, 19rem);
  --legal-header-offset: 5.5rem;
  color: #e2e8f0;
  padding-bottom: 4rem;
}
@media (min-width: 640px) {
  .legal-doc { padding-bottom: 5rem; }
}
@media (min-width: 1024px) {
  .legal-doc { padding-bottom: 6rem; }
}

/* Même cadre que #site-header > nav (gutter + --vitrine-wide-max) */
.legal-doc__shell {
  width: 100%;
  max-width: var(--vitrine-wide-max, 96rem);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--vitrine-gutter, 1rem);
  padding-right: var(--vitrine-gutter, 1rem);
  padding-top: 1.5rem;
}
@media (min-width: 640px) {
  .legal-doc__shell { padding-top: 2rem; }
}
@media (min-width: 1024px) {
  .legal-doc__shell { padding-top: 2.5rem; }
}

/* Liquid glass — bordure chromatique + panneau semi-transparent */
@keyframes legal-border-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.legal-doc__glass {
  position: relative;
  border-radius: 1.5rem;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(34, 211, 238, 0.55),
    rgba(99, 102, 241, 0.28),
    rgba(34, 211, 238, 0.18),
    rgba(167, 139, 250, 0.38),
    rgba(34, 211, 238, 0.4)
  );
  background-size: 260% 260%;
  animation: legal-border-flow 16s ease infinite;
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(34, 211, 238, 0.1);
}
@media (min-width: 1024px) {
  .legal-doc__glass { border-radius: 1.75rem; }
}

/*
  Pas de backdrop-filter sur ce wrapper : il crée un containing block
  qui empêche position:sticky de suivre le scroll de la page.
  Le flou est reporté sur une couche décorative (::after).
*/
.legal-doc__glass-inner {
  position: relative;
  overflow: visible;
  isolation: isolate;
  border-radius: calc(1.5rem - 1px);
  background: linear-gradient(
    168deg,
    rgba(8, 15, 28, 0.96) 0%,
    rgba(12, 20, 38, 0.94) 48%,
    rgba(16, 28, 48, 0.92) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -28px 56px rgba(0, 0, 0, 0.24);
}
@media (min-width: 1024px) {
  .legal-doc__glass-inner { border-radius: calc(1.75rem - 1px); }
}

.legal-doc__glass-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  background-image:
    linear-gradient(rgba(34, 211, 238, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 90% 70% at 30% 0%, black 8%, transparent 72%);
  opacity: 0.7;
}

.legal-doc__glass-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  backdrop-filter: blur(28px) saturate(1.35);
  -webkit-backdrop-filter: blur(28px) saturate(1.35);
}

.legal-doc__hero,
.legal-doc__layout {
  position: relative;
  z-index: 1;
}

.legal-doc__hero {
  padding: 1.75rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
@media (min-width: 640px) {
  .legal-doc__hero { padding: 2.25rem 1.75rem 1.5rem; }
}
@media (min-width: 1024px) {
  .legal-doc__hero { padding: 2.75rem 2.5rem 1.75rem; }
}

.legal-doc__eyebrow {
  margin: 0;
  font-family: var(--font-code, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(103, 232, 249, 0.9);
}

html body main .legal-doc .legal-doc__title {
  margin: 0.85rem 0 0;
  max-width: min(100%, 34ch);
  font-family: var(--font-title, ui-sans-serif, system-ui, sans-serif) !important;
  font-size: clamp(1.85rem, 1.4rem + 1.6vw, 3rem) !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em;
  line-height: 1.12 !important;
  color: #fff;
}

.legal-doc__date {
  margin: 0.85rem 0 0;
  font-size: 1rem;
  font-style: italic;
  color: rgb(148 163 184);
}

.legal-doc__layout {
  padding: 1.25rem 1.25rem 2.5rem;
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 640px) {
  .legal-doc__layout { padding: 1.5rem 1.75rem 3rem; gap: 1.5rem; }
}
@media (min-width: 1024px) {
  .legal-doc__layout {
    grid-template-columns: var(--legal-toc-w) minmax(0, 1fr);
    gap: 2.25rem;
    padding: 2rem 2.5rem 3.5rem;
    /* stretch : la colonne sommaire doit faire toute la hauteur du texte
       pour que position:sticky puisse glisser jusqu’en bas du contenu */
    align-items: stretch;
  }
}
@media (min-width: 1600px) {
  .legal-doc {
    --legal-toc-w: clamp(17rem, 15vw, 21rem);
  }
  .legal-doc__layout {
    gap: 2.75rem;
    padding: 2.25rem 3rem 4rem;
  }
}

.legal-doc__toc-panel { display: none; }
@media (min-width: 1024px) {
  .legal-doc__toc-panel {
    display: block;
    min-height: 100%;
  }
  .legal-doc__mobile-toc { display: none; }
}

/* Sommaire sticky + panneau premium */
.legal-doc__toc-sticky {
  position: sticky;
  top: calc(var(--legal-header-offset) + 0.85rem);
  max-height: calc(100vh - var(--legal-header-offset) - 1.75rem);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 1.05rem 0.95rem 1.15rem;
  border-radius: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.07) 0%,
    rgba(255, 255, 255, 0.025) 42%,
    rgba(34, 211, 238, 0.045) 100%
  );
  /* Pas de backdrop-filter ici : un filtre sur l’élément sticky
     peut le faire scroller avec la page selon les navigateurs */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 16px 36px rgba(0, 0, 0, 0.22);
}

.legal-doc__toc-label {
  margin: 0 0 0.95rem;
  padding: 0 0.2rem 0.7rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-code, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(103, 232, 249, 0.88);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.legal-doc__toc-label::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: rgb(34 211 238);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.65);
  flex-shrink: 0;
}

.legal-doc__toc-summary {
  margin: 0 0 0.85rem;
  font-family: var(--font-code, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.95);
}

.legal-doc__toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.legal-doc__toc-item { margin: 0; }

.legal-doc__toc-link {
  display: block;
  position: relative;
  padding: 0.48rem 0.7rem 0.48rem 0.85rem;
  color: rgb(148 163 184);
  text-decoration: none;
  font-family: var(--font-body, ui-sans-serif, system-ui, sans-serif);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.01em;
  border-radius: 0.55rem;
  border: 1px solid transparent;
  transition:
    color 0.15s ease,
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.legal-doc__toc-item--l2 .legal-doc__toc-link {
  padding-left: 1.35rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgb(148 163 184 / 0.88);
}
.legal-doc__toc-item--l2 .legal-doc__toc-link::before {
  content: "";
  position: absolute;
  left: 0.7rem;
  top: 50%;
  width: 0.28rem;
  height: 0.28rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.45);
  transform: translateY(-50%);
}

.legal-doc__toc-link:hover,
.legal-doc__toc-link:focus-visible {
  color: #ecfeff;
  background: rgba(255, 255, 255, 0.045);
  outline: none;
}
.legal-doc__toc-link:focus-visible {
  outline: 2px solid rgb(34 211 238);
  outline-offset: 2px;
}
.legal-doc__toc-link[aria-current="location"] {
  color: #ecfeff;
  background: linear-gradient(
    105deg,
    rgba(34, 211, 238, 0.16) 0%,
    rgba(99, 102, 241, 0.1) 100%
  );
  border-color: rgba(34, 211, 238, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 18px rgba(34, 211, 238, 0.08);
}
.legal-doc__toc-link[aria-current="location"]::after {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 0.45rem;
  bottom: 0.45rem;
  width: 2px;
  border-radius: 999px;
  background: rgb(34 211 238);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.55);
}
.legal-doc__toc-item--l2 .legal-doc__toc-link[aria-current="location"]::before {
  background: rgb(34 211 238);
}

.legal-doc__toc-drawer {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.95rem;
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.07) 0%,
    rgba(255, 255, 255, 0.025) 100%
  );
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 0.15rem 0.85rem 0.85rem;
  margin-bottom: 0.25rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.legal-doc__toc-summary {
  cursor: pointer;
  list-style: none;
  padding: 0.85rem 0 0.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: rgba(103, 232, 249, 0.9);
}
.legal-doc__toc-summary::-webkit-details-marker { display: none; }
.legal-doc__toc-summary::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid rgba(148, 163, 184, 0.9);
  border-bottom: 1.5px solid rgba(148, 163, 184, 0.9);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.legal-doc__toc-drawer[open] > .legal-doc__toc-summary::after {
  transform: rotate(-135deg);
  margin-top: 0.2rem;
}
@media (prefers-reduced-motion: reduce) {
  .legal-doc__glass { animation: none; }
  .legal-doc__toc-summary::after,
  .legal-doc__toc-link { transition: none; }
}

.legal-doc__toc--mobile .legal-doc__toc-list {
  padding-top: 0.35rem;
}
.legal-doc__toc--mobile .legal-doc__toc-link {
  padding-left: 0.65rem;
}
.legal-doc__toc--mobile .legal-doc__toc-item--l2 .legal-doc__toc-link {
  padding-left: 1.2rem;
}
.legal-doc__toc--mobile .legal-doc__toc-item--l2 .legal-doc__toc-link::before {
  left: 0.55rem;
}

.legal-doc__content {
  min-width: 0;
  width: 100%;
}

.legal-doc__content :is(h2, h3) {
  scroll-margin-top: calc(var(--legal-header-offset) + 0.75rem);
}

html body main .legal-doc .legal-doc__content h2 {
  margin: 2.5rem 0 1rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-title, ui-sans-serif, system-ui, sans-serif) !important;
  font-size: clamp(1.25rem, 1.1rem + 0.55vw, 1.55rem) !important;
  font-weight: 700 !important;
  letter-spacing: -0.015em;
  line-height: 1.3 !important;
  color: #f8fafc;
  max-width: none;
}
.legal-doc__content section:first-child > h2:first-child,
.legal-doc__content > h2:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.legal-doc__content h3 {
  margin: 1.6rem 0 0.7rem;
  font-family: var(--font-subtitle, ui-sans-serif, system-ui, sans-serif);
  font-size: clamp(1.05rem, 1rem + 0.25vw, 1.2rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: #e2e8f0;
  max-width: none;
}

html body main .legal-doc .legal-doc__content p {
  margin: 0 0 1.05rem;
  font-family: var(--font-body, ui-sans-serif, system-ui, sans-serif) !important;
  font-size: clamp(1rem, 0.96rem + 0.12vw, 1.0625rem) !important;
  line-height: 1.78 !important;
  color: rgb(226 232 240);
  text-align: left;
  max-width: none;
  width: 100%;
}

.legal-doc__content ul {
  margin: 0 0 1.2rem;
  padding: 0 0 0 1.2rem;
  max-width: none;
  width: 100%;
}
.legal-doc__content li {
  margin: 0 0 0.5rem;
  font-size: clamp(1rem, 0.96rem + 0.12vw, 1.0625rem);
  line-height: 1.7;
  color: rgb(226 232 240);
}
.legal-doc__content li::marker {
  color: rgba(34, 211, 238, 0.7);
}

.legal-doc__content a {
  color: #67e8f9;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.legal-doc__content a:hover,
.legal-doc__content a:focus-visible {
  color: #ecfeff;
}

.legal-doc__meta {
  margin: 0 0 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.legal-doc__meta p {
  margin-bottom: 0.35rem;
}

/* Mesure de lecture (Mentions) : colonne large, lignes confortables */
.legal-doc__measure > section > :is(p, ul) {
  max-width: min(100%, 42rem);
}

.legal-doc__facts {
  display: grid;
  grid-template-columns: minmax(9rem, 15rem) minmax(0, 1fr);
  gap: 0.55rem 1.35rem;
  margin: 0 0 0.35rem;
  max-width: min(100%, 44rem);
  font-family: var(--font-body, ui-sans-serif, system-ui, sans-serif);
  font-size: clamp(1rem, 0.96rem + 0.12vw, 1.0625rem);
  line-height: 1.55;
}

.legal-doc__facts dt {
  margin: 0;
  color: rgb(148 163 184);
  font-weight: 500;
}

.legal-doc__facts dd {
  margin: 0;
  color: #f1f5f9;
  font-weight: 500;
  overflow-wrap: anywhere;
}

@media (max-width: 639px) {
  .legal-doc__facts {
    grid-template-columns: 1fr;
    gap: 0.2rem 0;
  }
  .legal-doc__facts dt {
    margin-top: 0.7rem;
    font-size: 0.9em;
  }
  .legal-doc__facts dt:first-child {
    margin-top: 0;
  }
}

@media print {
  .legal-doc {
    color: #0f172a;
    background: #fff;
    padding-bottom: 0;
  }
  .legal-doc__shell {
    max-width: none;
    padding: 0;
  }
  .legal-doc__glass {
    animation: none;
    padding: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }
  .legal-doc__glass-inner {
    border-radius: 0;
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
  }
  .legal-doc__glass-inner::before,
  .legal-doc__toc-panel,
  .legal-doc__mobile-toc,
  .legal-doc__eyebrow {
    display: none !important;
  }
  .legal-doc__hero,
  .legal-doc__layout {
    padding: 0;
    border: none;
  }
  .legal-doc__layout {
    display: block;
  }
  .legal-doc__title,
  .legal-doc__content h2,
  .legal-doc__content h3 {
    color: #0f172a;
  }
  .legal-doc__content p,
  .legal-doc__content li,
  .legal-doc__date {
    color: #1e293b;
    max-width: none;
  }
  .legal-doc__content a {
    color: #0f172a;
    text-decoration: underline;
  }
  .legal-doc__content :is(h2, h3) {
    scroll-margin-top: 0;
    break-after: avoid;
  }
}
