/* ChatFaso — site public (chatfaso.com) */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-grotesque-var.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("fonts/atkinson-hyperlegible-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("fonts/atkinson-hyperlegible-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  /* Blanc cassé, indigo et bleu du logo ; le téléphone reprend les
     couleurs de l'app. */
  --paper: #f3f5f2;
  --paper-2: #e8ece7;
  --ink: #10162b;
  --ink-soft: #4a5068;
  --indigo: #1c2a6b;
  --indigo-deep: #131d4f;
  --blue: #1f5bff;
  --blue-hover: #1848d4;
  --blue-soft: #dfe7ff;
  --line: rgba(16, 22, 43, 0.14);

  --app-bg: #05070c;
  --app-surface: #0c111a;
  --app-text: #f2f5f9;
  --app-dim: #9aa7b8;
  --app-out: #00945a;

  --display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;

  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1328;
    --paper-2: #151b36;
    --ink: #eef0f7;
    --ink-soft: #aab1c8;
    --indigo: #222f75;
    --indigo-deep: #1a2463;
    --blue: #2f63ff;
    --blue-hover: #4473ff;
    --blue-soft: #1e2a5c;
    --line: rgba(238, 240, 247, 0.14);
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; }

a { color: inherit; }

h1, h2, h3 {
  font-family: var(--display);
  line-height: 1.08;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 { font-size: clamp(1.9rem, 3.6vw, 2.75rem); max-width: 22ch; }
h3 { font-size: 1.2rem; letter-spacing: -0.01em; }

p { margin: 0; }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  border-radius: 6px;
  z-index: 10;
}
.skip:focus { top: 1rem; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 3.25rem;
  padding: 0 1.4rem;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font: 700 1.05rem/1 var(--body);
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.btn:hover { background: var(--blue-hover); }
.btn-small { min-height: 2.6rem; padding: 0 1.1rem; font-size: 0.95rem; }
.btn-light { background: var(--paper); color: var(--indigo-deep); }
.btn-light:hover { background: #fff; }

/* ---------- En-tête ---------- */
.top { background: var(--paper); }

.nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  min-height: 4.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font: 800 1.35rem/1 var(--display);
  letter-spacing: -0.03em;
}
.brand img { border-radius: 9px; }

.links {
  display: flex;
  gap: 1.6rem;
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
}
.links a {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.98rem;
}
.links a:hover { color: var(--ink); }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  padding-top: clamp(2.5rem, 7vw, 5.5rem);
  padding-bottom: clamp(3rem, 8vw, 6.5rem);
}

.hero h1 {
  font-size: clamp(2.6rem, 6.4vw, 5.1rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.98;
  max-width: 13ch;
  font-variation-settings: "opsz" 96;
}

.lead {
  margin-top: 1.6rem;
  font-size: clamp(1.1rem, 1.6vw, 1.25rem);
  color: var(--ink-soft);
  max-width: 36rem;
}

.cta { margin-top: 2.2rem; }
.cta-meta {
  margin-top: 0.9rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.cta-meta a { color: var(--ink); font-weight: 700; }

.note {
  margin-top: 1.6rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
  padding-left: 0.8rem;
  border-left: 3px solid var(--blue);
}

/* ---------- Démonstration : le téléphone ---------- */
.demo { margin: 0; justify-self: center; width: min(100%, 19.5rem); }

/* Téléphone Android au format 18:9 (écran 360 × 720 dp) :
   bordures fines, caméra en poinçon, barre de navigation gestuelle. */
.phone {
  position: relative;
  display: flex;
  flex-direction: column;
  aspect-ratio: 9 / 18;
  background: var(--app-bg);
  color: var(--app-text);
  border-radius: 1.7rem;
  border: 5px solid #23262e;
  outline: 1px solid #3a3f4a;
  overflow: hidden;
  box-shadow: 0 40px 70px -30px rgba(19, 29, 79, 0.6);
}
.phone::before {
  content: "";
  position: absolute;
  top: 0.55rem;
  left: 50%;
  width: 0.7rem;
  height: 0.7rem;
  margin-left: -0.35rem;
  border-radius: 50%;
  background: #000;
  box-shadow: 0 0 0 2px #15171c;
  z-index: 2;
}

.statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem 0.35rem;
  font: 700 0.72rem/1 var(--body);
  background: var(--app-surface);
}
.sb-icons { display: inline-flex; gap: 0.35rem; align-items: center; }

.phone-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem 0.75rem 0.7rem;
  background: var(--app-surface);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}
