:root {
  --bg: #f8f5ef;
  --surface: #ffffff;
  --ink: #131211;
  --ink-muted: #6b665d;
  --accent: #2d4a3e;
  --accent-soft: #e6ede9;
  --rule: #e7e3dc;
  --shadow-sm: 0 1px 2px rgba(19,18,17,.04);
  --shadow-md: 0 1px 2px rgba(19,18,17,.04), 0 8px 24px rgba(19,18,17,.06);
  --shadow-lg: 0 4px 12px rgba(19,18,17,.06), 0 24px 64px rgba(19,18,17,.12);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --display: 'Fraunces', 'Georgia', serif;
  --sans: 'Geist', 'Segoe UI', system-ui, sans-serif;
  --mono: 'Geist Mono', 'SFMono-Regular', monospace;

  /* Échelle d'espacement fluide — s'étire avec la largeur d'écran */
  --gap-1: clamp(6px, 1vw, 10px);
  --gap-2: clamp(10px, 1.6vw, 16px);
  --gap-3: clamp(16px, 2.6vw, 26px);
  --gap-4: clamp(20px, 3.4vw, 32px);
  --gap-block: clamp(30px, 5vw, 56px);
  --pad-card: clamp(20px, 3vw, 32px);
  --pad-wrap: clamp(20px, 4vw, 32px);
  --pad-section: clamp(56px, 9vw, 96px);
  --topbar-h: clamp(58px, 7vw, 70px);

  /* Échelle typographique fluide */
  --fs-micro: clamp(10px, 0.2vw + 9px, 12px);
  --fs-small: clamp(12px, 0.35vw + 11px, 14px);
  --fs-15: clamp(13px, 0.4vw + 11.5px, 15px);
  --fs-body: clamp(15px, 0.4vw + 13.3px, 17px);
  --fs-lead: clamp(17px, 0.7vw + 14px, 22px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--pad-wrap);
}

section {
  padding: var(--pad-section) 0;
}

.eyebrow {
  font-family: var(--sans);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 var(--gap-3);
  display: inline-flex;
  align-items: center;
  gap: var(--gap-1);
}
.eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--ink-muted);
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0;
}

h1 {
  font-size: clamp(48px, 8vw, 92px);
  font-variation-settings: 'opsz' 144;
  font-weight: 400;
}
h1 em {
  font-style: italic;
  color: var(--accent);
}

h2 {
  font-size: clamp(32px, 4.5vw, 48px);
  font-variation-settings: 'opsz' 60;
  margin-bottom: var(--gap-4);
}

h3 {
  font-size: clamp(16px, 0.5vw + 14px, 18px);
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: 0;
  margin-bottom: var(--gap-1);
}

p { margin: 0 0 var(--gap-2); color: var(--ink); }
.muted { color: var(--ink-muted); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(248,245,239,.85);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
}
.brand {
  display: flex;
  align-items: center;
}
.brand img {
  height: clamp(36px, 4.6vw, 48px);
  width: auto;
}
.topbar nav {
  display: flex;
  gap: var(--gap-4);
  font-size: var(--fs-small);
  color: var(--ink-muted);
}
.topbar nav a {
  position: relative;
  padding: 4px 0;
  transition: color .2s ease;
}
.topbar nav a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
}
.topbar nav a:hover { color: var(--ink); }
.topbar nav a:hover::after { transform: scaleX(1); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  margin-right: -8px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease;
}

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .topbar nav {
    position: absolute;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    box-shadow: var(--shadow-md);
    padding: var(--gap-1) 0;
    font-size: var(--fs-15);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity .2s ease, transform .25s cubic-bezier(.2,.7,.2,1);
  }
  .topbar.nav-open nav {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  .topbar nav a { padding: var(--gap-2) var(--pad-wrap); }
  .topbar nav a::after { display: none; }
  .topbar.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .topbar.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  .topbar.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

#hero {
  padding-top: clamp(92px, 14vw, 150px);
  padding-bottom: clamp(92px, 14vw, 150px);
}
#hero .lede {
  font-size: var(--fs-lead);
  color: var(--ink-muted);
  max-width: 620px;
  margin: var(--gap-4) 0 var(--gap-block);
  line-height: 1.5;
}
.reveal { opacity: 0; transform: translateY(12px); animation: reveal .8s cubic-bezier(.2,.7,.2,1) forwards; }
.reveal-1 { animation-delay: .05s; }
.reveal-2 { animation-delay: .15s; }
.reveal-3 { animation-delay: .25s; }
.reveal-4 { animation-delay: .35s; }
@keyframes reveal { to { opacity: 1; transform: translateY(0); } }

