/*
 * styles.css — Aucune police ni ressource externe : tout est servi par votre domaine.
 * Conforme à une CSP stricte (aucun style en ligne).
 */

/* ------------------------------------------------------------- jetons */
:root {
  color-scheme: light dark;
  --ink: #17213A;
  --muted: #4F5C75;
  --paper: #F5F7FA;
  --panel: #FFFFFF;
  --line: #D5DBE6;
  --line-strong: #98A4BA;
  --primary: #0B5A6B;
  --primary-ink: #FFFFFF;
  --primary-soft: #E2F0F3;
  --amber: #8F5600;
  --amber-soft: #FFF1D6;
  --slate: #58637A;
  --slate-soft: #EAEEF4;
  --alert: #A12A1B;
  --alert-soft: #FDECE9;
  --focus: #1F6FEB;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 8px;
  --r-lg: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E9EDF6;
    --muted: #A9B3C8;
    --paper: #0E1524;
    --panel: #151E32;
    --line: #2B3754;
    --line-strong: #5A6A92;
    --primary: #63C3D6;
    --primary-ink: #06222A;
    --primary-soft: #12333B;
    --amber: #F2B65A;
    --amber-soft: #3A2B0E;
    --slate: #9DA8C0;
    --slate-soft: #1E2740;
    --alert: #FF9C8D;
    --alert-soft: #3E1D19;
    --focus: #7CB0FF;
  }
}

/* --------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--sans);
}
h1, h2 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.15;
  margin: 0;
}
h1 { font-size: clamp(2rem, 1.35rem + 2.7vw, 3.15rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.05rem); }
h3 { font-size: 1.15rem; line-height: 1.3; margin: 0; }
h4 { font-size: 1rem; margin: 0; }
p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--primary); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }

.sr {
  position: absolute; opacity: 0; width: 1px; height: 1px;
  margin: 0; padding: 0; pointer-events: none; left: 0; top: 0;
}
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 10;
  background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; border-radius: var(--r);
}
.skip:focus { top: 1rem; }

/* ------------------------------------------------------------ squelette */
.topbar {
  max-width: 1120px; margin: 0 auto; padding: 1.1rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.7rem;
  color: var(--ink); text-decoration: none;
  font-family: var(--serif); font-weight: 600; font-size: 1.3rem; letter-spacing: -0.01em;
}
.brand:hover { text-decoration: underline; }
.brand svg { width: 30px; height: 30px; }
.topbar-note { margin: 0; color: var(--muted); font-size: 0.92rem; text-align: right; }

.shell {
  max-width: 1120px; margin: 0 auto; padding: 0 1.25rem 4rem;
  display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 3.5rem; align-items: start;
}
.shell.no-rail { grid-template-columns: minmax(0, 1fr); }
main { min-width: 0; }
.rail { position: sticky; top: 1.5rem; padding-top: 2.6rem; }

.foot { border-top: 1px solid var(--line); background: var(--panel); }
.foot-inner { max-width: 1120px; margin: 0 auto; padding: 1.75rem 1.25rem 2.25rem; }
.foot p { color: var(--muted); font-size: 0.92rem; max-width: 80ch; }
.foot p:last-child { margin-bottom: 0; }

/* -------------------------------------------------------------- boutons */
.btn {
  font: inherit; font-weight: 600; line-height: 1.2;
  min-height: 48px; padding: 0.7rem 1.4rem;
  border-radius: var(--r); border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
}
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-quiet:hover { background: var(--slate-soft); }
.btn-small { min-height: 44px; padding: 0.5rem 1rem; font-size: 0.95rem; }

/* -------------------------------------------------------------- accueil */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  gap: 3.5rem; align-items: center; padding: 2.5rem 0 1rem;
}
.hero-copy .lead { font-size: 1.2rem; color: var(--muted); margin: 1.25rem 0 1.75rem; max-width: 52ch; }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.cta-note { color: var(--muted); font-size: 0.95rem; }