.back { color: var(--app-dim); }
.avatar {
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #9b5de5, #6a3fb5);
}
.avatar::before { content: attr(data-initial); font: 700 1rem/1 var(--body); }
.who { display: grid; line-height: 1.25; }
.who strong { font-size: 0.98rem; }
.who small { color: #3ccf8e; font-size: 0.78rem; }

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* comme un vrai fil : le plus ancien remonte hors écran */
  min-height: 0;
  overflow: hidden;
  padding: 0.8rem 0.65rem 0.5rem;
}
.screen > * { flex: none; }

.e2e {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  margin: 0 auto;
  width: fit-content;
  padding: 0.35rem 0.7rem;
  border-radius: 0.6rem;
  background: rgba(143, 176, 255, 0.1);
  color: #a9c0ff;
  font-size: 0.72rem;
}
.e2e-serveur { display: none; }

.day {
  margin: 0.8rem auto 0;
  width: fit-content;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--app-surface);
  color: var(--app-dim);
  font-size: 0.72rem;
}

.thread {
  list-style: none;
  margin: 0;
  padding: 0.9rem 0 0;
  display: grid;
  gap: 0.55rem;
}

.msg {
  max-width: 82%;
  padding: 0.5rem 0.7rem 0.35rem;
  border-radius: 1rem;
  font-size: 0.92rem;
  line-height: 1.38;
}
.msg.in { background: var(--app-surface); border-bottom-left-radius: 0.3rem; }
.msg.out {
  background: var(--app-out);
  justify-self: end;
  border-bottom-right-radius: 0.3rem;
}
.meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.1rem;
  font-size: 0.68rem;
  color: rgba(242, 245, 249, 0.6);
}
.ticks { color: #8fd8ff; }

.txt { overflow-wrap: anywhere; }
.msg.voice { min-width: 70%; }
.msg.voice .txt { display: flex; align-items: center; gap: 0.55rem; font-size: 0.8rem; color: var(--app-dim); }
.play {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--app-out);
  color: #fff;
}
.wave { display: flex; align-items: center; gap: 2px; flex: 1; height: 1.4rem; }
.wave i { flex: 1; border-radius: 2px; background: rgba(242, 245, 249, 0.45); height: 30%; }
.wave i:nth-child(3n) { height: 70%; }
.wave i:nth-child(4n+1) { height: 50%; }
.wave i:nth-child(5n+2) { height: 95%; }
.wave i:nth-child(-n+5) { background: #3ccf8e; }

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

.composer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem 0.5rem;
}
.navbar {
  display: grid;
  place-items: center;
  height: 1.4rem;
}
.navbar::before {
  content: "";
  width: 6.5rem;
  height: 0.25rem;
  border-radius: 999px;
  background: rgba(242, 245, 249, 0.55);
}
.field {
  flex: 1;
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  background: var(--app-surface);
  color: var(--app-dim);
  font-size: 0.85rem;
}
.mic {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--app-out);
  color: #fff;
}

/* Vue « serveur » : le texte est remplacé par le chiffré (main.js). */
.phone[data-view="serveur"] .txt {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.76rem;
  color: #9fb0c8;
}
.phone[data-view="serveur"] .msg.out { background: #18382b; }
.phone[data-view="serveur"] .msg.voice .txt { display: block; }
.phone[data-view="serveur"] .e2e { background: rgba(255, 255, 255, 0.06); color: #c9d3e0; }
.phone[data-view="serveur"] .e2e-ami { display: none; }
.phone[data-view="serveur"] .e2e-serveur { display: inline; }

.switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 1.1rem;
  padding: 0.3rem;
  border-radius: 999px;
  background: var(--paper-2);
}
.switch[hidden] { display: none; }
.switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: 700 0.92rem/1 var(--body);
  min-height: 2.6rem;
  border-radius: 999px;
  cursor: pointer;
}
.switch button[aria-pressed="true"] {
  background: var(--indigo);
  color: #fff;
}

