@font-face { font-family: Gabarito; src: url(fonts/gabarito.woff2) format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Hanken Grotesk"; src: url(fonts/hanken-grotesk.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Martian Mono"; src: url(fonts/martian-mono.woff2) format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
  --encre: #15231e;
  --gris: #5e7268;
  --papier: #fff;
  --envoi: #e2f8cc;
  --vert: #1f7a5c;
  --clavier: #24564a;
  --trait: #d6e2da;
  --corps: "Hanken Grotesk", system-ui, sans-serif;
  --titre: Gabarito, system-ui, sans-serif;
  --mono: "Martian Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
  margin: 0;
  color: var(--encre);
  font: 400 17px/1.5 var(--corps);
}

/* Le fond ne bouge pas : seuls les messages défilent */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background:
    url(doodles.svg) center top / 440px,
    radial-gradient(90vw 70vh at 8% 6%, #e3e6a2, transparent 70%),
    radial-gradient(80vw 80vh at 95% 30%, #a5cbdd, transparent 70%),
    radial-gradient(90vw 90vh at 20% 95%, #8fcdb4, transparent 70%),
    #bfdda6;
}

a { color: var(--vert); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--clavier); outline-offset: 2px; }

/* En-tête de conversation */
.barre {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 12px;
  padding: 9px max(16px, calc(50vw - 372px));
  background: #ffffffeb;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--trait);
}
.avatar { width: 42px; height: 42px; flex: none; background: url(favicon.svg) center / cover; border-radius: 50%; }
.identite { display: grid; line-height: 1.25; }
.identite strong { font: 700 17px var(--titre); }
.identite span { font-size: 14px; color: var(--vert); }

/* Le fil */
.fil {
  display: flex; flex-direction: column; gap: 7px;
  max-width: 744px; margin: 0 auto; padding: 18px 16px 112px;
}

.date {
  align-self: center; margin: 8px 0;
  padding: 3px 12px;
  font-size: 14px; font-weight: 600; color: #fff; text-align: center;
  background: #2f5f50a8; border-radius: 12px;
}
.date.mobile { display: none; }
.date.mention { margin-top: 26px; font-weight: 400; }

.message {
  position: relative;
  max-width: min(84%, 560px);
  padding: 8px 13px 7px;
  background: var(--papier);
  border-radius: 16px;
  box-shadow: 0 1px 1px #1d4a3c33;
  overflow-wrap: anywhere;
}
.message p { margin: 0 0 7px; }
.message p:last-of-type { margin-bottom: 2px; }
.message ol, .message ul { margin: 0 0 8px; padding-left: 22px; }
.message li { margin-bottom: 5px; }
.message li::marker { color: var(--vert); font-weight: 700; }
.message time { font: 400 10.500px var(--mono); color: var(--gris); }
.message > time { display: block; text-align: right; }
.message code { padding: 1px 5px; font: 500 13.500px var(--mono); color: var(--clavier); background: #e8f3ec; border-radius: 5px; }

.recu { align-self: flex-start; border-bottom-left-radius: 5px; }
.envoye { align-self: flex-end; background: var(--envoi); border-bottom-right-radius: 5px; margin-top: 14px; }
.recu + .recu { margin-top: 0; }
.envoye footer { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.envoye time { color: #4f8a55; }
.lu { font-size: 12px; letter-spacing: -4px; padding-right: 4px; color: #3f9c4b; }
.reaction { margin-right: auto; padding: 1px 8px; font-size: 15px; background: #c9eeb0; border-radius: 12px; }

.session { display: block; margin-bottom: 1px; font: 500 12.500px var(--mono); color: #7a3fb8; }

/* Le message d'ouverture : la thèse de la page */
.grand { max-width: 100%; padding: 20px 26px 12px; }
.grand h1 {
  margin: 0 0 14px;
  font: 800 clamp(42px, 8.600vw, 76px) / 1 var(--titre);
  letter-spacing: -.02em;
  text-wrap: balance;
}
.grand p { max-width: 34em; font-size: 20px; line-height: 1.4; }

/* Vocal */
.vocal { min-width: min(100%, 340px); }
.lecteur { display: flex; align-items: center; gap: 10px; margin: 3px 0 7px; }
.lecture { position: relative; flex: none; width: 40px; height: 40px; background: #4fae4e; border-radius: 50%; }
.lecture::after {
  content: ""; position: absolute; left: 15px; top: 11px;
  border: 9px solid transparent; border-left: 14px solid #fff; border-right: 0;
}
.lecteur svg { flex: 1; min-width: 0; height: 26px; fill: none; stroke: #4fae4e; stroke-width: 2.600; stroke-linecap: round; }
.duree { font: 400 11px var(--mono); color: #4f8a55; }

/* Boutons de bot */
.clavier { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.touche {
  padding: 14px 10px;
  font: 700 18px/1.2 var(--titre); color: #fff; text-align: center; text-decoration: none;
  background: var(--clavier);
  border-radius: 12px;
  transition: background .15s;
}
.touche:hover { background: #1b4238; }

.aide { margin-top: 7px; }
.aide button {
  display: block; width: 100%; margin: 8px 0 4px; padding: 9px;
  font: 700 16px var(--titre); color: var(--vert);
  background: #e8f3ec; border: 0; border-radius: 10px; cursor: pointer;
}

/* Barre de saisie */
.redaction {
  position: fixed; inset: auto 0 0; z-index: 2;
  display: flex; align-items: center; gap: 12px;
  padding: 9px max(16px, calc(50vw - 372px));
  background: #ffffffeb;
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--trait);
}
.redaction label { flex: none; font-size: 14px; color: var(--gris); }
.redaction input {
  flex: 1; min-width: 0; padding: 8px 0;
  font: 400 12.500px var(--mono); color: var(--encre);
  background: none; border: 0; text-overflow: ellipsis;
}
.envoi {
  flex: none; width: 42px; height: 42px; padding: 9px;
  color: #fff; background: var(--vert); border: 0; border-radius: 50%; cursor: pointer;
}
.envoi svg { display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.envoi.fait { background: #4fae4e; }

/* La scène du vocal : les messages arrivent l'un après l'autre */
.joue .message { animation: arrive .28s ease-out both; }
@keyframes arrive { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.attente { display: flex; gap: 5px; padding: 13px 15px; }
.attente i { width: 7px; height: 7px; background: var(--gris); border-radius: 50%; animation: points 1s infinite; }
.attente i:nth-child(2) { animation-delay: .15s; }
.attente i:nth-child(3) { animation-delay: .3s; }
@keyframes points { 50% { opacity: .3; transform: translateY(-3px); } }
#demo { display: flex; flex-direction: column; gap: 7px; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .message { max-width: 92%; }
  .grand { max-width: 100%; padding: 16px 18px 10px; }
  .grand p { font-size: 18px; }
  .clavier { grid-template-columns: 1fr; }
  .date.mobile { display: block; }
  .redaction label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .joue .message, .attente i { animation: none; }
  .touche { transition: none; }
}
