/* =========================================================
   Le Salon — interface (menus, chargement, panneaux)
   Même direction artistique que le site : bleu, verre dépoli, Jost.
   La scène 3D elle-même n'est pas concernée par ce fichier.
   ========================================================= */
:root {
  --blue: #1d00ae;
  --blue-2: #3a1fd6;
  --blue-deep: #0d0059;
  --blue-soft: #eceaff;
  --muted: #6c6a99;
  --line: rgba(29, 0, 174, .12);
  --glass: rgba(255, 255, 255, .64);
  --glass-strong: rgba(255, 255, 255, .84);
  --glass-border: rgba(255, 255, 255, .78);
  --shadow: 0 18px 50px -18px rgba(29, 0, 174, .38);
  --font: "Jost", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --ease: cubic-bezier(.22, .8, .2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--blue-deep); color: var(--blue); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 10px; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
#scene.grab { cursor: grab; }
#scene.grabbing { cursor: grabbing; }
#scene.pointer { cursor: pointer; }
.vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(120% 90% at 50% 45%, transparent 58%, rgba(13, 0, 89, .28) 100%); }

/* Verre commun */
.glass {
  background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  border: 1px solid var(--glass-border); box-shadow: 0 10px 40px -16px rgba(29, 0, 174, .4), inset 0 1px 0 rgba(255, 255, 255, .8);
}

/* ---------- Écran de chargement : mur de tableaux flouté ---------- */
.intro { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; overflow: hidden; background: #f6f6fc; transition: opacity 1.2s var(--ease), visibility 1.2s; }
.intro.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.intro-bg { position: absolute; inset: -60px; overflow: hidden; }
.intro-wall {
  position: absolute; inset: 0; display: grid; grid-template-columns: repeat(6, 1fr); grid-auto-rows: 34vh; gap: 18px; padding: 18px;
  filter: blur(7px) saturate(1.1); transform: rotate(-4deg) scale(1.12); animation: wall 40s linear infinite alternate;
}
.intro-wall img { width: 100%; height: 100%; object-fit: cover; border-radius: 18px; box-shadow: 0 20px 40px -20px rgba(13, 0, 89, .5); }
.intro-wall img:nth-child(odd) { transform: translateY(-9vh); }
@keyframes wall { to { transform: rotate(-4deg) scale(1.12) translate(-3%, -4%); } }
.intro-bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(70% 60% at 50% 50%, rgba(246, 246, 252, .55), rgba(246, 246, 252, .2) 70%, rgba(29, 0, 174, .12)); }
.intro-card {
  position: relative; width: min(100%, 460px); text-align: center; padding: 38px 34px 32px; border-radius: 28px; color: var(--blue);
  background: rgba(255, 255, 255, .7); -webkit-backdrop-filter: blur(24px) saturate(1.5); backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, .85); box-shadow: 0 40px 90px -30px rgba(29, 0, 174, .55), inset 0 1px 0 rgba(255, 255, 255, .9);
  animation: cardIn .9s var(--ease) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.intro-logo { width: 62px; margin: 0 auto; display: block; }
