@font-face { font-family: "Heliopolis"; src: url("fonts/heliopolis-light.otf") format("opentype"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Heliopolis"; src: url("fonts/heliopolis-regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Heliopolis"; src: url("fonts/heliopolis-medium.otf") format("opentype"); font-weight: 500; font-display: swap; }

:root {
  --ink: #1b1714;
  --paper: #f6f0e8;
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.8);
  --gold: #e9c58f;
  --glass-line: rgba(255, 255, 255, 0.22);
  --ok: #9ad8ac;
  --warn: #f2c46b;
  --bad: #ef9585;
  --ease: cubic-bezier(.65, .02, .2, 1);
  --font: "Heliopolis", system-ui, sans-serif;
  --gutter: clamp(16px, 3vw, 40px);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--ink); color: var(--text); font-family: var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; }
.logo-svg { display: block; width: 100%; height: auto; }

.loader { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--ink); transition: opacity .8s, visibility 0s .8s; }
.loader span { width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(255,255,255,.2); border-top-color: var(--gold); animation: spin 1s linear infinite; }
.loader.is-done { opacity: 0; visibility: hidden; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px var(--gutter); pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 150px; color: #fff; opacity: 0; transition: opacity .6s; pointer-events: none;
  filter: drop-shadow(0 1px 8px rgba(0,0,0,.35));
}
body:not([data-screen="intro"]) .brand { opacity: .95; }
.top-actions { display: flex; gap: 8px; align-items: center; margin-inline-start: auto; }
.link { background: none; border: 0; padding: 8px 6px; font-size: 14px; color: var(--text); text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.link:hover { text-decoration: underline; text-underline-offset: 4px; }
html[dir="rtl"] .arrow { display: inline-block; transform: scaleX(-1); }
.pill {
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--glass-line); background: rgba(27, 23, 20, .35);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: 999px; padding: 8px 15px; font-size: 14px;
}
.pill:hover { background: rgba(27, 23, 20, .6); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 999px; padding: 14px 26px;
  background: var(--paper); color: var(--ink); font-weight: 500; font-size: 15px;
  transition: transform .25s var(--ease), background .25s;
}
.cta:hover { transform: translateY(-1px); background: #fff; }
:is(.cta, .link, .pill, .chip, .hotspot, .room-chip):focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; overflow: hidden; opacity: 0; visibility: hidden; transition: opacity .8s ease, visibility 0s linear .8s; }
.screen.is-active { opacity: 1; visibility: visible; transition: opacity .8s ease; }
body.is-busy .screen * { pointer-events: none !important; }

/* ---------- intro ---------- */
.shot { position: absolute; inset: 0; overflow: hidden; opacity: 0; }
.shot { pointer-events: none; }
.intro-shade { z-index: 3; }
.shot-caption, .intro-copy, .intro-foot { z-index: 4; }
.shot img { width: 100%; height: 100%; object-fit: cover; will-change: transform; }
.intro-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to top, rgba(20,16,12,.75) 0%, rgba(20,16,12,.15) 45%, rgba(20,16,12,0) 65%),
    linear-gradient(to bottom, rgba(20,16,12,.35), rgba(20,16,12,0) 18%);
}
.shot-caption {
  position: absolute; inset-inline-start: var(--gutter); bottom: 64px; margin: 0;
  font-weight: 300; font-size: clamp(30px, 4.4vw, 58px); letter-spacing: -.01em;
  text-shadow: 0 2px 30px rgba(0,0,0,.35); transition: opacity .8s, transform .8s var(--ease);
}
.shot-caption.is-out { opacity: 0; transform: translateY(10px); }
.intro-copy {
  position: absolute; inset-inline-start: var(--gutter); bottom: clamp(56px, 10vh, 110px);
  max-width: 520px; padding-inline-end: var(--gutter);
  opacity: 0; transform: translateY(18px); pointer-events: none;
  transition: opacity 1s ease, transform 1.2s var(--ease);
}
#intro.is-final .intro-copy { opacity: 1; transform: none; pointer-events: auto; }
#intro.is-final .shot-caption { opacity: 0; }
.intro-logo { width: min(420px, 78vw); color: #fff; margin-bottom: 22px; filter: drop-shadow(0 2px 20px rgba(0,0,0,.3)); }
.lead { font-size: clamp(16px, 1.4vw, 19px); line-height: 1.6; color: var(--text-dim); margin: 0 0 28px; max-width: 440px; }
.intro-foot { position: absolute; inset-inline: var(--gutter); bottom: 20px; display: flex; align-items: center; justify-content: space-between; }
.dots { display: flex; gap: 6px; }
.dots i { width: 22px; height: 2px; background: rgba(255,255,255,.35); border-radius: 2px; transition: background .4s; }
.dots i.is-on { background: #fff; }
#intro.is-final #skipBtn { visibility: hidden; }

/* ---------- towers ---------- */
.views { position: absolute; inset: 0; transition: transform 1.2s cubic-bezier(.2,.7,.2,1); }
.view { position: absolute; opacity: 0; transition: opacity .9s ease; pointer-events: none; }
.view.is-shown { opacity: 1; pointer-events: auto; }
.view img, .view svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.view svg { direction: ltr; overflow: visible; }
.tower-shade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(20,16,12,.38), rgba(20,16,12,0) 16%);
}
html:not([dir="rtl"]) .tower-shade { background: linear-gradient(to bottom, rgba(20,16,12,.38), rgba(20,16,12,0) 16%), linear-gradient(to left, rgba(20,16,12,.32), rgba(20,16,12,0) 40%); }
html[dir="rtl"] .tower-shade { background: linear-gradient(to bottom, rgba(20,16,12,.38), rgba(20,16,12,0) 16%), linear-gradient(to right, rgba(20,16,12,.32), rgba(20,16,12,0) 40%); }

