/* MCP I/O Gateway : feuille de style unique */

:root {
  --bg: #f7f8fa;
  --bg-alt: #eef1f5;
  --surface: #ffffff;
  --border: #d9dee6;
  --text: #14181f;
  --muted: #4d5663;
  --accent: #0f766e;
  --accent-strong: #0b5e58;
  --accent-soft: #d5f2ee;
  --on-accent: #ffffff;
  --code-bg: #10151c;
  --code-text: #e6edf3;
  --warn-bg: #fff4d6;
  --warn-text: #6b4a00;
  --ok: #157347;
  --dev: #9a5b00;
  --plan: #4b5ab8;
  --err: #b42318;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --bg-alt: #121821;
    --surface: #161c25;
    --border: #2a3340;
    --text: #e8edf3;
    --muted: #a4afbd;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --accent-soft: #123c38;
    --on-accent: #04201d;
    --code-bg: #0a0e14;
    --code-text: #e6edf3;
    --warn-bg: #3a2e0f;
    --warn-text: #fbd98a;
    --ok: #4ade80;
    --dev: #fbbf24;
    --plan: #a5b4fc;
    --err: #f87171;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
}

img, svg { max-width: 100%; height: auto; }
a { color: var(--accent-strong); text-underline-offset: 2px; }
@media (prefers-color-scheme: light) { a { color: var(--accent); } }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0 0 1rem; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); margin: 0 0 .75rem; }
h3 { font-size: 1.15rem; margin: 0 0 .5rem; }
p { margin: 0 0 1rem; }

code, pre, kbd { font-family: var(--mono); font-size: .9em; }
:not(pre) > code {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: .1em .35em;
  border-radius: 6px;
  overflow-wrap: anywhere;
}

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: var(--on-accent);
  padding: .5rem 1rem; z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.container { width: min(1120px, 100% - 2rem); margin-inline: auto; }
.narrow { width: min(780px, 100% - 2rem); margin-inline: auto; }

/* ---------- En-tête ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; font-weight: 700; }
.brand svg { width: 34px; height: 34px; flex: none; }
.logo-body { fill: var(--accent); }
.logo-fg { fill: var(--bg); }
.logo-line { stroke: var(--bg); }
.logo-pin { stroke: var(--accent); }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .75rem; }

.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: .4rem .6rem; font: inherit; cursor: pointer;
}
.site-nav ul { display: flex; gap: .25rem; list-style: none; margin: 0; padding: 0; align-items: center; }
.site-nav a {
  display: block; padding: .45rem .75rem; border-radius: 8px;
  color: var(--text); text-decoration: none; font-weight: 500;
}
.site-nav a:hover { background: var(--bg-alt); }
.site-nav a[aria-current="page"] { color: var(--accent-strong); background: var(--accent-soft); }
@media (prefers-color-scheme: light) { .site-nav a[aria-current="page"] { color: var(--accent-strong); } }

@media (max-width: 840px) {
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 64px; background: var(--bg); border-bottom: 1px solid var(--border); }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; padding: .5rem 1rem 1rem; }
  .no-js .header-inner { flex-wrap: wrap; }
  .no-js .nav-toggle { display: none; }
  .no-js .site-nav { display: block; position: static; width: 100%; border: 0; }
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .7rem 1.15rem; border-radius: 10px;
  font-weight: 600; text-decoration: none; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; }

/* ---------- Sections ---------- */
section { padding: clamp(3rem, 7vw, 5rem) 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--border); }
.section-head { max-width: 720px; margin-bottom: 2rem; }
.section-head p { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--accent-strong); margin-bottom: .5rem; }
@media (prefers-color-scheme: light) { .eyebrow { color: var(--accent); } }

.hero { padding-top: clamp(3rem, 8vw, 6rem); }
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 3rem; align-items: center; }
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 40ch; }
.hero-art { margin: 0; min-width: 0; }
.hero-art img { display: block; width: 100%; height: auto; }
.hero-code {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: .5rem 2rem; align-items: center;
  margin-top: clamp(2rem, 5vw, 3rem);
}
.hero-code .code-block { margin: 0; }
.hero-code p:last-child { margin-bottom: 0; }
@media (max-width: 760px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .hero-code { grid-template-columns: minmax(0, 1fr); }
}

.page-hero { padding: clamp(2.5rem, 6vw, 4rem) 0 1rem; }
.page-hero p { color: var(--muted); max-width: 65ch; font-size: 1.08rem; }

/* ---------- Illustrations (assets/illustrations/*.svg) ---------- */
.page-hero.has-art { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 2rem; align-items: center; }
.page-art { display: block; width: 100%; max-width: 480px; height: auto; justify-self: end; }
.card-art {
  display: block; width: 100%; height: auto; aspect-ratio: 320 / 200;
  margin: 0 0 .9rem; border-radius: 8px; background: var(--bg-alt);
}
.uc-art { display: block; width: 72px; height: 72px; margin-bottom: .6rem; }
.module-art { float: right; width: min(42%, 300px); height: auto; margin: 0 0 1rem 1.5rem; }
.module .module-grid, .module .version-grid { clear: both; }
.version-art { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto .75rem; }
@media (max-width: 760px) {
  .page-hero.has-art { grid-template-columns: 1fr; gap: 1.25rem; }
  .page-art { max-width: 400px; justify-self: start; }
  .module-art { float: none; display: block; width: 100%; max-width: 340px; margin: 0 auto 1rem; }
}

