/* Formation IA — feuille de style commune
   Aucune ressource externe (compatible CSP default-src 'self'). */

:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --ink: #17233b;
  --ink-soft: #4a5670;
  --line: #e3ded3;
  --accent: #0f7c78;        /* bleu-vert */
  --accent-soft: #dcefed;
  --warm: #d9663f;          /* corail */
  --warm-soft: #fbe6dd;
  --gold: #b8891c;
  --winter: #5b7fa6;
  --winter-soft: #e4ecf5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23,35,59,.06), 0 6px 20px rgba(23,35,59,.06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--warm); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); margin: .2em 0 .4em; }
h2 { font-size: 1.7rem; margin: 2.2em 0 .6em; }
h3 { font-size: 1.2rem; margin: 1.4em 0 .4em; }
p { margin: 0 0 1em; }
code { font-family: var(--mono); font-size: .9em; background: #efebe2; padding: .1em .35em; border-radius: 5px; }

/* ---------- En-tête ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(247,245,240,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .inner {
  max-width: 1120px; margin: 0 auto; padding: .7rem 1.4rem;
  display: flex; align-items: center; gap: 1.2rem;
}
.brand {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -.01em;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--ink);
  display: grid; place-items: center;
}
.brand-mark svg { width: 20px; height: 20px; }
.topbar nav { margin-left: auto; display: flex; gap: 1.1rem; font-size: .95rem; }
.topbar nav a { color: var(--ink-soft); text-decoration: none; }
.topbar nav a:hover, .topbar nav a[aria-current] { color: var(--ink); }

/* ---------- Mise en page ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 1.4rem; }
.prose { max-width: 720px; }
main { padding-bottom: 5rem; }

.hero { padding: 4rem 0 2.5rem; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .12em; font-size: .78rem;
  font-weight: 700; color: var(--accent);
}
.lede { font-size: 1.2rem; color: var(--ink-soft); max-width: 680px; }

/* ---------- Carte de parcours ---------- */
.path { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; margin-top: 1.6rem; }
.mod {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.3rem 1.3rem 1.1rem; text-decoration: none; color: inherit;
  box-shadow: var(--shadow); transition: transform .15s, border-color .15s;
}
a.mod:hover { transform: translateY(-2px); border-color: var(--accent); color: inherit; }
.mod .num { font-family: var(--serif); font-size: 2.2rem; color: var(--accent); line-height: 1; }
.mod h3 { margin: .5rem 0 .3rem; }
.mod p { color: var(--ink-soft); font-size: .95rem; margin-bottom: .8rem; }
.mod .meta { margin-top: auto; display: flex; gap: .5rem; flex-wrap: wrap; font-size: .8rem; }
.mod.soon { opacity: .6; box-shadow: none; background: transparent; border-style: dashed; }
.mod.soon .num { color: var(--ink-soft); }
.tag {
  display: inline-block; padding: .15rem .55rem; border-radius: 999px;
  background: #efebe2; color: var(--ink-soft); font-weight: 600;
}
.tag.interactive { background: var(--warm-soft); color: #a2421f; }
.tag.health { background: var(--accent-soft); color: #0b5a57; }
.tag.done { background: var(--accent); color: #fff; }

/* ---------- Encarts ---------- */
.callout {
  border-left: 4px solid var(--accent); background: var(--accent-soft);
  padding: 1rem 1.2rem; border-radius: 0 10px 10px 0; margin: 1.5rem 0;
}
.callout.warm { border-color: var(--warm); background: var(--warm-soft); }
.callout strong:first-child { display: block; margin-bottom: .2rem; }

details.deeper {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  margin: 1.4rem 0; padding: 0 1.1rem;
}
details.deeper summary {
  cursor: pointer; padding: .85rem 0; font-weight: 600; color: var(--ink);
  list-style: none; display: flex; align-items: center; gap: .5rem;
}
details.deeper summary::-webkit-details-marker { display: none; }
details.deeper summary::before {
  content: "+"; display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 6px; background: var(--ink); color: #fff; font-size: .9rem;
}
details.deeper[open] summary::before { content: "−"; }
details.deeper > *:last-child { margin-bottom: 1rem; }
.formula {
  font-family: var(--mono); background: #f2efe7; border-radius: 8px;
  padding: .7rem 1rem; overflow-x: auto; font-size: .95rem;
}

/* ---------- Frise chronologique ---------- */
.eras { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.2rem 0 2rem; }
.eras button {
  font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  padding: .4rem .85rem; border-radius: 999px;
}
.eras button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before {
  content: ""; position: absolute; left: 88px; top: 0; bottom: 0; width: 2px; background: var(--line);
}
.era-band {
  position: relative; margin: 2.2rem 0 1rem 110px;
  font-family: var(--serif); font-size: 1.35rem; font-weight: 600;
}
.era-band small { display: block; font-family: var(--sans); font-size: .85rem; font-weight: 400; color: var(--ink-soft); }
.era-band.winter { color: var(--winter); }
.event { position: relative; display: grid; grid-template-columns: 78px 1fr; gap: 32px; margin: 0 0 1rem; }
.event .year {
  text-align: right; font-family: var(--serif); font-size: 1.25rem; font-weight: 600; padding-top: .9rem;
}
.event::after {
  content: ""; position: absolute; left: 82px; top: 1.25rem; width: 14px; height: 14px;
  border-radius: 50%; background: var(--bg); border: 3px solid var(--accent);
}
.event.winter::after { border-color: var(--winter); }
.event.health::after { background: var(--accent); }
.event .card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: .9rem 1.1rem;
}
.event.winter .card { background: var(--winter-soft); border-color: #cddbea; }
.event .card h3 { margin: 0 0 .25rem; font-size: 1.08rem; }
.event .card p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.event .card .why { margin-top: .55rem; font-size: .9rem; color: var(--ink); }
.event .card .why b { color: var(--warm); }
.event .card .tags { margin-top: .55rem; display: flex; gap: .4rem; flex-wrap: wrap; font-size: .75rem; }
.event[hidden], .era-band[hidden] { display: none; }

/* ---------- Démo ---------- */
.demo {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.3rem; margin: 1.8rem 0;
}
.demo-head { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.demo-head h3 { margin: 0; }
.demo-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.4rem; }
@media (max-width: 860px) { .demo-grid { grid-template-columns: 1fr; } }
.plot {
  width: 100%; aspect-ratio: 1 / 1; border-radius: 10px; border: 1px solid var(--line);
  display: block; background: #fff; touch-action: none;
}
.controls { display: flex; flex-direction: column; gap: .9rem; }
.ctrl label { display: flex; justify-content: space-between; font-size: .9rem; font-weight: 600; }
.ctrl label output { font-family: var(--mono); font-weight: 500; color: var(--accent); }
.ctrl input[type=range] { width: 100%; accent-color: var(--accent); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button {
  flex: 1; font: inherit; font-size: .85rem; padding: .45rem .3rem; border: 0; cursor: pointer;
  background: var(--surface); color: var(--ink-soft); border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.btn {
  font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  padding: .55rem 1rem; border-radius: 9px;
}
.btn.ghost { background: transparent; color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.stat { background: var(--bg); border-radius: 10px; padding: .55rem .8rem; }
.stat b { display: block; font-family: var(--serif); font-size: 1.5rem; line-height: 1.1; }
.stat span { font-size: .78rem; color: var(--ink-soft); }
.hint { font-size: .88rem; color: var(--ink-soft); min-height: 2.6em; }
.neuron-svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 1rem; font-size: .82rem; color: var(--ink-soft); flex-wrap: wrap; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: .35rem; vertical-align: -1px; }

/* ---------- Quiz ---------- */
.quiz { margin-top: 3rem; }
.q { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.q p { font-weight: 600; margin-bottom: .6rem; }
.q .opts { display: flex; flex-direction: column; gap: .4rem; }
.q button.opt {
  font: inherit; text-align: left; cursor: pointer; padding: .5rem .8rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.q button.opt:hover:not(:disabled) { border-color: var(--accent); }
.q button.opt.right { background: var(--accent-soft); border-color: var(--accent); }
.q button.opt.wrong { background: var(--warm-soft); border-color: var(--warm); }
.q button.opt:disabled { cursor: default; }
.q .explain { margin-top: .6rem; font-size: .92rem; color: var(--ink-soft); }
.quiz-result { font-weight: 600; }

/* ---------- Navigation bas de module ---------- */
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.pager a { text-decoration: none; font-weight: 600; }
.pager small { display: block; font-weight: 400; color: var(--ink-soft); }

footer.site { border-top: 1px solid var(--line); padding: 2rem 0; color: var(--ink-soft); font-size: .85rem; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .topbar nav { display: none; }
  .timeline::before { left: 10px; }
  .era-band { margin-left: 32px; }
  .event { grid-template-columns: 1fr; gap: .2rem; padding-left: 32px; }
  .event .year { text-align: left; padding-top: 0; }
  .event::after { left: 4px; top: .35rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
