/* =============================================================================
   Lecteur des démos interactives OMAG (format « Storylane »).
   Une démo = public/demos/<nom>/ : index.html (3 lignes), demo.json, captures/.
   Écrit par scripts/demos/capturer-demo.js (omagAPI). Voir lecteur.js.
   ============================================================================= */
:root {
  --fond: #eef3f8;
  --surface: #ffffff;
  --texte: #13233a;
  --doux: #5b6b80;
  --omag: #1675c7;
  --omag-fort: #0f5a9c;
  --halo: rgba(22, 117, 199, .35);
  --trait: #d6e0ea;
  --cadre: #e7edf4;
  --voile: rgba(8, 15, 28, .62);
  --f-titre: "Figtree", "Segoe UI", system-ui, sans-serif;
  --f-texte: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #0d1520; --surface: #152234; --texte: #e6edf5; --doux: #9db0c6;
    --omag: #4ea3ec; --omag-fort: #8cc4f4; --halo: rgba(78, 163, 236, .4); --trait: #24364d; --cadre: #1b2a3e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #0d1520; --surface: #152234; --texte: #e6edf5; --doux: #9db0c6;
  --omag: #4ea3ec; --omag-fort: #8cc4f4; --halo: rgba(78, 163, 236, .4); --trait: #24364d; --cadre: #1b2a3e;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--fond); color: var(--texte); font: 16px/1.45 var(--f-texte); }

/* Largeur bornée par la hauteur de la fenêtre : l'écran 16:10 et ses boutons tiennent sans défiler. */
.dl-page { max-width: min(1240px, calc((100vh - 200px) * 1.6 + 32px)); margin: 0 auto; padding-inline: 16px; padding-block: 16px 28px; display: grid; gap: 12px; }
.dl-bandeau { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dl-bandeau img { height: 30px; width: auto; }
.dl-bandeau .dl-nom { font-family: var(--f-titre); font-weight: 800; font-size: 1.1rem; flex: 1 1 auto; min-width: 0; }
.dl-bandeau .dl-nom span { color: var(--doux); font-weight: 600; }

/* --- Fenêtre façon navigateur ------------------------------------------- */
.dl-fenetre { border-radius: 14px; overflow: hidden; background: var(--surface); box-shadow: 0 18px 50px rgba(9, 20, 40, .18); border: 1px solid var(--trait); }
.dl-barre-fenetre { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--cadre); border-bottom: 1px solid var(--trait); }
.dl-points { display: flex; gap: 6px; }
.dl-points i { width: 11px; height: 11px; border-radius: 50%; background: #f87171; display: block; }
.dl-points i:nth-child(2) { background: #fbbf24; }
.dl-points i:nth-child(3) { background: #34d399; }
.dl-adresse { flex: 1; min-width: 0; text-align: center; color: var(--doux); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-bouton-chap { font-size: .85rem; padding: 4px 10px; }

.dl-ecran { position: relative; width: 100%; max-width: 100%; aspect-ratio: 16 / 10; background: #0b1220; overflow: hidden; }
.dl-zoom { position: absolute; inset: 0; transform-origin: 0 0; transition: transform .7s cubic-bezier(.22, .8, .25, 1); }
.dl-zoom img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top left; transition: opacity .35s ease; }
.dl-calque { position: absolute; inset: 0; pointer-events: none; }

.dl-cible { position: absolute; border: 2px solid var(--omag); border-radius: 10px; box-shadow: 0 0 0 9999px rgba(8, 15, 28, .22); transition: all .45s ease; }
.dl-point { position: absolute; width: 0; height: 0; pointer-events: auto; cursor: pointer; }
.dl-point span { position: absolute; left: -14px; top: -14px; width: 28px; height: 28px; border-radius: 50%; background: var(--omag); border: 3px solid #fff; animation: dl-pulse 1.6s infinite; }
@keyframes dl-pulse { 0% { box-shadow: 0 0 0 0 var(--halo); } 70% { box-shadow: 0 0 0 18px rgba(0,0,0,0); } 100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); } }

.dl-bulle { position: absolute; width: min(330px, 42%); background: var(--omag); color: #fff; border-radius: 12px; padding: 14px 16px 12px; box-shadow: 0 14px 40px rgba(5, 12, 25, .35); pointer-events: auto; display: grid; gap: 6px; cursor: pointer; }
.dl-bulle .dl-etape { font: 800 .74rem var(--f-titre); letter-spacing: .06em; text-transform: uppercase; opacity: .8; }
.dl-bulle h2 { font: 800 1.05rem/1.25 var(--f-titre); margin: 0; text-wrap: balance; }
.dl-bulle p { margin: 0; line-height: 1.45; }
.dl-bulle .dl-suite { font-size: .85rem; opacity: .85; text-align: right; }

/* --- Panneaux plein écran (accueil, chapitres, fin) ------------------------ */
.dl-panneau { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: var(--voile); backdrop-filter: blur(3px); pointer-events: auto; overflow: auto; }
.dl-carte { background: var(--surface); color: var(--texte); border-radius: 16px; padding: 22px 24px; width: min(560px, 100%); display: grid; gap: 12px; }
.dl-carte h2 { font: 800 1.35rem/1.2 var(--f-titre); margin: 0; text-wrap: balance; }
.dl-carte p { margin: 0; color: var(--doux); }
.dl-rangee { display: flex; flex-wrap: wrap; gap: 8px; }
.dl-chapitres { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.dl-chap { text-align: left; border: 1px solid var(--trait); background: var(--surface); color: var(--texte); border-radius: 12px; padding: 10px 12px; cursor: pointer; display: grid; gap: 2px; font: inherit; }
.dl-chap:hover { border-color: var(--omag); }
.dl-chap b { font-family: var(--f-titre); }
.dl-chap small { color: var(--doux); }
.dl-chap.fait b::after { content: " ✓"; color: var(--omag); }

/* --- Commandes sous l'écran ------------------------------------------------ */
.dl-progres { height: 4px; background: var(--trait); }
.dl-progres i { display: block; height: 100%; width: 0; background: var(--omag); transition: width .4s ease; }
.dl-commandes { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; }
.dl-compteur { color: var(--doux); font-variant-numeric: tabular-nums; }
.dl-texte-mobile { display: none; padding: 12px 14px; border-top: 1px solid var(--trait); gap: 4px; }
.dl-texte-mobile h2 { font: 800 1.02rem var(--f-titre); margin: 0; }
.dl-texte-mobile p { margin: 0; }

button.dl-btn, a.dl-btn { font: 600 .95rem var(--f-texte); border-radius: 9px; padding: 8px 14px; cursor: pointer; border: 1px solid transparent; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.dl-primaire { background: var(--omag); color: #fff; }
.dl-primaire:hover { background: var(--omag-fort); }
.dl-second { background: transparent; color: var(--texte); border-color: var(--trait) !important; }
.dl-second:hover { border-color: var(--omag) !important; }
.dl-btn:disabled { opacity: .4; cursor: default; }
.dl-btn:focus-visible, .dl-chap:focus-visible, .dl-bulle:focus-visible { outline: 3px solid var(--halo); outline-offset: 2px; }

@media (max-width: 760px) {
  .dl-bulle { display: none; }
  .dl-texte-mobile { display: grid; }
  .dl-adresse { display: none; }
  .dl-panneau { padding: 10px; }
  .dl-carte { padding: 14px 16px; gap: 8px; }
  .dl-carte h2 { font-size: 1.05rem; }
  .dl-carte > p { display: none; }
}
/* Intégrée dans la doc (#integre) : la page de doc porte le titre. */
.dl-integre .dl-bandeau { display: none; }
/* Dans un cadre, 100vh = hauteur du cadre (qui suit le contenu) : pas de borne par la hauteur. */
.dl-integre .dl-page { padding-block: 2px; max-width: none; }
@media (prefers-reduced-motion: reduce) {
  .dl-zoom, .dl-cible, .dl-progres i, .dl-zoom img { transition: none; }
  .dl-point span { animation: none; }
}
