/* AnzarSeha — feuille de style des documents juridiques.
   Alignée sur la charte de la vitrine (jetons repris de src/index.css /
   public/presentation) : même police AnzarSans, même bleu Anzar / sarcelle
   Seha, mêmes cartes à ombre-anneau. Aucun appel à un tiers. */
@font-face {
  font-family: 'AnzarSans';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/presentation/fonts/anzarsans.woff2) format('woff2');
}

/* ── Jetons — repris du produit (mode clair) ─────────────────────────── */
:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --fg: #0f172a;
  --muted-fg: #556278;
  --soft-fg: #5b6b81;
  --border: #e3e8ef;
  --border-strong: #d3dbe6;
  --muted: #eef2f7;
  --primary: #1d4ed8;
  --primary-strong: #1e40af;
  --primary-soft: #eff6ff;
  --anzar: #0C4A6E;
  --seha: #0D9488;
  --seha-ink: #0f766e;
  --tile-a: #0EA5E9;
  --tile-b: #0D9488;
  --green-soft: #dcfce7; --green-fg: #15803d;
  --blue-soft: #e0f2fe;  --blue-fg: #0369a1;
  --radius-card: 16px;
  --radius-frame: 24px;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, .05), 0 0 0 1px var(--border);
  --shadow-pop: 0 18px 44px rgba(15, 23, 42, .12);
  --ring: #1d4ed8;
}

/* La vitrine AnzarSeha est en thème clair uniquement ; les pages juridiques
   le sont donc aussi, pour rester cohérentes avec le reste du site — quel que
   soit le réglage clair/sombre du système. Toutes les couleurs sont peintes
   explicitement ci-dessus, aucun bloc « prefers-color-scheme: dark ». */
:root { color-scheme: light; }

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body {
  background: var(--bg); color: var(--fg);
  font-family: 'AnzarSans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px; line-height: 1.68;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.wrap { max-width: 776px; margin: 0 auto; padding: 0 24px; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }

/* Étiquette « eyebrow » — reprise de la vitrine, remplace le monospace. */
.kicker, .toc h2, .tbl thead th, .docref dt {
  font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
}

/* ── Barre supérieure « verre » — même traitement que l'en-tête de la
   vitrine : translucide, floutée, contenu qui glisse dessous. ────────── */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px) saturate(1.35);
  -webkit-backdrop-filter: blur(14px) saturate(1.35);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
