:root {
  --bg: #faf9f5;
  --bg-alt: #f0eee6;
  --card: #ffffff;
  --text: #141413;
  --muted: #6f6d64;
  --accent: #c96442;
  --accent-soft: rgba(201, 100, 66, 0.10);
  --coral: #d97757;
  --border: #e4e1d6;
  --ink: #141413;
  --ink-text: #faf9f5;
  --radius: 20px;
  --icon-filter: none;
  --grid: rgba(20, 16, 8, 0.045);
}

[data-theme="dark"] {
  --bg: #141413;
  --bg-alt: #1b1a18;
  --card: #201f1d;
  --text: #f5f4ef;
  --muted: #a5a196;
  --accent: #d97757;
  --accent-soft: rgba(217, 119, 87, 0.13);
  --coral: #d97757;
  --border: #35332e;
  --ink: #f5f4ef;
  --ink-text: #141413;
  --icon-filter: invert(0.93);
  --grid: rgba(246, 242, 233, 0.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  color: var(--text);
  font-family: "Archivo", "Helvetica Neue", sans-serif;
  font-size: 16.5px;
  line-height: 1.65;
}

h1, h2, h3 { font-family: "Source Serif 4", Georgia, serif; font-weight: 600; line-height: 1.12; letter-spacing: -0.01em; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 28px; }

/* ---------- kickers ---------- */
.kicker {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.74rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent);
  display: inline-flex; align-items: center; gap: 9px;
}
.kicker::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--coral); }

/* ---------- header ---------- */
header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; gap: 20px; height: 68px; }
.brand {
  font-family: "Archivo", sans-serif; font-weight: 700; font-size: 1rem;
  text-decoration: none; color: var(--text); letter-spacing: 0.01em; white-space: nowrap;
}
.brand span { font-weight: 500; color: var(--muted); }
.nav-links { display: flex; gap: 28px; margin-left: auto; align-items: center; }
.nav-links a { color: var(--text); text-decoration: none; font-size: 0.93rem; font-weight: 500; }
.nav-links a:hover { color: var(--accent); }
.nav-cta {
  background: var(--ink); color: var(--ink-text) !important;
  padding: 10px 20px; border-radius: 999px; font-weight: 600; white-space: nowrap;
}
.nav-cta:hover { background: var(--accent); color: #fff !important; }
.toggles { display: flex; gap: 8px; align-items: center; margin-left: 6px; }
.toggles button {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 0.8rem; font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
}
.toggles button:hover { color: var(--text); border-color: var(--muted); }

/* ---------- hero ---------- */
.hero { padding: 96px 0 84px; }
.hero .container { display: grid; grid-template-columns: minmax(0, 1fr); gap: 52px; }
.hero h1 { font-size: clamp(2.4rem, 5vw, 3.7rem); margin: 24px 0 22px; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero p.lead { color: var(--muted); font-size: 1.13rem; }
.hero-ctas { margin-top: 34px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--ink); color: var(--ink-text); text-decoration: none;
  font-family: "Archivo", sans-serif; font-weight: 600; font-size: 0.98rem;
  padding: 14px 28px; border-radius: 999px; border: none; cursor: pointer;
  transition: background 0.15s ease;
}
.btn::after { content: "↗"; font-family: "IBM Plex Mono", monospace; }
.btn:hover { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--text); }
.btn-ghost::after { content: "↓"; }
.btn-ghost:hover { background: var(--bg-alt); color: var(--text); }

