/* ============================================================
   HOOVI — Système visuel
   Registre : archive institutionnelle.
   Pierre froide, encre, grenat. La citation est la signature.
   ============================================================ */

:root {
  /* Surfaces — pierre froide, jamais crème */
  --stone-0: #ffffff;
  --stone-1: #eff1f2;
  --stone-2: #e2e5e7;
  --stone-3: #cfd4d7;

  /* Encre */
  --ink:    #16191c;
  --ink-2:  #474d52;
  --ink-3:  #7a8187;

  /* Accent — grenat : source, suivi, action principale */
  --garnet:      #7a2231;
  --garnet-deep: #5c1925;
  --garnet-line: #c08d95;
  --garnet-bg:   #f7edee;

  /* Signaux */
  --moss:     #3d5a40;
  --moss-bg:  #ecf1eb;
  --moss-line:#a8bfa9;
  --amber:    #8a5a16;
  --amber-bg: #f8f1e3;
  --amber-line:#d6b785;

  /* Typographie */
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Mesure et rythme */
  --measure: 34rem;
  --wide: 64rem;
  --r: 3px;
  --r-lg: 6px;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--stone-1);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  font-feature-settings: "kern";
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

/* ---------- Typographie ---------- */

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.18; margin: 0; letter-spacing: -0.012em; }
h1 { font-size: clamp(2rem, 5.5vw, 3.1rem); }
h2 { font-size: clamp(1.4rem, 3.2vw, 1.9rem); }
h3 { font-size: 1.15rem; line-height: 1.3; }

p { margin: 0 0 1rem; }
a { color: inherit; }

.lede { font-size: 1.125rem; line-height: 1.65; color: var(--ink-2); }
.small { font-size: 0.875rem; }
.muted { color: var(--ink-3); }
.dim { color: var(--ink-2); }

/* Eyebrow : mono, capitales, interlettrage — code de section */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 0.85rem;
  display: block;
}
.eyebrow--garnet { color: var(--garnet); }

/* ---------- SIGNATURE : le bloc de citation ---------- */
/* Une cote de catalogue, pas une note de bas de page. */

.cite {
  border-left: 2px solid var(--garnet-line);
  padding: 0.1rem 0 0.1rem 0.75rem;
  margin: 0.65rem 0 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink-2);
  letter-spacing: -0.01em;
}
.cite b { font-weight: 500; color: var(--garnet); }
.cite span { display: block; color: var(--ink-3); font-size: 0.7rem; }

/* ---------- Structure ---------- */

.wrap { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: var(--measure); }
.section { padding: 3.5rem 0; }
.section + .section { border-top: 1px solid var(--stone-3); }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.sp { flex: 1; }

/* ---------- En-tête ---------- */