.intro-kicker { font-size: 13px; letter-spacing: .32em; text-transform: uppercase; margin: 16px 0 6px; color: var(--muted); font-weight: 500; }
.intro-title { font-weight: 500; font-size: clamp(52px, 11vw, 80px); line-height: .95; margin: 0; letter-spacing: -.03em; }
.intro-title span { display: inline-block; font-size: .24em; letter-spacing: .06em; vertical-align: super; padding: 4px 9px; border-radius: 999px; background: var(--blue); color: #fff; margin-left: 4px; }
.intro-text { font-size: 16px; line-height: 1.55; color: #3d3a7a; margin: 14px auto 26px; max-width: 340px; }
.intro-progress { width: 100%; max-width: 260px; height: 5px; border-radius: 99px; background: var(--blue-soft); margin: 0 auto 12px; overflow: hidden; }
.intro-progress span { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--blue); transition: width .4s var(--ease); }
.intro-status { font-size: 13px; color: var(--muted); margin: 0 0 20px; min-height: 1.2em; }
.btn-enter {
  display: inline-flex; align-items: center; gap: 10px; padding: 14px 28px; border-radius: 999px; font-size: 16px; font-weight: 500;
  background: var(--blue); color: #fff; border: 1px solid var(--blue); box-shadow: 0 12px 26px -12px rgba(29, 0, 174, .8);
  transition: transform .3s var(--ease), background .3s, opacity .3s;
}
.btn-enter svg { width: 16px; height: 16px; transition: transform .3s var(--ease); }
.btn-enter:hover:not(:disabled) { transform: translateY(-2px); background: var(--blue-2); }
.btn-enter:hover:not(:disabled) svg { transform: translateX(3px); }
.btn-enter:disabled { opacity: .35; cursor: default; }
.intro-error { margin: 18px 0 0; font-size: 14px; line-height: 1.5; padding: 12px 14px; border-radius: 14px; background: var(--blue-soft); }
.intro-error small { display: block; margin-top: 8px; font-size: 11.5px; color: var(--muted); word-break: break-word; }
.intro-fallback { display: inline-block; margin-top: 12px; padding: 11px 20px; border-radius: 999px; background: var(--blue); color: #fff; font-weight: 500; }
@media (max-width: 760px) {
  .intro-wall { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 26vh; gap: 12px; }
}

/* ---------- Interface ---------- */
.ui { opacity: 0; transition: opacity 1s var(--ease) .6s; }
body.in .ui { opacity: 1; }

/* Barre du haut : même menu que le site */
.topbar {
  position: fixed; z-index: 10; top: calc(12px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  width: min(calc(100% - 24px), 1180px); display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 16px; border-radius: 999px;
  background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  border: 1px solid var(--glass-border); box-shadow: 0 10px 40px -16px rgba(29, 0, 174, .45), inset 0 1px 0 rgba(255, 255, 255, .8);
}
.tb-logo img { width: 40px; display: block; }
.tb-links { display: flex; gap: 4px; margin: 0 auto; }
.tb-links a { padding: 9px 16px; border-radius: 999px; font-size: 15px; font-weight: 500; transition: background .25s, color .25s; }
.tb-links a:hover { background: var(--blue-soft); }
.tb-links a.active { background: var(--blue); color: #fff; }
.top-right { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 500; border: 1px solid var(--line); transition: background .25s, color .25s, border-color .25s; }
.chip:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.chip svg { width: 16px; height: 16px; }
.lang { display: flex; align-items: center; padding: 3px; border-radius: 999px; background: rgba(29, 0, 174, .06); }
.lang button { padding: 6px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; opacity: .5; transition: opacity .2s, background .25s; }
.lang button.active { opacity: 1; background: #fff; box-shadow: 0 2px 8px -3px rgba(29, 0, 174, .4); }

/* Barre du bas */
.dock {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 10;
  display: flex; align-items: center; gap: 2px; padding: 6px; border-radius: 999px; max-width: calc(100vw - 24px);
  background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  border: 1px solid var(--glass-border); box-shadow: 0 10px 40px -16px rgba(29, 0, 174, .45), inset 0 1px 0 rgba(255, 255, 255, .8);
}
.dock-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; transition: background .25s, color .25s, transform .25s var(--ease); }
.dock-btn:hover { background: var(--blue); color: #fff; }
.dock-btn:active { transform: scale(.94); }
.dock-label { display: flex; flex-direction: column; align-items: center; min-width: 200px; padding: 2px 12px; line-height: 1.25; overflow: hidden; border-radius: 999px; transition: background .25s; }
.dock-label:hover { background: var(--blue-soft); }
.dock-count { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.dock-title { font-size: 17px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px; }
.dock-sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.hint {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 9; margin: 0;
  padding: 7px 14px; border-radius: 999px; font-size: 12.5px; color: #fff; white-space: nowrap; pointer-events: none;
  background: rgba(29, 0, 174, .55); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); transition: opacity .8s;
}
body.focused .hint, body.moved .hint { opacity: 0 !important; }

.tooltip {
  position: fixed; z-index: 12; pointer-events: none; transform: translate(14px, 14px); padding: 9px 13px; border-radius: 14px; font-size: 12.5px; white-space: nowrap; color: #fff;
  background: rgba(29, 0, 174, .78); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 10px 24px -10px rgba(13, 0, 89, .6);
}
.tooltip b { display: block; font-size: 15px; font-weight: 500; }

/* ---------- Panneau d'une œuvre ---------- */
.panel {
  position: fixed; z-index: 20; top: calc(84px + env(safe-area-inset-top, 0px)); right: 18px; bottom: 18px; width: 380px; display: flex; flex-direction: column; border-radius: 24px;
  background: var(--glass); -webkit-backdrop-filter: blur(26px) saturate(1.6); backdrop-filter: blur(26px) saturate(1.6);
  border: 1px solid var(--glass-border); box-shadow: 0 30px 80px -24px rgba(29, 0, 174, .5), inset 0 1px 0 rgba(255, 255, 255, .8);
  transform: translateX(calc(100% + 40px)); opacity: 0; transition: transform .7s var(--ease), opacity .5s;
}
.panel.open { transform: none; opacity: 1; }
.panel-close { position: absolute; top: 14px; right: 14px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .7); transition: background .25s, color .25s; }
.panel-close:hover { background: var(--blue); color: #fff; }
.panel-close.static { position: static; flex: none; }
.panel-scroll { flex: 1; overflow-y: auto; padding: 26px 24px 18px; scrollbar-width: thin; }
.panel-kicker { margin: 0 46px 8px 0; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.panel-title { font-weight: 500; font-size: 32px; line-height: 1.05; margin: 0 0 18px; letter-spacing: -.02em; }
.specs { display: grid; grid-template-columns: auto 1fr; margin: 0 0 14px; font-size: 15px; border-bottom: 1px solid var(--line); }
.specs dt, .specs dd { margin: 0; padding: 11px 0; border-top: 1px solid var(--line); }
.specs dt { color: var(--muted); }
.specs dd { text-align: right; font-weight: 500; }
.scale-note { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; margin: 0 0 14px; padding: 6px 12px; border-radius: 999px; background: var(--blue-soft); }
.scale-note .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.detail-strip { display: flex; gap: 8px; overflow-x: auto; margin: 0 -24px 16px; padding: 2px 24px; scrollbar-width: none; }
.detail-strip::-webkit-scrollbar { display: none; }
.detail-strip button { flex: none; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: var(--blue-soft); transition: transform .25s var(--ease); }
.detail-strip button:hover { transform: translateY(-2px); }
.detail-strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.panel-actions { margin-bottom: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-line { width: 100%; padding: 12px 8px; border-radius: 999px; font-size: 14px; font-weight: 500; border: 1px solid var(--blue); transition: background .25s, color .25s, transform .25s var(--ease); }
.btn-line:hover, .btn-line.on { background: var(--blue); color: #fff; }
#btn-details { background: var(--blue); color: #fff; box-shadow: 0 10px 22px -12px rgba(29, 0, 174, .8); }
#btn-details:hover { background: var(--blue-2); }
.swap-title { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.swap-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.swap-item { position: relative; text-align: left; }
.swap-item .thumb { display: block; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: var(--blue-soft); outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .25s, transform .3s var(--ease); }
.swap-item:hover .thumb { transform: translateY(-2px); }
.swap-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease); }
.swap-item:hover img { transform: scale(1.06); }
.swap-item .t { display: block; font-size: 12.5px; font-weight: 500; line-height: 1.25; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swap-item .d { display: block; font-size: 11px; color: var(--muted); }
.swap-item.current .thumb { outline-color: var(--blue); }
.swap-item .badge { position: absolute; top: 6px; left: 6px; right: 6px; width: fit-content; max-width: calc(100% - 12px); font-size: 9.5px; font-weight: 600; padding: 3px 7px; border-radius: 99px; background: rgba(255, 255, 255, .92); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swap-item.current .badge { background: var(--blue); color: #fff; }
.panel-nav { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 500; color: var(--muted); }
.panel-nav button { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--blue); transition: background .25s, color .25s; }
.panel-nav button:hover { background: var(--blue); color: #fff; }

/* ---------- Collection ---------- */
.collection {
  position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column;
  background: rgba(246, 246, 252, .8); -webkit-backdrop-filter: blur(30px) saturate(1.4); backdrop-filter: blur(30px) saturate(1.4);
  opacity: 0; visibility: hidden; transition: opacity .45s, visibility .45s;
}
.collection.open { opacity: 1; visibility: visible; }
.collection-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; width: min(100%, 1180px); margin: 0 auto; padding: 30px 18px 18px; }
.collection-title { font-weight: 500; font-size: clamp(36px, 6vw, 60px); margin: 0; line-height: 1; letter-spacing: -.025em; }
.collection-head .panel-kicker { margin: 0 0 8px; }
.collection-head .panel-close { background: #fff; box-shadow: 0 6px 18px -8px rgba(29, 0, 174, .4); }
.collection-grid { flex: 1; overflow-y: auto; width: min(100%, 1180px); margin: 0 auto; padding: 8px 18px 48px; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 22px 16px; align-content: start; }
.collection-grid .swap-item { background: #fff; border-radius: 18px; padding: 8px 8px 12px; box-shadow: 0 12px 30px -20px rgba(29, 0, 174, .5); transition: transform .35s var(--ease), box-shadow .35s; }
.collection-grid .swap-item:hover { transform: translateY(-4px); box-shadow: 0 22px 40px -22px rgba(29, 0, 174, .6); }
.collection-grid .swap-item:hover .thumb { transform: none; }
.collection-grid .swap-item .thumb { aspect-ratio: 4 / 5; border-radius: 12px; }
.collection-grid .swap-item .t { font-size: 15px; margin: 10px 4px 0; }
.collection-grid .swap-item .d { font-size: 12px; margin: 0 4px; }
.collection-grid .swap-item .badge { top: 14px; left: 14px; }

/* ---------- Visionneuse ---------- */
.viewer {
  position: fixed; inset: 0; z-index: 40; display: grid; grid-template-rows: 1fr auto; padding: 64px 70px 18px; color: #fff;
  background: rgba(13, 0, 89, .72); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  opacity: 0; visibility: hidden; transition: opacity .4s, visibility .4s;
}
.viewer.open { opacity: 1; visibility: visible; }
.viewer .panel-close { position: absolute; top: 16px; right: 16px; background: rgba(255, 255, 255, .9); color: var(--blue); }
.viewer-fig { margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; }
.viewer-fig img { max-width: 100%; max-height: calc(100vh - 210px); object-fit: contain; border-radius: 16px; box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .7); }
.viewer-fig figcaption { margin-top: 14px; font-size: 17px; font-weight: 500; }
.viewer-arrow { position: absolute; top: 50%; width: 48px; height: 48px; margin-top: -40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .9); color: var(--blue); transition: transform .25s var(--ease); }
.viewer-arrow:hover { transform: scale(1.06); }
.viewer-arrow.left { left: 14px; } .viewer-arrow.right { right: 14px; }
.viewer-thumbs { display: flex; gap: 8px; justify-content: center; overflow-x: auto; padding-top: 14px; }
.viewer-thumbs button { flex: none; width: 58px; height: 58px; border-radius: 12px; overflow: hidden; opacity: .5; outline: 2px solid transparent; outline-offset: 2px; transition: opacity .2s, outline-color .2s; }
.viewer-thumbs button.active { opacity: 1; outline-color: #fff; }
.viewer-thumbs button:hover { opacity: 1; }
.viewer-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .tb-links { display: none; }
}
@media (max-width: 760px) {
  .topbar { padding: 7px 8px 7px 12px; }
  .tb-logo img { width: 34px; }
  .chip span { display: none; }
  .chip { padding: 9px 11px; }
  .dock-label { min-width: 0; flex: 1; }
  .dock-title { max-width: 46vw; font-size: 15px; }
  .hint { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); font-size: 11px; white-space: normal; width: max-content; max-width: 90vw; text-align: center; border-radius: 16px; }
  .panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 62vh; border-radius: 24px; transform: translateY(calc(100% + 30px)); }
  .panel-title { font-size: 26px; margin-bottom: 12px; }
  .swap-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .viewer { padding: 60px 10px 12px; }
  .viewer-arrow { display: none; }
  .collection-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px 10px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition-duration: .01s !important; } }
[hidden] { display: none !important; }

/* ---------- Version 2D (appareils sans 3D) ---------- */
.flat { position: fixed; inset: 0; overflow: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; background: #e9e0d0; transition: opacity .22s, transform .6s cubic-bezier(.22, .8, .2, 1); }
.flat::-webkit-scrollbar { display: none; }
.flat.switching { opacity: 0; }
.flat-stage { position: relative; margin: 0 auto; }
.flat-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }
.flat-arts { position: absolute; inset: 0; -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; transition: opacity .18s; }
.flat-arts.swap { opacity: .25; }
.flat-art {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #15130f; display: block; cursor: pointer;
  filter: brightness(.96) saturate(.98); transition: filter .25s, box-shadow .25s; -webkit-tap-highlight-color: transparent;
}
.flat-art img { width: 100%; height: 100%; display: block; object-fit: cover; pointer-events: none; }
.flat-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 236, 205, .16), transparent 45%, rgba(40, 20, 0, .1)); pointer-events: none; }
.flat-art:hover, .flat-art.on { filter: brightness(1.06) saturate(1.04); }
.flat-art.on { box-shadow: 0 0 0 10px rgba(255, 255, 255, .85), 0 0 0 16px rgba(29, 0, 174, .55); }
body.flat-mode .vignette { z-index: 1; }