.floor-band { fill: transparent; cursor: pointer; }
.tower-dim { fill: rgba(10, 14, 24, 0); transition: fill .35s; pointer-events: none; }
svg.is-hovering .tower-dim { fill: rgba(10, 14, 24, .3); }
.pick { transition: transform .18s var(--ease); }
.floor-glow { fill: rgba(255, 214, 150, .55); mix-blend-mode: screen; pointer-events: none; }
.floor-edge { fill: none; stroke: rgba(255, 240, 210, .95); stroke-width: 2.5; pointer-events: none; }
.floor-tag { transition: transform .18s var(--ease); pointer-events: none; }
.floor-tag line { stroke: rgba(255,255,255,.9); }
.floor-tag text { fill: #fff; font-family: var(--font); font-weight: 300; paint-order: stroke; stroke: rgba(0,0,0,.18); stroke-width: 2; }

.view-switch {
  position: absolute; bottom: 20px; inset-inline-start: var(--gutter); display: flex; gap: 4px;
  padding: 4px; border-radius: 999px; background: rgba(27, 23, 20, .4); border: 1px solid var(--glass-line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.view-switch .chip { border: 0; }

.panel {
  position: absolute; top: 72px; inset-inline-end: var(--gutter);
  max-height: calc(100% - 96px); width: min(370px, calc(36vw - 2 * var(--gutter)));
  display: flex; flex-direction: column; padding: 28px 26px 22px; overflow-y: auto;
  background: linear-gradient(180deg, rgba(40, 30, 22, .52), rgba(27, 23, 20, .5));
  border: 1px solid var(--glass-line); border-radius: 4px;
  backdrop-filter: blur(22px) saturate(1.15); -webkit-backdrop-filter: blur(22px) saturate(1.15);
  box-shadow: 0 30px 80px rgba(0,0,0,.25);
  opacity: 0; transform: translateX(40px);
  transition: opacity .8s ease .5s, transform 1s var(--ease) .5s;
}
html[dir="rtl"] .panel { transform: translateX(-40px); }
#tower.is-active .panel { opacity: 1; transform: none; }
body.is-diving .panel { opacity: 0 !important; transition-delay: 0s; }
.panel h2 { font-weight: 300; font-size: clamp(34px, 3.1vw, 44px); line-height: 1.05; margin: 0 0 14px; color: var(--paper); }
.panel-lead { font-size: 14px; line-height: 1.6; margin: 0 0 20px; color: var(--text-dim); }
.tower-switch { display: flex; gap: 6px; margin-bottom: 18px; }
.chip { border: 1px solid var(--glass-line); background: transparent; border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--text-dim); }
.chip[aria-selected="true"] { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.level-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.level-label { font-size: 15px; color: var(--text-dim); }
.level-num { font-weight: 300; font-size: clamp(64px, 6vw, 88px); line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; }
.badge { margin-inline-start: auto; align-self: center; font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid currentColor; }
.badge[data-s="available"] { color: var(--ok); }
.badge[data-s="reserved"] { color: var(--warn); }
.badge[data-s="sold"] { color: var(--bad); }
.panel h3 { font-weight: 500; font-size: 18px; margin: 6px 0; }
.unit-desc { font-size: 14px; line-height: 1.6; color: var(--text-dim); margin: 0 0 16px; min-height: 4.8em; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 20px; }
.facts div { border-top: 1px solid var(--glass-line); padding-top: 8px; }
.facts dt { font-size: 12px; color: var(--text-dim); }
.facts dd { margin: 4px 0 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.range { width: 100%; margin: 4px 0 18px; accent-color: var(--gold); height: 22px; flex: none; }
.cta-block { width: 100%; }
.hint { font-size: 12px; color: var(--text-dim); text-align: center; margin: 12px 0 0; }

/* ---------- interior ---------- */
#interior { background: #111; }
.scene { position: absolute; inset: 0; overflow: hidden; opacity: 0; }
.scene.is-front { opacity: 1; }
.scene img { width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 50%; }
.scene.is-front img { animation: drift 24s linear forwards; }
@keyframes drift { from { transform: scale(1); } to { transform: scale(1.06); } }
.interior-shade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(10,10,12,.62) 0%, rgba(10,10,12,0) 42%), linear-gradient(to bottom, rgba(10,10,12,.38) 0%, rgba(10,10,12,0) 14%);
}
.hotspots { position: absolute; inset: 0; pointer-events: none; }
.hotspot {
  position: absolute; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  border: 1px solid rgba(255,255,255,.4); border-radius: 3px;
  background: rgba(30, 26, 22, .45); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 7px 11px; font-size: 13px; pointer-events: auto; opacity: 0; transition: opacity .5s, background .2s;
}
.hotspots.is-shown .hotspot { opacity: 1; }
.hotspot:hover { background: rgba(30, 26, 22, .75); }
.hotspot::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: ping 2.2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.7); } 70% { box-shadow: 0 0 0 9px rgba(255,255,255,0); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } }
.caption {
  position: absolute; inset-inline-start: var(--gutter); bottom: 108px; max-width: 560px;
  opacity: 0; transform: translateY(12px); transition: opacity .7s, transform .7s var(--ease);
}
.caption.is-shown { opacity: 1; transform: none; }
.caption h2 { font-weight: 300; font-size: clamp(34px, 4.8vw, 62px); line-height: 1.08; margin: 0 0 12px; text-shadow: 0 2px 30px rgba(0,0,0,.35); }
.caption p { font-size: 15px; line-height: 1.6; margin: 0; color: rgba(255,255,255,.9); max-width: 430px; text-shadow: 0 1px 12px rgba(0,0,0,.5); }
.room-strip { position: absolute; inset-inline: var(--gutter); bottom: 22px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; opacity: 0; transition: opacity .5s; }
.room-strip::-webkit-scrollbar { display: none; }
.room-strip.is-shown { opacity: 1; }
.room-chip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 4px 12px 4px 4px;
  background: rgba(27, 23, 20, .45); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 13px;
}
html[dir="rtl"] .room-chip { padding: 4px 4px 4px 12px; }
.room-chip img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.room-chip[aria-current="true"] { background: var(--paper); color: var(--ink); border-color: var(--paper); }