/* ---------- schéma d'architecture ---------- */
.schema {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 28px 24px;
}
.schema-head {
  font-family: "IBM Plex Mono", monospace; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 34px;
}
.flow { display: flex; align-items: stretch; gap: 0; }
.node {
  position: relative; flex: 1;
  background: var(--bg); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 14px 15px;
  display: flex; flex-direction: column; gap: 4px;
}
.node::after {
  content: ""; position: absolute; top: -6px; right: -6px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--coral); border: 2px solid var(--card);
}
.node img.glyph {
  width: 42px; height: 42px; object-fit: contain; margin-bottom: 10px;
  filter: var(--icon-filter);
}
.node b { font-family: "Archivo", sans-serif; font-weight: 700; font-size: 0.94rem; line-height: 1.25; }
.node small { font-family: "IBM Plex Mono", monospace; font-size: 0.64rem; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.flow .link { flex: 0 0 34px; display: grid; place-items: center; color: var(--accent); }
.flow .link::before { content: "─►"; font-family: "IBM Plex Mono", monospace; font-size: 0.9rem; letter-spacing: -2px; }
.schema-caption {
  margin-top: 30px; font-family: "IBM Plex Mono", monospace; font-size: 0.76rem; color: var(--accent);
}
.schema-caption::before { content: "● "; color: var(--coral); }

/* ---------- stats band ---------- */
.stats { border-block: 1px solid var(--border); background: var(--bg-alt); }
.stats .container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding-block: 30px; }
.stat { text-align: center; }
.stat b { display: block; font-family: "Source Serif 4", serif; font-weight: 600; font-size: 1.9rem; }
.stat span { font-family: "IBM Plex Mono", monospace; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------- sections ---------- */
section { padding: 92px 0; }
section.alt { background: var(--bg-alt); border-block: 1px solid var(--border); }
.section-head { margin-bottom: 50px; }
.section-head h2 { font-size: clamp(1.8rem, 3.8vw, 2.5rem); margin: 18px 0 14px; }
.section-head p { color: var(--muted); font-size: 1.05rem; }

/* ---------- expertise cards ---------- */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; display: flex; flex-direction: column; gap: 13px; position: relative;
}
.card .num {
  font-family: "IBM Plex Mono", monospace; font-size: 0.74rem; font-weight: 600;
  letter-spacing: 0.12em; color: var(--accent);
}
.card h3 { font-size: 1.32rem; color: var(--accent); }
.card ul { list-style: none; color: var(--muted); font-size: 0.95rem; display: flex; flex-direction: column; gap: 8px; }
.card ul li { padding-left: 22px; position: relative; }
.card ul li::before { content: "─"; position: absolute; left: 0; color: var(--coral); font-family: "IBM Plex Mono", monospace; }
.card .tag {
  position: absolute; top: 28px; right: 28px;
  font-family: "IBM Plex Mono", monospace; font-size: 0.66rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 4px 12px;
}

/* ---------- approche ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; counter-reset: step; }
.step {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px 24px; position: relative;
}
.step::before {
  counter-increment: step; content: "0" counter(step);
  font-family: "IBM Plex Mono", monospace; font-weight: 600; font-size: 0.8rem;
  letter-spacing: 0.1em; color: var(--accent);
  display: inline-block; margin-bottom: 14px;
  background: var(--accent-soft); border-radius: 999px; padding: 4px 12px;
}
.step h3 { font-size: 1.12rem; margin-bottom: 8px; }
.step p { color: var(--muted); font-size: 0.92rem; }

/* ---------- references ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  padding: 9px 20px; font-weight: 600; font-size: 0.9rem;
}
.ref-note { color: var(--muted); font-size: 0.95rem; margin-top: 20px; max-width: 70ch; }
blockquote {
  margin-top: 38px; background: var(--bg-alt); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 28px 32px; max-width: 780px;
  font-family: "Source Serif 4", serif; font-size: 1.12rem; line-height: 1.6;
}
blockquote footer { font-family: "IBM Plex Mono", monospace; color: var(--muted); font-size: 0.76rem; margin-top: 14px; }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 200px 1fr; gap: 46px; align-items: center; }
.monogram {
  width: 200px; height: 200px; border-radius: var(--radius); display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--border);
  font-family: "Source Serif 4", serif; font-weight: 600; font-size: 3rem;
}
.monogram small { font-family: "IBM Plex Mono", monospace; font-size: 0.6rem; font-weight: 600; letter-spacing: 0.14em; color: var(--accent); text-transform: uppercase; }
.about-text p + p { margin-top: 15px; }
.about-text .edu { margin-top: 20px; font-family: "IBM Plex Mono", monospace; color: var(--muted); font-size: 0.78rem; line-height: 1.8; }

/* ---------- extras ---------- */
.extras { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.extra {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 30px; text-decoration: none; color: var(--text);
  transition: border-color 0.15s ease;
}
.extra:hover { border-color: var(--accent); }
.extra h3 { font-size: 1.2rem; margin-bottom: 9px; }
.extra p { color: var(--muted); font-size: 0.95rem; }
.extra .go { font-family: "IBM Plex Mono", monospace; color: var(--accent); font-weight: 600; font-size: 0.8rem; display: inline-block; margin-top: 14px; }

/* ---------- final CTA ---------- */
.cta-final { text-align: center; }
.cta-final .kicker { justify-content: center; }
.cta-final h2 { font-size: clamp(1.9rem, 4.2vw, 2.7rem); margin: 18px 0 14px; }
.cta-final h2 em { font-style: italic; color: var(--accent); }
.cta-final p { color: var(--muted); margin: 0 auto 32px; font-size: 1.05rem; }

/* ---------- footer ---------- */
footer.site { border-top: 1px solid var(--border); padding: 38px 0; color: var(--muted); font-size: 0.85rem; font-family: "IBM Plex Mono", monospace; }
footer.site .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
footer.site a { color: var(--muted); }
footer.site a:hover { color: var(--accent); }

/* ---------- timecode tool ---------- */
.tool-wrap { max-width: 640px; margin: 0 auto; }
.tool-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 34px; display: flex; flex-direction: column; gap: 18px;
}
.tool-card label { font-weight: 700; font-size: 0.9rem; display: block; margin-bottom: 7px; }
.tool-card input, .tool-card select {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 15px; font-size: 1.05rem; font-family: "IBM Plex Mono", monospace;
}
.tool-card input:focus, .tool-card select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.tool-result {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; font-family: "IBM Plex Mono", monospace; font-size: 1rem; line-height: 2;
}
.tool-result b { color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 840px) {
  .nav { gap: 10px; }
  .brand span { display: none; }
  .nav-cta { padding: 8px 15px; font-size: 0.84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
  .nav-links a:not(.nav-cta) { display: none; }
  .nav-links { min-width: 0; }
  .cards, .extras { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .stats .container { grid-template-columns: repeat(2, 1fr); gap: 22px; }
  .about-grid { grid-template-columns: 1fr; }
  .monogram { width: 140px; height: 140px; font-size: 2.2rem; }
  .flow { flex-direction: column; }
  .flow .link { flex-basis: 30px; }
  .flow .link::before { content: "│▼"; letter-spacing: -6px; }
}

/* ---------- schéma interactif ---------- */
.schema-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 34px; }
.schema-top .schema-head { margin-bottom: 0; }
.schema-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.schema-tabs button { white-space: nowrap; }
.schema-tabs button {
  font-family: "IBM Plex Mono", monospace; font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.08em; color: var(--muted);
  background: transparent; border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 10px; cursor: pointer; transition: all 0.15s ease;
}
.schema-tabs button:hover { color: var(--text); border-color: var(--muted); }
.schema-tabs button.active { color: #fff; background: var(--coral); border-color: var(--coral); }

.node { cursor: pointer; transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease; }
.node:hover, .node.active { transform: translateY(-3px); border-color: var(--coral); background: var(--card); }
.node:hover::after, .node.active::after { animation: dotpulse 1.1s ease-in-out infinite; }
@keyframes dotpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 87, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(217, 119, 87, 0); }
}

