/* ══════════════════════════════════════════════════════════
   Veilforge — page de présentation
   ══════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;
  --bg: #0c1017;
  --side: #10151e;
  --panel: #131a24;
  --field: #0f151e;
  --ink: #edf2fa;
  --muted: #9aa8bc;
  --line: #293446;
  --accent: #91e5be;
  --on-accent: #10271d;
  --hover: #1d2938;
  --error: #ffb4b4;
  --faint: #6d7d92;
  --accent-soft: rgba(145, 229, 190, .10);
  --accent-line: rgba(145, 229, 190, .35);
  --shadow: 0 10px 34px rgba(0, 0, 0, .28);
}

/* ── Base ────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
code, pre, kbd { font-family: ui-monospace, Consolas, "Cascadia Mono", monospace; }

pre {
  margin: 0; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--field); border: 1px solid var(--line);
  border-radius: 9px; padding: 16px;
  font-size: 12.5px; line-height: 1.75; color: var(--ink);
  max-width: 100%;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { opacity: .45; cursor: not-allowed; }
[hidden] { display: none !important; }
img { max-width: 100%; height: auto; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: fixed; top: -100px; left: 20px; z-index: 120;
  padding: 11px 16px; background: var(--accent); color: var(--on-accent);
  font-weight: 600; border-radius: 0 0 8px 8px; transition: top .18s ease;
}
.skip:focus { top: 0; }

.muted { color: var(--muted); font-size: 12px; }
.accent { color: var(--accent); }
.dot {
  display: inline-block; width: 6px; height: 6px; flex-shrink: 0;
  background: var(--accent); border-radius: 50%;
}

/* ── Chargement ──────────────────────────────────────────── */
.loader {
  position: fixed; inset: 0; z-index: 110;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity .4s ease, visibility .4s ease;
}
.loader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-card { display: grid; justify-items: center; gap: 16px; }
.loader-card p { margin: 0; color: var(--muted); font-size: 12.5px; letter-spacing: .3px; }
.loader .logo { width: 44px; height: 48px; font-size: 24px; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--accent-line); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Navigation supérieure ───────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topnav-inner {
  max-width: 1160px; margin: 0 auto; padding: 0 32px;
  min-height: 68px; display: flex; align-items: center;
  justify-content: space-between; gap: 22px;
}
.topnav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.topnav-links a {
  padding: 8px 13px; border-radius: 8px;
  color: var(--muted); font-size: 13px; font-weight: 500;
  transition: background .15s, color .15s;
}
.topnav-links a:hover, .topnav-links a.is-active { background: var(--hover); color: var(--ink); }
.topnav-right { display: flex; align-items: center; gap: 14px; }

.brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 21px; font-weight: 750; letter-spacing: -1px;
}
.brand > .accent { margin-left: -9px; }
.brand.small { font-size: 15px; }
.logo {
  width: 30px; height: 33px; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent);
  font-size: 17px; font-weight: 700;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

/* ── Boutons ─────────────────────────────────────────────── */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; font-weight: 600; font-size: 12.5px;
  border: 1px solid transparent; border-radius: 8px;
  transition: background .15s, filter .15s, border-color .15s;
  min-height: 38px; white-space: nowrap;
}
.button.lg { padding: 13px 22px; font-size: 13.5px; min-height: 46px; }
.primary { background: var(--accent); color: var(--on-accent); }
.primary:hover { filter: brightness(1.08); }
.secondary { background: transparent; border-color: var(--line); color: var(--ink); }
.secondary:hover { background: var(--hover); border-color: var(--accent-line); }

.text-button {
  background: none; border: 0; padding: 0;
  color: var(--muted); font-size: 11.5px;
}
.text-button:hover:not(:disabled) { color: var(--accent); }

.button.is-busy::after {
  content: ""; width: 12px; height: 12px; margin-left: 2px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 11px; font-size: 10px; color: var(--muted);
  white-space: nowrap; background: var(--panel);
}
.badge.ok { color: var(--accent); border-color: var(--accent-line); }
.badge.error { color: var(--error); border-color: color-mix(in srgb, var(--error) 45%, transparent); }

/* ── Structure ───────────────────────────────────────────── */
main { display: block; }
.inner { max-width: 1160px; margin: 0 auto; padding: 0 32px; }

