/* ---------------------------------------------------------------
   Systeme visuel : lecture annotee.
   Le produit montre des reponses de machines ; l'interface les
   presente comme un texte relu au feutre, pas comme un dashboard.
   --------------------------------------------------------------- */

:root {
  --paper: #fcfcfa;
  --ink: #1c1b19;
  --muted: #6b6862;
  --rule: #e4e2dc;
  --mark: #ede84a;
  --source: #2b4fe8;
  --silent: #9b9791;

  --measure: 62ch;
  --gap: clamp(1.5rem, 4vw, 3rem);

  --t-xs: 0.8125rem;
  --t-sm: 0.9375rem;
  --t-base: 1.0625rem;
  --t-lg: 1.3125rem;
  --t-xl: clamp(1.75rem, 4vw, 2.5rem);
  --t-display: clamp(2.25rem, 6.5vw, 4rem);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: var(--t-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

p { max-width: var(--measure); margin: 0 0 1rem; }

a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--source); }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; }
h2 {
  font-size: var(--t-lg);
  margin: 3.5rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  max-width: var(--measure);
}

/* --- Ossature --- */

.shell { max-width: 1120px; margin: 0 auto; padding: 0 var(--gap); }

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--rule);
}
.wordmark { font-size: var(--t-base); font-weight: 600; letter-spacing: -0.03em; text-decoration: none; }
.wordmark::after {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-left: 6px;
  background: var(--mark);
  border-radius: 50%;
  vertical-align: 0.1em;
}
.masthead nav a { font-size: var(--t-sm); color: var(--muted); text-decoration: none; }
.masthead nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

main { padding: clamp(2.5rem, 7vw, 5rem) 0 5rem; }

.split { display: grid; gap: var(--gap); }
@media (min-width: 1000px) {
  .split { grid-template-columns: minmax(0, 1fr) 248px; align-items: start; }
  .rail { position: sticky; top: 2rem; }
}

/* --- Titres --- */

.display { font-size: var(--t-display); letter-spacing: -0.04em; max-width: 18ch; }
.verdict { font-size: var(--t-xl); letter-spacing: -0.03em; max-width: 24ch; margin-bottom: 1.5rem; }
.kicker { font-size: var(--t-sm); color: var(--muted); margin-bottom: 1rem; }
.lede { font-size: var(--t-lg); line-height: 1.45; color: var(--muted); max-width: 44ch; margin-top: 1.25rem; }

/* --- Reponses annotees : l'element central --- */

.answer { padding: 1.5rem 0; border-bottom: 1px solid var(--rule); max-width: var(--measure); }
.answer:first-of-type { border-top: 1px solid var(--rule); }
.answer .meta {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  justify-content: space-between;
  font-size: var(--t-xs);
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.answer .engine { font-weight: 600; color: var(--ink); }
.answer .question { font-size: var(--t-base); font-weight: 600; margin-bottom: 0.6rem; }
.answer .body { color: var(--muted); line-height: 1.65; }

mark.rival { background: var(--mark); color: var(--ink); padding: 0.05em 0.15em; border-radius: 2px; }
mark.you {
  background: none;
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 -0.42em 0 rgba(43, 79, 232, 0.16);
}

.state { font-size: var(--t-xs); white-space: nowrap; }
.state.absent { color: var(--silent); }
.state.present { color: var(--source); }

/* --- Metriques : chiffres nus, pas de cartes --- */

.readout { border-top: 1px solid var(--ink); padding-top: 1rem; }
.readout dl { margin: 0; display: grid; gap: 1.25rem; }
@media (max-width: 999px) { .readout dl { grid-template-columns: repeat(2, 1fr); } }
.readout dt { font-size: var(--t-xs); color: var(--muted); }
.readout dd {
  margin: 0.1rem 0 0;
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.readout dd small { font-size: 0.9rem; font-weight: 400; color: var(--muted); letter-spacing: 0; }

/* --- Formulaire --- */

.field { display: flex; max-width: 480px; margin: 2rem 0 0.75rem; border-bottom: 2px solid var(--ink); }
.field input { flex: 1; padding: 0.7rem 0; border: 0; background: none; font: inherit; color: var(--ink); }
.field input::placeholder { color: var(--silent); }
.field input:focus { outline: none; }
.field:focus-within { border-bottom-color: var(--source); }

button {
  padding: 0.7rem 1.1rem;
  border: 0;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-weight: 600;
  font-size: var(--t-sm);
  cursor: pointer;
  border-radius: 3px;
  margin: 0.25rem 0 0.35rem;
}
button:hover { background: var(--source); }
:focus-visible { outline: 2px solid var(--source); outline-offset: 3px; }

.hint { font-size: var(--t-sm); color: var(--muted); max-width: 46ch; }
.hint.error { color: #a3271a; }

/* --- Listes de donnees --- */

.rank { list-style: none; padding: 0; margin: 0; max-width: var(--measure); }
.rank li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 1rem;
  align-items: baseline;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}
.rank .share { font-variant-numeric: tabular-nums; color: var(--muted); font-size: var(--t-sm); }
.rank .bar { grid-column: 1 / -1; height: 3px; background: var(--mark); }

.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; max-width: var(--measure); }
.steps li { counter-increment: s; padding: 1.1rem 0 1.1rem 2.4rem; border-bottom: 1px solid var(--rule); position: relative; }
.steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: 1.15rem;
  font-size: var(--t-xs);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.steps b { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.steps span { color: var(--muted); }

/* --- Progression --- */

.progress { max-width: var(--measure); }
.progress .track { height: 2px; background: var(--rule); margin: 1.25rem 0 0.6rem; }
.progress .fill { height: 2px; background: var(--ink); width: 0; transition: width 0.6s ease; }

/* --- Pied de page --- */

footer { border-top: 1px solid var(--rule); padding: 2.5rem 0 3.5rem; color: var(--muted); font-size: var(--t-sm); }
footer p { max-width: 52ch; }

/* --- Revelation unique au chargement --- */

@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }
}

/* --- Courbe de suivi --- */
.curve { width: 100%; max-width: var(--measure); height: auto; margin: 1.5rem 0 0.5rem; display: block; }

/* --- Brouillon d'article --- */
.prose {
  max-width: var(--measure);
  white-space: pre-wrap;
  line-height: 1.7;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