.cta {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-2);
  background: var(--ink);
  color: var(--bg);
  padding: clamp(13px, 1.6vw, 16px) clamp(20px, 2.6vw, 28px);
  border-radius: 999px;
  font-size: var(--fs-15);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: transform .2s cubic-bezier(.2,.7,.2,1), box-shadow .2s ease, background .2s ease;
}
.cta:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); background: var(--accent); }
.cta .arrow { transition: transform .25s ease; }
.cta:hover .arrow { transform: translateX(3px); }

.cta-soft {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-1);
  background: var(--accent-soft);
  color: var(--accent);
  padding: clamp(11px, 1.4vw, 14px) clamp(16px, 2.4vw, 24px);
  border-radius: 999px;
  font-size: var(--fs-small);
  font-weight: 500;
  border: 1px solid transparent;
  transition: border-color .2s ease, transform .2s ease;
}
.cta-soft:hover { border-color: var(--accent); transform: translateY(-1px); }

#apropos .grid {
  display: grid;
  grid-template-columns: clamp(140px, 20vw, 220px) 1fr;
  gap: var(--gap-block);
  align-items: center;
}
.portrait {
  width: clamp(120px, 17vw, 200px);
  height: clamp(120px, 17vw, 200px);
  border-radius: 999px;
  object-fit: cover;
  background: var(--accent-soft);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--rule);
}
#apropos p { font-size: var(--fs-body); max-width: 580px; }

@media (max-width: 720px) {
  #apropos .grid { grid-template-columns: 1fr; gap: var(--gap-4); }
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.skill-grid > div {
  background: var(--bg);
  padding: var(--pad-card);
}
.skill-grid h3 {
  font-family: var(--display);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(18px, 0.9vw + 14px, 22px);
  color: var(--accent);
  letter-spacing: -0.01em;
  margin-bottom: var(--gap-2);
}
.skill-grid p {
  margin: 0;
  font-size: var(--fs-small);
  color: var(--ink-muted);
  line-height: 1.7;
}
.skill-grid .kicker {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 7px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: 1px;
}

/* Cas d'usage — blocs alternés */
.use-cases {
  display: flex;
  flex-direction: column;
  gap: clamp(36px, 6vw, 64px);
  margin-top: var(--gap-1);
}
.use-case {
  display: flex;
  align-items: center;
  gap: var(--gap-block);
}
.use-case:nth-child(even) { flex-direction: row-reverse; }
.use-case .uc-text { flex: 1; min-width: 0; }
.use-case .uc-media {
  flex: 0 0 clamp(130px, 15vw, 200px);
  display: flex;
  justify-content: center;
}
.use-case .uc-media img {
  width: 100%;
  height: auto;
}
.use-case h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(20px, 1.1vw + 16px, 26px);
  color: var(--accent);
  letter-spacing: -0.01em;
  margin-bottom: var(--gap-3);
}
.uc-point {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: var(--gap-2);
  padding: var(--gap-2) 0;
  border-top: 1px solid var(--rule);
  align-items: baseline;
}
.uc-point:first-of-type { border-top: none; }
.uc-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 999px;
  justify-self: start;
}
.uc-point p {
  margin: 0;
  font-size: var(--fs-15);
  color: var(--ink-muted);
  line-height: 1.6;
}
.use-case .cta-soft { margin-top: var(--gap-3); }