.demo figcaption {
  margin-top: 0.9rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
  min-height: 3em;
}
.demo figcaption [data-for="serveur"] { display: none; }
.demo.serveur figcaption [data-for="ami"] { display: none; }
.demo.serveur figcaption [data-for="serveur"] { display: inline; }

/* ---------- Fonctions ---------- */
.band {
  background: var(--paper-2);
  padding: clamp(3.5rem, 8vw, 6rem) 0;
}

.features {
  list-style: none;
  margin: 2.8rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.6rem 3rem;
}
.features svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: var(--indigo);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-bottom: 1rem;
}
@media (prefers-color-scheme: dark) {
  .features svg { stroke: #8fb0ff; }
}
.features p { margin-top: 0.5rem; color: var(--ink-soft); max-width: 32ch; }

/* ---------- Sécurité ---------- */
.security { padding-top: clamp(3.5rem, 8vw, 6rem); padding-bottom: clamp(3.5rem, 8vw, 6rem); }

.security-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: clamp(2rem, 6vw, 5rem);
  margin-top: 2.4rem;
}
.security-main p + p { margin-top: 1.2rem; color: var(--ink-soft); max-width: 38rem; }
.big {
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.3vw, 1.75rem);
  line-height: 1.3;
  letter-spacing: -0.015em;
  max-width: 34ch;
}

.facts { margin: 0; display: grid; gap: 1.6rem; }
.facts div { border-top: 2px solid var(--ink); padding-top: 0.8rem; }
.facts div:nth-child(2) { border-color: var(--blue); }
.facts dt { font-weight: 700; }
.facts dd { margin: 0.3rem 0 0; color: var(--ink-soft); }

/* ---------- Installation ---------- */
.install {
  background: var(--indigo-deep);
  color: #eef0f7;
}
.install .wrap { padding-top: clamp(3.5rem, 8vw, 6rem); padding-bottom: clamp(3.5rem, 8vw, 6rem); }
.install-intro { margin-top: 1rem; color: #c3c9e2; max-width: 38rem; font-size: 1.1rem; }

.steps {
  list-style: none;
  counter-reset: etape;
  margin: 2.8rem 0 2.8rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem;
}
.steps li { counter-increment: etape; }
.steps li::before {
  content: counter(etape);
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  margin-bottom: 1.1rem;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font: 800 1.2rem/1 var(--display);
}
.steps p { margin-top: 0.5rem; color: #c3c9e2; }

/* ---------- Questions ---------- */
.faq { padding-top: clamp(3.5rem, 8vw, 6rem); padding-bottom: clamp(3.5rem, 8vw, 6rem); }
.faq-list { margin-top: 2.2rem; max-width: 46rem; }

details { border-bottom: 1px solid var(--line); }
details:first-child { border-top: 1px solid var(--line); }
summary {
  list-style: none;
  cursor: pointer;
  padding: 1.15rem 2.4rem 1.15rem 0;
  font-weight: 700;
  font-size: 1.08rem;
  position: relative;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "";
  position: absolute;
  right: 0.4rem;
  top: 50%;
  width: 0.65rem;
  height: 0.65rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.2s ease;
}
details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
details p { padding: 0 0 1.3rem; color: var(--ink-soft); max-width: 40rem; }

/* ---------- Pied de page ---------- */
.foot { background: var(--paper-2); }
.foot-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 2rem;
  padding-top: 2rem;
  padding-bottom: 2rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.foot .brand { color: var(--ink); font-size: 1.15rem; }
.copy { margin-left: auto; }

/* ---------- Petits écrans ---------- */
@media (max-width: 900px) {
  .links { display: none; }
  .nav .btn-small { margin-left: auto; }
  .hero { grid-template-columns: 1fr; }
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .security-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  body { font-size: 1rem; }
  .btn { width: 100%; justify-content: center; }
  .nav .btn { width: auto; }
  .features, .steps { grid-template-columns: 1fr; }
  .copy { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

section[id] { scroll-margin-top: 1.5rem; }
