/* legal.comunikcrm.com — feuille de style unique.
 *
 * Contraintes assumées :
 *  - aucune ressource externe (police, image, script) : la politique de
 *    sécurité du serveur interdit toute origine tierce, et un document
 *    juridique n'a pas à dépendre d'un CDN pour rester lisible ;
 *  - propriétés LOGIQUES partout (`margin-inline-start`, `padding-inline`,
 *    `border-inline-start`) : la version arabe est en `dir="rtl"` et doit se
 *    retourner sans une seule règle en double ;
 *  - clair/sombre par `prefers-color-scheme`, surchargeable par
 *    `[data-theme]` — c'est ce que pose `theme.js` quand l'app mobile ouvre
 *    la page avec `?theme=dark`.
 */

:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --text: #1b1b1f;
  --muted: #5b5f6b;
  --border: #e2e4e9;
  --accent: #2f4fd0;
  --accent-soft: #eef1fd;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131317;
    --surface: #1c1c22;
    --text: #e9e9ee;
    --muted: #a2a5b0;
    --border: #2c2d35;
    --accent: #8fa5ff;
    --accent-soft: #1e2136;
    color-scheme: dark;
  }
}

/* Le paramètre `?theme=` de l'app mobile l'emporte sur le réglage de
 * l'appareil : l'utilisateur qui a choisi le thème sombre DANS l'application
 * ne doit pas recevoir un document blanc parce que son téléphone est en
 * clair. Les deux sens sont couverts, sinon le forçage ne marcherait que
 * dans une direction. */
:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --text: #1b1b1f;
  --muted: #5b5f6b;
  --border: #e2e4e9;
  --accent: #2f4fd0;
  --accent-soft: #eef1fd;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #131317;
  --surface: #1c1c22;
  --text: #e9e9ee;
  --muted: #a2a5b0;
  --border: #2c2d35;
  --accent: #8fa5ff;
  --accent-soft: #1e2136;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

/* ── En-tête ─────────────────────────────────────────────────────────── */

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-block-end: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
}

.langs { display: flex; gap: 4px; }

.lang {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

.lang:hover { color: var(--text); background: var(--bg); }

.lang.current {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* ── Sélecteur de thème ──────────────────────────────────────────────── */

/* `[hidden]` doit l'emporter sur le `display:flex` ci-dessous : le groupe
 * reste masqué tant que `theme.js` ne l'a pas câblé. Sans cette règle, la
 * spécificité de `.themes` gagnerait et un contrôle inerte s'afficherait
 * chez les visiteurs sans JavaScript. */
.themes[hidden] { display: none; }

.themes {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
}

.theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  /* Le bouton n'a pas de texte : sans ça, sa hauteur de ligne héritée
   * décalerait l'icône d'un pixel selon la police du système. */
  line-height: 0;
}

.theme:hover { color: var(--text); }

.theme:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.theme[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ── Corps ───────────────────────────────────────────────────────────── */

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 40px 24px 24px;
}

h1 {
  margin: 0 0 6px;
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.updated,
.intro {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 28px;
}

.intro { font-size: 16px; }

h2 {
  margin: 40px 0 12px;
  padding-block-end: 8px;
  border-block-end: 1px solid var(--border);
  font-size: 20px;
  line-height: 1.35;
  scroll-margin-top: 16px;
}

h3 {
  margin: 24px 0 8px;
  font-size: 16px;
  font-weight: 600;
}

p { margin: 0 0 14px; }

ul, ol { margin: 0 0 16px; padding-inline-start: 22px; }

li { margin-bottom: 6px; }

a { color: var(--accent); }

strong { font-weight: 600; }

blockquote {
  margin: 16px 0;
  padding: 2px 16px;
  border-inline-start: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 6px 6px 0;
  color: var(--text);
}

blockquote p:last-child { margin-bottom: 0; }

/* Ancre de section : discrète, révélée au survol du titre. Elle existe pour
 * qu'un échange par courriel puisse pointer une clause précise. */
.anchor {
  float: inline-start;
  margin-inline-start: -1.1em;
  padding-inline-end: 0.3em;
  opacity: 0;
  text-decoration: none;
  font-weight: 400;
}

h2:hover .anchor, .anchor:focus { opacity: 0.5; }

/* ── Sommaire ────────────────────────────────────────────────────────── */

.toc {
  margin: 0 0 36px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.toc-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ol { margin: 0; padding-inline-start: 20px; font-size: 14px; }

.toc li { margin-bottom: 2px; }

.toc a { color: var(--text); text-decoration: none; }

.toc a:hover { color: var(--accent); text-decoration: underline; }

/* ── Accueil ─────────────────────────────────────────────────────────── */

.cards { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 10px; }

.card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
}

.card:hover { border-color: var(--accent); }

.card-title { display: block; font-weight: 600; margin-bottom: 2px; }

.card-text { display: block; font-size: 14px; color: var(--muted); line-height: 1.55; }

.contact-title { margin-top: 40px; }

/* ── Pied de page ────────────────────────────────────────────────────── */

.bottom {
  max-width: 46rem;
  margin: 0 auto;
  padding: 28px 24px 48px;
  border-block-start: 1px solid var(--border);
  font-size: 14px;
}

.nav-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.doc-nav {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

.doc-nav span { color: var(--muted); }

.note, .home { color: var(--muted); margin: 0 0 8px; }

/* ── Impression ──────────────────────────────────────────────────────── */

@media print {
  .top, .langs, .toc, .doc-nav, .nav-label, .home, .anchor { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  main, .bottom { max-width: none; padding: 0; }
  h2 { break-after: avoid; }
  a { color: #000; text-decoration: underline; }
}
