/* ============================================================
   ESPRIT ARTIFICIEL — Design System V2
   Violet profond / noir anthracite / blanc
   ============================================================ */

:root {
  --violet-50: #f5f3ff;
  --violet-100: #ede9fe;
  --violet-200: #ddd6fe;
  --violet-300: #c4b5fd;
  --violet-400: #a78bfa;
  --violet-500: #8b5cf6;
  --violet-600: #7c3aed;
  --violet-700: #6d28d9;
  --violet-800: #5b21b6;
  --violet-900: #4c1d95;

  --ink-900: #0b0d12;
  --ink-800: #12151c;
  --ink-700: #1a1f2a;
  --ink-600: #232a38;
  --ink-500: #39404f;

  --surface: #ffffff;
  --surface-soft: #f7f7fb;
  --border: #e6e6ef;
  --text: #1b1f27;
  --text-muted: #5b6270;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 18, 30, .05), 0 8px 24px -12px rgba(16, 18, 30, .12);
  --shadow-lg: 0 12px 40px -12px rgba(16, 18, 30, .22);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
}

/* ---- Théme sombre ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #12151c;
    --surface-soft: #171b24;
    --border: #242b3a;
    --text: #e8eaf0;
    --text-muted: #9aa3b5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  --surface: #12151c;
  --surface-soft: #171b24;
  --border: #242b3a;
  --text: #e8eaf0;
  --text-muted: #9aa3b5;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
main { min-height: 60vh; }
img { max-width: 100%; height: auto; }
a { color: var(--violet-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; margin: 0 0 .6em; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
ul { padding-left: 1.2em; }
::selection { background: var(--violet-500); color: #fff; }

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

/* ---- Layout ---- */
.container { max-width: 1180px; margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 5.5rem 0; }
.section--soft { background: var(--surface-soft); }
.section--dark { background: var(--ink-950); color: #e8eaf0; }
.section--dark h2, .section--dark h3 { color: #fff; }
.section--accent { background: linear-gradient(135deg, var(--ink-950), var(--violet-900)); color: #e9e6f7; }

.section-head { max-width: 760px; margin: 0 auto 3rem; text-align: center; }
.section-head h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); }
.section-head p { color: var(--text-muted); font-size: 1.08rem; }

.grid { display: grid; gap: 1.5rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.grid--5 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }

/* ---- Header ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 76px; gap: 1rem; }
.site-header .brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.02rem; color: var(--text); }
.site-header .brand img { height: 44px; width: auto; }
.site-nav { display: flex; align-items: center; gap: 1.4rem; }
.site-nav a { color: var(--text-muted); font-size: .95rem; font-weight: 500; }
.site-nav a:hover { color: var(--violet-600); text-decoration: none; }
.site-nav a.active { color: var(--violet-600); }
.menu-toggle { display: none; background: none; border: 0; font-size: 1.3rem; color: var(--text); cursor: pointer; padding: .4rem; }
.theme-toggle { padding: .5rem .7rem; font-size: 1rem; }
.eco-list a { display: inline-flex; align-items: center; gap: .35rem; }

.btn { display: inline-block; padding: .72rem 1.35rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .95rem; transition: .18s ease; cursor: pointer; border: 0; }
.btn--primary { background: var(--violet-600); color: #fff; }
.btn--primary:hover { background: var(--violet-700); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--violet-600); border: 1.5px solid var(--violet-500); }
.btn--ghost:hover { background: var(--violet-600); color: #fff; text-decoration: none; }
.btn--light { background: #fff; color: var(--ink-900); }
.btn--light:hover { background: var(--violet-100); text-decoration: none; }
.btn--block { width: 100%; text-align: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- Hero ---- */
.hero { padding: 6rem 0 5rem; background: radial-gradient(1200px 500px at 80% -10%, var(--violet-100), transparent 60%), var(--surface); }
:root[data-theme="dark"] .hero { background: radial-gradient(1200px 500px at 80% -10%, rgba(124, 58, 237, .25), transparent 60%), var(--surface); }
.hero .container { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.5rem); font-weight: 800; }
.hero h1 .accent { background: linear-gradient(135deg, var(--violet-600), #6366f1); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.15rem; color: var(--text-muted); max-width: 52ch; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1.6rem; }
.hero-proof { margin-top: 2.5rem; color: var(--text-muted); font-size: .9rem; display: flex; gap: 1.4rem; flex-wrap: wrap; }
.hero-proof b { color: var(--text); }

.hero-visual {
  border: 1px solid var(--border); border-radius: 20px; padding: 2rem;
  background: var(--surface-soft);
  box-shadow: var(--shadow);
}

/* ---- Mini-architecture du hero (frontière IA ↔ monde réel) ---- */
.arch-flow { display: flex; flex-direction: column; align-items: center; gap: .15rem; margin-top: 1rem; }
.af-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; justify-content: center; }
.af-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--violet-500); box-shadow: 0 0 10px var(--violet-500); animation: af-pulse 2.4s ease-in-out infinite; }
.af-dot:nth-child(2) { animation-delay: .3s; }
.af-dot:nth-child(3) { animation-delay: .6s; }
@keyframes af-pulse { 0%, 100% { opacity: .45; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.05); } }
.af-label { font-size: .68rem; letter-spacing: .22em; color: var(--text-muted); font-weight: 700; }
.af-link { color: var(--violet-500); font-size: .85rem; line-height: 1; }
.af-box {
  display: inline-block; padding: .45rem 1.1rem; border-radius: 8px;
  font-weight: 700; font-size: .8rem; letter-spacing: .06em;
  background: var(--ink-800); color: #e8eaf0; border: 1px solid var(--ink-500);
  position: relative;
}
.af-box--hitl { background: var(--violet-600); border-color: var(--violet-600); color: #fff; }
.af-rows3 { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }
.af-cap {
  padding: .4rem .85rem; border-radius: 8px; font-weight: 700; font-size: .78rem; letter-spacing: .04em;
  background: var(--surface); border: 1px solid var(--violet-300); color: var(--violet-700);
  position: relative; cursor: default; transition: transform .15s ease;
}
.af-cap:hover { transform: translateY(-2px); }
.af-cap:hover::after {
  content: attr(data-tip); position: absolute; top: -2.1rem; left: 50%; transform: translateX(-50%);
  background: var(--ink-800); color: #e8eaf0; font-size: .7rem; font-weight: 500; letter-spacing: 0;
  padding: .3rem .6rem; border-radius: 6px; white-space: nowrap; z-index: 5;
}
:root[data-theme="dark"] .af-cap { background: var(--ink-700); border-color: var(--violet-500); color: var(--violet-300); }
:root[data-theme="dark"] .af-box { background: var(--ink-600); }

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card .icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--violet-100); color: var(--violet-700); font-size: 1.3rem; margin-bottom: 1rem; }
.card h3 { font-size: 1.12rem; }
.card p { color: var(--text-muted); font-size: .95rem; margin-bottom: .4rem; }
:root[data-theme="dark"] .card .icon { background: rgba(139, 92, 246, .15); color: var(--violet-400); }

