/* Section immersive : chaque élément a sa zone, rien ne se superpose à la scène (surcharge de styles.css).
   Intégration au site : donner une hauteur au parent via --stage-h, ou garder 100dvh par défaut. */
.immersive {
  --stage-h: 100dvh; --rail-w: clamp(340px, 28vw, 420px); --bar-h: 56px;
  position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 0;
  height: var(--stage-h); min-height: 560px; padding: 0; margin: 0; overflow: hidden; background: var(--stage);
}

/* ---------- Barre du haut : une seule ligne ---------- */
.immersive .topbar {
  grid-row: 1; position: relative; z-index: 6; display: flex; flex-wrap: nowrap; align-items: center; gap: var(--s3);
  min-height: var(--bar-h); padding: 6px var(--s3); background: var(--surface);
  border: 0; border-bottom: 1px solid var(--border); border-radius: 0; backdrop-filter: none;
}
.immersive .topbar-id { order: 1; flex: none; }
.immersive .topbar-mark { height: 24px; }
.immersive .topbar h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.immersive .tabs-row { order: 2; flex: 1 1 auto; min-width: 0; padding: 0; border: 0; }
.immersive .topbar .tabs { display: flex; flex-wrap: nowrap; gap: 6px; }
.immersive .topbar .tab { min-height: 44px; min-width: 44px; padding: 4px 8px; justify-content: center; white-space: nowrap; }
.immersive .topbar .tab-t { font-size: 14px; }
/* Seul le parcours actif affiche son titre ; les autres gardent leur lettre (titre au survol et pour les lecteurs d'écran). */
.immersive .topbar .tab:not([aria-selected="true"]) .tab-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.immersive .topbar .tab[aria-selected="true"] { padding-right: var(--s3); }

.immersive .demo-flag {
  order: 3; flex: 0 1 auto; display: flex; flex-wrap: nowrap; align-items: center; gap: var(--s2); min-width: 0;
  padding: 6px var(--s3); border-radius: 999px; background: var(--magenta-tint); white-space: nowrap;
}
.immersive .demo-flag strong { font-size: 14px; color: var(--magenta-ink); }
.immersive .demo-flag span:not(.flag-dot) { font-size: 13px; color: var(--navy); overflow: hidden; text-overflow: ellipsis; }
.immersive .demo-flag .flag-dot { flex: none; }

.immersive .more-btn { order: 4; display: none; flex: none; }
/* Retour au site et appel à l'action toujours visibles : l'expérience mène au contact. */
.immersive .topbar-home { display: block; flex: none; border-radius: var(--r-sm, 6px); }
.immersive .topbar-cta { order: 6; flex: none; white-space: nowrap; }
.immersive .toolbar { order: 5; flex: none; display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; }
.immersive .toolbar .icon-btn, .immersive .toolbar .btn.small { width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; justify-content: center; }
.immersive .toolbar .btn.small > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.immersive .toolbar .seg button { height: 38px; }

/* ---------- Zone de jeu : scène + rail de l'assistant + ligne de guidage ---------- */
.immersive .interactive.scene-card {
  grid-row: 2; position: relative; inset: auto; width: auto; height: auto; min-height: 0;
  display: grid; grid-template-rows: minmax(0, 1fr) auto; border: 0; border-radius: 0; background: var(--stage); overflow: hidden;
}
.immersive .scene-body, .immersive .scene-body.with-ai {
  grid-row: 1; position: static; inset: auto; width: auto; height: auto; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); border: 0; background: none;
}
.immersive .scene-body.with-ai { grid-template-columns: minmax(0, 1fr) var(--rail-w); }
.immersive .svg-wrap {
  position: relative; inset: auto; width: auto; height: auto; min-height: 0; aspect-ratio: auto;
  display: block; overflow: hidden; border: 0; border-radius: 0; background: var(--stage);
}
.immersive #scene { display: block; width: 100%; height: 100%; min-width: 0; }

/* Rail de l'assistant : dans le flux, à côté de la scène, défile seul. */
.immersive .ai-pane:not([hidden]) {
  position: static; inset: auto; width: auto; height: auto; min-height: 0; max-height: none;
  display: flex; flex-direction: column; gap: var(--s3); overflow-y: auto; overscroll-behavior: contain;
  padding: var(--s4); background: var(--surface); border: 0; border-left: 1px solid var(--border); border-radius: 0;
  box-shadow: none; backdrop-filter: none;
}
.immersive .ai-pane > *, .immersive .ai-pane .cmp { flex: none; min-height: auto; }
.immersive .ai-title { font-size: 18px; }
.immersive .ai-questions { grid-template-columns: minmax(0, 1fr); gap: 6px; }
.immersive .ai-q { font-size: 14px; padding: 10px var(--s3); }
.immersive .cmp-q-t { font-size: 16px; }
.immersive .cmp-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.immersive .cmp-col { padding: var(--s3) 10px; }
.immersive .cmp-text, .immersive .cmp-sees { font-size: 14px; line-height: 1.5; }
.immersive .ai-tag { font-size: 12px; }
.immersive .ai-foot { display: grid; gap: var(--s1); }
.immersive .ai-scripted { font-size: 13px; }