@media (max-width: 720px) {
  .use-case,
  .use-case:nth-child(even) {
    flex-direction: column;
    align-items: stretch;
    gap: var(--gap-4);
  }
  .use-case .uc-media { flex: none; order: -1; }
  .use-case .uc-media img { max-width: clamp(150px, 42vw, 220px); }
  .uc-point { grid-template-columns: 1fr; gap: 6px; }
}

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  display: grid;
  grid-template-columns: clamp(96px, 13vw, 140px) 1fr;
  gap: var(--gap-4);
  padding: var(--gap-3) 0;
  border-top: 1px solid var(--rule);
  align-items: baseline;
}
.timeline li:first-child { border-top: none; }
.timeline .year {
  font-family: var(--mono);
  font-size: var(--fs-small);
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}
.timeline .role {
  font-size: clamp(15px, 0.6vw + 13px, 18px);
  color: var(--ink);
}
.timeline strong { font-weight: 600; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-1);
  margin-top: var(--gap-4);
  font-size: var(--fs-15);
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
  transition: gap .25s ease;
}
.link-arrow:hover { gap: 14px; }

@media (max-width: 600px) {
  .timeline li { grid-template-columns: 1fr; gap: 4px; }
}

#facturation {
  background: var(--accent-soft);
}
#facturation .wrap {
  max-width: 720px;
}
#facturation h2 { color: var(--accent); }
#facturation p {
  font-size: clamp(16px, 0.6vw + 13px, 18px);
  color: var(--ink);
  max-width: 600px;
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--gap-3);
}
.contact-list li {
  padding: var(--pad-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color .2s ease, transform .2s ease;
}
.contact-list li:hover { border-color: var(--accent); transform: translateY(-2px); }
.contact-list .label {
  font-size: var(--fs-micro);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--gap-1);
}
.contact-list a {
  font-family: var(--display);
  font-size: clamp(16px, 0.8vw + 13px, 20px);
  font-weight: 500;
  color: var(--ink);
  word-break: break-all;
}

footer.site-footer {
  padding: var(--gap-block) 0;
  text-align: center;
  font-size: var(--fs-small);
  color: var(--ink-muted);
  border-top: 1px solid var(--rule);
}

#chatLauncher {
  position: fixed;
  right: clamp(14px, 2.2vw, 24px);
  bottom: clamp(14px, 2.2vw, 24px);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: var(--gap-2);
}

#chatTeaser {
  position: relative;
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 500;
  padding: var(--gap-2) var(--gap-3);
  border-radius: 999px;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  animation: teaserIn .6s cubic-bezier(.2,.7,.2,1) .8s backwards, teaserFloat 3.4s ease-in-out 1.4s infinite;
  transition: transform .2s ease, box-shadow .2s ease;
}
#chatTeaser:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
#chatTeaser::after {
  content: '';
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: var(--surface);
  border-right: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
}
#chatLauncher.hidden-teaser #chatTeaser { display: none; }

@keyframes teaserIn {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes teaserFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

#chatFab {
  position: relative;
  width: clamp(52px, 6.5vw, 64px);
  height: clamp(52px, 6.5vw, 64px);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-md);
  transition: transform .25s cubic-bezier(.2,.7,.2,1), box-shadow .2s ease;
  animation: fabPulse 4s ease-in-out 2s infinite;
}
#chatFab img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px;
}
#chatFab:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-lg);
}
#chatFab .status-dot {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 14px;
  height: 14px;
  background: #3fb96f;
  border: 2px solid var(--surface);
  border-radius: 999px;
}
#chatFab .status-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  background: #3fb96f;
  opacity: .4;
  animation: dotPulse 2.4s ease-out infinite;
}
@keyframes dotPulse {
  0% { transform: scale(0.6); opacity: .5; }
  80%, 100% { transform: scale(1.6); opacity: 0; }
}
@keyframes fabPulse {
  0%, 92%, 100% { transform: scale(1); }
  94% { transform: scale(1.04); }
  96% { transform: scale(1); }
}

