/* Manrope stands in for Roobert, the design's (commercial) typeface. */
@font-face {
  font-family: Manrope;
  src: url("/shared/fonts/Manrope-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Manrope;
  src: url("/shared/fonts/Manrope-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: Manrope;
  src: url("/shared/fonts/Manrope-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #212325;
  --accent: #e1debf;
  --glass: rgba(54, 54, 54, 0.77);
  --glass-line: rgba(121, 121, 121, 0.6);
  --ease-quick: cubic-bezier(0.2, 0.9, 0.2, 1);
}

html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; }
body { font-family: Manrope, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #fff; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; }
#stage { position: fixed; inset: 0; user-select: none; -webkit-user-select: none; }

#canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; outline: none;
  /* Horizontal drags rotate the building; vertical swipes still scroll the host page when embedded. */
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}
#canvas.dragging { cursor: grabbing; }

/* Frosted glass: a luminosity-blended grey over a blurred backdrop. */
.glass { isolation: isolate; backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); }
.glass::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: var(--glass); mix-blend-mode: luminosity;
}

/* ---------- Main menu ---------- */
.topbar {
  position: absolute; top: 15px; left: 50%; transform: translateX(-50%);
  max-width: calc(100% - 24px);
}
.menu {
  position: relative; display: flex; align-items: center; height: 68px; padding: 0 14px; border-radius: 20px;
  border: 1px solid var(--glass-line);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.26), 0 4px 0 1px rgba(0, 0, 0, 0.34), 0 14px 35px rgba(112, 112, 112, 0.28);
}
.menu .divider { height: 68px; width: 19px; display: block; }
.tabs { display: flex; align-items: center; }
.icon-btn { display: flex; padding: 5px; cursor: pointer; }
.icon-btn img { display: block; }
.icon-btn:disabled { cursor: default; }
.tab {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 22px 20px;
  font-size: 13px; font-weight: 600; line-height: normal; white-space: nowrap; opacity: 0.5;
}
.tab img { display: block; flex: none; }
.tab:disabled { cursor: default; }
.tab.active {
  opacity: 1; cursor: default;
  background: radial-gradient(ellipse 50% 86% at 50% 100%, rgba(225, 222, 191, 0.19), rgba(225, 222, 191, 0));
}
.tab.active::after {
  content: ""; position: absolute; bottom: 0; left: calc(50% + 0.5px); transform: translateX(-50%);
  width: 17px; height: 4px; border-radius: 6px; background: var(--accent);
}

/* ---------- Bottom navigation ---------- */
.navigation {
  position: absolute; bottom: 27px; left: 50%; transform: translateX(-50%);
  width: 168px; height: 168px; pointer-events: none;
}
.cube-frame {
  position: absolute; left: 50%; top: calc(50% - 0.5px); transform: translate(-50%, -50%);
  width: 104px; height: 104px; box-sizing: border-box; border-radius: 58px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.19); background: rgba(0, 0, 0, 0.3);
  display: grid; place-items: center;
}
.cube { position: relative; width: 36px; height: 36px; }
.cube svg { display: block; overflow: visible; }

.turn-btn {
  position: absolute; top: calc(50% - 0.5px); transform: translateY(-50%);
  display: flex; align-items: center; height: 44px; padding: 0 9px; box-sizing: border-box;
  border-radius: 22px; border: 1px solid var(--glass-line); cursor: pointer; pointer-events: auto;
  filter: drop-shadow(0 14px 17.5px rgba(112, 112, 112, 0.28));
  touch-action: none; -webkit-touch-callout: none;
}
.turn-btn.left { right: calc(114px + 5px); }
.turn-btn.right { left: calc(114px + 5px); }
.turn-btn img { display: block; flex: none; }
.turn-label {
  font-size: 12px; font-weight: 400; color: rgba(255, 255, 255, 0.7); white-space: nowrap;
  max-width: 0; opacity: 0; overflow: hidden;
  transition: max-width 0.5s var(--ease-quick), opacity 0.5s var(--ease-quick), padding 0.5s var(--ease-quick);
}
.turn-btn:hover .turn-label, .turn-btn:focus-visible .turn-label { max-width: 120px; opacity: 1; }
.turn-btn.left:hover .turn-label, .turn-btn.left:focus-visible .turn-label { padding: 0 6px 0 5px; }
.turn-btn.right:hover .turn-label, .turn-btn.right:focus-visible .turn-label { padding: 0 5px 0 6px; }
.turn-btn:active { transform: translateY(-50%) scale(0.96); }

