/* L'univers Belel : tokens tirés du logo (cacao) et de Dakar au couchant (laiton, sable, Atlantique). */
:root {
  --cacao: #3A2218;
  --cacao-deep: #22130C;
  --glass: rgba(34, 19, 12, 0.8);
  --laiton: #D6B175;
  --laiton-soft: rgba(214, 177, 117, 0.28);
  --sable: #F1E6D2;
  --sable-dim: rgba(241, 230, 210, 0.72);
  --atlantique: #16404A;
  --braise: #EE9457;
  --display: 'Marcellus', 'Times New Roman', serif;
  --text: 'Albert Sans', system-ui, sans-serif;
  --gutter: clamp(16px, 2.4vw, 32px);
  --ease: cubic-bezier(.2, .7, .1, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--cacao-deep);
  color: var(--sable);
  font: 400 15px/1.55 var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input { font: inherit; color: inherit; }
a { color: var(--laiton); }
:focus-visible { outline: 2px solid var(--laiton); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------- Libellés dans la scène ---------- */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.label {
  position: absolute; left: 0; top: 0;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 4px 10px 14px; border: 0; background: none; cursor: pointer;
  pointer-events: auto; will-change: transform;
  text-shadow: 0 1px 12px rgba(20, 10, 5, .9), 0 0 2px rgba(20, 10, 5, .8);
  transition: opacity .4s var(--ease);
}
.label::after {
  content: ''; position: absolute; bottom: 0; left: 50%; width: 1px; height: 10px;
  background: linear-gradient(var(--laiton), transparent);
}
.label__name, .label__place { transform: scale(var(--s, 1)); transform-origin: 50% 100%; transition: color .25s; }
.label__name { font: 19px/1.1 var(--display); letter-spacing: .02em; }
.label__place { font-size: 12px; color: var(--sable-dim); }
.label:hover .label__name, .label.is-hover .label__name, .label.is-focus .label__name { color: var(--laiton); }
.label.is-dim { opacity: .35; }
.label--hq .label__name { font-size: 15px; }
.label--veiled .label__name { font-style: italic; color: var(--laiton); }
body:not(.is-entered) #labels, body.in-view #labels { opacity: 0; pointer-events: none; }
#labels { transition: opacity .8s var(--ease); }

.place {
  position: absolute; left: 0; top: 0; font: 13px var(--display); letter-spacing: .12em;
  color: rgba(241, 230, 210, .78); text-shadow: 0 1px 8px rgba(20, 10, 5, .9); white-space: nowrap;
}
.place--sea { font-style: italic; letter-spacing: .3em; color: rgba(241, 230, 210, .55); }

/* ---------- HUD ---------- */
.hud { position: fixed; left: 0; right: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: var(--gutter); pointer-events: none; transition: opacity 1s var(--ease), transform 1s var(--ease); }
.hud > * { pointer-events: auto; }
.hud--top { top: 0; padding-top: max(var(--gutter), env(safe-area-inset-top)); }
.hud--bottom { bottom: 0; align-items: flex-end; padding-bottom: max(var(--gutter), env(safe-area-inset-bottom)); }
body:not(.is-entered) .hud { opacity: 0; pointer-events: none; }
body:not(.is-entered) .hud--top { transform: translateY(-12px); }
body:not(.is-entered) .hud--bottom { transform: translateY(12px); }

.brand { display: flex; align-items: center; gap: 12px; height: 48px; padding: 4px 20px 4px 4px; border: 1px solid var(--laiton-soft); border-radius: 999px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); cursor: pointer; }
.brand:hover { border-color: var(--laiton); }
.brand img { width: 38px; height: 38px; border-radius: 50%; }
.brand__name { font: 19px var(--display); letter-spacing: .04em; white-space: nowrap; }

.tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tool {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px 0 12px;
  border: 1px solid var(--laiton-soft); border-radius: 999px; background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); cursor: pointer; font-size: 14px;
  transition: border-color .2s, background .2s;
}
.tool svg, .panel__close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover { border-color: var(--laiton); }
.tool[aria-pressed="true"] { background: rgba(214, 177, 117, .18); border-color: var(--laiton); }
.tool--accent { background: var(--laiton); color: var(--cacao-deep); border-color: var(--laiton); font-weight: 600; }
.tool--accent:hover { background: #E3C38C; }

.where { margin: 0; display: flex; flex-direction: column; min-width: 180px; text-shadow: 0 1px 10px rgba(20, 10, 5, .8); }
#where { font: 18px var(--display); }
#coords { font-size: 12px; color: var(--sable-dim); font-variant-numeric: tabular-nums; white-space: pre; }

/* Barre des résidences : des arches, comme le logo */
.rail { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; align-items: flex-end; }
.rail__item {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 1px;
  min-width: 104px; padding: 22px 14px 12px; border: 1px solid var(--laiton-soft);
  border-radius: 999px 999px 6px 6px; background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); cursor: pointer;
  transition: background .3s var(--ease), border-color .3s, padding .4s var(--ease), color .3s;
}
.rail__name { font: 17px/1.1 var(--display); letter-spacing: .02em; white-space: nowrap; }
.rail__place { font-size: 11.5px; color: var(--sable-dim); white-space: nowrap; }
.rail__item:hover { border-color: var(--laiton); padding-top: 30px; }
.rail__item.is-active { background: var(--laiton); color: var(--cacao-deep); border-color: var(--laiton); padding-top: 34px; }
.rail__item.is-active .rail__place { color: rgba(34, 19, 12, .75); }
.rail__item--veiled { border-style: dashed; }
.rail__item--veiled .rail__name { font-style: italic; }
.hud--bottom nav { margin-left: auto; margin-right: auto; }
body.has-panel .hud--bottom nav { margin-right: calc(min(440px, 40vw) + var(--gutter)); }
body.has-panel .where { opacity: 0; pointer-events: none; }
body.has-panel .hud--bottom { justify-content: flex-start; }
body.has-panel .rail__place { display: none; }
body.has-panel .rail__item { min-width: 0; padding: 18px 16px 10px; }
body.has-panel .rail__item.is-active { padding-top: 26px; }
#where { white-space: nowrap; }
.where { transition: opacity .4s var(--ease); }

