:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --surface-2: #eceef2;
  --text: #111827;
  --muted: #4b5563;
  --line: #d9dde3;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --on-accent: #ffffff;
  --user-bg: #1d4ed8;
  --user-text: #ffffff;
  --err-bg: #fef2f2;
  --err-text: #991b1b;
  --err-line: #fecaca;
  --ok: #15803d;
  --focus: #1d4ed8;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d10;
    --surface: #14171c;
    --surface-2: #1c2027;
    --text: #e8eaed;
    --muted: #a0a8b4;
    --line: #2a2f38;
    --accent: #8ab0ff;
    --accent-hover: #a9c3ff;
    --on-accent: #0b0d10;
    --user-bg: #2b4aa3;
    --user-text: #ffffff;
    --err-bg: #2a1214;
    --err-text: #fca5a5;
    --err-line: #5b2226;
    --ok: #4ade80;
    --focus: #8ab0ff;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
.wrap { max-width: 760px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 8px; z-index: 20; }
.skip:focus { top: 8px; color: var(--on-accent); }

/* Barre haute */
.topbar { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.brand { font-weight: 700; letter-spacing: .04em; font-size: 14px; color: var(--muted); }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang-btn { font: inherit; font-size: 13px; font-weight: 600; background: transparent; color: var(--muted); border: 0; padding: 6px 12px; min-height: 36px; cursor: pointer; }
.lang-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.lang-btn:focus-visible { outline-offset: -3px; }

/* En-tête */
.hero { padding-top: 40px; padding-bottom: 8px; }
.hero-id { display: flex; gap: 20px; align-items: center; }
.avatar { position: relative; width: 96px; height: 96px; flex: none; border-radius: 50%; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar .initials { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font-size: 30px; font-weight: 700; color: var(--muted); }
.avatar.no-photo img { display: none; }
.avatar.no-photo .initials { display: flex; }
h1 { margin: 0; font-size: clamp(28px, 6vw, 38px); line-height: 1.15; letter-spacing: -0.02em; }
.label { margin: 4px 0 0; font-size: 18px; color: var(--muted); }
.loc { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.loc:empty { display: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.links { margin: 16px 0 0; font-size: 15px; color: var(--muted); }
.links a { margin-right: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; text-align: center; }
.btn:hover { background: var(--surface); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Sections */
main { padding-top: 8px; padding-bottom: 24px; }
section { padding-top: 40px; }
h2 { margin: 0 0 16px; font-size: 13px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; }
h3 { margin: 20px 0 8px; font-size: 15px; }
.prose p { margin: 0 0 12px; max-width: 68ch; }
.prose p:last-child { margin-bottom: 0; }
.note { color: var(--muted); font-size: 15px; margin: 16px 0; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 6px 0; }
.plain .sub { color: var(--muted); font-size: 14px; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 20px; border-left: 2px solid var(--line); }
.job { position: relative; padding: 0 0 32px 16px; }
.job:last-child { padding-bottom: 0; }
.job::before { content: ""; position: absolute; left: -27px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.job h3 { margin: 0; font-size: 17px; line-height: 1.35; }
.job .co { color: var(--muted); font-weight: 400; }
.job .dates { margin: 2px 0 8px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.job p { margin: 0 0 8px; max-width: 68ch; }
.job ul { margin: 0; padding-left: 20px; max-width: 68ch; }
.job li { margin: 4px 0; }
.job .more { margin-top: 8px; }
.linklike { font: inherit; font-size: 14px; color: var(--accent); background: none; border: 0; padding: 8px 0; min-height: 36px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linklike:hover { color: var(--accent-hover); }

/* Compétences */
.skills { display: grid; gap: 16px; }
.skill-group h3 { margin: 0 0 6px; font-size: 14px; color: var(--muted); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.chips li { font-size: 14px; padding: 4px 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; }

/* Chat */
.chat-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px; }
.ai-banner { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 8px 12px; font-size: 14px; font-weight: 600; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; width: fit-content; max-width: 100%; }
.ai-banner .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
@media (min-width: 600px) { .grid { grid-template-columns: 1fr 1fr; } .field.wide { grid-column: 1 / -1; } }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
input[type="text"], input[type="email"], select, textarea { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 44px; }
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--err-text); }
.consent { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0 12px; font-size: 14px; color: var(--muted); }
.consent input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.ts-box { min-height: 0; margin: 8px 0; max-width: 100%; overflow: hidden; }
.msg.err, .bubble.err { background: var(--err-bg); color: var(--err-text); border: 1px solid var(--err-line); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin: 8px 0; }

.log { max-height: min(60vh, 520px); min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 4px 2px 12px; }
.row { display: flex; flex-direction: column; max-width: 92%; }
.row.user { align-self: flex-end; align-items: flex-end; }
.row.bot, .row.sys { align-self: flex-start; align-items: flex-start; }
.who { font-size: 12px; color: var(--muted); margin: 0 4px 2px; }
.bubble { padding: 10px 14px; border-radius: 14px; max-width: 100%; }
.row.user .bubble { background: var(--user-bg); color: var(--user-text); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.row.bot .bubble { background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble p { margin: 0 0 8px; }
.bubble p:last-child, .bubble ul:last-child, .bubble ol:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 0 0 8px; padding-left: 22px; }
.bubble a { color: var(--accent); }
.row.user .bubble a { color: var(--user-text); }
.bubble .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.bubble .acts .btn { min-height: 40px; font-size: 14px; }
.typing { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: .6; } }

.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.suggest button, .suggest a { font: inherit; font-size: 14px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; min-height: 40px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; text-align: left; }
.suggest button:hover, .suggest a:hover { border-color: var(--accent); color: var(--text); }

.composer textarea { min-height: 72px; max-height: 220px; }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.meta .over { color: var(--err-text); font-weight: 700; }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
#c-reset { margin-top: 8px; }

.foot { padding-top: 40px; padding-bottom: 48px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 48px; max-width: 760px; }
.foot p { margin: 0 0 8px; max-width: 68ch; }

@media (max-width: 480px) {
  .hero { padding-top: 24px; }
  .hero-id { gap: 14px; }
  .avatar { width: 72px; height: 72px; }
  .actions .btn { flex: 1 1 100%; }
  .row { max-width: 100%; }
}