.flow .link { transition: color 0.18s ease; }
.flow .link.hot { color: var(--coral); }
.flow .link.hot::before { animation: flowpulse 0.7s linear infinite; }
@keyframes flowpulse {
  0% { transform: translateX(-3px); opacity: 0.5; }
  60% { transform: translateX(2px); opacity: 1; }
  100% { transform: translateX(3px); opacity: 0; }
}

.flow.swap { animation: schemafade 0.35s ease; }
@keyframes schemafade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.schema-caption { min-height: 1.6em; transition: opacity 0.15s ease; }
.schema-caption.dim { opacity: 0; }

@media (max-width: 840px) {
  .flow .link.hot::before { animation: none; }
  .schema-top { flex-direction: column; gap: 10px; }
}

/* ---------- canvas React Flow ---------- */
#flow-canvas {
  height: 280px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg);
}
#flow-canvas .react-flow__node { cursor: grab; }
#flow-canvas .react-flow__node.dragging { cursor: grabbing; }
#flow-canvas .rf-node {
  width: 216px;
  height: 70px;
  cursor: inherit;
  transform: none !important; /* le drag est géré par React Flow, pas par le hover CSS */
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}
#flow-canvas .rf-node .icon-frame {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border: 1.5px solid var(--text);
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--card);
}
#flow-canvas .rf-node .icon-frame .glyph { width: 30px; height: 30px; margin: 0; }
#flow-canvas .rf-node .rf-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#flow-canvas .rf-node .rf-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#flow-canvas .rf-node::after { width: 16px; height: 16px; top: -7px; right: -7px; }
#flow-canvas .react-flow__node:hover .rf-node,
#flow-canvas .react-flow__node.selected .rf-node { border-color: var(--coral); background: var(--card); }
#flow-canvas .react-flow__node:hover .rf-node::after,
#flow-canvas .react-flow__node.selected .rf-node::after { animation: dotpulse 1.1s ease-in-out infinite; }
#flow-canvas .react-flow__handle {
  width: 8px; height: 8px;
  background: var(--coral);
  border: 2px solid var(--card);
}
#flow-canvas .react-flow__edge-path { stroke: var(--accent); }
#flow-canvas .react-flow__controls {
  box-shadow: none;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
}
#flow-canvas .react-flow__controls-button {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  width: 24px; height: 24px;
}
#flow-canvas .react-flow__controls-button svg { fill: var(--text); }
#flow-canvas .react-flow__controls-button:hover { background: var(--bg-alt); }
#flow-canvas .react-flow__attribution {
  background: transparent;
  font-family: "IBM Plex Mono", monospace; font-size: 0.6rem;
}
#flow-canvas .react-flow__attribution a { color: var(--muted); }