.eyebrow {
  color: var(--accent); font-size: 10px; font-weight: 700;
  letter-spacing: 1.8px; margin: 0 0 10px;
}
h1 { font-size: clamp(34px, 5vw, 58px); letter-spacing: -2px; line-height: 1.08; margin: 0 0 20px; }
h2 { font-size: clamp(22px, 2.4vw, 30px); letter-spacing: -.8px; margin: 0 0 12px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 7px; letter-spacing: -.2px; }
.section-lead { margin: 0 0 30px; color: var(--muted); font-size: 14px; max-width: 660px; line-height: 1.7; }

.section { padding: 82px 0; scroll-margin-top: 84px; }
.section.alt { background: var(--side); border-block: 1px solid var(--line); }
section[id] { scroll-margin-top: 84px; }

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden; padding: 84px 0 76px;
  background:
    radial-gradient(900px 340px at 12% -10%, var(--accent-soft), transparent 70%),
    radial-gradient(700px 300px at 88% 0%, var(--accent-soft), transparent 70%);
  border-bottom: 1px solid var(--line);
}
.hero::after {
  content: ""; position: absolute; inset: auto 0 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-line), transparent);
}
.hero-inner {
  max-width: 1160px; margin: 0 auto; padding: 0 32px;
  display: grid; grid-template-columns: 1.05fr .95fr;
  gap: 40px; align-items: center;
}
.hero-lead {
  max-width: 560px; margin: 0 0 30px;
  color: var(--muted); font-size: clamp(14px, 1.4vw, 16.5px); line-height: 1.7;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-points {
  display: flex; flex-wrap: wrap; gap: 12px 26px;
  list-style: none; padding: 0; margin: 36px 0 0;
  color: var(--muted); font-size: 12px;
}
.hero-points li { display: flex; align-items: center; gap: 8px; }
.hero-art img { width: 100%; height: auto; display: block; }

/* Bandeau de modèles (défilement) */
.hero-models { max-width: 1160px; margin: 56px auto 0; padding: 0 32px; }
.models-label {
  margin: 0 0 12px; color: var(--muted);
  font-size: 10px; font-weight: 700; letter-spacing: 1.6px;
  text-transform: uppercase; text-align: center;
}
.models-note {
  margin: 14px auto 0; max-width: 720px; text-align: center;
  color: var(--muted); font-size: 11px; line-height: 1.7;
}

.marquee {
  overflow: hidden; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); padding: 14px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.marquee-track { display: flex; }
.marquee-group { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.marquee-item {
  display: inline-flex; align-items: center; gap: 9px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--field); padding: 9px 16px;
  font-size: 12.5px; font-weight: 550; color: var(--ink);
  white-space: nowrap;
}
.marquee.is-animated .marquee-track {
  flex-wrap: nowrap; width: max-content;
  animation: marquee 46s linear infinite;
}
.marquee.is-animated .marquee-group {
  flex-wrap: nowrap; justify-content: flex-start; padding-right: 10px;
}
.marquee.is-animated:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.logo-mark {
  width: 18px; height: 18px; flex-shrink: 0;
  background-color: var(--muted);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.marquee-item:hover .logo-mark { background-color: var(--accent); }

/* ── Panneaux / formulaires ──────────────────────────────── */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; box-shadow: var(--shadow);
}
.panel-heading {
  min-height: 56px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--line); padding: 14px 20px;
}
.panel-heading h3 { margin: 0; font-size: 13px; }
.panel-heading > .muted { font-size: 10px; }
.panel-body { padding: 20px; }
.step-number { color: var(--muted); font-size: 10px; margin-right: 8px; }

textarea, input[type="password"] {
  width: 100%; background: var(--field); color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 14px 15px; line-height: 1.75;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 178px; resize: vertical; font-size: 13px; }
textarea::placeholder, input::placeholder { color: var(--muted); opacity: .75; }
textarea:hover, input:hover { border-color: var(--accent-line); }
textarea:focus, input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Surbrillance des champs détectés dans le texte original (panneau 01) */
.editor { position: relative; }
.editor.is-marked #demo-input { position: relative; z-index: 2; }
#demo-input { display: block; }
.editor-marks {
  position: absolute; inset: 0; z-index: 1; overflow: hidden;
  padding: 14px 15px; border: 1px solid transparent; border-radius: 9px;
  font-size: 13px; line-height: 1.75;
  white-space: pre-wrap; overflow-wrap: anywhere;
  color: var(--ink); pointer-events: none;
}
#demo-input { overflow-wrap: anywhere; }
.editor.is-marked #demo-input {
  background: transparent; color: transparent; caret-color: var(--ink);
}
.editor.is-marked #demo-input::selection { background: rgba(145, 229, 190, .3); color: transparent; }
.editor-marks mark {
  background: rgba(145, 229, 190, .22); color: inherit;
  text-decoration: underline; text-decoration-color: rgba(145, 229, 190, .55);
  text-underline-offset: 3px; border-radius: 3px;
}
label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.7; margin: 14px 0 0; }
kbd {
  background: var(--field); border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 5px;
  padding: 1px 5px; font-size: 10.5px; color: var(--ink);
}