@media (max-width: 480px) {
  #chatTeaser { display: none; }
}

#chatWidget {
  position: fixed;
  right: clamp(14px, 2.2vw, 24px);
  bottom: clamp(14px, 2.2vw, 24px);
  width: clamp(320px, 92vw, 400px);
  height: clamp(440px, 74vh, 600px);
  max-height: calc(100dvh - 48px);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--rule);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: scale(.92) translateY(20px);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity .25s ease, transform .35s cubic-bezier(.2,.7,.2,1);
}
#chatWidget.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

#chatWidget header {
  display: flex;
  align-items: center;
  gap: var(--gap-2);
  padding: var(--gap-2) var(--gap-3);
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}
#chatWidget header img {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--rule);
}
#chatWidget header .meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
#chatWidget header .meta strong {
  font-family: var(--display);
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--ink);
}
#chatWidget header .meta span {
  font-size: var(--fs-micro);
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#chatWidget header .meta span::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #3fb96f;
  border-radius: 999px;
}
#chatClose {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  color: var(--ink-muted);
  font-size: 22px;
  line-height: 1;
  transition: background .2s ease, color .2s ease;
}
#chatClose:hover { background: var(--accent-soft); color: var(--ink); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--gap-3);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 999px; }

.bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: var(--fs-15);
  line-height: 1.45;
  word-wrap: break-word;
  opacity: 0;
  transform: translateY(8px);
  animation: bubbleIn .35s cubic-bezier(.2,.7,.2,1) forwards;
}
@keyframes bubbleIn { to { opacity: 1; transform: translateY(0); } }

.bubble.user {
  background: var(--ink);
  color: var(--bg);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.bubble.bot {
  background: var(--accent-soft);
  color: var(--ink);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.bubble.bot p { margin: 0 0 8px; }
.bubble.bot p:last-child { margin-bottom: 0; }
.bubble.bot strong { color: var(--accent); font-weight: 600; }
.bubble.bot h1, .bubble.bot h2, .bubble.bot h3, .bubble.bot h4 {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 500;
  margin: 8px 0 4px;
  color: var(--accent);
}
.bubble.bot ul, .bubble.bot ol { margin: 4px 0 8px; padding-left: 18px; }
.bubble.bot li { margin-bottom: 3px; }
.bubble.bot code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--rule);
}
.bubble.bot a { color: var(--accent); border-bottom: 1px solid var(--accent); }

.bubble.loading {
  display: inline-flex;
  gap: 4px;
  padding: 14px 16px;
}
.bubble.loading span {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 999px;
  animation: dotJump 1.2s ease-in-out infinite;
}
.bubble.loading span:nth-child(2) { animation-delay: .15s; }
.bubble.loading span:nth-child(3) { animation-delay: .3s; }
@keyframes dotJump {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

#form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--rule);
  background: var(--bg);
}
#form textarea {
  flex: 1;
  font-family: var(--sans);
  font-size: var(--fs-15);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 10px 14px;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  line-height: 1.4;
  outline: none;
  transition: border-color .2s ease;
}
#form textarea:focus { border-color: var(--accent); }
#form button[type="submit"] {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease, transform .15s ease;
  flex-shrink: 0;
}
#form button[type="submit"]:hover { background: var(--accent); transform: translateY(-1px); }
#form button[type="submit"]:disabled { opacity: .4; cursor: not-allowed; }

@media (max-width: 480px) {
  #chatWidget {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }
}

/* Séparateurs de sections — nature × tech */
.section-divider {
  max-width: 760px;
  margin: -20px auto;
  padding: 0 var(--pad-wrap);
  box-sizing: border-box;
}
.section-divider img {
  width: 100%;
  height: auto;
  display: block;
  opacity: .7;
}
@media (max-width: 600px) {
  .section-divider { margin: -8px auto; }
  .section-divider img { opacity: .8; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
