/* ══════════════════════════════════════════════════════════════
   UI — le design-system de La Maison, sobre et remplaçable.
   Règles : noir pur · texte système · les degrés en mono ·
   la couleur est un ÉVÉNEMENT (acquis, palier) jamais un décor ·
   tout est natif et accessible (button, fieldset, radio, focus visible) ·
   aucune dépendance réseau · contrastes ≥ 4,5:1 (vérifiés par tests/ui.test.js).
   Changer l'identité = changer les tokens ci-dessous.
   ══════════════════════════════════════════════════════════════ */
:root {
  --fond: #000000;
  --surface: #141416;
  --trait: rgba(255, 255, 255, .12);
  --encre: #F2F2F4;
  --secondaire: #ABABB2;
  --tertiaire: #85858D;
  --ok: #6FCF97;
  --alerte: #FF7A7A;
  --evenement: linear-gradient(120deg, #E2C9FF, #8CFFDD);
  --fam-mesure: #6FCF97;
  --fam-declaratif: #B8ACFF;
  --fam-ecriture: #ABABB2;
  --fam-symbolique: #E6C46A;
  --fam-projectif: #8FC4F0;
  --police: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --rayon: 14px;
  --rayon-s: 8px;
  --marge: 20px;
  --largeur: 640px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  background: var(--fond); color: var(--encre);
  font-family: var(--police); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
.app { max-width: var(--largeur); margin: 0 auto; padding: 0 var(--marge) 60px; }

/* ── accessibilité de base ── */
.lien-saut { position: absolute; left: -9999px; top: 8px; background: var(--encre); color: var(--fond); padding: 10px 14px; border-radius: var(--rayon-s); z-index: 100; font-weight: 600; }
.lien-saut:focus { left: 8px; }
*:focus-visible { outline: 2px solid var(--encre); outline-offset: 3px; border-radius: 4px; }
.visuel-seul { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── typographie ── */
.k { font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--tertiaire); }
h1 { font-size: clamp(28px, 6vw, 38px); font-weight: 700; letter-spacing: -.02em; line-height: 1.12; margin: 12px 0 14px; }
h2 { font-size: clamp(21px, 4.5vw, 26px); font-weight: 700; letter-spacing: -.015em; line-height: 1.2; margin: 10px 0 12px; }
h3 { font-size: 17px; font-weight: 600; line-height: 1.3; }
p.l { color: var(--secondaire); font-size: 16.5px; max-width: 58ch; }
p.s { color: var(--secondaire); font-size: 14px; }
.mono, .degre { font-family: var(--mono); }
.degre { font-weight: 600; font-variant-numeric: tabular-nums; }
a { color: var(--encre); }

/* ── actions (toujours sur button ou a) ── */
.btn, .btn-ligne {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 15.5px; line-height: 1.2;
  padding: 15px 22px; border-radius: var(--rayon); cursor: pointer; text-decoration: none;
  transition: opacity .15s, transform .08s;
}
.btn { background: var(--encre); color: var(--fond); border: 0; }
.btn:hover { opacity: .9; }
.btn:active { transform: scale(.985); }
.btn-ligne { background: transparent; color: var(--secondaire); border: 1px solid var(--trait); }
.btn-ligne:hover { color: var(--encre); border-color: var(--secondaire); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.pleine { width: 100%; }

/* ── choix (question à options : fieldset + radio natifs) ── */
.choix { border: 0; display: grid; gap: 8px; }
.choix legend { font-size: clamp(19px, 4.5vw, 24px); font-weight: 600; line-height: 1.3; margin-bottom: 18px; }
.choix label {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--trait); border-radius: 12px;
  padding: 14px 16px; font-size: 15.5px; min-height: 52px;
}
.choix label:hover { border-color: var(--secondaire); }
.choix input[type="radio"] { appearance: none; width: 18px; height: 18px; border: 2px solid var(--tertiaire); border-radius: 50%; flex: none; margin: 0; }
.choix input[type="radio"]:checked { border-color: var(--encre); background: radial-gradient(circle, var(--encre) 45%, transparent 50%); }
.choix input[type="radio"]:focus-visible { outline: 2px solid var(--encre); outline-offset: 3px; }
.choix label:has(input:checked) { border-color: var(--encre); }

/* ── champs ── */
input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="time"], textarea, select {
  font: inherit; color: var(--encre); background: var(--surface); border: 1px solid var(--trait);
  border-radius: 12px; padding: 13px 14px; width: 100%; min-height: 48px;
}
textarea { min-height: 110px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--tertiaire); }
label.champ { display: block; font-size: 14px; color: var(--secondaire); margin-bottom: 6px; }

