/* wevalue · self-assessment IA-code — styles dérivés de DESIGN.md
   Éditorial-dev, dark-first chaud, accent ambre, Fraunces / Geist / Geist Mono. */

:root {
  /* Couleur — dark (défaut) */
  --bg: #14130f;
  --surface: #1e1c17;
  --surface-hover: #262219;
  --text: #f5f1e8;
  --text-muted: #9b9486;
  --accent: #f2b84b;
  --accent-soft: rgba(242, 184, 75, 0.14);
  --hairline: #2e2b24;
  --focus: #f2b84b;

  /* Typo */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Geist", system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", monospace;

  /* Espacement (base 8) */
  --xs: 4px;  --sm: 8px;  --md: 16px;  --lg: 24px;
  --xl: 32px; --2xl: 48px; --3xl: 64px;

  /* Radius */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;

  /* Motion */
  --ease-enter: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-short: 200ms;
  --dur-medium: 280ms;
}

[data-theme="light"] {
  --bg: #f7f3ea;
  --surface: #ffffff;
  --surface-hover: #f0ead9;
  --text: #1a1814;
  --text-muted: #6b6458;
  --accent: #b5821c;          /* ambre assombri pour contraste sur clair */
  --accent-soft: rgba(181, 130, 28, 0.12);
  --hairline: #e3ddcf;
  --focus: #b5821c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--lg) var(--md) var(--3xl);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Barre de progression --- */
.progress {
  display: flex;
  align-items: center;
  gap: var(--md);
  margin-bottom: var(--2xl);
}
.progress__track {
  flex: 1;
  height: 4px;
  background: var(--hairline);
  border-radius: 9999px;
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 9999px;
  transition: width var(--dur-medium) var(--ease-enter);
}
.progress__count {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* --- Typo display --- */
.display {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.question-text {
  font-family: var(--font-display);
  font-weight: 450;
  font-size: 28px;
  line-height: 1.25;
  margin-bottom: var(--xl);
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sm);
}
.lede { color: var(--text-muted); font-size: 17px; }

/* --- Options (groupe radio stylé) --- */
.options { list-style: none; display: flex; flex-direction: column; gap: var(--sm); border: 0; }
.option {
  display: flex;
  align-items: center;
  gap: var(--md);
  width: 100%;
  min-height: 56px;
  padding: var(--md);
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color var(--dur-short), background var(--dur-short);
}
.option:hover { background: var(--surface-hover); }
.option:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.option[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.option__dot {
  flex: 0 0 auto;
  width: 18px; height: 18px;
  border-radius: 9999px;
  border: 2px solid var(--text-muted);
  position: relative;
}
.option[aria-checked="true"] .option__dot { border-color: var(--accent); }
.option[aria-checked="true"] .option__dot::after {
  content: ""; position: absolute; inset: 3px;
  border-radius: 9999px; background: var(--accent);
}

/* --- Boutons --- */
.btn {
  font: inherit; font-weight: 500;
  min-height: 48px; padding: 0 var(--lg);
  border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--dur-short), border-color var(--dur-short);
}
.btn--primary { background: var(--accent); color: #14130f; }
.btn--primary:hover { filter: brightness(1.06); }
.btn--ghost { background: transparent; color: var(--text-muted); border-color: var(--hairline); }
.btn--ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.nav-row { display: flex; justify-content: space-between; align-items: center; margin-top: var(--xl); }

/* --- Accueil --- */
.intro { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: var(--lg); }
.intro__title { font-size: 40px; }
.intro__reassure {
  font-family: var(--font-mono); font-size: 14px; color: var(--text-muted);
  border-left: 2px solid var(--accent); padding-left: var(--md);
}

/* --- Résultat --- */
.result { display: flex; flex-direction: column; gap: var(--2xl); }
.accroche { font-family: var(--font-display); font-weight: 450; font-size: 20px; line-height: 1.35; }
.accroche b { font-weight: 600; color: var(--accent); }

/* Couverture archétype */
.archetype__name { font-size: 40px; margin-top: var(--xs); }
.archetype__tagline { font-family: var(--font-mono); font-size: 14px; color: var(--accent); letter-spacing: 0.02em; margin: var(--sm) 0 var(--md); }

/* Axes de style (spectres) */
.axes { display: flex; flex-direction: column; gap: var(--sm); }
.axis { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--md); }
.axis__pole { font-size: 14px; color: var(--text-muted); }
.axis__pole:first-child { text-align: right; }
.axis__pole--on { color: var(--text); font-weight: 600; }
.axis__track { position: relative; width: 88px; height: 4px; background: var(--hairline); border-radius: 9999px; }
.axis__dot { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 9999px; background: var(--accent); transform: translate(-50%, -50%); }

/* Forced-choice : 2 grandes cartes */
.options--choice .option { min-height: 72px; font-size: 18px; }

/* Reformulation (Feature B) */
.reformulate { margin: 0 0 var(--lg); }
.reformulate__btn { font-family: var(--font-mono); font-size: 13px; min-height: 44px; }
.reformulate__panel {
  margin-top: var(--sm); padding: var(--md);
  background: var(--surface); border: 1px solid var(--hairline); border-left: 2px solid var(--accent);
  border-radius: var(--r-sm); animation: fade-in var(--dur-short) var(--ease-enter);
}
.reformulate__loading { color: var(--text-muted); font-family: var(--font-mono); font-size: 14px; }
.reformulate__error { color: var(--text-muted); font-size: 14px; }
.reformulate__text { font-size: 16px; }
.reformulate__ex { font-size: 15px; color: var(--text-muted); margin-top: var(--sm); }
.reformulate__ex b { color: var(--accent); font-weight: 600; }

/* Plan 30 jours (Feature C) */
.plan-cta { margin-top: var(--md); }
.plan { display: flex; flex-direction: column; gap: var(--lg); border-top: 1px solid var(--hairline); padding-top: var(--lg); }
.plan__phase-title { font-size: 22px; margin-bottom: var(--sm); }
.plan__item { padding: var(--sm) 0; border-top: 1px solid var(--hairline); }
.plan__item:first-of-type { border-top: 0; }
.plan__action { font-size: 17px; }
.plan__ind { font-family: var(--font-mono); font-size: 13px; color: var(--accent); margin-top: 2px; }
.plan__focus { font-family: var(--font-display); font-size: 20px; line-height: 1.35; }

/* Coach (Feature D) */
.coach-cta { margin-top: var(--sm); }
.coach { display: flex; flex-direction: column; gap: var(--md); min-height: 80vh; }
.coach__header { display: flex; justify-content: space-between; align-items: center; gap: var(--md); }
.coach__banner { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); border-left: 2px solid var(--accent); padding-left: var(--sm); }
.coach__messages { flex: 1; display: flex; flex-direction: column; gap: var(--sm); overflow-y: auto; padding: var(--sm) 0; }
.msg { max-width: 85%; padding: var(--sm) var(--md); border-radius: var(--r-md); }
.msg--assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--hairline); }
.msg--user { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--accent); }
.msg__text { white-space: pre-wrap; font-size: 16px; }
.msg__text--streaming::after { content: "▍"; color: var(--accent); }
.coach__input { display: flex; gap: var(--sm); align-items: flex-end; border-top: 1px solid var(--hairline); padding-top: var(--md); }
.coach__input textarea {
  flex: 1; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: var(--sm) var(--md);
  resize: none; min-height: 48px; max-height: 160px;
}
.coach__input textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.dim { padding: var(--md) 0; border-top: 1px solid var(--hairline); }
.dim__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--md); }
.dim__label { font-weight: 500; }
.dim__level { font-family: var(--font-mono); font-size: 14px; color: var(--accent); }
.dim__segments { display: flex; gap: var(--xs); margin: var(--sm) 0; }
.seg { flex: 1; height: 6px; border-radius: 9999px; background: var(--hairline); }
.seg--on { background: var(--accent); }
.dim__piste { color: var(--text-muted); font-size: 15px; }
.dim__feedback { color: var(--text-muted); font-size: 13px; font-style: italic; margin-top: var(--xs); opacity: 0.9; }