.promises { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.85rem; max-width: 56ch; }
.promises li { position: relative; padding-left: 2rem; margin: 0; }
.promises li::before {
  content: ""; position: absolute; left: 0.2rem; top: 0.38em;
  width: 0.5rem; height: 0.9rem;
  border: solid var(--primary); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.promises strong { font-weight: 650; }

.sample-note { margin: 0.75rem 0 0; color: var(--muted); font-size: 0.9rem; }
.method { margin-top: 3.5rem; max-width: 70ch; }
.method ul { margin: 0.75rem 0 0; padding-left: 1.2rem; }
.method li { margin-bottom: 0.45rem; }

/* ------------------------------------------------------- parcours / rail */
.rail-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.1rem; }
.rail-item {
  display: flex; align-items: center; gap: 0.8rem; width: 100%;
  padding: 0.5rem 0.55rem; border-radius: var(--r);
  font: inherit; font-weight: 500; color: var(--muted); text-align: left;
  background: none; border: 0; text-decoration: none; margin: 0;
}
button.rail-item { cursor: pointer; }
button.rail-item:hover, a.rail-item:hover { background: var(--slate-soft); color: var(--ink); }
.rail-num {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--line-strong); background: var(--panel);
  font-size: 0.85rem; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--muted);
}
.rail-item[aria-current="step"] { color: var(--ink); font-weight: 650; }
.rail-item[aria-current="step"] .rail-num { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.rail-item.done .rail-num { border-color: var(--primary); color: var(--primary); }
.rail-note { margin: 1.5rem 0.55rem 0; color: var(--muted); font-size: 0.9rem; }

.step { padding-top: 2.25rem; max-width: 760px; }
.step-title { margin: 0.25rem 0 0.75rem; }
.step-intro { color: var(--muted); margin-bottom: 2.25rem; }
.mprog { display: none; margin-bottom: 1rem; }
.mprog-text { margin: 0 0 0.4rem; color: var(--muted); font-size: 0.95rem; font-weight: 600; }
progress {
  -webkit-appearance: none; appearance: none; display: block;
  width: 100%; height: 6px; border: 0; border-radius: 3px; overflow: hidden; background: var(--line);
}
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--primary); }
progress::-moz-progress-bar { background: var(--primary); }

/* ------------------------------------------------------------ questions */
.q { border: 0; padding: 0; margin: 0 0 2.4rem; min-width: 0; }
.q[hidden] { display: none; }
.q-label { font-weight: 650; font-size: 1.15rem; line-height: 1.35; padding: 0; margin-bottom: 0.35rem; }
.q-help { color: var(--muted); font-size: 0.95rem; margin: 0 0 0.9rem; max-width: 62ch; }
.q-error { display: none; color: var(--alert); font-weight: 600; font-size: 0.95rem; margin: 0.6rem 0 0; }
.q.missing .q-error { display: block; }
.q.missing .opts { border-color: var(--alert); }

.opts { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.opts > * + * { border-top: 1px solid var(--line); }
.opt-group {
  margin: 0; max-width: none; padding: 0.65rem 1rem;
  background: var(--slate-soft); font-weight: 650; font-size: 0.95rem; color: var(--ink);
}
.opt { position: relative; display: flex; align-items: flex-start; gap: 0.9rem; padding: 0.85rem 1rem; cursor: pointer; }
.opt:hover { background: var(--slate-soft); }
.opt:has(input:checked) { background: var(--primary-soft); }
.ctl {
  flex: none; width: 22px; height: 22px; margin-top: 2px;
  border: 2px solid var(--line-strong); background: var(--panel);
  display: grid; place-items: center;
}
.single .ctl { border-radius: 50%; }
.multi .ctl { border-radius: 6px; }
.opt input:checked ~ .ctl { background: var(--primary); border-color: var(--primary); }
.single input:checked ~ .ctl::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary-ink); }
.multi input:checked ~ .ctl::after {
  content: ""; width: 6px; height: 11px;
  border: solid var(--primary-ink); border-width: 0 2.5px 2.5px 0;
  transform: translateY(-1px) rotate(45deg);
}
.opt input:focus-visible ~ .ctl { outline: 3px solid var(--focus); outline-offset: 2px; }
.opt-title { font-weight: 500; }
.opt input:checked ~ .opt-text .opt-title { font-weight: 650; }
.opt-hint { display: block; color: var(--muted); font-size: 0.92rem; margin-top: 0.15rem; }

/* Boutons de choix compacts (taille, chiffres) */
.opts.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; border: 0; background: none; border-radius: 0; overflow: visible; }
.chips > * + * { border-top: 0; }
.chips .opt { padding: 0; background: none; display: block; }
.chips .opt:hover, .chips .opt:has(input:checked) { background: none; }
.chips .ctl { display: none; }
.chips .opt-text {
  display: flex; align-items: center; min-height: 48px; padding: 0.6rem 1.05rem;
  border: 1.5px solid var(--line-strong); border-radius: var(--r); background: var(--panel); font-weight: 500;
}
.chips .opt:hover input:not(:checked) ~ .opt-text { background: var(--slate-soft); }
.chips input:checked ~ .opt-text { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 650; }
.chips input:focus-visible ~ .opt-text { outline: 3px solid var(--focus); outline-offset: 2px; }

