/* Pages légales — refonte du 1er octobre 2026. */
/* La feuille imprimée reste blanche dans les deux thèmes. */
:root {
  --legal-print-paper: #fff;
  --legal-print-ink: #000;
}
.legal-hero {
  position: relative;
  isolation: isolate;
  overflow-x: clip;
  padding-block: clamp(28px, 4.4vw, 64px) clamp(28px, 3.4vw, 44px);
}
.legal-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 58%;
  top: -30%;
  width: min(1100px, 110vw);
  height: 150%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 13%, transparent), transparent);
  filter: blur(10px);
  pointer-events: none;
}
.legal-hero h1 {
  line-height: 1.04;
  max-width: 13ch;
  font-size: clamp(42px, 5.6vw, 76px);
}
.legal-hero .kicker {
  margin-bottom: 18px;
}
.legal-meta {
  display: flex;
  flex-wrap: wrap;
  font-size: 15px;
  color: var(--muted);
  margin-top: 26px;
  gap: 12px 14px;
  align-items: stretch;
}
.legal-tabs {
  max-width: 100%;
  flex-wrap: wrap;
  display: flex;
  width: auto;
  gap: 4px;
  padding: 0 0 0 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
  position: relative;
  z-index: 1;
}
.legal-tabs a {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  text-decoration: none;
  transition:
    color 0.2s,
    background-color 0.2s;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px 14px 0 0;
  font-size: 14.5px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: color-mix(in srgb, var(--surface) 45%, transparent);
}
.legal-tabs a:hover {
  color: var(--text);
  background: var(--surface);
}
.legal-tabs a[aria-current="page"] {
  font-weight: 500;
  background: var(--surface);
  box-shadow: none;
  margin-bottom: -1px;
  padding-bottom: 1px;
  color: var(--text);
}
:root[data-theme="dark"] .legal-tabs a[aria-current="page"] {
  box-shadow: none;
  background: var(--surface);
}
.legal-tabs .tab-short,
.toc-box > summary::-webkit-details-marker,
.toc-now {
  display: none;
}
.legal-layout {
  display: grid;
  align-items: start;
  padding-bottom: var(--section);
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 76px);
}
.legal-aside {
  position: sticky;
  display: grid;
  gap: 28px;
  top: 100px;
}
.toc-title {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 12px;
  border-bottom: 2px solid var(--text);
  cursor: default;
}
.toc ol {
  display: grid;
  padding-top: 8px;
}
.toc li {
  border-bottom: 0;
  border-left: 2px solid var(--line);
  transition: border-color 0.25s;
}
.toc a {
  position: relative;
  display: grid;
  align-items: center;
  font-size: 15px;
  line-height: 1.35;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  column-gap: 4px;
  padding: 7px 0 7px 14px;
  min-height: 40px;
}
.toc a:hover,
.toc li:has(~ li > a[aria-current="location"]) a,
:root[data-theme="dark"] .toc a[aria-current="location"] {
  color: var(--text);
}
.toc a[aria-current="location"] {
  font-weight: 500;
  color: var(--accent);
}
.toc .num {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--accent);
  font-weight: 400;
}
.aside-tools {
  display: grid;
  gap: 2px;
  justify-items: start;
}
.aside-tools .text-link,
.doc-end .text-link {
  font-size: 15px;
}
.print-btn {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}
.legal-doc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  min-width: 0;
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) 0.16s both;
  border-top-left-radius: 0;
  padding: clamp(28px, 4vw, 56px) clamp(22px, 4.6vw, 68px) clamp(22px, 3vw, 36px);
}
:root[data-theme="dark"] .legal-doc {
  box-shadow: none;
}
.clause {
  display: grid;
  border-top: 1px solid var(--line);
  grid-template-columns: 76px minmax(0, 1fr);
  column-gap: 0;
  padding-block: 28px;
}
.clause:first-child {
  border-top: 0;
  padding-top: 0;
}
.clause h2 {
  grid-column: 1 / -1;
  display: grid;
  line-height: 1.15;
  grid-template-columns: 76px minmax(0, 1fr);
  column-gap: 0;
  align-items: center;
  font-size: clamp(24px, 2.1vw, 29px);
  margin-bottom: 12px;
}
.clause h2 .num {
  font-size: 1.45em;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.02em;
  opacity: 0.9;
}
.clause > :not(h2) {
  grid-column: 2;
}
.clause p {
  text-wrap: pretty;
  overflow-wrap: break-word;
  font-size: 17.5px;
  line-height: 1.76;
  max-width: 62ch;
}
.clause li {
  font-size: 17px;
  line-height: 1.72;
  max-width: 64ch;
  text-wrap: pretty;
  overflow-wrap: break-word;
  position: relative;
  padding-left: 22px;
}
.clause p + p,
.clause ul + p {
  margin-top: 14px;
}
.clause ul {
  display: grid;
  gap: 10px;
}
.clause li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.86em;
  width: 10px;
  height: 1px;
  background: var(--accent);
}
.clause a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.clause a:hover {
  text-decoration-thickness: 2px;
}
.clause sup {
  font-size: 0.68em;
  line-height: 0;
}
.doc-end {
  padding-top: 18px;
  border-top: 1px solid var(--line);
  margin-top: 0;
}
.footer-col a[aria-current="page"],
.footer-legal a[aria-current="page"] {
  color: var(--text);
  font-weight: 500;
}
.moved {
  position: relative;
  isolation: isolate;
  overflow-x: clip;
  padding-block: clamp(56px, 9vw, 128px);
}
.moved::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  width: min(900px, 110vw);
  height: 110%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 15%, transparent), transparent);
  filter: blur(10px);
  pointer-events: none;
}
.moved-card {
  max-width: 640px;
  margin-inline: auto;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow-soft);
  padding: clamp(32px, 5vw, 64px) clamp(22px, 5vw, 64px);
  animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.moved-card .kicker {
  margin-bottom: 0;
}
.moved-card h1 {
  font-size: clamp(34px, 4.6vw, 54px);
  line-height: 1.06;
}
.moved-card .lede {
  max-width: 30em;
}
.moved-card .actions {
  justify-content: center;
  margin-top: 6px;
}
.moved-mark {
  width: 40px;
  height: 50px;
  color: var(--accent);
}
.moved-note {
  font-size: 13.5px;
  color: var(--muted);
}
.legal-hero .wrap > * {
  animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.legal-hero .wrap > :nth-child(2) {
  animation-delay: 0.04s;
}
.legal-hero .wrap > :nth-child(3) {
  animation-delay: 0.08s;
}
.legal-hero .wrap > :nth-child(4) {
  animation-delay: 0.12s;
}
.meta-date {
  display: inline-block;
  min-height: 40px;
  padding: 8px 14px;
  line-height: 1.5;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 14.5px;
}
.meta-note {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 14px 6px 16px;
  border-radius: 4px 12px 12px 4px;
  background: var(--wash);
  color: var(--text);
  font-size: 14.5px;
  box-shadow: inset 3px 0 0 var(--accent);
}
.doc-col {
  min-width: 0;
}
.toc-box > summary {
  list-style: none;
}
.toc li:has(~ li > a[aria-current="location"]),
.toc li:has(> a[aria-current="location"]) {
  border-left-color: var(--accent);
}
.toc-key {
  justify-self: end;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 20px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  background: var(--wash);
  color: var(--accent);
}
.toc-key sup {
  font-size: 0.7em;
  line-height: 0;
}
.toc a[aria-current="location"] .toc-key {
  background: var(--accent);
  color: var(--on-accent);
}
.clause:target h2 span:last-child {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}
.cle {
  font-weight: 600;
  color: var(--text);
  padding-inline: 0.08em;
  background: linear-gradient(
    transparent 60%,
    color-mix(in srgb, var(--accent) 22%, transparent) 60%,
    color-mix(in srgb, var(--accent) 22%, transparent) 92%,
    transparent 92%
  );
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
:root[data-theme="dark"] .cle {
  background: linear-gradient(
    transparent 60%,
    color-mix(in srgb, var(--accent) 30%, transparent) 60%,
    color-mix(in srgb, var(--accent) 30%, transparent) 92%,
    transparent 92%
  );
}
@media (max-width: 1020px) {
  .legal-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
  .legal-enhanced .toc {
    order: 1;
    position: sticky;
    top: 76px;
    z-index: 20;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: saturate(1.2) blur(14px);
    -webkit-backdrop-filter: saturate(1.2) blur(14px);
  }
  .doc-col {
    order: 2;
  }
  .aside-tools {
    order: 3;
    grid-auto-flow: column;
    justify-content: start;
    gap: 4px 24px;
  }
  .toc-box {
    position: relative;
  }
  .toc-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 54px;
    padding: 0;
    cursor: pointer;
    border-bottom: 1px solid var(--line);
  }
  .toc-title::after {
    content: "";
    margin-left: auto;
    width: 9px;
    height: 9px;
    flex: none;
    border-right: 1.6px solid var(--text);
    border-bottom: 1.6px solid var(--text);
    transform: translateY(-3px) rotate(45deg);
    transition: transform 0.2s;
  }
  .toc-box[open] > .toc-title::after {
    transform: translateY(2px) rotate(-135deg);
  }
  .toc-now {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text);
  }
  .toc-now:not(:empty)::before {
    content: "·";
    margin-right: 10px;
    color: var(--muted);
  }
  .toc-box::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 100%;
    background: var(--accent);
    transform-origin: left;
    transform: scaleX(var(--read, 0));
  }
  .toc a {
    min-height: 44px;
  }
  .clause {
    scroll-margin-top: 46px;
  }
  .legal-aside {
    display: contents;
  }
  .legal-enhanced .toc ol {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    max-height: min(64vh, 560px);
    overflow: auto;
    padding: 10px 14px;
    border-radius: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
  }
  .toc ol {
    padding-top: 8px;
  }
}
@media (max-width: 720px) {
  .legal-tabs {
    display: flex;
    width: 100%;
  }
  .legal-tabs a {
    flex: 1 1 auto;
    justify-content: center;
    padding: 0 10px;
  }
  .legal-tabs .tab-long {
    display: none;
  }
  .legal-tabs .tab-short {
    display: inline;
  }
  .legal-aside,
  .toc ol {
    grid-template-columns: minmax(0, 1fr);
  }
  .legal-doc {
    border-radius: 20px;
    padding: 26px 18px 18px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
  .clause {
    grid-template-columns: minmax(0, 1fr);
    padding-block: 24px;
  }
  .clause h2 {
    grid-template-columns: 52px minmax(0, 1fr);
    font-size: 24px;
    display: grid;
  }
  .clause h2 .num {
    display: block;
    font-size: 1.5em;
    margin-bottom: 0;
  }
  .clause > :not(h2) {
    grid-column: 1;
  }
  .clause p {
    font-size: 16.5px;
    line-height: 1.7;
  }
  .clause li {
    font-size: 16.5px;
    line-height: 1.68;
  }
  .moved-card {
    border-radius: 22px;
  }
  .moved-card .actions {
    width: 100%;
  }
  .moved-card .actions .btn {
    flex: 1 1 auto;
  }
  .legal-enhanced .toc {
    top: 64px;
  }
  .legal-meta {
    flex-direction: column;
    align-items: flex-start;
  }
  .aside-tools {
    grid-auto-flow: row;
  }
}
@media print {
  .site-header,
  .site-footer,
  .legal-aside,
  .legal-tabs,
  .skip-link,
  .doc-end,
  .toc,
  .aside-tools {
    display: none !important;
  }
  body {
    font-size: 11pt;
    background: var(--legal-print-paper);
    color: var(--legal-print-ink);
  }
  .legal-hero {
    padding: 0 0 12pt;
  }
  .legal-hero::before {
    display: none;
  }
  .legal-hero h1 {
    font-size: 26pt;
    max-width: none;
  }
  .legal-layout {
    display: block;
    padding: 0;
  }
  .legal-doc {
    border: 0;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
    background: none;
  }
  .clause {
    break-inside: avoid;
    padding-block: 12pt;
  }
  .clause p,
  .clause li {
    font-size: 11pt;
    max-width: none;
  }
  .clause a {
    color: inherit;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
  }
  .cle,
  :root[data-theme="dark"] .cle {
    background: none;
    color: var(--legal-print-ink);
  }
  .clause h2 .num {
    color: var(--legal-print-ink);
  }
  .meta-date,
  .meta-note {
    color: var(--legal-print-ink);
    background: none;
  }
  .legal-hero .kicker {
    color: var(--legal-print-ink);
  }
}
@media (prefers-reduced-motion: reduce) {
  .toc-box::after,
  .toc li,
  .toc-title::after {
    transition: none;
  }
}