.masthead {
  background: var(--stone-0);
  border-bottom: 1px solid var(--stone-3);
  position: sticky; top: 0; z-index: 20;
}
.masthead .wrap { display: flex; align-items: center; gap: 1rem; height: 56px; }
.logo {
  font-family: var(--serif);
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.logo em { font-style: normal; color: var(--garnet); }
.navlinks { display: flex; gap: 1.25rem; margin-left: auto; align-items: center; }
.navlinks a { font-size: 0.85rem; text-decoration: none; color: var(--ink-2); }
.navlinks a:hover { color: var(--garnet); }
.lang {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em;
  border: 1px solid var(--stone-3); border-radius: var(--r);
  padding: 0.2rem 0.45rem; color: var(--ink-3); background: none; cursor: pointer;
}
.lang b { color: var(--ink); font-weight: 500; }
@media (max-width: 720px) { .navlinks a.hide-s { display: none; } }

/* ---------- Boutons ---------- */

button, .btn {
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 450;
  line-height: 1.2;
  padding: 0.6rem 1rem;
  border: 1px solid var(--stone-3);
  border-radius: var(--r);
  background: var(--stone-0);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: border-color .15s, background .15s;
}
button:hover, .btn:hover { border-color: var(--ink-3); }
.btn--primary {
  background: var(--garnet); border-color: var(--garnet); color: #fff;
}
.btn--primary:hover { background: var(--garnet-deep); border-color: var(--garnet-deep); }
.btn--block { display: block; width: 100%; text-align: center; }
.btn--sm { font-size: 0.8rem; padding: 0.4rem 0.7rem; }

:focus-visible { outline: 2px solid var(--garnet); outline-offset: 2px; }

/* ---------- Cartes et panneaux ---------- */

.card {
  background: var(--stone-0);
  border: 1px solid var(--stone-3);
  border-radius: var(--r-lg);
  padding: 1.25rem;
}
.card + .card { margin-top: 0.75rem; }
.panel { background: var(--stone-0); border: 1px solid var(--stone-3); border-radius: var(--r-lg); overflow: hidden; }
.panel > .pad { padding: 1.25rem; }
.panel > .pad + .pad { border-top: 1px solid var(--stone-2); }

/* ---------- Pastilles ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.25rem 0.5rem; border-radius: var(--r);
  background: var(--stone-1); color: var(--ink-2); border: 1px solid var(--stone-2);
}
.pill--garnet { background: var(--garnet-bg); color: var(--garnet); border-color: var(--garnet-line); }
.pill--amber  { background: var(--amber-bg);  color: var(--amber);  border-color: var(--amber-line); }
.pill--moss   { background: var(--moss-bg);   color: var(--moss);   border-color: var(--moss-line); }

/* ---------- Identité de l'expert ---------- */

.expert { display: flex; gap: 0.9rem; align-items: flex-start; }
.portrait {
  width: 56px; height: 56px; flex: none; border-radius: 2px;
  background: var(--garnet); color: #fff;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 1.2rem; letter-spacing: 0.02em;
}
.portrait--sm { width: 30px; height: 30px; font-size: 0.75rem; }
.expert h3 { font-size: 1.1rem; }
.expert .role { font-size: 0.85rem; color: var(--ink-2); margin: 0.15rem 0 0; }

/* ---------- Conversation ---------- */

.thread { display: flex; flex-direction: column; gap: 1.4rem; }
.ask { align-self: flex-end; max-width: 84%; }
.ask p {
  margin: 0; background: var(--stone-1); border: 1px solid var(--stone-2);
  border-radius: var(--r-lg); padding: 0.55rem 0.8rem; font-size: 0.95rem;
}
.reply { display: flex; gap: 0.7rem; }
.reply .body { min-width: 0; }
/* La parole de l'expert est en serif : quelqu'un parle, ce n'est pas une sortie machine */
.reply .body > p { font-family: var(--serif); font-size: 1.0625rem; line-height: 1.68; margin: 0; }

.note {
  border: 1px solid var(--stone-3); border-radius: var(--r-lg);
  padding: 0.85rem 0.95rem; font-size: 0.875rem; line-height: 1.55;
}
.note h4 { margin: 0 0 0.3rem; font-family: var(--sans); font-size: 0.875rem; font-weight: 550; }
.note p { margin: 0; }
.note--garnet { background: var(--garnet-bg); border-color: var(--garnet-line); color: var(--garnet-deep); }
.note--amber  { background: var(--amber-bg);  border-color: var(--amber-line);  color: #6d470f; }
.note--moss   { background: var(--moss-bg);   border-color: var(--moss-line);   color: #2e4531; }

.composer { display: flex; gap: 0.5rem; }
input[type=text], input[type=tel], input[type=email], textarea, select {
  font-family: var(--sans); font-size: 0.95rem; color: var(--ink);
  width: 100%; padding: 0.6rem 0.75rem;
  background: var(--stone-0); border: 1px solid var(--stone-3); border-radius: var(--r);
}
textarea { min-height: 90px; resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
label { display: block; font-size: 0.85rem; font-weight: 500; margin: 0 0 0.3rem; }
.field + .field { margin-top: 1.1rem; }
.hint { font-size: 0.78rem; color: var(--ink-3); margin: 0.3rem 0 0; }

/* ---------- Choix (segments, passes) ---------- */

.choice {
  display: flex; align-items: center; gap: 0.9rem;
  border: 1px solid var(--stone-3); border-radius: var(--r);
  padding: 0.8rem 0.9rem; background: var(--stone-0);
  cursor: pointer; width: 100%; text-align: left; font-family: var(--sans);
}
.choice + .choice { margin-top: 0.5rem; }
.choice:hover { border-color: var(--ink-3); }
.choice[aria-pressed="true"], .choice.is-on {
  border-color: var(--garnet); background: var(--garnet-bg);
}
.choice .t { display: block; font-size: 0.95rem; font-weight: 500; margin: 0; }
.choice .d { display: block; font-size: 0.82rem; color: var(--ink-2); margin: 0.1rem 0 0; }
.choice .price { margin-left: auto; font-family: var(--mono); font-size: 0.95rem; white-space: nowrap; }

/* ---------- Données ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.75rem; }
.stat { background: var(--stone-0); border: 1px solid var(--stone-3); border-radius: var(--r-lg); padding: 0.9rem 1rem; }
.stat .k { font-size: 0.78rem; color: var(--ink-2); margin: 0; }
.stat .v { font-family: var(--mono); font-size: 1.5rem; margin: 0.15rem 0 0; letter-spacing: -0.02em; }

.scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.4rem 1.2rem;
  border-top: 1px solid var(--stone-2); border-bottom: 1px solid var(--stone-2); padding: 0.8rem 0; }
.scores div { display: flex; justify-content: space-between; font-size: 0.85rem; }
.scores span:first-child { color: var(--ink-2); }
.scores span:last-child { font-family: var(--mono); }

.meter { height: 3px; background: var(--stone-2); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--garnet); }

/* ---------- Liste de tâches (file, essai) ---------- */

.queue-head { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.q-index { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-3); margin-left: auto; }
.q-title { font-size: 1.05rem; font-weight: 500; line-height: 1.4; margin: 0 0 0.25rem; }
.draft {
  background: var(--stone-1); border: 1px solid var(--stone-2);
  border-radius: var(--r); padding: 0.8rem 0.9rem; margin: 0.9rem 0;
}
.draft .lbl { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-3); margin: 0 0 0.4rem; }
.draft p:last-child { margin: 0; font-size: 0.92rem; line-height: 1.6; }
.is-next { opacity: 0.5; }

/* ---------- Grille de pages ---------- */

.grid-2 { display: grid; gap: 1.5rem; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: start; } }
.grid-3 { display: grid; gap: 1.25rem; }
@media (min-width: 760px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* Liste de faits — les points d'un argument, numérotés seulement si séquence réelle */
.facts { list-style: none; padding: 0; margin: 0; }
.facts li { padding: 0.9rem 0; border-top: 1px solid var(--stone-3); }
.facts li:last-child { border-bottom: 1px solid var(--stone-3); }
.facts b { display: block; font-weight: 550; font-size: 0.95rem; margin-bottom: 0.15rem; }
.facts span { font-size: 0.9rem; color: var(--ink-2); }
.facts .step { font-family: var(--mono); font-size: 0.7rem; color: var(--garnet); letter-spacing: 0.08em; }

/* ---------- Barre d'app ---------- */

.appbar { background: var(--ink); color: var(--stone-1); }
.appbar .wrap { display: flex; align-items: center; gap: 1.1rem; height: 50px; }
.appbar a { color: var(--stone-3); text-decoration: none; font-size: 0.82rem; }
.appbar a:hover, .appbar a[aria-current] { color: #fff; }
.appbar .logo { color: #fff; font-size: 1.05rem; }
.appbar .logo em { color: var(--garnet-line); }
@media (max-width: 720px) { .appbar a.hide-s { display: none; } }

/* ---------- Pied ---------- */

.foot { border-top: 1px solid var(--stone-3); padding: 2rem 0 3rem; font-size: 0.82rem; color: var(--ink-3); }
.foot a { color: var(--ink-2); text-decoration: none; margin-right: 1.1rem; }

/* ---------- Bannière prototype ---------- */

.proto {
  background: var(--ink); color: var(--stone-3);
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em;
  text-align: center; padding: 0.35rem 1rem;
}
.proto a { color: #fff; }

/* ---------- Accessibilité ---------- */

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   Composants ajoutés pour le site complet
   ============================================================ */

/* --- Cartes cliquables --- */
.card--link { text-decoration: none; display: block; transition: border-color .15s; }
.card--link:hover { border-color: var(--ink-3); }
.card--link h3 { margin: 0.35rem 0 0; }
.card--link p { margin: 0.5rem 0 0; }

/* --- Liens dans les listes de faits --- */
.facts a { text-decoration: none; }
.facts a b { text-decoration: underline; text-decoration-color: var(--stone-3);
  text-underline-offset: 3px; }
.facts a:hover b { text-decoration-color: var(--garnet); color: var(--garnet); }

/* --- Prose longue (manifeste, textes de cadre) --- */
.prose { max-width: 34rem; }
.prose p { font-family: var(--serif); font-size: 1.0625rem; line-height: 1.75;
  margin: 0 0 1.15rem; }
.prose h2 { font-size: 1.25rem; margin: 2rem 0 0.75rem; }

/* --- Barre d'app : libellé d'espace --- */
.appbar-label { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-3); border-left: 1px solid #3a4046;
  padding-left: 1.1rem; margin-left: -0.3rem; white-space: nowrap; }
@media (max-width: 640px) { .appbar-label { display: none; } }

/* --- Pied de page en colonnes --- */
.foot-cols { display: grid; gap: 1.75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.foot-cols a { display: block; margin: 0 0 0.4rem; }
.foot-cols .eyebrow { margin-bottom: 0.65rem; }
.foot-note { margin: 2rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--stone-3); }

/* --- Assistant d'installation --- */
.wizard { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem;
  padding: 0; margin: 0 0 2rem; font-size: 0.8rem; color: var(--ink-3); }
.wz-step { display: flex; align-items: center; gap: 0.4rem; }
.wz-n { font-family: var(--mono); font-size: 0.68rem; width: 18px; height: 18px;
  border-radius: 50%; border: 1px solid var(--stone-3); display: grid; place-items: center; }
.wz-step.is-now { color: var(--garnet); }
.wz-step.is-now .wz-n { border-color: var(--garnet); background: var(--garnet); color: #fff; }
.wz-step.is-done { color: var(--ink-2); }
.wz-step.is-done .wz-n { border-color: var(--garnet-line); color: var(--garnet); }

/* --- Tableaux --- */
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem;
  background: var(--stone-0); border: 1px solid var(--stone-3); border-radius: var(--r-lg);
  overflow: hidden; }
.table th, .table td { text-align: left; padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--stone-2); vertical-align: middle; }
.table thead th { font-size: 0.72rem; font-weight: 500; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3); background: var(--stone-1); }
.table tbody th { font-weight: 500; color: var(--ink-2); }
.table tr:last-child td { border-bottom: 0; }
@media (max-width: 620px) { .table { display: block; overflow-x: auto; white-space: nowrap; } }

/* --- Zone de dépôt --- */
.drop { border: 1px dashed var(--stone-3); border-radius: var(--r-lg);
  padding: 1.75rem 1.25rem; text-align: center; background: var(--stone-0); }
.drop:hover { border-color: var(--garnet-line); }

/* --- Onglets --- */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--stone-3); }
.tab { background: none; border: 0; border-bottom: 2px solid transparent;
  border-radius: 0; padding: 0.5rem 0.75rem; color: var(--ink-2); font-size: 0.875rem;
  text-decoration: none; display: inline-block; }
.tab:hover { color: var(--ink); border-color: var(--stone-3); }
.tab.is-on { color: var(--garnet); border-color: var(--garnet); }

/* --- Interrupteur --- */
.switch { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.875rem;
  font-weight: 400; cursor: pointer; margin-top: 0.5rem; }
.switch input { width: auto; margin: 0.2rem 0 0; accent-color: var(--garnet); }

/* --- Action destructive --- */
.btn--danger { color: var(--garnet); border-color: var(--garnet-line); background: var(--stone-0); }
.btn--danger:hover { background: var(--garnet-bg); border-color: var(--garnet); }

/* --- Curseur de réglage --- */
input[type=range] { accent-color: var(--garnet); width: 100%; padding: 0; }

/* --- Champ en erreur --- */
.is-error { border-color: var(--amber); background: var(--amber-bg); }
.err { font-size: 0.78rem; color: var(--amber); margin: 0.3rem 0 0; }

/* --- Chargement --- */
.typing { display: inline-flex; gap: 4px; align-items: center; height: 1.6rem; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-3);
  animation: pulse 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

[data-spin]::before { content: ""; width: 8px; height: 8px; border-radius: 50%;
  border: 1.5px solid var(--stone-3); border-top-color: var(--ink-3);
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Nuanciers du système visuel --- */
.swatch { height: 56px; border-radius: var(--r); border: 1px solid var(--stone-3);
  margin-bottom: 0.4rem; }
.tok { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-3); margin: 0.15rem 0 0; }

/* --- Listes déroulantes --- */
select { appearance: none; background-image:
  linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
  linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }

/* --- Alternative dépliable (mot de passe) --- */
details summary { cursor: pointer; color: var(--ink-2); list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "+ "; font-family: var(--mono); color: var(--ink-3); }
details[open] summary::before { content: "− "; }
details summary:hover { color: var(--garnet); }

/* --- Bascule de langue : c'est un lien, pas un bouton --- */
a.lang { text-decoration: none; display: inline-block; }
a.lang:hover { border-color: var(--garnet); color: var(--garnet); }