.hint {
  position: fixed; left: 50%; bottom: 128px; z-index: 11; margin: 0; max-width: min(92vw, 460px);
  padding: 10px 18px; border-radius: 999px; background: var(--glass); border: 1px solid var(--laiton-soft);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); text-align: center; font-size: 14px;
  transform: translate(-50%, 8px); opacity: 0; transition: opacity .6s var(--ease), transform .6s var(--ease); pointer-events: none;
}
.hint.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border-radius: 999px; border: 1px solid transparent; background: none; text-decoration: none; cursor: pointer;
  font-size: 15px; font-weight: 500; color: var(--sable); transition: background .2s, border-color .2s, color .2s;
}
.btn--primary { background: var(--laiton); color: var(--cacao-deep); font-weight: 600; }
.btn--primary:hover { background: #E3C38C; }
.btn--primary:disabled { opacity: .6; cursor: progress; }
.btn--line { border-color: var(--laiton-soft); }
.btn--line:hover { border-color: var(--laiton); }
.btn--ghost { padding: 0 4px; min-height: 36px; color: var(--laiton); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--laiton-soft); }
.btn--ghost:hover { text-decoration-color: var(--laiton); }
.btn--sm { font-size: 13.5px; }
.btn--lg { min-height: 54px; padding: 0 30px; font-size: 16px; }

/* ---------- Fiche résidence ---------- */
.panel {
  position: fixed; z-index: 20; top: calc(var(--gutter) + 64px); right: var(--gutter); bottom: var(--gutter);
  width: min(440px, 40vw); overflow-y: auto; overscroll-behavior: contain;
  padding: 36px 32px 28px; border-radius: 22px; background: var(--glass);
  border: 1px solid var(--laiton-soft); backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: 0 30px 80px rgba(10, 5, 2, .45);
  transform: translateX(calc(100% + 40px)); transition: transform .6s var(--ease);
  scrollbar-width: thin; scrollbar-color: var(--laiton-soft) transparent;
}
.panel.is-open { transform: none; }
body.in-view .panel { transform: translateX(calc(100% + 40px)); }
.panel__close {
  position: sticky; top: 0; float: right; margin: -20px -14px 0 0; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--laiton-soft); background: var(--cacao-deep); cursor: pointer; z-index: 2;
}
.panel__close:hover { border-color: var(--laiton); }

