/* 3D explorer UI */
:root {
  --bg: #0a0b0d;
  --ink: #ece7de;
  --ink-2: rgba(243, 239, 232, .66);
  --ink-3: rgba(243, 239, 232, .38);
  --line: rgba(243, 239, 232, .14);
  --glass: rgba(14, 15, 18, .58);
  --glass-2: rgba(22, 23, 27, .72);
  --red: #e30613;
  --stone: #d8c4a3;
  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.2, .7, 0, 1);
  --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #ededeb; color: var(--ink); overflow: hidden; }
body { font-family: var(--f-body); -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.45; }
button { font: inherit; color: inherit; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }

/* ---------- loader ---------- */
.loader { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: radial-gradient(120% 90% at 50% 110%, #1b1612 0%, var(--bg) 60%); transition: opacity 1.2s var(--ease), visibility 1.2s; }
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__inner { width: min(560px, 84vw); text-align: left; }
.loader__eyebrow { font: 500 11px/1 var(--f-mono); letter-spacing: .24em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 22px; }
.loader__title { font: 200 clamp(38px, 6vw, 76px)/.95 var(--f-display); font-stretch: 125%; letter-spacing: -.02em; margin: 0 0 40px; text-transform: uppercase; }
.loader__bar { height: 1px; background: var(--line); position: relative; overflow: hidden; }
.loader__bar span { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ink); transition: width .3s linear; }
.loader__pct { font: 400 12px/1 var(--f-mono); color: var(--ink-2); margin: 14px 0 0; text-align: right; font-variant-numeric: tabular-nums; }
/* failure state (no WebGL / model error): message and ways out instead of the progress bar */
.loader.is-failed .loader__bar, .loader.is-failed .loader__pct { display: none; }
.loader.is-failed .loader__title { margin-bottom: 24px; }
.loader__msg { max-width: 48ch; margin: 0 0 30px; font: 400 15px/1.55 var(--f-body); color: var(--ink-2); }
.loader__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.loader__btn { display: inline-flex; align-items: center; height: 38px; padding: 0 18px; border-radius: 999px; border: 1px solid rgba(243,239,232,.28); background: transparent; color: var(--ink); text-decoration: none; font: 500 12px/1 var(--f-body); letter-spacing: .04em; cursor: pointer; transition: background .3s, color .3s, border-color .3s; }
.loader__btn:hover { background: var(--ink); color: #111; border-color: var(--ink); }
.loader__btn--accent { background: var(--red); border-color: var(--red); color: #fff; }
.loader__btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- top bar ---------- */
.xp-top { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: max(18px, env(safe-area-inset-top)) clamp(16px, 3vw, 36px) 18px; pointer-events: none; }
.xp-top > * { pointer-events: auto; }
.xp-brand { display: flex; flex-direction: column; text-decoration: none; color: #121315; line-height: 1; }
.xp-brand__mark { font: 600 17px/1 var(--f-display); font-stretch: 125%; letter-spacing: .18em; }
.xp-brand__sub { font: 300 10px/1 var(--f-display); font-stretch: 125%; letter-spacing: .52em; color: rgba(18,19,21,.6); margin-top: 5px; }
.xp-top__right { display: flex; gap: 10px; align-items: center; }
.xp-back, .xp-lang { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); color: var(--ink); text-decoration: none; font: 500 12px/1 var(--f-body); letter-spacing: .04em; cursor: pointer; transition: background .3s, border-color .3s; }
.xp-lang { width: 38px; padding: 0; justify-content: center; font-family: var(--f-mono); font-size: 11px; }
.xp-back:hover, .xp-lang:hover { background: var(--glass-2); border-color: rgba(243,239,232,.3); }

/* ---------- panel ---------- */
.xp-panel { position: fixed; z-index: 15; left: clamp(16px, 3vw, 36px); bottom: clamp(16px, 3vw, 36px); width: 340px; max-height: calc(100% - 120px); overflow: auto; scrollbar-width: none; padding: 22px 22px 8px; border-radius: var(--r); border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3); box-shadow: 0 30px 80px -30px rgba(0,0,0,.6); transition: transform .7s var(--ease), opacity .5s; }
.xp-panel::-webkit-scrollbar { display: none; }
.xp-panel.is-hidden { transform: translateY(calc(100% + 60px)); opacity: 0; pointer-events: none; }
.xp-panel__head { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.xp-eyebrow { font: 500 10px/1 var(--f-mono); letter-spacing: .22em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px; }
.xp-title { font: 300 23px/1.05 var(--f-display); font-stretch: 112%; letter-spacing: -.01em; margin: 0; }
.xp-ctl { padding: 16px 0; border-bottom: 1px solid var(--line); }
.xp-ctl:last-child { border-bottom: 0; }
.xp-ctl__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.xp-ctl__name { font: 500 13px/1.2 var(--f-body); margin: 0; letter-spacing: .01em; }
.xp-ctl__state { font: 400 12px/1.3 var(--f-body); color: var(--ink-2); margin: 3px 0 0; }
.xp-ctl--views .xp-ctl__name, .xp-ctl--time .xp-ctl__name { margin-bottom: 10px; }

.xp-toggle { flex: none; height: 34px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(243,239,232,.28); background: rgba(243,239,232,.04); cursor: pointer; font: 500 12px/1 var(--f-body); letter-spacing: .03em; transition: background .3s, color .3s, border-color .3s, transform .2s; }
.xp-toggle:hover { background: var(--ink); color: #111; border-color: var(--ink); }
.xp-toggle:active { transform: scale(.97); }
.xp-toggle[aria-pressed="true"] { background: var(--ink); color: #111; border-color: var(--ink); }
.xp-toggle--accent { background: var(--red); border-color: var(--red); color: #fff; }
.xp-toggle--accent:hover, .xp-toggle--accent[aria-pressed="true"] { background: #fff; border-color: #fff; color: var(--red); }
.xp-toggle:focus-visible, .xp-chip:focus-visible, .xp-seg button:focus-visible, .xp-back:focus-visible, .xp-lang:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.xp-range { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 12px 0 0; background: transparent; cursor: pointer; --p: 0%; }
.xp-range::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(to right, var(--ink) var(--p), var(--line) var(--p)); border-radius: 2px; }
.xp-range::-moz-range-track { height: 2px; background: linear-gradient(to right, var(--ink) var(--p), var(--line) var(--p)); }
.xp-range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -6px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 5px rgba(243,239,232,.12); transition: box-shadow .2s; }
.xp-range::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--ink); }
.xp-range:hover::-webkit-slider-thumb { box-shadow: 0 0 0 8px rgba(243,239,232,.16); }

.xp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.xp-ctl--seat .xp-chips { margin-top: 12px; }
.xp-chip { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer; font: 400 12px/1 var(--f-body); color: var(--ink-2); transition: all .25s; }
.xp-chip:hover { color: var(--ink); border-color: rgba(243,239,232,.4); }
.xp-chip.is-on { color: #111; background: var(--ink); border-color: var(--ink); }
.xp-chip[disabled] { opacity: .35; cursor: not-allowed; text-decoration: line-through; }

.xp-seg { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 999px; border: 1px solid var(--line); }
.xp-seg button { height: 28px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; font: 400 12px/1 var(--f-body); color: var(--ink-2); transition: all .3s; }
.xp-seg button.is-on { background: var(--ink); color: #111; }

.xp-panel-toggle { display: none; }

/* ---------- seat bar ---------- */
.xp-seatbar { position: fixed; z-index: 16; left: 50%; bottom: clamp(16px, 3vw, 36px); transform: translateX(-50%); display: flex; align-items: center; gap: 22px; padding: 14px 14px 14px 24px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); animation: rise .8s var(--ease); }
.xp-seatbar .xp-eyebrow { margin: 0 0 5px; color: var(--ink); }
.xp-seatbar__hint { margin: 0; font-size: 12px; color: var(--ink-2); }
@keyframes rise { from { transform: translate(-50%, 30px); opacity: 0; } }

/* ---------- lost GPU context notice ---------- */
.xp-lost { position: fixed; z-index: 60; top: calc(max(18px, env(safe-area-inset-top)) + 58px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 18px; padding: 10px 10px 10px 22px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass-2); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); }
.xp-lost p { margin: 0; font: 500 12px/1.3 var(--f-body); letter-spacing: .02em; }

/* ---------- tooltip & labels ---------- */
.xp-tip { position: fixed; z-index: 30; pointer-events: none; padding: 8px 12px; border-radius: 8px; background: rgba(10,11,13,.86); border: 1px solid var(--line); font: 500 11px/1.3 var(--f-body); letter-spacing: .02em; transform: translate(14px, 14px); white-space: nowrap; }
.xp-tip b { display: block; font: 500 10px/1 var(--f-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.xp-tip.is-no b { color: #ff6b6b; }
.xp-labels { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.xp-label { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 10px; transform: translate(-7px, -7px); transition: opacity .5s; white-space: nowrap; pointer-events: auto; cursor: pointer; }
.xp-label:hover span { background: rgba(10,11,13,.75); }
.xp-label.is-hidden { pointer-events: none; }
.xp-label i { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(255,255,255,.9); background: rgba(255,255,255,.15); box-shadow: 0 0 0 5px rgba(255,255,255,.08); position: relative; }
.xp-label i::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: #fff; }
.xp-label span { font: 500 10px/1 var(--f-mono); letter-spacing: .18em; text-transform: uppercase; color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.7); padding: 6px 9px; border-radius: 6px; background: rgba(10,11,13,.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.xp-label.is-hidden { opacity: 0; }

.xp-help { position: fixed; z-index: 10; right: clamp(16px, 3vw, 36px); bottom: clamp(16px, 3vw, 36px); margin: 0; font: 400 11px/1 var(--f-mono); letter-spacing: .08em; color: rgba(18,19,21,.7); transition: opacity 1s; }
.xp-help.is-hidden { opacity: 0; }
.xp-noscript { position: fixed; inset: auto 0 40% 0; text-align: center; }

body.is-seated .xp-panel { transform: translateX(calc(-100% - 60px)); opacity: 0; pointer-events: none; }
body.is-picking #scene { cursor: crosshair; }

@media (max-width: 760px) {
  .xp-panel { left: 10px; right: 10px; bottom: 10px; width: auto; max-height: 56vh; padding: 16px 16px 4px; }
  .xp-panel__head { display: none; }
  .xp-ctl { padding: 12px 0; }
  .xp-panel-toggle { display: inline-flex; position: fixed; z-index: 16; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); height: 38px; padding: 0 16px; align-items: center; border-radius: 999px; border: 1px solid var(--line); background: var(--glass-2); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); font: 500 12px/1 var(--f-body); cursor: pointer; }
  .xp-panel:not(.is-hidden) ~ .xp-panel-toggle { bottom: calc(56vh + 20px); }
  .xp-help { display: none; }
  .xp-seatbar { left: 10px; right: 10px; transform: none; border-radius: 18px; animation: none; }
  .xp-lost { left: 10px; right: 10px; transform: none; justify-content: space-between; border-radius: 18px; }
  .xp-back span:last-child { display: none; }
  .xp-back { width: 38px; padding: 0; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { * { transition-duration: .01ms !important; animation-duration: .01ms !important; } }

[hidden] { display: none !important; }

body.is-seated .xp-panel-toggle { display: none; }
.xp-label.is-left { flex-direction: row-reverse; }

/* architectural white model: light stage */
.xp-wide { width: 100%; height: 38px; margin-top: 12px; border-radius: 999px; border: 1px solid var(--red); background: var(--red); color: #fff; cursor: pointer; font: 500 12px/1 var(--f-body); letter-spacing: .03em; transition: background .3s, color .3s, transform .2s; }
.xp-wide:hover { background: #fff; color: var(--red); border-color: #fff; }
.xp-wide:active { transform: scale(.98); }
.xp-wide:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.xp-wide[disabled], .xp-toggle[disabled] { opacity: .35; cursor: not-allowed; }
.xp-ridebar .xp-eyebrow { font-variant-numeric: tabular-nums; }
body.is-riding .xp-panel { transform: translateX(calc(-100% - 60px)); opacity: 0; pointer-events: none; }
body.is-riding .xp-panel-toggle, body.is-riding .xp-help { display: none; }
.xp-label span { background: rgba(18,19,21,.72); text-shadow: none; }
.xp-label i { border-color: #121315; background: rgba(255,255,255,.7); box-shadow: 0 0 0 5px rgba(18,19,21,.08); }
.xp-label i::after { background: var(--red); }
/* light glass UI over the white model */
.xp-panel, .xp-seatbar, .xp-lang, .xp-back, .xp-panel-toggle, .xp-tip, .xp-lost {
  --ink: #121315; --ink-2: rgba(18,19,21,.64); --ink-3: rgba(18,19,21,.42); --line: rgba(18,19,21,.12);
  --glass: rgba(255,255,255,.72); --glass-2: rgba(255,255,255,.88);
  color: var(--ink); box-shadow: 0 24px 60px -30px rgba(20,22,26,.35);
}
.xp-tip { background: rgba(255,255,255,.92); }
.xp-tip b { color: var(--ink-3); }
.xp-toggle { border-color: rgba(18,19,21,.22); background: rgba(18,19,21,.03); }
.xp-toggle:hover, .xp-toggle[aria-pressed="true"] { background: #121315; color: #fff; border-color: #121315; }
.xp-toggle--accent { background: var(--red); border-color: var(--red); color: #fff; }
.xp-toggle--accent:hover, .xp-toggle--accent[aria-pressed="true"] { background: #121315; border-color: #121315; color: #fff; }
.xp-wide:hover { background: #121315; color: #fff; border-color: #121315; }
.xp-chip:hover { color: var(--ink); border-color: rgba(18,19,21,.4); }
.xp-chip.is-on { color: #fff; background: #121315; border-color: #121315; }
.xp-range::-webkit-slider-thumb { background: #121315; box-shadow: 0 0 0 5px rgba(18,19,21,.1); }
.xp-range::-moz-range-thumb { background: #121315; }
.xp-back:hover, .xp-lang:hover { background: var(--glass-2); border-color: rgba(18,19,21,.3); }
.xp-toggle:focus-visible, .xp-chip:focus-visible, .xp-back:focus-visible, .xp-lang:focus-visible { outline-color: #121315; }
/* démo automatique · bouton d’entrée (mode normal) */
.xp-demo { gap: 8px; cursor: pointer; }
.xp-demo svg { width: 9px; height: 9px; fill: currentColor; }
.xp-demo[disabled] { opacity: .45; cursor: default; }

/* démo · mode immersif : seule la maquette + « Sortir de la démo » */
body.is-demo-out .xp-top, body.is-demo-out .xp-panel, body.is-demo-out .xp-panel-toggle, body.is-demo-out .xp-seatbar,
body.is-demo-out .xp-labels, body.is-demo-out .xp-tip, body.is-demo-out .xp-help { opacity: 0 !important; pointer-events: none; transition: opacity .28s ease; }
body.is-demo .xp-top, body.is-demo .xp-panel, body.is-demo .xp-panel-toggle, body.is-demo .xp-seatbar,
body.is-demo .xp-labels, body.is-demo .xp-tip, body.is-demo .xp-help { display: none !important; }
body.is-demo { overflow: hidden; }
body.is-demo #scene { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; z-index: 40; cursor: grab; }
body.is-demo-in .xp-top, body.is-demo-in .xp-panel, body.is-demo-in .xp-panel-toggle, body.is-demo-in .xp-help { animation: demoUiIn .45s ease both; }
@keyframes demoUiIn { from { opacity: 0; } }

.xp-demo-exit {
  position: fixed; z-index: 50;
  top: max(16px, calc(env(safe-area-inset-top) + 10px)); right: max(16px, calc(env(safe-area-inset-right) + 10px));
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 18px 0 15px; border-radius: 999px;
  border: 1px solid rgba(243, 239, 232, .22); background: rgba(14, 15, 18, .42); color: #f3efe8;
  backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2);
  font: 500 12px/1 var(--f-body); letter-spacing: .04em; cursor: pointer;
  transition: background .3s, border-color .3s; animation: demoExitIn .6s .35s ease both;
}
.xp-demo-exit:hover { background: rgba(14, 15, 18, .62); border-color: rgba(243, 239, 232, .4); }
.xp-demo-exit:focus-visible { outline: 2px solid #f3efe8; outline-offset: 2px; }
.xp-demo-exit svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
@keyframes demoExitIn { from { opacity: 0; transform: translateY(-4px); } }
