/* Pages documents : légal (.doc) et FAQ (.faq). */

/* ---------- En-tête commun ---------- */
.doc__head {
  position: relative;
  overflow: hidden;
  padding-block: clamp(136px, 15vw, 196px) clamp(44px, 6vw, 72px);
  border-bottom: 1px solid var(--line);
}
.doc__head::before {
  content: "";
  position: absolute;
  left: 50%; top: -420px;
  width: 900px; height: 820px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, var(--gold-soft), transparent);
  pointer-events: none;
}
.doc__head-inner { position: relative; display: grid; justify-items: start; gap: 20px; }
.doc__head h1 { font-size: clamp(2.5rem, 1.3rem + 4.6vw, 4.75rem); line-height: 1; max-width: 18ch; }

.legal__meta,
.faq__meta {
  color: var(--ink-soft);
  font-size: var(--fs-lead);
  line-height: 1.5;
  max-width: 60ch;
}
.doc .legal__meta {
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--glass);
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- Barre de progression (scroll-driven, ignorée sans support) ---------- */
.doc__progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 150;
  height: 3px;
  display: none;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  transform-origin: 0 50%;
  transform: scaleX(0);
}
@supports (animation-timeline: scroll()) {
  .doc__progress { display: block; animation: doc-progress linear both; animation-timeline: scroll(root); }
}
@keyframes doc-progress { to { transform: scaleX(1); } }

/* ---------- Grille document ---------- */
.doc__grid {
  display: grid;
  gap: 28px;
  padding-block: clamp(36px, 5vw, 72px) var(--section-pad);
}
@media (min-width: 1100px) {
  .doc__grid {
    grid-template-columns: 264px minmax(0, 70ch);
    justify-content: center;
    column-gap: clamp(56px, 6vw, 96px);
  }
}

/* ---------- Sommaire ---------- */
.doc__toc { min-width: 0; }
@media (min-width: 1100px) {
  .doc__toc {
    position: sticky;
    top: 104px;
    align-self: start;
    max-height: calc(100dvh - 128px);
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
  }
}
@media (max-width: 1099px) {
  .doc__toc { position: sticky; top: 86px; z-index: 30; }
}

.toc {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.toc > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 0 16px 0 18px;
  list-style: none;
  cursor: pointer;
  font-weight: 600;
}
.toc > summary::-webkit-details-marker { display: none; }
.toc > summary svg { width: 18px; height: 18px; transition: transform .35s var(--ease-out); }
.toc[open] > summary svg { transform: rotate(180deg); }
.toc__count { margin-left: auto; color: var(--ink-faint); font-size: .8125rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.toc nav { max-height: min(62vh, 520px); overflow: auto; padding: 0 8px 12px; }

@media (min-width: 1100px) {
  .toc { border: 0; border-radius: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .toc > summary {
    min-height: 0;
    padding: 0 12px 14px;
    pointer-events: none;
    font-size: .75rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--ink-faint);
  }
  .toc > summary svg { display: none; }
  .toc nav { max-height: none; overflow: visible; padding: 0; }
}

.toc ol { margin: 0; padding: 0; list-style: none; }
.toc a {
  display: block;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  font-size: .875rem;
  line-height: 1.35;
  transition: color var(--dur-2), background-color var(--dur-2);
}
.toc a:hover { color: var(--ink); background: var(--line); }
.toc a[aria-current] { color: var(--ink); background: var(--gold-soft); }
.toc li > ol { display: none; margin: 2px 0 6px; padding-left: 12px; }
.toc li > ol a { padding-block: 5px; font-size: .8125rem; }
@media (min-width: 1100px) {
  .toc li.is-active > ol { display: block; }
}

/* ---------- Corps du document ---------- */
.doc__body {
  min-width: 0;
  color: var(--ink-soft);
  font-size: 1.0625rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
.doc__body > * + * { margin-top: 1em; }
.doc__body h2 {
  position: relative;
  margin-top: 2.6em;
  padding-top: 1.3em;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: clamp(1.5rem, 1.2rem + 1vw, 1.875rem);
  line-height: 1.15;
  scroll-margin-top: 110px;
}
.doc__body > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.doc__body h3 {
  margin-top: 2em;
  color: var(--ink);
  font-size: 1.125rem;
  scroll-margin-top: 110px;
}
.doc__body h2 + *, .doc__body h3 + * { margin-top: .7em; }
.doc__body strong, .doc__body b { color: var(--ink); font-weight: 600; }
.doc__body a {
  color: var(--gold-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.doc__body ul, .doc__body ol { padding-left: 1.25em; }
.doc__body li + li { margin-top: .45em; }
.doc__body li::marker { color: var(--gold-text); }

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-top: 1.25em;
  scrollbar-width: thin;
}
.doc__body table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9375rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
html:not(.js) .doc__body table { display: block; overflow-x: auto; }
.table-scroll > table { margin: 0; }
.doc__body th {
  background: var(--bg-sunken);
  color: var(--ink);
  font-weight: 600;
  text-align: left;
}
.doc__body th, .doc__body td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  min-width: 8ch;
}
.doc__body tr:last-child td { border-bottom: 0; }
.doc__body tbody tr:nth-child(even) td { background: var(--zebra); }
.doc__body pre {
  overflow-x: auto;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-sunken);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: .9375rem;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
  white-space: pre;
  overflow-wrap: normal;
}
.doc .legal__updated {
  margin-top: 3em;
  padding-top: 1.5em;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: var(--fs-small);
}

.heading-anchor {
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  margin-left: 6px;
  vertical-align: middle;
  border-radius: 8px;
  color: var(--ink-faint);
  opacity: 0;
  transition: opacity var(--dur-2), background-color var(--dur-2);
}
.heading-anchor svg { width: 16px; height: 16px; }
.doc__body h2:hover .heading-anchor,
.doc__body h3:hover .heading-anchor,
.heading-anchor:focus-visible { opacity: 1; }
.heading-anchor:hover { background: var(--line); color: var(--gold-text); }
@media (hover: none) { .heading-anchor { display: none; } }

/* ---------- FAQ ---------- */
.faq__bar {
  position: sticky;
  top: 84px;
  z-index: 30;
  padding-block: 14px;
}
.faq__bar-inner {
  display: grid;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--sh-float);
}
.faq__search {
  position: relative;
  display: flex;
  align-items: center;
}
.faq__search svg {
  position: absolute;
  left: 18px;
  width: 20px; height: 20px;
  color: var(--ink-faint);
  pointer-events: none;
}
.faq__search input {
  width: 100%;
  min-height: 56px;
  padding: 0 56px 0 50px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--ink);
  font-size: 1.0625rem;
  outline: none;
  transition: border-color var(--dur-2), box-shadow var(--dur-2);
  -webkit-appearance: none;
  appearance: none;
}
.faq__search input::placeholder { color: var(--ink-faint); }
.faq__search input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.faq__search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.faq__search kbd {
  position: absolute;
  right: 16px;
  min-width: 26px;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink-faint);
  font-family: var(--font-body);
  font-size: .8125rem;
  text-align: center;
  pointer-events: none;
}
.faq__search input:focus ~ kbd, .faq__search input:not(:placeholder-shown) ~ kbd { opacity: 0; }
@media (hover: none) { .faq__search kbd { display: none; } }

