:root {
  --paper: #ffffff;
  --linen: #eef0ea;
  --ink: #22261f;
  --muted: #5e645a;
  --olive: #4f5d3a;
  --olive-deep: #36412a;
  --rule: #d9dcd3;
  --hit: #f2e27d;
  --todo-bg: #fcebdd;
  --todo-ink: #8a3d0f;

  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  --measure: 68ch;
  --sticky-offset: 1.5rem;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-optical-sizing: auto;
}

a { color: var(--olive); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--olive-deep); text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--olive);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  z-index: 10;
}
.skip:focus { top: 1rem; }

/* En-tête */

.masthead {
  background: var(--linen);
  border-bottom: 1px solid var(--rule);
}

.masthead__inner {
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 5.5rem) clamp(1.25rem, 4vw, 3rem) clamp(2rem, 5vw, 3.5rem);
}

.brand {
  margin: 0 0 1.25rem;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.masthead h1 {
  margin: 0;
  max-width: 14ch;
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(2.5rem, 7.5vw, 5.25rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.masthead__lede {
  max-width: 56ch;
  margin: 1.75rem 0 0;
  font-size: 1.125rem;
  color: var(--ink);
}

.masthead__meta {
  max-width: 56ch;
  margin: 0.75rem 0 0;
  font-family: var(--sans);
  font-size: 0.9375rem;
  color: var(--muted);
}

.masthead__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: 500 0.9375rem/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--olive-deep); border-color: var(--olive-deep); color: var(--paper); }

.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Accès rapide */

.shortcuts {
  max-width: 76rem;
  margin: 0 auto;
  padding: 1.25rem clamp(1.25rem, 4vw, 3rem);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  font-family: var(--sans);
  border-bottom: 1px solid var(--rule);
}

.shortcuts__title { margin: 0; color: var(--muted); font-size: 0.9375rem; }

.shortcuts ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shortcuts a {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.9375rem;
  text-decoration: none;
}
.shortcuts a:hover { border-color: var(--olive); color: var(--olive-deep); }

/* Mise en page */

.layout {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: 17.5rem minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: 2rem 0 2rem;
  font-family: var(--sans);
}

/* Recherche */

.search__label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.9375rem;
}

.search__field { position: relative; }

.search input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0 4.75rem 0 0.9rem;
  border: 1px solid var(--muted);
  border-radius: 0.5rem;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem var(--sans);
}
.search input::placeholder { color: #8a9085; }
.search input::-webkit-search-cancel-button { display: none; }

.search__clear {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.35rem 0.6rem;
  border: 0;
  border-radius: 0.35rem;
  background: var(--linen);
  color: var(--ink);
  font: 500 0.8125rem var(--sans);
  cursor: pointer;
}
.search__clear:hover { background: var(--rule); }

.search__status {
  min-height: 1.4em;
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Sommaire */

.toc { margin-top: 1.25rem; }

.toc summary {
  padding: 0.25rem 0;
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  list-style: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 0.45em;
  margin-left: 0.5em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.2em) rotate(45deg);
  transition: transform 0.15s ease;
}
.toc[open] summary::after { transform: translateY(0.05em) rotate(-135deg); }

.toc__list {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--rule);
}

.toc__list a {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  padding: 0.3rem 0 0.3rem 0.85rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.4;
  text-decoration: none;
}
.toc__list a span { color: var(--muted); font-variant-numeric: tabular-nums; }
.toc__list a:hover { color: var(--ink); }

.toc__list a[aria-current="true"] {
  border-left-color: var(--olive);
  color: var(--ink);
  font-weight: 500;
}

.toc__list li.is-dimmed a { opacity: 0.35; }

/* Texte des CGV */

.cgv {
  max-width: var(--measure);
  padding: 2rem 0 5rem;
  outline: none;
}

.article {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: var(--sticky-offset);
}
.article:first-of-type { padding-top: 1rem; }

