/* =============================================================================
   Le Match IA : styles spécifiques (progression, test, radar, résultat).
   Toute couleur et toute police passent par les tokens du design system
   Inaia v2 (assets/inaia/). Aucune valeur hex inline ; les quelques tokens
   locaux documentés en tête de fichier complètent le DS sans le détourner.
   ============================================================================= */

/* Tokens locaux documentés (aucun existant au DS pour ces usages précis) :
   --match-série-modèle : le polygone « profil du modèle » du radar est porté
     par l'encre du DS (var(--ink)) avec une opacité de remplissage propre ;
   --match-indice : la barre d'indice d'affinité utilise l'accent du DS
     (var(--violet)) sans nouvelle couleur. */

/* ---------- header paper : pages claires ---------- */
.header--paper:not(.is-scrolled) .header__brand .logo-light { display: none; }
.header--paper:not(.is-scrolled) .header__brand .logo-dark { display: block; }

/* ---------- héros de la landing ---------- */
.hero__radar {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin-inline: auto;
}
.hero__radar .radar-svg { width: 100%; height: auto; overflow: visible; }
.hero__radar .radar__grille polygon,
.hero__radar .radar__grille line {
  fill: none;
  stroke: var(--white-16);
  stroke-width: 1;
}
.hero__radar .radar__série--attendu polygon {
  fill: var(--violet);
  fill-opacity: 0.24;
  stroke: var(--violet);
  stroke-width: 1.5;
}
.hero__radar .radar__série--attendu circle { fill: var(--violet-bright); }
.hero__radar .radar__label {
  fill: var(--text-inverse-secondary);
  font-family: var(--body);
  font-size: 11px;
}

/* ---------- radar en résultat (sur papier) ---------- */
.radar-frame {
  padding: var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--radius-3xl);
  background: var(--surface-card);
}
.radar-frame .radar-svg { width: 100%; max-width: 420px; height: auto; margin-inline: auto; display: block; overflow: visible; }
.radar-frame .radar__grille polygon,
.radar-frame .radar__grille line {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}
.radar-frame .radar__série--attendu polygon {
  fill: var(--violet);
  fill-opacity: 0.26;
  stroke: var(--violet);
  stroke-width: 1.5;
}
.radar-frame .radar__série--attendu circle { fill: var(--violet); }
.radar-frame .radar__série--modèle polygon {
  fill: var(--ink);
  fill-opacity: 0.1;
  stroke: var(--ink);
  stroke-width: 1.5;
}
.radar-frame .radar__série--modèle circle { fill: var(--ink); }
.radar-frame .radar__label {
  fill: var(--text-secondary);
  font-family: var(--body);
  font-size: 10.5px;
}
.radar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin-top: var(--space-4);
  font-size: var(--text-small);
  color: var(--text-secondary);
}
.radar-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: var(--space-2);
  vertical-align: -1px;
}
.radar-legend .point-attendu { background: var(--violet); }
.radar-legend .point-modèle { background: var(--ink); }

/* ---------- parcours de test ---------- */
.test-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--surface-page); }
.test-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface-page);
  border-bottom: 1px solid var(--line);
}
.test-topbar__inner {
  width: min(100% - (var(--gutter) * 2), var(--container-narrow));
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 0;
}
.test-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border: 0;
  background: none;
  color: var(--text-secondary);
  font-size: var(--text-small);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-pill);
  transition: color var(--duration-fast) var(--ease), background var(--duration-fast) var(--ease);
}
.test-back:hover { color: var(--text-primary); background: var(--ink-04); }
.test-back[hidden] { display: none; }
.test-count { margin-left: auto; color: var(--text-secondary); font-size: var(--text-small); }
.test-progress {
  height: 3px;
  background: var(--bone-deep);
}
.test-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--violet);
  transition: width var(--duration-fast) var(--ease);
}
.test-main {
  flex: 1;
  width: min(100% - (var(--gutter) * 2), var(--container-narrow));
  margin-inline: auto;
  padding: var(--space-12) 0 var(--space-24);
}
.q-view { max-width: 720px; margin-inline: auto; }
.q-view[hidden] { display: none; }
.q-view--anim { animation: qIn var(--duration-fast) var(--ease); }
@keyframes qIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.q-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  color: var(--accent-text);
  font-size: var(--text-meta);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-meta);
}
.q-prompt {
  font-family: var(--display);
  font-size: var(--text-title-2);
  font-weight: var(--weight-medium);
  line-height: var(--line-title);
  letter-spacing: var(--tracking-title);
  color: var(--text-primary);
  margin-bottom: var(--space-8);
}