/* ── Démonstration ───────────────────────────────────────── */
.demo-toolbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px; margin-bottom: 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow);
}
.demo-status { color: var(--muted); font-size: 12px; margin-left: auto; }
.demo-status.ok { color: var(--accent); }
.demo-status.error { color: var(--error); }

.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.demo-output { min-height: 260px; }
.demo-restore { margin-top: 20px; }
.demo-restore pre { margin-top: 14px; }

.output {
  position: relative;
  min-height: 200px; white-space: pre-wrap; overflow-wrap: anywhere;
  font: 13px/1.95 ui-monospace, Consolas, monospace;
  background: var(--field); border: 1px solid var(--line);
  border-radius: 9px; padding: 18px;
}
.output.empty {
  display: flex; flex-direction: column; justify-content: center;
  align-items: center; text-align: center; white-space: normal;
  font-family: inherit; color: var(--muted);
}
.output.empty strong { font-size: 13px; color: var(--ink); font-weight: 550; }
.output.empty p { font-size: 12px; max-width: 300px; margin: 6px 0 0; }
.empty-art { margin-bottom: 6px; }
.output mark {
  display: inline-block;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-line); border-radius: 999px;
  padding: 2px 10px; font-size: 12.5px; overflow-wrap: anywhere;
  cursor: help; transition: background .15s, border-color .15s, transform .15s;
}
.output mark:hover, .output mark:focus-visible {
  background: rgba(145, 229, 190, .2); border-color: var(--accent);
  transform: translateY(-1px); outline: none;
}

/* Détail d'un champ masqué, affiché au survol d'un jeton */
.token-tip {
  position: absolute; z-index: 15; min-width: 232px; max-width: 330px;
  padding: 11px 13px; pointer-events: none;
  background: var(--panel); border: 1px solid var(--accent-line);
  border-radius: 11px; box-shadow: var(--shadow);
  font-size: 12px; line-height: 1.6; color: var(--muted);
  animation: fade-up .16s ease both;
}
.token-tip strong { display: block; color: var(--ink); font-size: 12.5px; font-weight: 650; }
.token-tip code { display: block; margin-top: 3px; color: var(--accent); font-size: 11.5px; }
.token-tip .tip-row {
  display: flex; justify-content: space-between; gap: 14px;
  margin-top: 7px; font-size: 11.5px;
}
.token-tip .tip-row b {
  color: var(--faint); font-weight: 650; font-size: 9.5px;
  letter-spacing: .08em; text-transform: uppercase; flex-shrink: 0;
}
.token-tip .tip-row span { color: var(--ink); text-align: right; overflow-wrap: anywhere; }

.skeleton { display: grid; gap: 10px; width: 100%; margin-top: 14px; }
.skeleton span {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--hover) 25%, var(--line) 50%, var(--hover) 75%);
  background-size: 200% 100%; animation: shimmer 1.1s linear infinite;
}
.skeleton span:nth-child(1) { width: 92%; }
.skeleton span:nth-child(2) { width: 74%; }
.skeleton span:nth-child(3) { width: 58%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--field);
  border-radius: 999px; padding: 6px 12px; font-size: 11.5px;
  animation: fade-up .25s ease both;
}
.chip code { color: var(--accent); font-size: 11px; }
.chip em { color: var(--muted); font-style: normal; }
@keyframes fade-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── Avertissement ───────────────────────────────────────── */
.disclaimer {
  margin: 26px 0 0; padding: 16px 18px;
  border: 1px dashed var(--line); border-radius: 10px;
  color: var(--muted); font-size: 12px; line-height: 1.7;
}
.disclaimer code { color: var(--accent); }

/* ── Fonctionnement ──────────────────────────────────────── */
.flow-art {
  margin: 0 0 34px; padding: 22px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; overflow-x: auto;
}
.flow-art img { display: block; min-width: 640px; margin: 0 auto; }

.how {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  list-style: none; padding: 0; margin: 0;
}
.how li {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 24px;
}
.how-num {
  display: grid; place-items: center; width: 30px; height: 30px;
  margin-bottom: 16px; border-radius: 50%;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  color: var(--accent); font-size: 13px; font-weight: 700;
}
.how li p { color: var(--muted); font-size: 12.5px; margin: 0; line-height: 1.7; }
.how li code { color: var(--accent); font-size: 11.5px; }

