/* Primitive */
:root {
  --stone-50: #f7f3ec;
  --stone-200: #e4dccf;
  --stone-400: #b5aa98;
  --stone-600: #7d7466;
  --ink-900: #14110e;
  --ink-800: #1f1b17;
  --violet-500: #8b5cf6;
  --violet-600: #7c3aed;
  --amber-300: #f4c98a;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-pill: 999px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(.22, 1, .36, 1);

  /* Semantic */
  --text: var(--stone-50);
  --text-muted: rgba(247, 243, 236, .66);
  --text-faint: rgba(247, 243, 236, .45);
  --accent: var(--violet-600);
  --accent-soft: rgba(124, 58, 237, .22);
  --warm: var(--amber-300);
  --surface: rgba(20, 17, 14, .52);
  --surface-strong: rgba(20, 17, 14, .82);
  --line: rgba(247, 243, 236, .14);
  --line-strong: rgba(247, 243, 236, .28);

  /* Component */
  --glass-bg: var(--surface);
  --glass-border: var(--line);
  --glass-blur: 16px;
  --btn-active-bg: var(--stone-50);
  --btn-active-fg: var(--ink-900);
  --hotspot-size: 40px;
  --gutter: max(16px, env(safe-area-inset-left));
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ink-900);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--violet-500); outline-offset: 2px; }

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

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
  border-radius: var(--radius-md);
}

body[data-mode="exterior"] .only-interior,
body[data-mode="interior"] .only-exterior { display: none !important; }

/* Top bar */
.topbar {
  position: fixed; top: max(16px, env(safe-area-inset-top)); left: var(--gutter); right: var(--gutter);
  display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3);
  pointer-events: none; z-index: 5;
}
.topbar > * { pointer-events: auto; }
.brand { padding: var(--space-3) var(--space-4); display: flex; flex-direction: column; gap: 2px; }
.brand__eyebrow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.brand__title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.controls { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: flex-end; }

.segmented { display: flex; padding: 4px; border-radius: var(--radius-pill); gap: 2px; }
.segmented__btn {
  border: 0; background: transparent; padding: 8px 16px; border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 600; color: var(--text-muted);
  transition: background .3s var(--ease-out), color .3s var(--ease-out);
  white-space: nowrap;
}
.segmented__btn:hover { color: var(--text); }
.segmented__btn.is-active { background: var(--btn-active-bg); color: var(--btn-active-fg); }

/* Hotspots */
.hotspots { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.hotspot {
  position: absolute; left: 0; top: 0; pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  border: 0; background: none; padding: 0;
  transform: translate3d(-50%, -50%, 0);
  transition: opacity .35s var(--ease-out);
  will-change: transform;
}
.hotspot.is-hidden { opacity: 0; pointer-events: none; }
.hotspot__dot {
  width: var(--hotspot-size); height: var(--hotspot-size); border-radius: 50%;
  display: grid; place-items: center; flex: none;
  background: rgba(247, 243, 236, .92); color: var(--ink-900);
  font-weight: 700; font-size: 14px;
  box-shadow: 0 0 0 6px rgba(247, 243, 236, .22), 0 8px 24px rgba(0, 0, 0, .35);
  transition: transform .3s var(--ease-out), background .3s var(--ease-out), color .3s;
}
.hotspot__dot::after {
  content: ""; position: absolute; width: var(--hotspot-size); height: var(--hotspot-size); border-radius: 50%;
  border: 1.5px solid rgba(247, 243, 236, .7); animation: pulse 2.4s var(--ease-out) infinite;
}
.hotspot__label {
  padding: 7px 12px; border-radius: var(--radius-pill);
  background: var(--surface-strong); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; white-space: nowrap;
  opacity: 0; transform: translateX(-6px);
  transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
}
.hotspot:hover .hotspot__dot, .hotspot:focus-visible .hotspot__dot { transform: scale(1.1); background: var(--accent); color: #fff; }
.hotspot:hover .hotspot__label, .hotspot:focus-visible .hotspot__label { opacity: 1; transform: none; }
.hotspot--link .hotspot__dot { background: rgba(20, 17, 14, .72); color: var(--text); box-shadow: 0 0 0 6px rgba(20, 17, 14, .25); }
.hotspot--link .hotspot__label { opacity: 1; transform: none; }
@media (hover: none) { .hotspot__label { opacity: 1; transform: none; } }
@keyframes pulse { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.9); opacity: 0; } }

/* Views */
.views {
  position: fixed; left: var(--gutter); top: 50%; transform: translateY(-50%);
  padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); z-index: 4;
}
.views__label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); font-weight: 600; padding: 0 6px; }
.views__list { display: flex; flex-direction: column; gap: 2px; }
.views__btn {
  border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--text-muted); transition: background .25s, color .25s;
}
.views__btn:hover { background: rgba(247, 243, 236, .08); color: var(--text); }
.views__btn.is-active { color: var(--text); background: var(--accent-soft); }

