/* ==========================================================================
   Décor vivant (stage.js) + cinématique (cine.js)
   ========================================================================== */
.stage { position: fixed; inset: 0; z-index: -1; background: #02100f; overflow: hidden; pointer-events: none; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0;
  transform: scale(1.03) translate3d(calc(var(--px, 0) * -10px), calc(var(--py, 0) * -6px), 0); }
.stage video.front { opacity: 1; }
.stage-veil { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, #031a1999 0%, #031a19d9 75%);
  opacity: 0; transition: opacity 1.2s var(--ease-soft); }
.stage-veil.on { opacity: 1; }
/* the same film grain over everything keeps video, robot and panels "in the same camera" */
.staged body::after { content: ""; position: fixed; inset: -50%; z-index: 7; pointer-events: none; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: md-grain .9s steps(6) infinite; }
@keyframes md-grain { 0% { transform: translate(0, 0); } 33% { transform: translate(-3%, 2%); } 66% { transform: translate(2%, -3%); } 100% { transform: translate(-1%, 1%); } }

/* free mode: the page floats over the living city */
.staged { background: #02100f; }
.staged .hero, .staged .postes, .staged .avalanche, .staged .sovereign, .staged .steps-chapter, .staged .demo,
.staged .cases-section, .staged .contact-section, .staged .agency-section, .staged .pillars { background: transparent; border-color: transparent; }
.staged .hero-film { display: none; }
.staged .city-map { opacity: .25; }
.staged .header { background: #031a19cc; backdrop-filter: blur(10px); }
.staged .service, .staged .case-panel, .staged .contact-form, .staged .sector-grid li, .staged .claims li { backdrop-filter: blur(6px); }
.staged .service, .staged .case-panel { background: #061f1dcc; }

/* ---------- cinematic ---------- */
.cine, .cine body { overflow: hidden; }
.cine .header { transform: translateY(-110%); transition: transform .8s var(--ease-out); }
.cine main > *, .cine footer, .cine .cta-float, .cine .nour-bubble { opacity: 0; visibility: hidden; }
.cine-out main > *, .cine-out footer { transition: opacity .8s; }
/* bar heights come from cine.js (--lb-t / --lb-b): they only cover what the film can spare */
.lb { position: fixed; left: 0; right: 0; background: #000; z-index: 8; transition: transform 1s var(--ease-out), height .6s var(--ease-out); }
.lb-top { top: 0; height: var(--lb-t, 0px); } .lb-bot { bottom: 0; height: var(--lb-b, 0px); }
.cine-out .lb-top { transform: translateY(-100%); } .cine-out .lb-bot { transform: translateY(100%); }
.cine-skip { position: fixed; top: clamp(8px, 2.2vh, 26px); right: 20px; z-index: 9; background: transparent; border: 1px solid #ffffff40; color: #ffffffb3;
  border-radius: 99px; padding: 7px 14px; font: 600 12px var(--body); letter-spacing: .06em; }
.cine-skip:hover { color: #fff; border-color: #fff; }

/* the active chapter becomes a holographic panel over the scene */
/* between the top bar and the dialog box (cine.js sets --pa-t / --pa-b and scales the content down if needed) */
.cine .chapter.cine-on { position: fixed; top: var(--pa-t, 60px); bottom: var(--pa-b, 150px); left: 0; right: 0; z-index: 2; opacity: 1; visibility: visible;
  display: flex; align-items: center; justify-content: center; height: auto; overflow: visible; animation: md-holo .8s var(--ease-out) both; }
.cine .chapter.cine-on > .wrap, .cine .chapter.cine-on .demo-stage { width: min(1240px, calc(100% - 11vw)); margin-inline: 0; transform-origin: 50% 50%; flex: none; }
.cine .chapter.cine-on .demo-stage > .wrap { width: 100%; }
/* Nour stands in front of the panels and of the dialog box (on phones he speaks from its corner) */
.cine .nour-canvas, .cine .nour-2d { z-index: 10; }
.cine .chapter.cine-on::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(ellipse at 50% 50%, #031a19d9 0%, #031a1999 55%, transparent 85%); }
.cine .demo.cine-on { height: auto; }
.cine .demo.cine-on .demo-stage { position: static; height: auto; padding-block: 0; }
.cine .chapter.cine-on .section { padding-block: 10px; }
/* Nour says the details: the panel keeps the headline (the three claims as short tags) */
.cine .postes.cine-on .claims span, .cine .postes.cine-on .postes-next { display: none; }
.cine .postes.cine-on .claims { gap: 9px; margin-top: 18px; }
@keyframes md-holo { from { opacity: 0; transform: scale(1.04); filter: blur(8px) brightness(1.6); } to { opacity: 1; transform: none; filter: none; } }

/* game dialog box */
.dlg { position: fixed; left: 50%; bottom: clamp(14px, 4vh, 46px); z-index: 9; width: min(780px, 92vw); transform: translate(-50%, 30px); opacity: 0;
  padding: 18px 24px 18px; border-radius: 14px; background: linear-gradient(160deg, #072b28f2, #041816f2); border: 1px solid #2fb9c6aa;
  box-shadow: 0 0 0 1px #000, 0 18px 50px #000c, 0 0 30px #13c4d133, inset 0 0 22px #17d9ef14; transition: opacity .35s, transform .45s var(--ease-out); }
.dlg.on { opacity: 1; transform: translate(-50%, 0); }
.dlg-name { position: absolute; top: -13px; left: 20px; padding: 3px 12px; border-radius: 6px; background: linear-gradient(122deg, #fae0a8, #d9a75e);
  color: #11211d; font: 800 12px var(--heading); letter-spacing: .14em; }
.dlg-text { margin: 0; min-height: 4.65em; color: #eef4ef; font: 600 clamp(15px, 1.3vw, 19px)/1.55 var(--heading); }
.dlg-text b { color: var(--gold); }
.dlg-caret { display: inline-block; width: 2px; height: 1em; background: #5fe6f5; vertical-align: -2px; margin-left: 2px; }
.dlg-next { position: absolute; right: 18px; bottom: 10px; color: #5fe6f5; opacity: 0; font-size: 14px; }
.dlg.done .dlg-next { opacity: 1; animation: md-next .8s ease-in-out infinite alternate; }
@keyframes md-next { to { transform: translateX(4px); } }
@media (max-width: 730px) {
  .dlg { padding: 14px 96px 14px 16px; bottom: 10px; }
  .dlg-text { min-height: 6.2em; font-size: 15px; }
  .dlg-next { right: 100px; }
  .cine .chapter.cine-on > .wrap, .cine .chapter.cine-on .demo-stage { width: calc(100% - 28px); }
  /* the story on a phone keeps what matters: no decorative vault, sectors as a compact list */
  .cine .sovereign.cine-on .vault { display: none; }
  .cine .postes.cine-on .lead, .cine .avalanche.cine-on .lead, .cine .avalanche.cine-on .punch { display: none; }
  .cine .postes.cine-on .claims { margin-top: 12px; gap: 6px; }
  .cine .chapter.cine-on .nour-slot { display: none; }
  .cine .sectors.cine-on .sector-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .cine .sectors.cine-on .sector-grid li { padding: 12px 12px; min-height: 0; }
  .cine .sectors.cine-on .sector-grid li span { display: none; }
}
@media (max-width: 380px) {
  .dlg-text { min-height: 7.75em; }                  /* narrow phones: room for five lines, the panel never moves */
}
@media (prefers-reduced-motion: reduce) { .stage, .lb, .dlg, .cine-skip { display: none; } }

/* the loading screen (first visit only): the logo and a bar, while the film starts loading (cine.js) */
.loader { display: none; }
.cine .loader { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px;
  background: radial-gradient(ellipse at 50% 46%, #0a2b29 0%, #041c1b 45%, #020e0e 100%); transition: opacity .6s var(--ease-out); }
.loader img { width: min(230px, 54vw); height: auto; animation: loader-glow 1.6s ease-in-out infinite alternate; }
.loader-bar { width: min(240px, 58vw); height: 3px; border-radius: 3px; background: #ffffff1c; overflow: hidden; }
.loader-bar i { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, #e6bb78, #f3d9a4 55%, #5fe6f5); box-shadow: 0 0 10px #5fe6f588; }
.loader.done { opacity: 0; pointer-events: none; }
@keyframes loader-glow { from { filter: drop-shadow(0 0 0 #e6bb7800); } to { filter: drop-shadow(0 0 16px #e6bb7866); } }

/* « Passer » and the sound button: shown the first 5 s of the film, and 5 s after each tap; otherwise out of the way */
.cine-skip, .cine .snd { transition: opacity .5s, border-color .3s, color .3s; }
.cine-calm .cine-skip, .cine-calm .snd { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .loader img { animation: none; } }
