/* Kanol, espace de travail, V1 statique.
   Charte typo : les cinq polices se changent ici (et dans le <link> Google Fonts de index.html). */
:root {
  --font-corps: 'Instrument Sans', system-ui, sans-serif;   /* interface, bulles utilisateur */
  --font-lecture: 'Spectral', Georgia, serif;               /* réponses de Kanol, titres */
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;    /* sources, étiquettes, compteurs */
  --font-logo-k: 'Syne', sans-serif;                        /* le K retourné */
  --font-logo-mot: 'Unbounded', sans-serif;                 /* « anol » */

  --nuit: #0E0E0E;
  --encre: #111111;
  --papier: #E7E7E4;
  --gris: #8A8A86;
  --gris-sombre: #6A6A66;
  --gris-refus: #5A5A57;
  --trait: rgba(231,231,228,.1);
  --trait-fort: rgba(231,231,228,.2);

  --interligne-notes: 28px;   /* interligne du bloc-notes, égal au pas des lignes du fond */
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--nuit); color: var(--papier); }
body { font-family: var(--font-corps); -webkit-font-smoothing: antialiased; }
a { color: var(--papier); text-decoration: none; }
textarea { outline: none; }
::placeholder { color: var(--gris-sombre); }
button { font-family: inherit; }

/* ---------- Boutons ---------- */
.bouton { all: unset; cursor: pointer; text-align: center; border-radius: 3px; font-size: 13px; font-weight: 600; font-family: var(--font-corps); }
.bouton-plein { padding: 8px 14px; background: var(--papier); color: var(--encre); }
.bouton-plein:hover { background: #FFFFFF; }
.bouton-ligne { padding: 7px 0; border: 1px solid rgba(231,231,228,.25); font-weight: 500; color: var(--papier); }
.bouton-ligne:hover { border-color: var(--papier); }

/* ---------- Étiquettes mono ---------- */
.etiquette { margin: 0; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--gris); }
.mono { font-family: var(--font-mono); font-size: 11px; color: var(--papier); }

/* ---------- Grille ---------- */
.app { min-height: 100vh; display: grid; grid-template-columns: clamp(200px, 20vw, 232px) minmax(0, 1fr); }

/* ---------- Sidebar ---------- */
.sidebar { border-right: 1px solid var(--trait); padding: 22px 16px; display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh; }

.logo { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.logo-carre { width: 36px; height: 36px; background: var(--papier); display: grid; place-items: center; overflow: hidden; flex: none; }
.logo-carre svg { grid-area: 1 / 1; width: 100%; height: 100%; }
.logo-k { grid-area: 1 / 1; display: inline-block; font-family: var(--font-logo-k); font-weight: 800; font-size: 23px; line-height: 1; text-box: trim-both cap alphabetic; transform: scaleX(-1); color: var(--encre); }
.logo-mot { display: flex; align-items: baseline; font-size: 20px; line-height: 1; text-box: trim-both cap alphabetic; }
.logo-k-clair { font-size: 20px; color: var(--papier); }
.logo-anol { font-family: var(--font-logo-mot); font-weight: 800; color: var(--nuit); -webkit-text-stroke: .8px var(--papier); paint-order: stroke fill; }
.logo-mention { margin: 8px 0 0; font-family: var(--font-mono); font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--gris); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { all: unset; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 4px; font-size: 14px; font-weight: 500; color: var(--papier); background: transparent; font-family: var(--font-corps); }
.nav-item:hover { background: rgba(231,231,228,.06); }
.nav-item[aria-current="page"] { color: var(--encre); background: var(--papier); }
.nav-item[aria-current="page"]:hover { background: var(--papier); }
.nav-compte { font-family: var(--font-mono); font-size: 11px; color: var(--gris); }
.nav-item[aria-current="page"] .nav-compte { color: var(--encre); }

.socle { margin-top: auto; padding: 14px; border: 1px solid rgba(231,231,228,.12); border-radius: 4px; }
.socle .etiquette { margin-bottom: 6px; font-size: 10px; }
.socle-compteur { margin: 0; font-size: 22px; font-family: var(--font-lecture); line-height: 1.1; }
.socle-unite { font-size: 13px; color: var(--gris); font-family: var(--font-corps); }
.socle-attente { margin: 8px 0 0; font-size: 12.5px; color: var(--gris); }

/* ---------- Zone principale ---------- */
.main { display: flex; flex-wrap: wrap; min-width: 0; }

.conversation { flex: 1 1 460px; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.entete { padding: 18px 32px; border-bottom: 1px solid var(--trait); }
.entete .etiquette { margin-bottom: 4px; }
.entete-titre { margin: 0; font-family: var(--font-lecture); font-weight: 400; font-size: 24px; letter-spacing: -.01em; }

.fil { flex: 1; padding: 28px 32px; display: flex; flex-direction: column; gap: 22px; max-width: 820px; width: 100%; }

/* Bulle utilisateur */
.msg-user { display: flex; justify-content: flex-end; }
.msg-user > div { max-width: 78%; padding: 12px 16px; border: 1px solid rgba(231,231,228,.18); border-radius: 4px; font-size: 14.5px; line-height: 1.5; color: var(--papier); white-space: pre-wrap; }

/* Réponse de Kanol sur le bloc-notes ligné */
.msg-kanol { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 14px; align-items: start; }
.avatar { width: 32px; height: 32px; background: var(--papier); display: grid; place-items: center; overflow: hidden; }
.avatar svg { grid-area: 1 / 1; width: 100%; height: 100%; }
.avatar .logo-k { font-size: 20px; }

.notes {
  max-width: 640px;
  background-color: var(--papier);
  color: var(--encre);
  padding: 20px 24px 16px;
  box-shadow: 0 18px 40px rgba(0,0,0,.5);
  /* Une ligne fine tous les 28 px, décalée pour passer juste sous la ligne de base du texte. */
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--interligne-notes) - 1px), rgba(17,17,17,.1) calc(var(--interligne-notes) - 1px) var(--interligne-notes));
  background-position: 0 14px;
}
.notes-texte { margin: 0; font-family: var(--font-lecture); font-size: 16px; line-height: var(--interligne-notes); text-wrap: pretty; }
.notes-source { display: flex; align-items: center; gap: 9px; margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(17,17,17,.3); }
.pastille { width: 8px; height: 8px; border-radius: 50%; flex: none; border: 1px solid var(--encre); background: transparent; }
.pastille.pleine { background: var(--encre); }
.notes-source span:last-child { font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; line-height: 1.4; color: var(--gris-refus); }
.notes-source.sourcee span:last-child { color: var(--encre); }