.p-head { margin-bottom: 18px; }
.p-district { margin: 0 0 6px; font-size: 13.5px; color: var(--sable-dim); max-width: 32ch; }
.panel h2 { margin: 0; font: 400 clamp(40px, 4.4vw, 56px)/1 var(--display); letter-spacing: .01em; outline: none; }
.p-tagline { margin: 10px 0 0; font: 19px/1.35 var(--display); color: var(--laiton); }
.p-status { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 5px 12px 5px 10px; border-radius: 999px; background: rgba(238, 148, 87, .12); font-size: 13px; }
.p-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--braise); box-shadow: 0 0 0 4px rgba(238, 148, 87, .2); }
.p-price { display: grid; gap: 2px; margin: 0 0 20px; padding: 16px 0; border-block: 1px solid var(--laiton-soft); }
.p-price span, .p-price small { font-size: 13px; color: var(--sable-dim); }
.p-price strong { font: 400 30px/1.15 var(--display); color: var(--sable); font-variant-numeric: tabular-nums; }
.p-price--ask strong { font-size: 22px; }
.p-desc { margin: 0 0 22px; font-size: 16px; line-height: 1.6; color: var(--sable); max-width: 58ch; }
.p-facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 20px; margin: 0 0 26px; }
.p-facts div { padding: 12px 0; border-top: 1px solid var(--laiton-soft); }
.p-facts dt { font-size: 12.5px; color: var(--sable-dim); }
.p-facts dd { margin: 2px 0 0; font: 20px/1.3 var(--display); }
.p-facts div:has(dd:not(:only-child)), .p-facts div:nth-child(3):last-child { grid-column: 1 / -1; }
.p-block { margin: 0 0 24px; }
.p-block h3 { margin: 0 0 10px; font: 400 20px var(--display); color: var(--laiton); }
.p-block p { margin: 0 0 8px; color: var(--sable-dim); max-width: 58ch; }
.p-view { padding: 18px 20px; border-radius: 120px 120px 14px 14px; background: linear-gradient(180deg, rgba(238, 148, 87, .16), rgba(22, 64, 74, .28)); border: 1px solid var(--laiton-soft); text-align: center; }
.p-view p { margin-inline: auto; max-width: 30ch; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--laiton-soft); font-size: 13px; color: var(--sable); }
.p-actions { display: grid; gap: 8px; margin: 28px 0 22px; }
.p-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 16px; border-top: 1px solid var(--laiton-soft); font-size: 13px; color: var(--sable-dim); }