.step-nav { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: space-between; margin-top: 2.5rem; }
.form-error { color: var(--alert); font-weight: 600; margin: 1.25rem 0 0; }

/* ------------------------------------------------------------- matrice */
.matrix-wrap { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.matrix { width: 100%; border-collapse: collapse; table-layout: fixed; }
.matrix th, .matrix td { padding: 1rem 1.1rem; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
.matrix thead th { border-top: 0; border-bottom: 1px solid var(--line-strong); color: var(--muted); font-size: 0.92rem; font-weight: 650; }
.matrix tbody th { width: 34%; font-weight: 400; }
.matrix .reg-name { display: block; font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: var(--ink); line-height: 1.2; }
a.reg-name { text-decoration-color: var(--line-strong); }
.matrix .reg-kind { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.85rem; line-height: 1.35; }
.cell { display: flex; gap: 0.6rem; align-items: flex-start; }
.cell-text { min-width: 0; font-size: 0.95rem; line-height: 1.35; }
.cell-text strong { display: block; font-weight: 650; }
.cell-sub { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.85rem; }

.mark { flex: none; width: 26px; height: 26px; }
.mark-ring { fill: none; stroke: currentColor; stroke-width: 2; }
.mark-fill { fill: currentColor; stroke: none; transform-box: fill-box; transform-origin: center; }
.mark-likely { color: var(--primary); }
.mark-analyze { color: var(--amber); }
.mark-unlikely { color: var(--slate); }
.mark { print-color-adjust: exact; -webkit-print-color-adjust: exact; }

/* Un seul moment animé : les pastilles se remplissent à l'arrivée des résultats */
.matrix.reveal .mark-fill { animation: fill-in 0.45s ease-out both; animation-delay: var(--d, 0ms); }
.matrix.reveal tbody tr:nth-child(1) { --d: 120ms; }
.matrix.reveal tbody tr:nth-child(2) { --d: 260ms; }
.matrix.reveal tbody tr:nth-child(3) { --d: 400ms; }
.matrix.reveal tbody tr:nth-child(4) { --d: 540ms; }
@keyframes fill-in { from { opacity: 0; transform: scale(0.2); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .matrix.reveal .mark-fill { animation: none; }
}

/* ------------------------------------------------------------- résultats */
.results { padding-top: 2.25rem; }
.results-intro { color: var(--muted); font-size: 1.1rem; margin: 0.9rem 0 1.75rem; }
.notice {
  margin: 1.5rem 0 0; padding: 0.9rem 1.1rem; max-width: none;
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line-strong);
  border-radius: var(--r); font-size: 0.95rem;
}
.notice p { margin: 0 0 0.5rem; }
.notice p:last-child { margin: 0; }
.alertbox {
  margin: 1.5rem 0 0; padding: 1rem 1.1rem;
  background: var(--alert-soft); border: 1px solid var(--alert); border-left-width: 5px; border-radius: var(--r);
}
.alertbox h2 { font-size: 1.1rem; font-family: var(--sans); font-weight: 700; color: var(--alert); margin-bottom: 0.4rem; }
.alertbox p { margin: 0 0 0.4rem; }
.alertbox p:last-child { margin: 0; }
.actions-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.5rem 0 0; }

.reg { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--line-strong); scroll-margin-top: 1rem; }
.reg-head h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.9rem; }
.reg-full { font-family: var(--sans); font-size: 1rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.reg-about { color: var(--muted); margin: 0.75rem 0 1.5rem; }

.common { margin-bottom: 2.25rem; padding: 1.1rem 1.25rem 0.75rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); }
.common-note { color: var(--muted); font-size: 0.95rem; margin: 0.3rem 0 0.9rem; }
.country { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.country:first-of-type, .common + .country { border-top: 0; padding-top: 0; margin-top: 0; }
.verdict { display: flex; align-items: center; flex-wrap: wrap; gap: 0.3rem 0.7rem; margin: 0.6rem 0 1rem; max-width: none; }
.verdict .mark { width: 30px; height: 30px; }
.verdict strong { font-size: 1.1rem; font-weight: 650; }
.verdict-sub { color: var(--muted); font-size: 0.92rem; }

.block-title { font-size: 1rem; font-weight: 650; margin: 1.5rem 0 0.5rem; }
.list { list-style: none; margin: 0 0 0.5rem; padding: 0; display: grid; gap: 0.6rem; }
.list li { position: relative; padding-left: 1.6rem; margin: 0; max-width: 72ch; }
.list li::before { content: ""; position: absolute; left: 0.1rem; top: 0.42em; width: 0.62rem; height: 0.62rem; border-radius: 2px; background: var(--line-strong); }
.todo li::before { background: none; border: 2px solid var(--primary); }

.timeline { margin: 0; display: grid; gap: 0.7rem; max-width: 72ch; }
.timeline div { position: relative; padding-left: 1.6rem; }
.timeline div::before { content: ""; position: absolute; left: 0.1rem; top: 0.5em; width: 0.7rem; height: 0.7rem; border-radius: 50%; border: 2px solid var(--line-strong); }
.timeline div.live::before { background: var(--primary); border-color: var(--primary); }
.timeline dt { font-weight: 650; font-variant-numeric: tabular-nums; }
.timeline dd { margin: 0; color: var(--ink); }

details { margin-top: 1.25rem; }
summary { cursor: pointer; font-weight: 600; padding: 0.4rem 0; color: var(--primary); }
summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
details > :not(summary) { max-width: 72ch; }
details .list { margin-top: 0.6rem; }
.links { list-style: none; padding: 0; margin: 0.75rem 0 0; display: grid; gap: 0.35rem; }
.links li { margin: 0; }

/* --------------------------------------------------- mentions légales */
.doc { max-width: 760px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.doc h1 { margin-bottom: 1.5rem; }
.doc h2 { font-size: 1.4rem; margin: 2.2rem 0 0.7rem; }
.todo-field { background: var(--amber-soft); color: var(--amber); padding: 0.05em 0.35em; border-radius: 4px; font-weight: 600; }

/* ----------------------------------------------------------- adaptation */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .rail { display: none; }
  .mprog { display: block; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 2rem; padding-top: 1rem; }
  .topbar-note { display: none; }
  .step { padding-top: 1rem; }
  .results { padding-top: 1rem; }
}
@media (max-width: 560px) {
  body { font-size: 1rem; }
  .matrix th, .matrix td { padding: 0.8rem 0.6rem; }
  .matrix tbody th { width: 30%; }
  .matrix .reg-name { font-size: 1.05rem; }
  .mark { width: 22px; height: 22px; }
  .cell { gap: 0.4rem; }
  .cell-text { font-size: 0.85rem; }
  .step-nav .btn { flex: 1 1 100%; }
  .step-nav .btn-primary { order: -1; }
}

/* --------------------------------------------------------------- impression */
@media print {
  :root { --paper: #fff; --panel: #fff; --ink: #000; --muted: #333; --line: #bbb; --line-strong: #777; }
  body { font-size: 11pt; background: #fff; }
  .skip, .topbar, .rail, .mprog, .actions-row, .step-nav, .foot-links, .btn { display: none !important; }
  .shell { display: block; max-width: none; padding: 0; }
  .reg { break-inside: avoid-page; }
  .country, .alertbox, .matrix-wrap { break-inside: avoid; }
  a[href^="https"]::after { content: " (" attr(href) ")"; font-size: 9pt; word-break: break-all; }
  details > :not(summary) { display: block; }
  summary { list-style: none; color: #000; }
  .foot { border: 0; }
}

/* ------------------------------------------------------- choix de la langue */
.lang { display: inline-flex; border: 1.5px solid var(--line-strong); border-radius: var(--r); overflow: hidden; flex: none; }
.lang button {
  font: inherit; font-size: 0.85rem; font-weight: 650; letter-spacing: 0.04em;
  padding: 0.35rem 0.7rem; min-width: 2.6rem; border: 0; background: transparent; color: var(--ink); cursor: pointer;
}
.lang button + button { border-left: 1.5px solid var(--line-strong); }
.lang button:hover { background: var(--slate-soft); }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
@media print { .lang { display: none; } }

/* ------------------------------------------------------------- version bêta */
.beta {
  font-family: var(--sans, inherit); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.15rem 0.5rem; border: 1.5px solid var(--amber, var(--line-strong)); color: var(--amber, var(--ink)); border-radius: 999px;
}
.beta-note {
  max-width: 1120px; margin: 0 auto; padding: 0 1.25rem 0.75rem; color: var(--muted); font-size: 0.9rem;
}