/* Choix forcé binaire : deux cartes cliquables */
.q-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.q-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--radius-2xl);
  background: var(--surface-card);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--text-primary);
  transition: border-color var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease), box-shadow var(--duration-base) var(--ease);
}
.q-card:hover { border-color: var(--line-strong); transform: translateY(-3px); box-shadow: var(--shadow-card); }
.q-card:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
.q-card__key {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line-strong);
  color: var(--text-secondary);
  font-size: var(--text-meta);
}
.q-card__label { font-size: var(--text-lead); line-height: var(--line-body); }

/* Likert 5 */
.q-likert { display: grid; gap: var(--space-3); }
.q-scale {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface-card);
  cursor: pointer;
  font: inherit;
  color: var(--text-primary);
  text-align: left;
  width: 100%;
  transition: border-color var(--duration-fast) var(--ease), background var(--duration-fast) var(--ease);
}
.q-scale:hover { border-color: var(--line-strong); background: var(--bone); }
.q-scale:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.q-scale__num {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--text-secondary);
  font-size: var(--text-meta);
}
.q-scale__label { font-size: var(--text-body); }
.q-hint { margin-top: var(--space-6); color: var(--text-tertiary); font-size: var(--text-meta); }

/* Écrans d'accueil, de respiration et de calcul */
.test-intro, .test-breath, .test-calc { max-width: 640px; margin-inline: auto; text-align: center; }
.test-intro h1, .test-breath h2 {
  font-family: var(--display);
  font-size: var(--text-title-1);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-title);
  margin-bottom: var(--space-4);
}
.test-intro p, .test-breath p { color: var(--text-secondary); margin: 0 auto var(--space-3); }
.test-facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2) var(--space-6);
  margin: var(--space-6) 0;
  color: var(--text-secondary);
  font-size: var(--text-small);
  list-style: none;
  padding: 0;
}
.test-facts li { display: flex; align-items: center; gap: var(--space-2); }
.test-facts i { width: 7px; height: 7px; border-radius: 50%; background: var(--violet); }
.test-actions { display: flex; justify-content: center; gap: var(--space-3); margin-top: var(--space-8); }
.test-calc__ring {
  width: 84px;
  height: 84px;
  margin: 0 auto var(--space-6);
  border-radius: 50%;
  border: 3px solid var(--bone-deep);
  border-top-color: var(--violet);
  animation: calcSpin 1.1s linear infinite;
}
@keyframes calcSpin { to { transform: rotate(360deg); } }
.test-calc p { color: var(--text-secondary); }

/* ---------- écran de résultat ---------- */
.result[hidden] { display: none; }
.result-head { text-align: center; max-width: 720px; margin-inline: auto; }
.result-head__kicker { color: var(--accent-text); font-size: var(--text-meta); font-weight: var(--weight-medium); letter-spacing: var(--tracking-meta); }
.result-head h1 {
  font-family: var(--display);
  font-size: var(--text-title-1);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-title);
  margin: var(--space-2) 0 var(--space-4);
}
.result-head__desc { color: var(--text-secondary); margin-inline: auto; }
.result-axes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-6);
}
.result-axes .tag i { background: var(--tag, var(--violet)); }

.result-section {
  max-width: var(--container-narrow);
  margin: var(--space-16) auto 0;
  padding-top: var(--space-8);
  border-top: 1px solid var(--line);
}
.result-section > h2 {
  font-family: var(--display);
  font-size: var(--text-title-2);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-title);
  margin-bottom: var(--space-6);
}
.match-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-8);
  align-items: start;
}
.match-identity__name {
  font-family: var(--display);
  font-size: var(--text-title-2);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-title);
}
.match-identity__editor { color: var(--text-secondary); margin-top: var(--space-1); }
.affinity {
  margin-top: var(--space-5);
}
.affinity__value {
  font-family: var(--display);
  font-size: 52px;
  font-weight: var(--weight-medium);
  line-height: 1;
  letter-spacing: var(--tracking-title);
}
.affinity__bar {
  height: 8px;
  margin-top: var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--bone-deep);
  overflow: hidden;
}
.affinity__bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  background: var(--violet);
  transition: width var(--duration-slow) var(--ease);
}
.match-reasons { margin-top: var(--space-6); }
.match-reasons h3 { font-size: var(--text-title-4); margin-bottom: var(--space-3); }
.match-reasons ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.match-reasons li { color: var(--text-secondary); line-height: var(--line-body); }
.match-reasons li strong { color: var(--text-primary); font-weight: var(--weight-medium); }