/* ── degrés : la seule place du dégradé, et de la couleur ── */
.jauge { height: 8px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; }
.jauge > i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--encre); transition: width .9s cubic-bezier(.2,.7,.2,1); }
.jauge.acquise > i { background: var(--evenement); }
.ligne-degre { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.ligne-degre .degre { font-size: 17px; }

/* ── cartes, badges, états ── */
.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 18px; }
.carte + .carte { margin-top: 12px; }
.badge { font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; }
.fam-mesure { color: var(--fam-mesure); }
.fam-declaratif { color: var(--fam-declaratif); }
.fam-ecriture { color: var(--fam-ecriture); }
.fam-symbolique { color: var(--fam-symbolique); }
.fam-projectif { color: var(--fam-projectif); }
.trace { font-size: 13px; line-height: 1.6; color: var(--secondaire); border: 1px solid var(--trait); border-radius: var(--rayon-s); padding: 12px 14px; margin-top: 16px; }
.trace b { color: var(--encre); font-weight: 600; }
.verrou { opacity: .55; }
.brume { color: var(--tertiaire); }
.acquis { color: var(--ok); font-family: var(--mono); font-size: 12px; }
.evenement { background: var(--evenement); color: #000; }
.alerte { color: var(--alerte); }
.separateur { border: 0; border-top: 1px solid var(--trait); margin: 28px 0; }

/* ── progression (écran d'items) ── */
.prog { font-family: var(--mono); font-size: 11px; color: var(--tertiaire); }
.pbar { height: 3px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; margin: 8px 0 20px; }
.pbar > i { display: block; height: 100%; width: 0; background: var(--encre); transition: width .3s; }

/* ── navigation ── */
.entete { display: flex; justify-content: space-between; align-items: center; padding: 18px 0 8px; gap: 12px; }
.entete .marque { font-weight: 600; text-decoration: none; }
.entete nav { display: flex; gap: 18px; }
.entete nav a { color: var(--secondaire); text-decoration: none; font-size: 14px; }
.entete nav a:hover, .entete nav a[aria-current="page"] { color: var(--encre); }
.groupe { margin-top: 30px; }
.groupe .quoi { color: var(--tertiaire); font-size: 13.5px; margin-top: 2px; }
.instrument { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--trait); text-decoration: none; color: inherit; }
.instrument:first-of-type { border-top: 0; }
.instrument .nom { font-weight: 600; font-size: 15.5px; }
.instrument .resume { color: var(--secondaire); font-size: 13.5px; margin-top: 2px; }
.instrument .meta { margin-left: auto; text-align: right; flex: none; font-family: var(--mono); font-size: 11px; color: var(--tertiaire); }
.instrument.verrou .nom { color: var(--secondaire); }

/* ── mouvement ── */
.apparait { animation: apparait .5s cubic-bezier(.2,.7,.2,1) both; }
@keyframes apparait { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-delay: 0s !important; transition-duration: .001s !important; scroll-behavior: auto !important; }
}

/* ── impression (Portrait / Miroir → PDF) ── */
@media print {
  body { background: #fff !important; color: #111 !important; }
  * { color: #111 !important; background: #fff !important; border-color: #bbb !important; }
  .no-print, .lien-saut { display: none !important; }
  .jauge { background: #eee !important; border: 1px solid #999; }
  .jauge > i { background: #555 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