.faq__chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
  mask-image: linear-gradient(90deg, #000 88%, transparent);
}
.faq__chips::-webkit-scrollbar { display: none; }
.faq__chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--dur-2), color var(--dur-2);
}
.faq__chip:hover { background: var(--line); color: var(--ink); }
.faq__chip-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--line);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.faq__grid { padding-block: clamp(28px, 4vw, 48px) var(--section-pad); }
.faq__list { max-width: 820px; margin-inline: auto; }

.faq__empty {
  padding: 40px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  color: var(--ink-soft);
  text-align: center;
}

.faq__category { scroll-margin-top: 220px; }
.faq__category + .faq__category { margin-top: clamp(52px, 7vw, 88px); }
.faq__category-title {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-strong);
  font-size: clamp(1.625rem, 1.25rem + 1.3vw, 2.25rem);
  line-height: 1.1;
}

.faq-item { border-bottom: 1px solid var(--line); }
.faq-item > summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
  padding: 20px 2px;
  list-style: none;
  cursor: pointer;
  color: var(--ink);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.4;
  transition: color var(--dur-2);
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary:hover { color: var(--gold-text); }
.faq-item > summary::after {
  content: "";
  flex: none;
  width: 30px; height: 30px;
  margin-top: -3px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background:
    linear-gradient(currentColor, currentColor) center / 12px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1.5px 12px no-repeat;
  transition: transform .45s var(--ease-out), background-color var(--dur-2), border-color var(--dur-2);
}
.faq-item[open] > summary::after { transform: rotate(135deg); border-color: var(--gold); }
.faq-item > p {
  padding: 0 52px 26px 2px;
  color: var(--ink-soft);
  line-height: 1.7;
}
.faq-item a {
  color: var(--gold-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
@media (max-width: 560px) {
  .faq-item > p { padding-right: 2px; }
}

@supports (interpolate-size: allow-keywords) {
  .faq-item { interpolate-size: allow-keywords; }
  .faq-item::details-content {
    height: 0;
    overflow: clip;
    transition: height .45s var(--ease-out), content-visibility .45s allow-discrete;
  }
  .faq-item[open]::details-content { height: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .faq-item::details-content { transition: none; }
}

::highlight(faq) { background-color: var(--gold-mark); color: inherit; }

.faq__contact {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 14px;
  justify-items: start;
  margin-top: clamp(64px, 8vw, 104px);
  padding: clamp(28px, 5vw, 56px);
  border: 1px solid var(--line);
  border-radius: var(--r-sheet);
  background: var(--bg-raised);
}
.faq__contact .grid-bg { --mx: 85%; --my: 0%; }
.faq__contact > * { position: relative; }
.faq__contact h3 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem); line-height: 1.05; }
.faq__contact p { color: var(--ink-soft); max-width: 52ch; }
.faq__contact-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