.card--project { display: flex; flex-direction: column; }
.card--project .tag { align-self: flex-start; }
.card--project .stack { margin-top: auto; padding-top: .8rem; font-size: .8rem; color: var(--text-muted); font-family: var(--mono); }

.tag { display: inline-block; padding: .22rem .7rem; border-radius: 999px; font-size: .75rem; font-weight: 600; letter-spacing: .02em; }
.tag--production { background: #dcfce7; color: #15803d; }
.tag--experimental { background: #fef9c3; color: #a16207; }
.tag--prototype { background: #fee2e2; color: #b91c1c; }
.tag--open-source { background: var(--violet-100); color: var(--violet-700); }
.tag--used-internal { background: #dbeafe; color: #1d4ed8; }
.tag--private { background: #e2e8f0; color: #475569; }
:root[data-theme="dark"] .tag--production { background: rgba(22, 163, 74, .2); color: #4ade80; }
:root[data-theme="dark"] .tag--experimental { background: rgba(202, 138, 4, .2); color: #facc15; }
:root[data-theme="dark"] .tag--prototype { background: rgba(220, 38, 38, .2); color: #f87171; }
:root[data-theme="dark"] .tag--open-source { background: rgba(139, 92, 246, .2); color: #c4b5fd; }
:root[data-theme="dark"] .tag--used-internal { background: rgba(59, 130, 246, .2); color: #93c5fd; }
:root[data-theme="dark"] .tag--private { background: var(--ink-600); color: #aab3c5; }

/* Diagrammes d'architecture ASCII (aucune librairie) */
.arch-diagram {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  color: var(--text);
  margin: 0;
}
.arch-diagram::-webkit-scrollbar { height: 6px; }
.arch-diagram::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- Pillars / features list ---- */
.pillar-list { display: grid; gap: 1rem; }
.pillar { display: flex; gap: 1rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.3rem; }
.pillar .n { font-weight: 800; color: var(--violet-500); font-size: 1.1rem; min-width: 2.2rem; }
.pillar h3 { font-size: 1.05rem; margin: 0 0 .15rem; }
.pillar p { margin: 0; color: var(--text-muted); font-size: .93rem; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }

/* ---- Forms ---- */
.form { display: grid; gap: 1.1rem; }
.form label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: .35rem; }
.form input, .form textarea, .form select {
  width: 100%; padding: .72rem .9rem; font: inherit;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
.form input:focus, .form textarea:focus { outline: 2px solid var(--violet-500); border-color: transparent; }
.form .honeypot { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }
.form-status { display: none; padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: .92rem; }
.form-status.ok { display: block; background: #dcfce7; color: #15803d; }
.form-status.err { display: block; background: #fee2e2; color: #b91c1c; }
.form-status.sending { display: block; background: var(--violet-100); color: var(--violet-700); }

/* ---- Contact info ---- */
.contact-block { display: grid; gap: 1rem; }
.contact-item { display: flex; gap: .9rem; align-items: center; padding: 1rem 1.2rem; border: 1px solid var(--border); border-radius: var(--radius); }
.contact-item .icon { font-size: 1.2rem; color: var(--violet-500); }

/* ---- Footer ---- */
.site-footer { border-top: 1px solid var(--border); background: var(--inky-950, #0f0f14); margin-top: 0; padding: 3.5rem 0 2rem; }
.site-footer, .site-footer a { color: #aab3c5; }
.site-footer .grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr 1.2fr; gap: 2rem; }
@media (max-width: 1100px) { .site-footer .grid { grid-template-columns: 1fr 1fr; } }
.site-footer h4 { color: #fff; font-size: .95rem; margin-bottom: 1rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; font-size: .92rem; }
.site-footer .brand img { height: 40px; }
.site-footer .fine { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.1); font-size: .82rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---- Badges / chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--border); font-size: .83rem; color: var(--text-muted); background: var(--surface-soft); }

/* ---- Breadcrumb ---- */
.breadcrumb { font-size: .85rem; color: var(--text-muted); display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb .sep { color: var(--border); }

/* ---- Page hero (interne) ---- */
.page-head { padding: 4rem 0 0; }
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); max-width: 24ch; }
.page-head p { color: var(--text-muted); font-size: 1.1rem; max-width: 60ch; }

/* ---- Maryline widget ---- */
#maryline-root { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 90; }
.ml-fab {
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--violet-600), #6366f1); color: #fff;
  box-shadow: 0 10px 30px -6px rgba(124, 58, 237, .5); font-size: 1.5rem;
  display: grid; place-items: center; transition: transform .15s;
}
.ml-fab:hover { transform: scale(1.05); }
.ml-fab img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.ml-fab .badge { position: absolute; top: -2px; right: -2px; width: 14px; height: 14px; background: #22c55e; border-radius: 50%; border: 2px solid #fff; }
.ml-fab .ml-fab-txt {
  position: absolute; right: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  white-space: nowrap; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  border-radius: 999px; padding: .55rem 1rem; font-size: .82rem; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .18s ease; max-width: 60vw; overflow: hidden; text-overflow: ellipsis;
}
.ml-fab:hover .ml-fab-txt { opacity: 1; }

.ml-panel {
  position: fixed; right: 1.2rem; bottom: 5.6rem; width: min(420px, calc(100vw - 2.4rem));
  max-height: min(640px, calc(100vh - 7rem)); display: none; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: 0 24px 60px -16px rgba(16, 18, 30, .35); overflow: hidden; z-index: 91;
}
.ml-panel.open { display: flex; }
.ml-head { display: flex; align-items: center; gap: .8rem; padding: .9rem 1.1rem; background: linear-gradient(135deg, var(--ink-900), var(--violet-800)); color: #fff; }
.ml-head img { width: 42px; height: 42px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); }
.ml-head .t { font-weight: 700; }
.ml-head .s { font-size: .78rem; opacity: .8; }
.ml-head .close { margin-left: auto; background: none; border: 0; color: #fff; font-size: 1.2rem; cursor: pointer; opacity: .8; }

.ml-modes { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .4rem; padding: .6rem .8rem; background: var(--surface-soft); border-bottom: 1px solid var(--border); }
.ml-mode { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: .45rem .4rem; font-size: .74rem; font-weight: 600; cursor: pointer; line-height: 1.25; }
.ml-mode.active { border-color: var(--violet-500); color: var(--violet-600); background: var(--violet-50); }
:root[data-theme="dark"] .ml-mode.active { background: rgba(139,92,246,.15); }

.ml-msgs { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .7rem; background: var(--surface-soft); }
.ml-msg { max-width: 85%; padding: .65rem .9rem; border-radius: 14px; font-size: .9rem; white-space: pre-wrap; word-break: break-word; }
.ml-msg--bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ml-msg--user { align-self: flex-end; background: var(--violet-600); color: #fff; border-bottom-right-radius: 4px; }
.ml-msg .op { display: inline-flex; align-items: center; gap: .45rem; font-size: .78rem; color: var(--violet-500); font-weight: 600; margin-bottom: .3rem; }
.ml-msg--user .op { color: rgba(255,255,255,.85); }

.ml-actions { padding: .5rem .9rem; border-top: 1px solid var(--border); display: flex; gap: .6rem; background: var(--surface); }
.ml-actions button { flex: 1; }

.ml-input { display: flex; gap: .5rem; padding: .7rem .9rem; border-top: 1px solid var(--border); background: var(--surface); }
.ml-input input { flex: 1; border: 1px solid var(--border); border-radius: 999px; padding: .6rem 1rem; font: inherit; background: var(--surface-soft); color: var(--text); }
.ml-input button { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--violet-600); color: #fff; cursor: pointer; font-size: 1rem; flex-shrink: 0; }
.ml-input button[disabled] { opacity: .4; cursor: not-allowed; }
.ml-micro { background: var(--ink-600) !important; }

.ml-dot { display: inline-block; font-size: .9rem; letter-spacing: .15em; color: var(--violet-500); }
.ml-spin { display: inline-block; animation: kf-spin .8s linear infinite; font-size: .85rem; }
@keyframes kf-spin { to { transform: rotate(360deg); } }

/* ---- Utility ---- */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .9rem; }
.text-xs { font-size: .8rem; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 2rem; } .mt-4 { margin-top: 3rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 2rem; }
.center { text-align: center; }
.stack { display: flex; flex-wrap: wrap; gap: 1rem; }

.prose { max-width: 72ch; }
.prose h2 { margin-top: 2rem; font-size: 1.5rem; }
.prose h3 { margin-top: 1.5rem; font-size: 1.15rem; }
.prose li { margin-bottom: .3rem; }
.prose code { font-family: var(--mono); font-size: .85em; background: var(--surface-soft); border: 1px solid var(--border); padding: .1em .35em; border-radius: 4px; }

/* ---- Section niveaux formations ---- */
.level-head { display: flex; align-items: center; gap: .9rem; margin: 2.6rem 0 1.4rem; }
.level-head .pill { background: var(--violet-600); color: #fff; border-radius: 999px; padding: .25rem .8rem; font-size: .78rem; font-weight: 700; }
.level-head h2 { margin: 0; font-size: 1.45rem; }

@media (max-width: 900px) {
  .hero .container { grid-template-columns: 1fr; }
  .site-footer .grid { grid-template-columns: 1fr 1fr; }
  .site-nav {
    display: none;
    position: absolute; top: 76px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: .2rem;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: .8rem 1.2rem 1.2rem; box-shadow: var(--shadow);
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: .55rem .2rem; }
  .site-nav .btn { margin-top: .4rem; }
  .menu-toggle { display: block; }
}
@media (max-width: 640px) {
  .section { padding: 3.5rem 0; }
  .hero { padding: 4rem 0 3rem; }
  .site-header .brand img { height: 40px; }
  .site-header .container { height: 64px; }
  .site-nav { top: 64px; }
  .form input, .form textarea { padding: .6rem .7rem; }
  .contact-item { padding: .8rem 1rem; }
  .ml-panel { bottom: 5rem; right: .6rem; width: calc(100vw - 1.2rem); }
  .ml-fab { width: 54px; height: 54px; }
  .ml-fab .ml-fab-txt { display: none; }
  .arch-diagram { font-size: .72rem; padding: .8rem; }
  .table-wrap th, .table-wrap td { padding: .5rem .6rem; font-size: .85rem; }
}