/* Ligne de guidage : une bande fine sous la scène, jamais par-dessus. */
.immersive .guide {
  grid-row: 2; position: static; inset: auto; transform: none; width: auto;
  display: flex; flex-wrap: nowrap; align-items: center; gap: var(--s3) var(--s4);
  min-height: var(--bar-h); padding: 6px var(--s4); border-radius: 0; box-shadow: none;
}
.immersive .guide-step { flex: 1 1 auto; gap: var(--s3); }
.immersive .guide-n { width: 32px; height: 32px; font-size: 15px; }
.immersive .guide-copy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--s3); }
.immersive .guide-k { font-size: 12px; white-space: nowrap; }
.immersive .guide-t { font-size: 17px; line-height: 1.35; }
.immersive .guide-dots { flex: none; }
.immersive .guide-dots li { width: 20px; height: 4px; }
.immersive .guide-cta { flex: none; flex-wrap: nowrap; }
.immersive .guide-cta .btn { min-height: 40px; white-space: nowrap; }
.immersive .milestones { flex: none; display: block; padding: 0; border: 0; }
.immersive .milestones ol { display: flex; gap: 6px; }
.immersive .milestones li { min-height: 0; padding: 0; border: 0; }
.immersive .milestones .ms-n { width: 28px; height: 28px; font-size: 12px; border-style: dashed; color: #C9C8E6; }
.immersive .milestones.on .ms-n { border-style: solid; }

/* Fiche détaillée : tiroir explicite, fermé par défaut. */
.immersive .sheet:not([hidden]) {
  position: absolute; z-index: 7; top: 8px; right: 8px; bottom: 8px; width: min(720px, calc(100% - 16px));
  overflow-y: auto; padding: var(--s5); border-radius: var(--r-md); box-shadow: 0 16px 48px rgba(0, 0, 55, .3);
}
.immersive .sheet-close { position: absolute; top: 8px; right: 8px; z-index: 1; min-width: 44px; min-height: 44px; }
.immersive .mobile-chain, .immersive .product { display: none; }

/* ---------- Points de rupture ---------- */
@media (min-width: 1280px) {
  .immersive { --rail-w: 460px; }
}
@media (max-width: 1599px) {
  .immersive .demo-flag span:not(.flag-dot) { display: none; }
}
@media (max-width: 1180px) {
  .immersive .more-btn { display: inline-flex; margin-left: auto; }
  .immersive .toolbar { display: none; }
  .immersive .topbar.tools-open .toolbar {
    display: flex; position: absolute; top: calc(100% + 6px); right: var(--s3); flex-wrap: wrap; justify-content: flex-end;
    max-width: calc(100% - 2 * var(--s3)); padding: var(--s2); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: 0 10px 30px rgba(0, 0, 55, .18);
  }
  .immersive .toolbar .icon-btn, .immersive .toolbar .btn.small { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  .immersive .toolbar .seg button { height: 42px; }
  .immersive .guide-k { display: none; }
}
@media (max-width: 980px) {
  /* Tablette et mobile : la section suit le contenu ; scène, guidage puis assistant, empilés. */
  .immersive { height: auto; min-height: 0; overflow: visible; grid-template-rows: auto auto; }
  .immersive .interactive.scene-card { grid-template-rows: auto; overflow: visible; }
  .immersive .scene-body, .immersive .scene-body.with-ai { display: contents; }
  .immersive .svg-wrap { grid-row: 1; height: 58dvh; min-height: 320px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; }
  .immersive .svg-wrap::-webkit-scrollbar { display: none; }
  .immersive #scene { width: max(100%, 760px); }
  .immersive .guide { grid-row: 2; flex-wrap: wrap; position: sticky; bottom: 0; z-index: 3; }
  .immersive .guide-step { flex-basis: 100%; }
  .immersive .ai-pane:not([hidden]) { grid-row: 3; overflow: visible; border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 760px) {
  .immersive .topbar { flex-wrap: wrap; gap: 6px var(--s2); padding: 6px var(--s2); }
  .immersive .topbar-mark { height: 20px; }
  .immersive .tabs-row { flex: 0 1 auto; }
  .immersive .topbar .tab .tab-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .immersive .topbar .tab, .immersive .topbar .tab[aria-selected="true"] { padding: 4px; }
  .immersive .demo-flag { order: 10; flex: 1 1 100%; justify-content: center; padding: 4px var(--s2); }
  .immersive .demo-flag strong { font-size: 13px; }
  /* Mobile : le bandeau d'exemple et l'appel à l'action partagent la deuxième ligne. */
  .immersive .demo-flag { flex: 1 1 0; }
  .immersive .topbar-cta { order: 11; min-height: 40px; padding: 0 var(--s3); font-size: 13px; }
  .immersive .svg-wrap, .immersive .desk-tool { display: block; }
  .immersive .desk-tool { display: inline-flex; }
  .immersive .svg-wrap { height: 55dvh; min-height: 300px; }
  .immersive .guide { padding: var(--s2) var(--s3); }
  .immersive .guide-t { font-size: 16px; }
  /* Fin de parcours : les boutons passent à la ligne au lieu de pousser la page (aucun défilement horizontal). */
  .immersive .guide-cta { flex: 1 1 100%; flex-wrap: wrap; min-width: 0; }
  .immersive .guide-cta .btn { white-space: normal; }
  .immersive .cmp-cols { grid-template-columns: minmax(0, 1fr); }
  .immersive .ai-pane:not([hidden]) { padding: var(--s3); }
  .immersive .sheet:not([hidden]) { left: 8px; width: auto; }
}

/* ---------- Sans JavaScript ---------- */
.no-js .immersive { display: block; height: auto; min-height: 0; overflow: visible; padding: 16px; }
.no-js .immersive .topbar { border: 1px solid var(--border); border-radius: var(--r-md); }
.no-js .immersive .demo-flag span:not(.flag-dot) { display: inline; }
.no-js .immersive .static-chain { display: block; }