[hidden] { display: none !important; }

/* ---------- Idle + transition videos ---------- */
.clips { position: absolute; inset: 0; overflow: hidden; background: #000; touch-action: pan-y; -webkit-tap-highlight-color: transparent; }
.clips-poster, .clips-loop, .clips-move {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none;
}
/* The fade into and out of a sub-scene; it also swallows taps while it runs. */
.scene-fade { position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity 0.35s ease; pointer-events: none; }
.scene-fade.on { opacity: 1; pointer-events: auto; }
.clips-fade { position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity 0.35s ease; pointer-events: none; }
.clips-fade.on { opacity: 1; }
.clips-spots { position: absolute; inset: 0; pointer-events: none; }
.clips-daynight {
  position: absolute; top: 15px; right: 24px; display: flex; align-items: center; gap: 8px;
  height: 52px; min-width: 52px; padding: 0 16px; box-sizing: border-box; border-radius: 26px;
  border: 1px solid var(--glass-line); cursor: pointer; font-size: 14px; font-weight: 600;
}
.clips-daynight img { display: block; flex: none; }
.turn-btn:disabled { opacity: 0.35; cursor: default; }
body.mode-clips #canvas, body.mode-clips #spots, body.mode-clips #loadbar { display: none !important; }

/* Sales menus on idle videos: a dot per unit in its status colour (the button around it is big enough
   to tap), the unit's code next to it on hover; filtered-out units fade away. */
.unit-pin {
  position: absolute; left: 0; top: 0; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0;
  border: 0; background: none; cursor: pointer; pointer-events: none; opacity: 0; transition: opacity 0.25s;
  display: grid; place-items: center; -webkit-tap-highlight-color: transparent;
}
.unit-pin.shown { opacity: 1; pointer-events: auto; }
.unit-pin.off { opacity: 0 !important; pointer-events: none !important; }
.unit-pin.locked { cursor: not-allowed; }
.unit-pin-dot {
  width: calc(16px * var(--bal-k, 1)); height: calc(16px * var(--bal-k, 1)); border-radius: 50%; background: var(--c, #fff); box-sizing: border-box;
  border: calc(3px * var(--bal-k, 1)) solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45); transition: transform 0.2s;
}
.unit-pin-code {
  position: absolute; left: calc(22px + 12px * var(--bal-k, 1)); top: 50%; transform: translateY(-50%); padding: 3px 9px; border-radius: 10px;
  background: rgba(10, 18, 34, 0.72); color: #fff; font-size: calc(12px * var(--bal-f, 1)); font-weight: 600; white-space: nowrap;
  font-family: var(--bal-font, Manrope), system-ui, sans-serif;
  opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.unit-pin:hover .unit-pin-dot, .unit-pin.strong .unit-pin-dot { transform: scale(1.35); }
.unit-pin:hover .unit-pin-code, .unit-pin.strong .unit-pin-code, .unit-pin:focus-visible .unit-pin-code { opacity: 1; }

/* The floors of the block: a scale next to the unit cards, the current floor marked with a line. */
.clips-floors {
  position: absolute; top: 50%; right: 24px; transform: translateY(-50%); display: flex; flex-direction: column;
  align-items: flex-end; gap: 2px; max-height: 60%; overflow-y: auto; scrollbar-width: none;
}
.clips-floors::-webkit-scrollbar { display: none; }
.clips-floors button {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 44px; height: 36px; padding: 0 2px;
  border: 0; background: none; color: rgba(255, 255, 255, 0.55); font-size: 14px; cursor: pointer;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.clips-floors button::after { content: ''; width: 10px; height: 1px; background: currentColor; transition: width 0.25s; }
.clips-floors button.active { color: #fff; font-size: 17px; font-weight: 700; }
.clips-floors button.active::after { width: 34px; }
.clips-floors button:disabled { cursor: default; }
body.mode-sales .clips-floors { right: 282px; }
body.mode-sales .clips-daynight { right: 286px; }

/* Floor up and down: round buttons above and below the cube. */
.floor-btn {
  position: absolute; left: 50%; width: 44px; height: 44px; margin-left: -22px; padding: 0; border-radius: 50%;
  border: 1px solid var(--glass-line); display: grid; place-items: center; cursor: pointer; pointer-events: auto;
}
.floor-btn.up { top: -24px; }
.floor-btn.up img { transform: rotate(180deg); }
.floor-btn.down { bottom: -24px; }
.floor-btn:disabled { opacity: 0.35; cursor: default; }
body.has-floors .navigation { bottom: 48px; }

/* A block's balloon opens a summary of its units, with the way in. */
.block-pop {
  position: absolute; z-index: 5; width: 240px; padding: 18px 18px 16px; box-sizing: border-box; border-radius: 20px;
  border: 1px solid var(--glass-line); color: #fff;
}
.block-pop-close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.block-pop-title { margin: 0 34px 2px 0; font-size: 18px; font-weight: 700; }
.block-pop-total { margin: 0 0 10px; font-size: 13px; color: rgba(255, 255, 255, 0.65); }
.block-pop-rows { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.block-pop-rows li { display: flex; align-items: center; gap: 8px; }
.block-pop-rows li::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.block-pop-rows b { margin-left: auto; font-weight: 700; }
.block-pop-go {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 44px; border-radius: 22px;
  border: 1px solid var(--glass-line); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}

/* ---------- Balloons ---------- */
.spots { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
/* The balloons themselves: /shared/balloon.css. */

/* ---------- Space panel ---------- */
.panel {
  position: absolute; left: 0; top: 0; z-index: 5; box-sizing: border-box; padding: 1.5px;
  display: flex; flex-direction: column; max-height: calc(100% - 32px);
  border-radius: 32px; border: 1.5px solid rgba(255, 255, 255, 0.16);
  background: rgba(45, 45, 45, 0.75); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  opacity: 0; transform: scale(0.96); transition: opacity 0.2s, transform 0.2s var(--ease-quick);
}
.panel.open { opacity: 1; transform: none; }
.panel.dragging { cursor: grabbing; transition: none; }
.panel-close {
  position: absolute; top: -15px; right: -15px; z-index: 2; display: flex; padding: 7px; cursor: pointer;
  border-radius: 20px; border: 1px solid #f2f2f2; background: rgba(174, 174, 174, 0.5);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
}
.panel-close img { display: block; }
.panel-media { display: flex; justify-content: center; padding: 14px; flex: none; }
.panel-image { display: block; border-radius: 19px; object-fit: cover; pointer-events: none; }
.panel-media[hidden] + .panel-actions { padding-top: 14px; }
.panel-actions { display: flex; gap: 10px; padding: 0 14px; flex: none; }
.panel-btn {
  flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px; border-radius: 19px; cursor: pointer; font-size: 14px; line-height: 1; white-space: nowrap;
  background: rgba(255, 255, 255, 0.09); border: 1px solid rgba(255, 255, 255, 0.14);
  transition: background 0.15s;
}
.panel-btn:hover { background: rgba(255, 255, 255, 0.16); }
.panel-btn span { padding: 5px 2px 5px 0; }
.panel-btn img { display: block; flex: none; }
.panel-text { display: flex; flex-direction: column; gap: 22px; padding: 28px 34px 30px; min-height: 0; }
.panel-title { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.1; overflow-wrap: anywhere; }
/* Up to five lines; longer text scrolls inside the panel. */
.panel-desc {
  margin: 0; font-size: 13px; line-height: 1.45; max-height: calc(13px * 1.45 * 5); overflow-y: auto;
  overscroll-behavior: contain; touch-action: pan-y; cursor: auto; user-select: text; -webkit-user-select: text;
  white-space: pre-line; overflow-wrap: anywhere; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* ---------- Gallery ---------- */
.gallery {
  position: absolute; inset: 0; z-index: 10; background: #000; box-sizing: border-box; padding: 18px;
  display: flex; flex-direction: column; gap: 18px;
}
.gallery-bar { display: flex; align-items: center; justify-content: space-between; padding: 0 10px; flex: none; }
.gallery-title { margin: 0; font-size: 16px; font-weight: 700; line-height: 24px; }
.gallery-close { display: flex; cursor: pointer; }
.gallery-close img { display: block; }
.gallery-main {
  position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center;
  touch-action: pan-y;
}
.gallery-photo { display: block; max-width: 100%; max-height: 100%; border-radius: 30px; object-fit: contain; user-select: none; }
.round-btn {
  position: absolute; top: 50%; transform: translateY(-50%); display: flex; padding: 9px; cursor: pointer;
  border-radius: 22px; border: 1px solid var(--glass-line); filter: drop-shadow(0 14px 17.5px rgba(112, 112, 112, 0.28));
}
.round-btn img { display: block; }
.round-btn:active { transform: translateY(-50%) scale(0.96); }
.gallery-prev { left: 18px; }
.gallery-next { right: 18px; }
.gallery-thumbs {
  flex: none; display: flex; justify-content: safe center; height: 66px; overflow-x: auto; scrollbar-width: none;
  padding: 0 50px;
}
.gallery-thumbs::-webkit-scrollbar { display: none; }
.thumb { flex: none; width: 114px; height: 66px; padding: 5px; box-sizing: border-box; cursor: pointer; opacity: 0.5; transition: opacity 0.2s; }
.thumb.active, .thumb:hover { opacity: 1; }
.thumb-card {
  position: relative; display: block; width: 100%; height: 100%; border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16); box-sizing: border-box;
}
.thumb-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0, 0, 0, 0) 56%, rgba(0, 0, 0, 0.7)); }
.thumb-card i { display: none; position: absolute; z-index: 1; left: 50%; bottom: 4px; transform: translateX(-50%); width: 17px; height: 4px; border-radius: 6px; background: var(--accent); }
.thumb.active .thumb-card i { display: block; }

/* ---------- Status ---------- */
#message {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 24px;
  color: rgba(255, 255, 255, 0.7); font-size: 16px; text-align: center;
}
#message.hidden { display: none; }
#loadbar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; transition: opacity 0.6s; }
#loadbar > div { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

/* Narrow screens: icons only in the menu, and hover labels stay hidden. */
@media (max-width: 600px) {
  .panel-text { padding: 22px 24px 24px; gap: 16px; }
  .panel-title { font-size: 22px; }
  .gallery { padding: 12px; gap: 12px; }
  .gallery-photo { border-radius: 18px; }
  .gallery-prev { left: 8px; }
  .gallery-next { right: 8px; }
  .gallery-thumbs { padding: 0; height: 56px; }
  .thumb { width: 92px; height: 56px; }
}
@media (max-width: 760px) {
  .tab span { display: none; }
  .tab { padding: 22px 14px; }
  .menu { padding: 0 6px; }
}
@media (hover: none) {
  .turn-btn:hover .turn-label { max-width: 0; opacity: 0; padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .turn-label { transition: none; }
}