/* Plan */
.plan {
  position: fixed; right: var(--gutter); bottom: max(16px, env(safe-area-inset-bottom));
  width: 300px; padding: var(--space-4); z-index: 4;
}
.plan__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--space-3); }
.plan__room { font-weight: 700; font-size: 16px; }
.plan__count { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.plan__svg { width: 100%; height: auto; display: block; }
.plan__svg .room { fill: rgba(247, 243, 236, .05); stroke: var(--line-strong); stroke-width: 1; }
.plan__svg .room-label { fill: var(--text-faint); font-size: 10px; font-family: var(--font); font-weight: 600; }
.plan__svg .stop { cursor: pointer; }
.plan__svg .stop circle { fill: var(--stone-400); transition: fill .25s, r .25s; }
.plan__svg .stop:hover circle { fill: var(--text); }
.plan__svg .stop.is-active circle { fill: var(--violet-500); }
.plan__svg .stop.is-active .cone { opacity: 1; }
.plan__svg .cone { fill: var(--violet-500); opacity: 0; transition: opacity .3s; }
.plan__nav { display: flex; justify-content: space-between; align-items: center; margin-top: var(--space-3); }
.plan__note { font-size: 12px; color: var(--text-faint); }

.iconbtn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(247, 243, 236, .06); display: grid; place-items: center; font-size: 16px;
  transition: background .25s, border-color .25s;
}
.iconbtn:hover { background: rgba(247, 243, 236, .16); border-color: var(--line-strong); }

/* Hint */
.hint {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 10px 16px; border-radius: var(--radius-pill); font-size: 13px; color: var(--text-muted);
  white-space: nowrap; z-index: 4; transition: opacity .6s;
}
.hint b { color: var(--text); font-weight: 600; }

/* Loader */
.loader {
  position: fixed; inset: 0; z-index: 20; background: var(--ink-900);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-4);
  transition: opacity .8s var(--ease-out), visibility .8s;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader__mark { font-weight: 700; font-size: 22px; letter-spacing: -.02em; }
.loader__bar { width: 180px; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.loader__bar span { display: block; height: 100%; width: 0; background: var(--text); transition: width .3s; }
.loader__text { font-size: 13px; color: var(--text-muted); }

/* Fade between interior stops */
.fade { position: fixed; inset: 0; background: var(--ink-900); opacity: 0; pointer-events: none; z-index: 2; transition: opacity .32s ease; }
.fade.is-on { opacity: 1; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 10; background: rgba(10, 9, 8, .78);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: grid; place-items: center; padding: var(--space-5);
  animation: lbIn .35s var(--ease-out);
}
.lightbox[hidden] { display: none; }
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox__inner { width: min(1200px, 100%); display: flex; flex-direction: column; gap: var(--space-4); max-height: 100%; }
.lightbox__head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-4); }
.lightbox__eyebrow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.lightbox__title { margin: 2px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.lightbox__figure { margin: 0; position: relative; display: grid; place-items: center; min-height: 0; }
.lightbox__figure img {
  max-width: 100%; max-height: calc(100vh - 230px); border-radius: var(--radius-md); display: block;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5); animation: imgIn .45s var(--ease-out);
}
@keyframes imgIn { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
.lightbox__arrow { position: absolute; top: 50%; transform: translateY(-50%); background: var(--surface-strong); }
.lightbox__arrow--prev { left: 12px; }
.lightbox__arrow--next { right: 12px; }
.lightbox__thumbs { display: flex; gap: var(--space-2); justify-content: center; flex-wrap: wrap; }
.lightbox__thumbs button {
  width: 72px; height: 48px; padding: 0; border-radius: 8px; overflow: hidden;
  border: 2px solid transparent; background: none; opacity: .55; transition: opacity .25s, border-color .25s;
}
.lightbox__thumbs button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox__thumbs button.is-active { border-color: var(--text); opacity: 1; }
.lightbox__thumbs button:hover { opacity: 1; }

/* Mobile */
@media (max-width: 760px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .brand { align-self: flex-start; padding: 10px 14px; }
  .brand__title { font-size: 16px; }
  .controls { justify-content: flex-start; }
  .segmented__btn { padding: 7px 13px; font-size: 13px; }
  .views {
    top: auto; transform: none; left: var(--gutter); right: var(--gutter);
    bottom: max(16px, env(safe-area-inset-bottom));
    flex-direction: row; align-items: center; padding: 6px; overflow-x: auto; scrollbar-width: none;
  }
  .views::-webkit-scrollbar { display: none; }
  .views__label { display: none; }
  .views__list { flex-direction: row; }
  .views__btn { white-space: nowrap; font-size: 13px; padding: 7px 10px; }
  .plan { left: var(--gutter); right: var(--gutter); width: auto; bottom: max(16px, env(safe-area-inset-bottom)); padding: 12px; }
  .plan { display: flex; align-items: center; gap: 12px; }
  .plan__svg, .plan__note { display: none; }
  .plan__head { flex: 1; flex-direction: column; margin: 0; gap: 0; order: 2; min-width: 0; }
  .plan__room { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .plan__nav { display: contents; }
  #prevStop { order: 1; }
  #nextStop { order: 3; }
  .hint {
    font-size: 12px; max-width: calc(100% - 32px); white-space: normal; text-align: center; border-radius: var(--radius-md);
    bottom: auto; top: 50%; transform: translate(-50%, -50%); pointer-events: none;
  }
  .lightbox { padding: var(--space-3); }
  .lightbox__title { font-size: 18px; }
  .lightbox__arrow { width: 36px; height: 36px; }
  .lightbox__thumbs button { width: 56px; height: 38px; }
  :root { --hotspot-size: 34px; }
}

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