/* ---------- Grilles & cartes ---------- */
.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
@media (max-width: 400px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.card p:last-child { margin-bottom: 0; }
.card .muted, .muted { color: var(--muted); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.card-head h3, .card-head .h3 { margin: 0; font-family: var(--mono); font-size: 1.05rem; }
.card-link { display: inline-block; margin-top: .5rem; font-weight: 600; }
.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }

.icon { width: 40px; height: 40px; color: var(--accent); margin-bottom: .6rem; }

.badge {
  display: inline-block; font-size: .75rem; font-weight: 700;
  padding: .15rem .55rem; border-radius: 999px; border: 1px solid currentColor;
  white-space: nowrap;
}
.badge-proto { color: var(--ok); }
.badge-dev { color: var(--dev); }
.badge-plan { color: var(--plan); }
.badge-star { color: var(--accent-strong); }

/* ---------- Module (page détaillée) ---------- */
.module { scroll-margin-top: 80px; }
.module + .module { margin-top: 1.25rem; }
.module .card-head .h3 { font-size: 1.3rem; }
.module-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; margin-top: 1rem; }
@media (max-width: 760px) { .module-grid { grid-template-columns: 1fr; } }
.module .h4 { margin: 0 0 .4rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tool-list { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.tool-list code { font-size: .82rem; }
.spec { margin: 0; padding-left: 1.1rem; }
.spec li { margin-bottom: .25rem; }
.toc { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; padding: 0; margin: 1rem 0 0; }
.toc a { display: inline-block; padding: .3rem .7rem; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; font-family: var(--mono); font-size: .85rem; background: var(--surface); }

/* ---------- Schéma ---------- */
.diagram { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.diagram svg { display: block; width: 100%; }
.diagram .d-box { fill: var(--bg-alt); stroke: var(--border); stroke-width: 1.5; }
.diagram .d-box-accent { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.diagram .d-title { fill: var(--text); font: 700 15px var(--font); }
.diagram .d-sub { fill: var(--muted); font: 500 12px var(--font); }
.diagram .d-mono { fill: var(--muted); font: 500 11.5px var(--mono); }
.diagram .d-line { stroke: var(--accent); stroke-width: 2.2; fill: none; }
.diagram .d-line-back { stroke: var(--muted); stroke-width: 1.6; fill: none; stroke-dasharray: 5 4; }
.diagram .d-head { fill: var(--accent); }
.diagram .d-head-back { fill: var(--muted); }
.diagram figcaption { color: var(--muted); font-size: .9rem; margin-top: .5rem; }
.diagram .diagram-mobile { display: none; }
@media (max-width: 640px) {
  .diagram .diagram-desktop { display: none; }
  .diagram .diagram-mobile { display: block; }
}

.steps { counter-reset: step; list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.steps li { counter-increment: step; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1rem 1rem 3.2rem; position: relative; }
.steps li::before {
  content: counter(step); position: absolute; left: 1rem; top: 1rem;
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
  background: var(--accent); color: var(--on-accent);
}

/* ---------- Code ---------- */
.code-block { position: relative; margin: 0 0 1.25rem; }
pre {
  background: var(--code-bg); color: var(--code-text);
  padding: 1rem 1.1rem; border-radius: 10px; overflow-x: auto;
  margin: 0; line-height: 1.55; border: 1px solid var(--border);
}
pre .c { color: #8b98a8; }
pre .p { color: #5eead4; user-select: none; }
.copy-btn {
  position: absolute; top: .45rem; right: .45rem;
  background: #263040; color: #e6edf3; border: 1px solid #3a4556;
  border-radius: 6px; padding: .2rem .55rem; font: 600 .75rem var(--font); cursor: pointer;
}
.copy-btn:hover { background: #33405a; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 520px; }
th, td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: var(--bg-alt); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody th { font-weight: 600; }
table caption { text-align: left; padding: .75rem .9rem; font-weight: 600; }

/* ---------- Notes ---------- */
.note {
  background: var(--warn-bg); color: var(--warn-text);
  border-radius: 10px; padding: .85rem 1rem; margin: 1rem 0;
  border: 1px solid color-mix(in srgb, var(--warn-text) 25%, transparent);
}
.note strong { color: inherit; }
.callout { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 10px; padding: .9rem 1rem; margin: 1rem 0; }

/* ---------- Sécurité ---------- */
.safety-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.safety-list li { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px; padding: 1rem; }
.safety-list strong { display: block; margin-bottom: .25rem; }

/* ---------- FAQ ---------- */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .25rem 1rem; }
.faq details + details { margin-top: .6rem; }
.faq summary { cursor: pointer; font-weight: 600; padding: .7rem 0; }
.faq details[open] summary { border-bottom: 1px solid var(--border); margin-bottom: .7rem; }

/* ---------- Docs ---------- */
.docs-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.docs-nav { position: sticky; top: 84px; }
.docs-nav ul { list-style: none; padding: 0; margin: 0; }
.docs-nav a { display: block; padding: .3rem .6rem; border-radius: 6px; text-decoration: none; color: var(--muted); font-size: .95rem; }
.docs-nav a:hover { color: var(--text); background: var(--bg-alt); }
.docs-content section { padding: 0 0 2.5rem; scroll-margin-top: 84px; }
.docs-content h2 { padding-top: .5rem; }
.docs-content h3 { margin-top: 1.5rem; }
.docs-content ol, .docs-content ul { padding-left: 1.3rem; }
.docs-content li { margin-bottom: .35rem; }
@media (max-width: 900px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .docs-nav { position: static; }
  .docs-nav ul { display: flex; flex-wrap: wrap; gap: .3rem; }
  .docs-nav a { border: 1px solid var(--border); }
}

/* ---------- Formulaire (soutien / support) ---------- */
.form { display: grid; gap: .9rem; }
.form label { font-weight: 600; display: block; margin-bottom: .25rem; }
.form input, .form textarea, .form select {
  width: 100%; padding: .65rem .75rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit;
}
.form textarea { min-height: 120px; resize: vertical; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
@media (max-width: 560px) { .form .row { grid-template-columns: 1fr; } }
.form button { border: 0; cursor: pointer; font: inherit; justify-self: start; }
.form button:disabled { opacity: .6; cursor: progress; }
.form .form-hint { margin: 0; font-size: .9rem; }
.form .check { display: flex; align-items: flex-start; gap: .6rem; }
.form .check input { width: 1.15rem; height: 1.15rem; flex: none; margin: .2rem 0 0; padding: 0; accent-color: var(--accent); }
.form .check label { font-weight: 500; margin: 0; }
.form [aria-invalid="true"] { border-color: var(--err); box-shadow: 0 0 0 1px var(--err); }
.field-error { color: var(--err); font-size: .88rem; font-weight: 600; margin: .3rem 0 0; }
.form-status { margin: 0; font-weight: 600; }
.form-status:empty { display: none; }
.form-status.is-ok { color: var(--ok); }
.form-status.is-error { color: var(--err); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Appel à soutien (accueil) / call to action ---------- */
.cta-section { padding-top: 0; }
.cta-band {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem 2rem;
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: clamp(1.25rem, 4vw, 2rem);
}
.cta-band > div { max-width: 62ch; }
.cta-band h2 { margin-bottom: .5rem; }
.cta-band p:last-child { margin-bottom: 0; }

/* ---------- Pied de page ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 2.5rem 0; color: var(--muted); font-size: .92rem; margin-top: 2rem; }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 1rem; }
.site-footer a { color: var(--muted); }

.center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Sélecteur de langue / language switcher ---------- */
.site-nav { margin-left: auto; }
.header-tools { display: flex; align-items: center; gap: .5rem; }
.lang-switch {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .35rem .6rem; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .85rem;
  background: var(--surface);
}
.lang-switch:hover { border-color: var(--accent); }
.lang-switch svg { width: 16px; height: 16px; flex: none; }
@media (max-width: 840px) {
  .site-nav { margin-left: 0; }
  .no-js .header-tools { margin-left: auto; }
}

/* ---------- Variantes de module, grille 4 colonnes ---------- */
.variant { font-family: var(--font); font-weight: 600; font-size: .8rem; color: var(--muted); display: block; margin-top: .15rem; }
.version-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-top: 1rem; }
.version { border: 1px solid var(--border); border-radius: 10px; padding: 1rem; background: var(--bg); }
.version h3 { font-size: 1rem; display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; flex-wrap: wrap; }
.version .spec { margin-bottom: .75rem; }
[id] { scroll-margin-top: 80px; }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
@media (max-width: 400px) { .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Installateur web / web installer ---------- */
.install-section { padding-top: 1rem; }
.install-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
@media (max-width: 900px) { .install-grid { grid-template-columns: 1fr; } }
.install-card h2 { font-size: 1.35rem; }
.install-card select:disabled { opacity: .6; cursor: not-allowed; }
.h3 { font-size: 1.15rem; margin: 0 0 .75rem; }
.fw-info { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px; padding: .75rem 1rem; }
.fw-info p { margin: 0; }
.fw-info dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem 1rem; margin: 0; }
.fw-info dt { color: var(--muted); font-weight: 600; }
.fw-info dd { margin: 0; overflow-wrap: anywhere; }
.fw-action .btn { border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.fw-action .btn:disabled { opacity: .55; cursor: not-allowed; }
.fw-action .note { margin: 0; }
esp-web-install-button:not(:defined) [slot="unsupported"],
esp-web-install-button:not(:defined) [slot="not-allowed"] { display: none; }
.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.check-list li { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px; padding: .8rem 1rem; }
.check-list strong:first-child { display: block; margin-bottom: .15rem; }
.steps-col { grid-template-columns: 1fr; margin: 1rem 0 1.25rem; }
.note p:last-child { margin-bottom: 0; }
kbd { background: var(--bg-alt); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: .05em .35em; font-size: .85em; }