.clip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; background: transparent; }
.flash { position: fixed; inset: 0; z-index: 25; background: #fff; opacity: 0; pointer-events: none; }
body.is-busy { cursor: progress; }

/* ---------- dialog ---------- */
.dialog { border: 0; border-radius: 6px; padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--paper); color: var(--ink); font-family: var(--font); }
.dialog::backdrop { background: rgba(10, 12, 16, .55); backdrop-filter: blur(4px); }
.dialog form { padding: 28px; display: grid; gap: 14px; }
.dialog h2 { font-weight: 300; font-size: 30px; margin: 0; }
.dialog p { margin: 0; font-size: 14px; line-height: 1.5; color: #555; }
.dialog label { display: grid; gap: 6px; font-size: 13px; color: #444; }
.dialog input { font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid #d8d0c4; border-radius: 4px; background: #fff; color: var(--ink); }
.dialog input[readonly] { background: #efe9e0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.dialog .link { color: var(--ink); text-shadow: none; }
.dialog .cta { background: var(--ink); color: var(--paper); }
.thanks { color: #2d6a43 !important; font-weight: 500; }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  .panel {
    top: auto; bottom: 0; inset-inline: 0; width: auto; max-height: 46svh;
    border-radius: 14px 14px 0 0; padding: 18px 18px 14px; transform: translateY(40px) !important;
  }
  #tower.is-active .panel { transform: none !important; }
  .panel h2 { font-size: 26px; margin-bottom: 6px; }
  .panel-lead, .hint, .unit-desc { display: none; }
  .tower-switch { margin-bottom: 8px; }
  .level-num { font-size: 52px; }
  .facts { margin-bottom: 12px; }
  .range { margin-bottom: 10px; }
  .view-switch { bottom: auto; top: 60px; }
  .caption { bottom: 84px; inset-inline-end: var(--gutter); }
  .caption p { font-size: 14px; }
  .brand { display: none; }
  .hotspot { font-size: 12px; padding: 6px 9px; }
  .shot-caption { bottom: 56px; }
  #backLabel { display: none; }
  .back-btn-arrow { font-size: 18px; }
  .pill { white-space: nowrap; padding: 7px 12px; font-size: 13px; }
  .floor-tag { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .scene.is-front img, .hotspot::after, .loader span { animation: none; }
}

/* ---------- camera glide (served over http) ---------- */
#glide { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 5; pointer-events: none; }
body.gl #intro { z-index: 8; }
body.gl #tower { z-index: 7; }
body.gl #interior { z-index: 6; background: transparent; }
body.gl .scene, body.gl .interior-shade { visibility: hidden; }
body.gl #interior::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(10,10,12,.62) 0%, rgba(10,10,12,0) 42%), linear-gradient(to bottom, rgba(10,10,12,.38) 0%, rgba(10,10,12,0) 14%);
}
body.gl-top #glide { z-index: 9; }
.screen.no-fade { transition: none !important; }