.podium-list { display: grid; gap: var(--space-3); }
.podium-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface-card);
}
.podium-row__rank {
  font-family: var(--display);
  color: var(--text-tertiary);
  font-size: var(--text-title-4);
}
.podium-row__name { font-weight: var(--weight-medium); }
.podium-row__editor { color: var(--text-secondary); font-size: var(--text-small); }
.podium-row__indice {
  font-family: var(--display);
  font-size: var(--text-title-3);
  letter-spacing: var(--tracking-title);
}
.podium-row__line { grid-column: 1 / -1; color: var(--text-secondary); font-size: var(--text-small); margin: 0; }

.anti-match {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-5);
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--radius-2xl);
  background: var(--bone);
}
.anti-match__name { font-family: var(--display); font-size: var(--text-title-3); font-weight: var(--weight-medium); }
.anti-match p { color: var(--text-secondary); margin-top: var(--space-1); }

.detail-bars { display: grid; gap: var(--space-4); }
.detail-bar__head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  font-size: var(--text-small);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.detail-bar__head b { color: var(--text-primary); font-weight: var(--weight-medium); }
.detail-bar__track {
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--bone-deep);
  position: relative;
  overflow: hidden;
}
.detail-bar__modèle {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: var(--radius-pill);
  background: var(--ink);
}
.detail-bar__attendu {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 3px;
  border-radius: var(--radius-pill);
  background: var(--violet);
}

.limits-line {
  max-width: var(--container-reading);
  margin: var(--space-16) auto 0;
  padding: var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--radius-2xl);
  background: var(--surface-card);
  text-align: center;
}
.limits-line p { margin-inline: auto; color: var(--text-secondary); }
.limits-line .link { margin-top: var(--space-3); }
.result-share { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; margin-top: var(--space-8); }
.share-status { margin-top: var(--space-3); text-align: center; color: var(--text-secondary); font-size: var(--text-small); min-height: 1.4em; }
.result-cta { text-align: center; margin-top: var(--space-16); }
.result-cta p { margin: 0 0 var(--space-5); color: var(--text-secondary); }

/* Crédit Artificial Analysis sur l'écran de résultat */
.result-credit {
  margin-top: var(--space-10);
  text-align: center;
  color: var(--text-tertiary);
  font-size: var(--text-meta);
  line-height: var(--line-body);
}

/* ---------- page méthode et mentions ---------- */
.formule {
  font-family: var(--font-code);
  font-size: var(--text-small);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bone);
  overflow-x: auto;
  white-space: nowrap;
}
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 26px; font-size: 14.5px; }
.prose th, .prose td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-weight: var(--weight-medium); color: var(--ink); }
.prose td { color: inherit; }

/* ---------- footer : crédits ---------- */
.footer-credit {
  color: var(--text-inverse-tertiary);
  font-size: var(--text-meta);
  line-height: var(--line-body);
  max-width: 72ch;
  margin: var(--space-8) 0 0;
}
.footer-credit a { color: var(--text-inverse-secondary); text-decoration: underline; text-underline-offset: 3px; }
.footer-credit a:hover { color: var(--text-inverse); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .match-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .q-choices { grid-template-columns: 1fr; }
  .test-main { padding-top: var(--space-8); }
  .q-prompt { font-size: var(--text-title-3); }
  .result-section { margin-top: var(--space-12); }
  .affinity__value { font-size: 44px; }
  .podium-row { grid-template-columns: auto minmax(0, 1fr) auto; padding: var(--space-4); }
  .anti-match { grid-template-columns: 1fr; }
  .hero__radar { max-width: 400px; }
  /* Les boutons à libellé long passent sur deux lignes au lieu de déborder. */
  .result-cta .btn, .article-cta__actions .btn, .result-share .btn {
    white-space: normal;
    height: auto;
    min-height: 52px;
    padding: 12px 22px;
  }
}
/* Les mots techniques longs (noms de traits Elo) se coupent dans les tables
   et le code de la page méthode, sans élargir la page. */
.prose td, .prose th, .prose code, .legal-body td { overflow-wrap: anywhere; }
/* Les colonnes de grille éditoriales peuvent rétrécir (sinon la table de
   l'étude MIT force la colonne à sa largeur min-content sur petit écran). */
.article-layout > *, .legal-layout > * { min-width: 0; }
.prose table { display: block; width: 100%; overflow-x: auto; }

/* ---------- mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  .q-view--anim { animation: none; }
  .test-calc__ring { animation: none; border-top-color: var(--violet); }
  .test-progress span, .affinity__bar span { transition: none; }
}