/* Filet dégradé — accent « en-tête officiel » qui reste visible en sticky. */
.topbar::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--tile-a), var(--tile-b));
}
.topbar-in {
  max-width: 776px; margin: 0 auto; padding: 11px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.topbar .home, .topbar .act {
  font-size: 13px; font-weight: 600; color: var(--primary-strong); text-decoration: none;
  padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 70%, transparent); white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease;
}
.topbar .act { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-family: inherit; }
.topbar .act svg { color: var(--seha-ink); }
.topbar .home:hover, .topbar .act:hover { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
@media (max-width: 460px) { .topbar .act span { display: none; } .topbar .act { padding: 6px 9px; } }

/* ── En-tête du document ─────────────────────────────────────────────── */
.doc-head { padding: 30px 0 0; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand svg { width: 32px; height: 32px; border-radius: 9px; box-shadow: var(--shadow-card); flex: none; }
.brand .wm {
  font-weight: 800; font-size: 18px; letter-spacing: -.02em; line-height: 1.1;
}
.brand .wm .a { color: var(--anzar); }
.brand .wm .s { color: var(--seha); }
.crumb { font-size: 13px; color: var(--soft-fg); margin: 22px 0 0; }
.crumb a { color: var(--primary-strong); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

.kicker { font-size: 11px; color: var(--seha-ink); margin: 22px 0 0; }
h1 {
  font-weight: 800; font-size: clamp(30px, 5.2vw, 46px); line-height: 1.04;
  letter-spacing: -.03em; margin: 10px 0 0; color: var(--fg);
}
.lead { font-size: clamp(16.5px, 1.6vw, 18.5px); line-height: 1.62; color: var(--muted-fg); margin: 18px 0 0; }

/* Bloc de références — front matter d'un document officiel. */
.docref {
  margin: 24px 0 0; border-radius: var(--radius-card); background: var(--card);
  box-shadow: var(--shadow-card); overflow: hidden;
  display: grid; grid-template-columns: repeat(2, 1fr);
}
.docref > div { padding: 13px 18px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.docref > div:nth-child(-n+2) { border-top: none; }
.docref > div:nth-child(odd) { border-left: none; }
.docref .wide { grid-column: 1 / -1; }
.docref dt { font-size: 10px; color: var(--soft-fg); margin: 0 0 3px; }
.docref dd { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--fg); }
.docref dd.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-weight: 500; letter-spacing: .02em; }
@media (max-width: 520px) {
  .docref { grid-template-columns: 1fr; }
  .docref > div { border-left: none; border-top: 1px solid var(--border); }
  .docref > div:first-child { border-top: none; }
}

/* ── Sommaire ────────────────────────────────────────────────────────── */
.toc {
  margin: 30px 0 0; border-radius: var(--radius-card); background: var(--card);
  padding: 20px 22px; box-shadow: var(--shadow-card);
}
.toc h2 { font-size: 11px; color: var(--soft-fg); margin: 0 0 13px; }
.toc ol { list-style: none; counter-reset: toc; columns: 2; column-gap: 30px; }
@media (max-width: 560px) { .toc ol { columns: 1; } }
.toc li { counter-increment: toc; font-size: 14.5px; margin: 0 0 8px; break-inside: avoid; }
.toc li a { color: var(--fg); text-decoration: none; border-bottom: 1px solid transparent; }
.toc li a::before {
  content: counter(toc, decimal-leading-zero); margin-right: 9px;
  color: var(--primary); font-weight: 700; font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.toc li a:hover { border-bottom-color: var(--primary); }

/* ── Sections / articles ─────────────────────────────────────────────── */
main { padding: 24px 0 0; counter-reset: sec; }
section.art { padding: 34px 0; border-top: 1px solid var(--border); scroll-margin-top: 76px; }
section.art > h2 {
  counter-increment: sec; font-weight: 800; font-size: 21px; letter-spacing: -.02em;
  line-height: 1.22; margin: 0; display: flex; gap: 13px; align-items: center; color: var(--fg);
}
section.art > h2::before {
  content: counter(sec, decimal-leading-zero);
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 23px; padding: 0 9px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-strong);
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  font-variant-numeric: tabular-nums; flex: none;
}
section.art h3 { font-size: 16px; font-weight: 700; margin: 24px 0 0; color: var(--fg); letter-spacing: -.01em; }
section.art p { margin: 14px 0 0; color: var(--muted-fg); }
section.art p.first { margin-top: 18px; }
section.art strong { color: var(--fg); font-weight: 600; }
section.art code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .85em;
  background: var(--blue-soft); color: var(--blue-fg); padding: 1px 6px; border-radius: 6px;
}

/* Listes */
ul, ol.body { margin: 14px 0 0; list-style: none; display: grid; gap: 10px; }
ul li, ol.body li { position: relative; padding-left: 24px; color: var(--muted-fg); font-size: 15.5px; }
ul li::before { content: ""; position: absolute; left: 3px; top: 10px; width: 7px; height: 7px; border-radius: 2px; background: var(--seha); }
ol.body { counter-reset: it; }
ol.body li { counter-increment: it; }
ol.body li::before {
  content: counter(it); position: absolute; left: 0; top: 1px;
  color: var(--primary); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums;
}
li strong { color: var(--fg); font-weight: 600; }

/* Tableaux de données / définitions */
.tbl { margin: 18px 0 0; border-radius: var(--radius-card); overflow: hidden; box-shadow: var(--shadow-card); background: var(--card); }
.tbl table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th, .tbl td { text-align: left; padding: 12px 15px; vertical-align: top; border-top: 1px solid var(--border); }
.tbl thead th {
  background: color-mix(in srgb, var(--primary-soft) 60%, var(--card));
  border-top: none; font-size: 10.5px; color: var(--soft-fg); font-weight: 600;
}
.tbl td { color: var(--muted-fg); }
.tbl td strong { color: var(--fg); }
.tbl-scroll { overflow-x: auto; }

/* Encadrés */
.callout {
  margin: 18px 0 0; border-left: 3px solid var(--primary); background: var(--card);
  border-radius: var(--radius-card); padding: 16px 19px; font-size: 15px; color: var(--muted-fg);
  box-shadow: var(--shadow-card);
}
.callout.green { border-left-color: var(--seha); }
.callout strong { color: var(--fg); font-weight: 600; }

/* Liens en ligne */
a.inl { color: var(--primary-strong); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--primary) 35%, transparent); }
a.inl:hover { border-bottom-color: var(--primary); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 3px; }