.how-flow {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  flex-wrap: wrap; margin: 28px 0 0; color: var(--muted); font-size: 12.5px;
}
.how-flow code {
  background: var(--field); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 14px; color: var(--ink);
}

/* ── Capacités ───────────────────────────────────────────── */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 22px;
  transition: border-color .18s, transform .18s;
}
.feature:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.feature p { color: var(--muted); font-size: 12.5px; margin: 0; line-height: 1.7; }
.feature code { color: var(--accent); font-size: 11.5px; }
.feature-icon {
  display: grid; place-items: center; width: 38px; height: 38px;
  margin-bottom: 16px; border-radius: 10px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  color: var(--accent);
}
.feature-icon svg { width: 20px; height: 20px; }

/* ── Intégration ─────────────────────────────────────────── */
.split { display: grid; grid-template-columns: 1.15fr .85fr; gap: 24px; align-items: start; }
.code-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; box-shadow: var(--shadow);
}
.code-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 11.5px;
}
.code-card pre {
  margin: 0; border: 0; border-radius: 0;
  background: var(--field); padding: 20px;
  font-size: 12.5px; line-height: 1.75; color: var(--ink);
  overflow-x: auto;
}

/* Onglets d'exemple par fournisseur */
.snippet-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 11px 14px; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .02);
}
.snippet-tab {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 6px 13px;
  font-size: 11.5px; font-weight: 600; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.snippet-tab:hover { color: var(--ink); border-color: var(--accent-line); }
.snippet-tab.is-active {
  background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line);
}
.snippet-note {
  margin: 0; padding: 12px 18px; border-top: 1px solid var(--line);
  font-size: 11.5px; line-height: 1.7; color: var(--muted);
}
.snippet-note code { color: var(--accent); }
.split-side h3 { font-size: 16px; margin-bottom: 12px; }
.split-side p { line-height: 1.75; }
.split-side code { color: var(--accent); font-size: 12px; }
.split-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

.meta-list { margin: 22px 0 0; display: grid; gap: 14px; }
.meta-list > div {
  display: grid; gap: 4px; padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.meta-list dt { color: var(--muted); font-size: 11px; letter-spacing: .5px; text-transform: uppercase; }
.meta-list dd { margin: 0; font-size: 12.5px; overflow-wrap: anywhere; }
.meta-list code { color: var(--accent); }

/* ── CTA ─────────────────────────────────────────────────── */
.cta {
  padding: 70px 0;
  background: radial-gradient(700px 240px at 50% 0%, var(--accent-soft), transparent 72%);
  border-top: 1px solid var(--line);
}
.cta-inner { display: flex; align-items: center; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
.cta-inner h2 { margin-bottom: 8px; }
.cta-inner .section-lead { margin: 0; }

/* ── Pied de page ────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); padding: 30px 0 44px; background: var(--side); }
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 12px;
}
.footer-tag { flex: 1 1 auto; }
.footer-links { display: flex; gap: 18px; }
.footer-links a:hover { color: var(--accent); }

/* ══════════════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1180px) {
  .features, .how { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; gap: 34px; }
  .hero-art { order: -1; max-width: 520px; }
  .topnav-links { display: none; }
  .inner, .topnav-inner, .hero-inner { padding: 0 20px; }
  .hero { padding: 56px 0 52px; }
  .section { padding: 56px 0; }
}

@media (max-width: 760px) {
  .demo-grid { grid-template-columns: 1fr; }
  .features, .how { grid-template-columns: 1fr; }
  .hero h1 { font-size: 34px; letter-spacing: -1.4px; }
  .hero-actions .button { width: 100%; }
  .demo-toolbar { flex-direction: column; align-items: stretch; }
  .demo-toolbar .button { width: 100%; }
  .demo-status { margin-left: 0; text-align: center; }
  .panel-heading, .panel-body { padding: 15px 16px; }
  .cta-inner { flex-direction: column; align-items: flex-start; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 560px) {
  .topnav-inner { min-height: 60px; gap: 12px; }
  .brand { font-size: 19px; }
  .footer-tag { display: none; }
  .hero-models { margin-top: 40px; padding: 0 20px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .marquee.is-animated .marquee-track { width: 100%; flex-wrap: wrap; justify-content: center; }
  .marquee.is-animated .marquee-group[aria-hidden="true"] { display: none; }
}