/* ---------- Vue depuis les étages ---------- */
.viewbar {
  position: fixed; z-index: 20; left: 50%; bottom: max(var(--gutter), env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(560px, calc(100vw - 2 * var(--gutter))); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px 18px;
  padding: 16px 20px; border-radius: 20px; background: var(--glass); border: 1px solid var(--laiton-soft);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.viewbar[hidden] { display: none; }
#floor-label { font: 20px var(--display); white-space: nowrap; min-width: 8ch; display: inline-block; }
.viewbar__note { grid-column: 1 / -1; margin: 0; font-size: 12.5px; color: var(--sable-dim); order: 3; }
input[type="range"] { accent-color: var(--laiton); width: 100%; height: 28px; cursor: pointer; }
body.in-view .hud--bottom, body.in-view .hint { opacity: 0; pointer-events: none; }

/* ---------- Liste ---------- */
.list {
  width: min(960px, calc(100vw - 2 * var(--gutter))); max-height: calc(100vh - 2 * var(--gutter)); padding: 0;
  border: 1px solid var(--laiton-soft); border-radius: 22px; background: #2A1810; color: var(--sable);
}
.list::backdrop { background: rgba(20, 10, 5, .6); backdrop-filter: blur(6px); }
.list__head { display: flex; align-items: center; justify-content: space-between; padding: 24px 28px 8px; }
.list__head h2 { margin: 0; font: 400 30px var(--display); }
.list__head .panel__close { position: static; float: none; margin: 0; }
.list__scroll { overflow: auto; padding: 0 28px 24px; }
.list table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.list th, .list td { text-align: left; padding: 14px 12px 14px 0; border-bottom: 1px solid var(--laiton-soft); vertical-align: top; }
.list thead th { font-weight: 500; font-size: 12.5px; color: var(--sable-dim); }
.list tbody th { font: 400 20px var(--display); white-space: nowrap; }
.list td:nth-child(5) { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Intro : on entre par l'arche ---------- */
.intro { position: fixed; inset: 0; z-index: 50; overflow: hidden; }
.arch-wrap { position: absolute; inset: 0; display: grid; place-items: center; padding-left: 34vw; pointer-events: none; }
.arch-window {
  width: clamp(240px, 26vw, 400px); aspect-ratio: 3 / 4.3; border-radius: 999px 999px 0 0;
  box-shadow: 0 0 0 300vmax var(--cacao); outline: 1px solid rgba(214, 177, 117, .55); outline-offset: 10px;
  will-change: transform;
}
.intro__copy { position: absolute; left: clamp(24px, 7vw, 120px); bottom: clamp(32px, 11vh, 120px); max-width: 480px; }
.intro__logo { width: 64px; height: 64px; border-radius: 14px; box-shadow: 0 0 0 1px var(--laiton-soft); display: block; margin-bottom: 28px; }
.intro h1 { margin: 0 0 18px; font: 400 clamp(52px, 7.4vw, 112px)/.95 var(--display); letter-spacing: -.005em; }
.intro p { margin: 0 0 30px; font-size: 17px; line-height: 1.6; color: var(--sable-dim); max-width: 40ch; }
.intro__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.check { display: inline-flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--sable-dim); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--laiton); }
body.is-entering .intro__copy { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
body.is-entering .arch-window { outline-color: transparent; transition: outline-color .4s; }

.noscript { position: fixed; inset: auto 0 0; padding: 20px; text-align: center; background: var(--cacao); z-index: 60; }
body.no-webgl .arch-window { box-shadow: none; background: var(--atlantique); }
body.no-webgl .intro { background: var(--cacao); }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .tool { width: 40px; padding: 0; justify-content: center; }
  .tool .btn-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .brand { padding-right: 4px; }
  .brand__name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tools { flex-wrap: nowrap; gap: 6px; }
  .place { display: none; }
  .hud--bottom { flex-direction: column; align-items: stretch; gap: 10px; padding-inline: 0; }
  .where { padding-inline: var(--gutter); }
  #coords { display: none; }
  .hud--bottom nav { margin: 0; }
  body.has-panel .hud--bottom nav { margin: 0; }
  .rail { overflow-x: auto; padding: 0 var(--gutter) 2px; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .rail li { scroll-snap-align: center; }
  .rail__item { min-width: 96px; padding-top: 18px; }
  body.has-panel .hud--bottom { opacity: 0; pointer-events: none; }
  .hint { bottom: 150px; border-radius: 16px; width: calc(100vw - 2 * var(--gutter)); }

  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 60vh; padding: 26px 20px max(24px, env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0; transform: translateY(105%);
  }
  body.in-view .panel { transform: translateY(105%); }
  .panel h2 { font-size: 40px; }
  .panel__close { margin: -10px -6px 0 0; }

  .viewbar { grid-template-columns: 1fr auto; }
  .viewbar input { grid-column: 1 / -1; order: 2; }

  .arch-wrap { padding: 9vh 0 0; place-items: start center; }
  .arch-window { width: min(56vw, 250px); }
  .intro__copy { left: var(--gutter); right: var(--gutter); bottom: max(28px, env(safe-area-inset-bottom)); }
  .intro__logo { display: none; }
  .intro h1 { font-size: 48px; }
  .intro p { font-size: 15.5px; margin-bottom: 22px; }
}
@media (max-height: 640px) and (min-width: 761px) {
  .rail__item { padding-top: 14px; padding-bottom: 8px; }
  .intro__logo { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