.article h2 {
  margin: 0 0 1.25rem;
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(1.5rem, 2.6vw, 1.875rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.article h3 {
  margin: 2.25rem 0 0.75rem;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 1.1875rem;
  line-height: 1.3;
  scroll-margin-top: var(--sticky-offset);
}

.num {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--olive);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0;
}
h3 .num {
  display: inline;
  margin: 0 0.6rem 0 0;
  font-size: inherit;
}

.article p { margin: 0 0 1rem; }
.article p:last-child { margin-bottom: 0; }

.emphasis { font-weight: 600; }

.warning {
  padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--ink);
  background: var(--linen);
  font-family: var(--sans);
  font-weight: 700;
  line-height: 1.5;
}

.contact {
  margin: 1.5rem 0;
  padding: 0;
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.contact div {
  display: grid;
  grid-template-columns: minmax(9rem, 30%) 1fr;
  gap: 1rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--rule);
}
.contact div:last-child { border-bottom: 1px solid var(--rule); }
.contact dt { color: var(--muted); }
.contact dd { margin: 0; overflow-wrap: anywhere; }

.legal-box {
  margin: 1rem 0 0;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 2px solid var(--ink);
  font-size: 0.96875rem;
  line-height: 1.65;
}
.legal-box__source {
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--muted);
}

.legal-list {
  margin: 0 0 1rem;
  padding-left: 0;
  list-style: none;
  counter-reset: legal;
}
.legal-list li {
  counter-increment: legal;
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.5rem;
}
.legal-list li::before {
  content: counter(legal) "°";
  position: absolute;
  left: 0;
  font-variant-numeric: tabular-nums;
}

.note { color: var(--muted); font-style: italic; }

.form-sheet {
  margin-top: 1.25rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--linen);
}
.form-sheet .field {
  padding-bottom: 1.75rem;
  border-bottom: 1px dotted var(--muted);
}

.a-completer {
  padding: 0 0.25em;
  border: 1px dashed var(--todo-ink);
  border-radius: 3px;
  background: var(--todo-bg);
  color: var(--todo-ink);
  font-family: var(--sans);
  font-size: 0.92em;
}

mark.hit {
  padding: 0 0.1em;
  border-radius: 2px;
  background: var(--hit);
  color: inherit;
}
mark.hit.is-current { outline: 2px solid var(--ink); }

.no-results {
  padding: 1.25rem;
  background: var(--linen);
  font-family: var(--sans);
}

.cgv__footer {
  padding-top: 2.5rem;
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--muted);
}
.back-top { display: inline-block; margin-top: 0.5rem; }

[hidden] { display: none !important; }

/* Mobile et tablette : la recherche et le sommaire restent accessibles en haut */

@media (max-width: 860px) {
  :root { --sticky-offset: 7.5rem; }

  .layout {
    display: block;
    padding: 0;
  }

  .sidebar {
    z-index: 5;
    max-height: none;
    overflow: visible;
    padding: 0.85rem clamp(1.25rem, 4vw, 3rem) 0.5rem;
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid var(--rule);
  }

  .search__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .search__status:empty { display: none; }

  .toc { margin-top: 0.5rem; }
  .toc[open] .toc__list {
    max-height: 60vh;
    overflow-y: auto;
    padding-bottom: 0.5rem;
  }

  .cgv {
    margin: 0 auto;
    padding: 1rem clamp(1.25rem, 4vw, 3rem) 4rem;
  }

  .shortcuts { border-bottom: 0; }

  .contact div { grid-template-columns: 1fr; gap: 0.1rem; }
}

/* Impression */

@media print {
  body { font-size: 10.5pt; line-height: 1.5; }
  .skip, .shortcuts, .sidebar, .masthead__actions, .back-top, .no-results { display: none !important; }
  .masthead { background: none; border: 0; }
  .masthead__inner { padding: 0 0 1rem; }
  .masthead h1 { font-size: 26pt; max-width: none; }
  .layout { display: block; padding: 0; }
  .cgv { max-width: none; padding: 0; }
  .article { padding: 1rem 0; break-inside: auto; }
  .article[hidden] { display: block !important; }
  .article h2, .article h3 { break-after: avoid; }
  .legal-box { break-inside: avoid-page; }
  mark.hit { background: none; outline: 0; }
  a { color: inherit; text-decoration: none; }
  .a-completer { border: 0; background: none; color: inherit; }
}