/* Alertes profils à risque */
.alerts { display: flex; flex-direction: column; gap: var(--sm); }
.alert { border: 1px solid var(--accent); border-radius: var(--r-md); padding: var(--md); background: var(--accent-soft); }
.alert__name { font-weight: 600; color: var(--accent); }
.alert__desc { font-size: 15px; margin-top: var(--xs); }
.alert__conseil { font-size: 14px; color: var(--text-muted); margin-top: var(--xs); }

/* Champ de saisie (prénom, confirmation) */
.field { display: flex; flex-direction: column; gap: var(--xs); }
.field__label { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.field__input {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--hairline); border-radius: var(--r-sm);
  padding: var(--sm) var(--md); min-height: 48px;
}
.field__input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-color: var(--accent); }

/* Accueil profil */
.home-actions { display: flex; flex-direction: column; gap: var(--sm); align-items: flex-start; }
.home-actions .btn { width: 100%; max-width: 360px; }
.home-links { margin-top: var(--md); font-size: 14px; }
.linkish { background: none; border: 0; color: var(--text-muted); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }
.linkish:hover { color: var(--text); }
.linkish--danger:hover { color: var(--accent); }

/* Dashboard */
.dashboard { display: flex; flex-direction: column; gap: var(--lg); }
.cards { display: flex; flex-direction: column; gap: var(--sm); }
.card { display: flex; align-items: stretch; gap: var(--sm); }
.card__open {
  flex: 1; display: flex; flex-direction: column; gap: 2px; text-align: left;
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: var(--md); cursor: pointer; color: var(--text); font: inherit;
}
.card__open:hover { background: var(--surface-hover); border-color: var(--text-muted); }
.card__open:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.card__date { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.card__title { font-size: 20px; }
.card__sub { color: var(--text-muted); font-size: 14px; }
.card__pills { display: flex; gap: var(--xs); margin-top: var(--xs); }
.pill { font-family: var(--font-mono); font-size: 11px; color: var(--accent); border: 1px solid var(--accent); border-radius: 9999px; padding: 1px var(--sm); }
.card__del { align-self: center; white-space: nowrap; }

/* --- Theme toggle --- */
.theme-toggle {
  align-self: flex-end; background: none; border: 1px solid var(--hairline);
  color: var(--text-muted); border-radius: 9999px; padding: var(--xs) var(--sm);
  font-family: var(--font-mono); font-size: 12px; cursor: pointer; margin-bottom: var(--md);
}
.theme-toggle:hover { color: var(--text); }

.fade-in { animation: fade-in var(--dur-medium) var(--ease-enter); }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