/* ── Pied — navigation entre documents ───────────────────────────────── */
.doc-foot { border-top: 1px solid var(--border); margin-top: 14px; padding: 26px 0 64px; }
.doc-foot .totop { display: inline-block; font-size: 13px; font-weight: 600; color: var(--soft-fg); text-decoration: none; margin: 0 0 22px; }
.doc-foot .totop:hover { color: var(--primary-strong); }
.doc-foot .nav { display: flex; flex-wrap: wrap; gap: 10px 18px; font-size: 14px; }
.doc-foot .nav a { color: var(--primary-strong); text-decoration: none; }
.doc-foot .nav a:hover { text-decoration: underline; }
.doc-foot .nav a[aria-current] { color: var(--soft-fg); pointer-events: none; }
.doc-foot .fin { font-size: 12.5px; color: var(--soft-fg); margin: 20px 0 0; line-height: 1.7; }

/* Bouton flottant « Haut de page » (injecté par legal.js). */
.totop-float {
  position: fixed; right: 22px; bottom: 22px; z-index: 70;
  width: 42px; height: 42px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); color: var(--primary-strong); font-size: 18px; line-height: 1;
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: blur(10px) saturate(1.3); -webkit-backdrop-filter: blur(10px) saturate(1.3);
  box-shadow: var(--shadow-pop);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.totop-float.show { opacity: 1; visibility: visible; transform: none; }
.totop-float:hover { background: var(--primary-soft); }
@media (prefers-reduced-motion: reduce) { .totop-float { transition: none; } }

/* ── Impression / archivage — mise en page de document officiel ───────── */
@media print {
  @page { margin: 18mm 16mm; }
  html { scroll-behavior: auto; }
  body { background: #fff; color: #000; font-size: 10.6pt; }
  .topbar, .totop-float, .doc-foot .totop { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .doc-head { padding: 0; }
  .kicker { color: #333; }
  h1 { font-size: 22pt; }
  .toc, .tbl, .callout, .docref { box-shadow: none; border: 1px solid #bbb; }
  .docref > div, .tbl th, .tbl td { border-color: #bbb; }
  section.art { border-top: 1px solid #ccc; break-inside: auto; }
  section.art > h2 { break-after: avoid; }
  h3 { break-after: avoid; }
  .tbl, .callout, .docref, ul li, ol.body li { break-inside: avoid; }
  section.art p, li { color: #111; }
  /* Les liens deviennent vérifiables sur papier : l'URL suit le libellé. */
  a.inl[href^="http"]::after,
  a.inl[href^="mailto:"]::after { content: " (" attr(href) ")"; font-size: .85em; color: #444; word-break: break-all; }
  a.inl { color: #000; border-bottom: none; }
  .doc-foot { border-top: 1px solid #ccc; }
}