/* État d'attente : le triskell « Kanol cherche » sur le bloc-notes */
.notes-attente { display: flex; align-items: center; gap: 16px; min-height: 56px; }
.notes-attente .notes-texte { color: var(--gris-refus); font-style: italic; }

/* Saisie */
.saisie { padding: 16px 32px 24px; border-top: 1px solid var(--trait); position: sticky; bottom: 0; background: var(--nuit); }
.saisie-boite { max-width: 820px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; border: 1px solid var(--trait-fort); border-radius: 4px; padding: 10px 10px 10px 16px; margin: 0; }
.saisie-boite:focus-within { border-color: var(--papier); }
.saisie-boite textarea { all: unset; width: 100%; min-height: 24px; max-height: 160px; resize: none; font-family: var(--font-corps); font-size: 14.5px; line-height: 24px; color: var(--papier); overflow-y: hidden; }
.saisie-pied { margin: 8px 0 0; font-family: var(--font-mono); font-size: 10.5px; color: var(--gris-sombre); }

/* ---------- Panneau droit ---------- */
.panneau { flex: 1 1 280px; max-width: 100%; border-left: 1px solid var(--trait); border-top: 1px solid var(--trait); padding: 24px 22px; display: flex; flex-direction: column; gap: 30px; min-width: 0; }
.etiquette-panneau { margin-bottom: 14px; }
.panneau-titre { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }

.sources { display: flex; flex-direction: column; gap: 1px; background: rgba(231,231,228,.08); }
.source { background: var(--nuit); padding: 12px; display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 10px; align-items: start; }
.source .pastille { margin-top: 4px; border-color: var(--papier); }
.source .pastille.pleine { background: var(--papier); }
.source-titre { margin: 0; font-size: 13.5px; line-height: 1.4; color: var(--papier); }
.source-meta { margin: 3px 0 0; font-family: var(--font-mono); font-size: 10.5px; color: var(--gris); }

.a-valider { display: flex; flex-direction: column; gap: 10px; }
.carte { border: 1px solid rgba(231,231,228,.14); border-radius: 4px; padding: 14px; }
.carte-texte { margin: 0 0 10px; font-family: var(--font-lecture); font-size: 14.5px; line-height: 1.5; color: var(--papier); font-style: italic; }
.carte-meta { margin: 0 0 12px; font-family: var(--font-mono); font-size: 10.5px; color: var(--gris); }
.carte-actions { display: flex; gap: 8px; }
.carte-actions .bouton { flex: 1; padding: 7px 0; font-size: 12.5px; }
.carte-vide { margin: 0; font-size: 13px; color: var(--gris); padding: 14px; border: 1px dashed rgba(231,231,228,.14); border-radius: 4px; }

/* ---------- Téléphone : sidebar en bandeau, panneau droit dessous ---------- */
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--trait); gap: 16px; padding: 16px; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .nav-item { padding: 8px 10px; font-size: 13px; }
  .socle { margin-top: 0; }
  .conversation { min-height: auto; flex-basis: 100%; }
  .entete, .fil, .saisie { padding-left: 16px; padding-right: 16px; }
  .msg-user > div { max-width: 90%; }
  .panneau { flex-basis: 100%; border-left: 0; padding: 20px 16px; }
}