/* secours statique si le CDN est indisponible */
#flow-canvas.flow-fallback { height: auto; border: none; overflow: visible; background: transparent; }

@media (max-width: 840px) {
  #flow-canvas { height: 380px; }
}

/* grille et alignement du canvas */
.schema-caption { min-height: 3.4em; } /* 2 lignes réservées */
@media (max-width: 840px) { .schema-caption { min-height: 5em; } } /* 3 lignes en mobile */

/* ---------- marquee de références ---------- */
.marquee {
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
  padding-block: 4px;
}
.marquee-track {
  display: flex; gap: 12px; width: max-content;
  animation: marquee 36s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee .chip { flex: 0 0 auto; }
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-50% - 6px)); }
}
@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; flex-wrap: wrap; width: auto; }
}

/* ---------- témoignages (4) ---------- */
.quotes { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 42px; }
.quotes blockquote { margin-top: 0; max-width: none; }
.quote-placeholder { border-style: dashed; opacity: 0.55; }
.quote-placeholder footer { font-style: italic; }
@media (max-width: 840px) {
  .quotes { grid-template-columns: 1fr; }
}

/* ---------- logos monochromes du marquee ---------- */
:root { --logo-filter: brightness(0); }
[data-theme="dark"] { --logo-filter: brightness(0) invert(0.93); }
.marquee-track { align-items: center; gap: 44px; }
.marquee .logo {
  height: 26px; width: auto; max-width: 150px; object-fit: contain;
  filter: var(--logo-filter); opacity: 0.78; flex: 0 0 auto;
}
.marquee .logo-text {
  font-family: "Archivo", sans-serif; font-weight: 800; font-size: 1.02rem;
  letter-spacing: 0.01em; opacity: 0.78; white-space: nowrap; flex: 0 0 auto;
}

/* logos en nuances de gris (pas d'aplat noir) */
.marquee .logo-gray { filter: none; }
[data-theme="dark"] .marquee .logo-gray { filter: invert(0.93); }
.marquee .logo-gray { max-width: 200px; }
.marquee .logo-lg { height: 48px; }

/* portrait animé (À propos) */
.portrait {
  width: 200px; border-radius: var(--radius);
  border: 1px solid var(--border); display: block;
}
@media (max-width: 840px) { .portrait { width: 160px; } }

.schema-tabs .schema-tab-cta {
  color: var(--accent); border-color: var(--accent); border-style: dashed;
}
.schema-tabs .schema-tab-cta:hover { color: #fff; background: var(--accent); border-style: solid; }

html, body { overflow-x: clip; }

/* icones sociales du footer */
.footer-icon svg { width: 18px; height: 18px; vertical-align: -4px; fill: currentColor; }
.footer-icon:hover { color: var(--accent); }

/* formations : logos + legendes */
.edu-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
  margin-top: 26px; padding-top: 24px;
  border-top: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.edu-item { margin: 0; text-align: center; }
.edu-item img {
  height: 34px; width: auto; max-width: 100%; object-fit: contain;
  filter: var(--logo-filter); opacity: 0.85; display: block; margin: 0 auto 8px;
}
.edu-item a { display: inline-block; }
.edu-item a:hover img { opacity: 1; }
.edu-item figcaption {
  font-family: "IBM Plex Mono", monospace; font-size: 0.72rem; color: var(--muted); line-height: 1.5;
}
@media (max-width: 840px) {
  .edu-grid { grid-template-columns: repeat(2, 1fr); }
}
.footer-emoji { font-size: 16px; text-decoration: none; vertical-align: -2px; filter: grayscale(1); }
.footer-emoji:hover { filter: none; }
.footer-mark { height: 28px; width: auto; align-self: center; }

/* FAQ */
.faq-list { max-width: 760px; margin-top: 42px; }
.faq-list details { border-top: 1px solid var(--border); padding: 4px 0; }
.faq-list details:last-child { border-bottom: 1px solid var(--border); }
.faq-list summary {
  cursor: pointer; list-style: none; position: relative;
  padding: 16px 40px 16px 0; font-weight: 600; font-size: 17px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font-family: "IBM Plex Mono", monospace; font-weight: 500; font-size: 20px; color: var(--accent);
  transition: transform 0.2s ease;
}
.faq-list details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq-list details p { margin: 0 0 18px; max-width: 680px; color: var(--muted); }

/* Notes pédagogiques des outils */
.tool-notes { max-width: 720px; margin-top: 48px; }
.tool-notes h3 { color: var(--accent); font-size: 18px; margin-bottom: 12px; }
.tool-notes p { color: var(--muted); margin: 0 0 14px; }
.tool-notes code { font-family: "IBM Plex Mono", monospace; font-size: 14px; background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
