/* ============================================================
   CSS Custom Properties — Design System Tokens
   ============================================================ */
:root {
  --bg:              #0a0a0f;
  --surface-dark:    rgba(5, 5, 15, 0.6);
  --surface-darker:  rgba(5, 5, 15, 0.9);
  --surface-mid:     #1a1a2e;
  --surface-btn:     rgba(10, 10, 20, 0.7);

  --gold:            #d4af7a;
  --gold-rgb:        212, 175, 122;
  --gold-dim:        rgba(212, 175, 122, 0.4);
  --gold-subtle:     rgba(212, 175, 122, 0.2);
  --gold-faint:      rgba(212, 175, 122, 0.1);
  --gold-glow:       rgba(212, 175, 122, 0.3);

  --text:            #e8e0d0;
  --text-muted:      rgba(232, 224, 208, 0.5);
  --text-faint:      rgba(232, 224, 208, 0.65);

  --font-display:    'Cinzel', serif;
  --font-body:       'Raleway', sans-serif;

  --radius-pill:     50px;
  --radius-circle:   50%;
  --radius-card:     8px;

  --transition:      all 0.3s;
  --blur-sm:         blur(4px);
  --blur-md:         blur(8px);
  --blur-lg:         blur(12px);
}

/* ============================================================
   Reset & Base
   ============================================================ */
* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -ms-text-size-adjust: none;
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  -ms-content-zooming: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

html, body {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
  font-family: var(--font-body);
  font-size: 16px;
  background-color: var(--bg);
  color: var(--text);
}

a, a:hover, a:active, a:visited {
  text-decoration: none;
  color: inherit;
}

/* ============================================================
   Panorama Canvas
   ============================================================ */
#pano {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ============================================================
   Loading Screen
   ============================================================ */
#loadingScreen {
  position: absolute;
  inset: 0;
  z-index: 500;
  background-color: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  transition: opacity 0.8s ease;
}

#loadingScreen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-circle);
  border: 2px solid rgba(212, 175, 122, 0.2);
  border-top-color: var(--gold);
  animation: spin 1s linear infinite;
}

.loading-text {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(212, 175, 122, 0.7);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   Header Bar
   ============================================================ */
#header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 24px 30px 70px;
  background: linear-gradient(to bottom, rgba(5, 5, 15, 0.9) 0%, transparent 100%);
  pointer-events: none;
  transition: opacity 1s ease;
}

#titleBar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scene-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(212, 175, 122, 0.4);
}

.scene-subtitle {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* JS writes scene name into this span */
.sceneName {
  -moz-user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* ============================================================
   Hidden Legacy Toggles (kept for JS, not visible)
   ============================================================ */
#autorotateToggle,
#sceneListToggle {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
   Fullscreen Button (top-right, desktop)
   ============================================================ */
#fullscreenToggle {
  display: none; /* shown only when body.fullscreen-enabled is set by JS */
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 200;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-circle);
  border: 1.5px solid var(--gold-dim);
  background: var(--surface-btn);
  -webkit-backdrop-filter: var(--blur-md);
  backdrop-filter: var(--blur-md);
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

body.fullscreen-enabled #fullscreenToggle {
  display: flex;
}

.no-touch #fullscreenToggle:hover {
  transform: scale(1.08);
}

#fullscreenToggle.enabled {
  background: var(--gold-subtle);
  border-color: var(--gold);
  box-shadow: 0 0 15px var(--gold-glow);
}

#fullscreenToggle .icon {
  position: static;
  width: 20px;
  height: 20px;
  /* Tint white PNG icons to gold */
  filter: sepia(1) saturate(1.5) hue-rotate(-10deg) brightness(1.05);
}

#fullscreenToggle .icon.on  { display: none; }
#fullscreenToggle .icon.off { display: block; }

#fullscreenToggle.enabled .icon.on  { display: block; }
#fullscreenToggle.enabled .icon.off { display: none; }

/* On mobile, shift left to make room for the gyro button */
.mobile.fullscreen-enabled #fullscreenToggle {
  right: 76px;
}

/* ============================================================
   Gyroscope / Device Orientation Button (mobile, top-right)
   ============================================================ */
#deviceOrientationToggle {
  display: none; /* shown only on mobile via .mobile selector below */
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 200;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-circle);
  border: 1.5px solid var(--gold-dim);
  background: var(--surface-btn);
  -webkit-backdrop-filter: var(--blur-md);
  backdrop-filter: var(--blur-md);
  color: var(--gold);
  cursor: pointer;
  transition: var(--transition);
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  padding: 0;
  align-items: center;
  justify-content: center;
}

.mobile #deviceOrientationToggle {
  display: flex;
}

#deviceOrientationToggle svg {
  width: 22px;
  height: 22px;
  pointer-events: none;
}

.no-touch #deviceOrientationToggle:hover {
  transform: scale(1.08);
}

#deviceOrientationToggle.enabled {
  background: var(--gold-subtle);
  border-color: var(--gold);
  box-shadow: 0 0 15px var(--gold-glow);
}

/* Icon state toggling */
#deviceOrientationToggle .icon.on  { display: none; }
#deviceOrientationToggle .icon.off { display: flex; align-items: center; justify-content: center; }

#deviceOrientationToggle.enabled .icon.on  { display: flex; align-items: center; justify-content: center; }
#deviceOrientationToggle.enabled .icon.off { display: none; }

/* ============================================================
   Controls Hint
   ============================================================ */
#controlsHint {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  gap: 20px;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 1s;
}

.hint-item {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(212, 175, 122, 0.8);
}

/* ============================================================
   Scene Navigation — Bottom Pill Bar
   ============================================================ */
#sceneList {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  /* Override any JS-applied margin/position from original slide-in logic */
  width: auto !important;
  max-height: none !important;
  padding-top: 0 !important;
  overflow: visible !important;
  margin-left: 0 !important;
  transition: none !important;
}

#sceneList .scenes {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--gold-subtle);
  background: var(--surface-dark);
  -webkit-backdrop-filter: var(--blur-lg);
  backdrop-filter: var(--blur-lg);
}

#sceneList .scene {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-circle);
  border: 2px solid transparent;
  background: var(--surface-mid);
  color: rgba(212, 175, 122, 0.7);
  cursor: pointer;
  transition: var(--transition);
  overflow: hidden;
  flex-shrink: 0;
}

.no-touch #sceneList .scene:hover {
  transform: scale(1.1);
}

#sceneList .scene.current {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(212, 175, 122, 0.4);
}

#sceneList .scene .text {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  pointer-events: none;
}

.mobile #sceneList {
  bottom: 20px;
}

body.single-scene #sceneList {
  display: none;
}

/* ============================================================
   Link Hotspot — POI Ring + Dot Style
   ============================================================ */
.link-hotspot {
  width: 44px;
  height: 44px;
  margin-left: -22px;
  margin-top: -22px;
  border-radius: var(--radius-circle);
  border: 2px solid rgba(212, 175, 122, 0.8);
  background: rgba(10, 10, 20, 0.5);
  -webkit-backdrop-filter: var(--blur-sm);
  backdrop-filter: var(--blur-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: pulse-ring 2.5s ease-in-out infinite;
  opacity: 1;
  transition: var(--transition);
}

.no-touch .link-hotspot:hover {
  transform: scale(1.1);
  opacity: 1;
}

/* Gold dot in the center */
.link-hotspot::after {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-circle);
  background: var(--gold);
  box-shadow: 0 0 8px rgba(212, 175, 122, 0.8);
  flex-shrink: 0;
}

/* Hide the original arrow icon image */
.link-hotspot-icon {
  display: none;
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: none; }
  50%       { box-shadow: 0 0 0 10px rgba(212, 175, 122, 0); }
}

/* Link hotspot tooltip — appears above on hover */
.link-hotspot-tooltip,
.hotspot-tooltip.link-hotspot-tooltip {
  position: absolute;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  padding: 10px 14px;
  border-radius: var(--radius-card);
  border: 1px solid rgba(212, 175, 122, 0.3);
  background: rgba(5, 5, 15, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.5;
  color: var(--text-faint);
  text-align: center;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  /* Remove the original slide transform */
  -ms-transform: none;
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
}

/* Arrow pointing down */
.link-hotspot-tooltip::after,
.hotspot-tooltip.link-hotspot-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(212, 175, 122, 0.3);
}

.no-touch .link-hotspot:hover .link-hotspot-tooltip,
.no-touch .link-hotspot:hover .hotspot-tooltip {
  opacity: 1;
  -ms-transform: translateX(-50%);
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
}

/* Fallback for IE < 11 */
.tooltip-fallback .link-hotspot-tooltip { display: none; }
.no-touch .tooltip-fallback .link-hotspot:hover .link-hotspot-tooltip { display: block; }

/* ============================================================
   Info Hotspot — POI Ring Style (desktop inline)
   ============================================================ */
.info-hotspot {
  opacity: 1;
  transition: opacity 0.2s;
}

.info-hotspot .info-hotspot-header {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-circle);
  border: 2px solid rgba(212, 175, 122, 0.8);
  background: rgba(10, 10, 20, 0.5);
  -webkit-backdrop-filter: var(--blur-sm);
  backdrop-filter: var(--blur-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: pulse-ring 2.5s ease-in-out infinite;
  transition: var(--transition);
  /* Override original expansion behavior */
  -webkit-transition: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

/* Keep header circle on all states — override original expand animation */
.desktop .info-hotspot .info-hotspot-header:hover,
.desktop.no-touch .info-hotspot .info-hotspot-header:hover,
.desktop .info-hotspot.visible .info-hotspot-header,
.desktop.no-touch .info-hotspot.visible .info-hotspot-header:hover {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-circle);
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(212, 175, 122, 0.4);
  border-top-right-radius: var(--radius-circle);
  border-bottom-right-radius: var(--radius-circle);
  border-bottom-left-radius: var(--radius-circle);
}

/* Gold dot in the center */
.info-hotspot .info-hotspot-header::after {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-circle);
  background: var(--gold);
  box-shadow: 0 0 8px rgba(212, 175, 122, 0.8);
  flex-shrink: 0;
}

/* Hide the original icon, title, and close elements inside the header */
.info-hotspot .info-hotspot-icon-wrapper,
.info-hotspot .info-hotspot-icon,
.info-hotspot .info-hotspot-title-wrapper,
.info-hotspot .info-hotspot-close-wrapper {
  display: none !important;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Text panel — appears above the ring on .visible */
.info-hotspot .info-hotspot-text {
  position: absolute;
  width: 200px;
  height: auto;
  max-height: 160px;
  bottom: 52px;
  left: 50%;
  top: auto;
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: var(--radius-card);
  border: 1px solid rgba(212, 175, 122, 0.3);
  background: rgba(5, 5, 15, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-family: var(--font-body);
  font-size: 0.65rem;
  line-height: 1.5;
  color: var(--text-faint);
  overflow-y: auto;
  visibility: hidden;
  opacity: 0;
  -ms-transform: translateX(-50%);
  -webkit-transform: translateX(-50%);
  -ms-transform-origin: 50% 0 0;
  -webkit-transform-origin: 50% 0 0;
  transform-origin: 50% 0 0;
  transition: opacity 0.3s, visibility 0s 0.3s;
  -moz-user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

.desktop .info-hotspot.visible .info-hotspot-text {
  visibility: visible;
  opacity: 1;
  -ms-transform: translateX(-50%);
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  transition: opacity 0.3s, visibility 0s;
}

/* ============================================================
   Info Hotspot Modal (mobile)
   ============================================================ */
.desktop .info-hotspot-modal {
  display: none;
}

.info-hotspot-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 11000 !important;
  background: rgba(5, 5, 15, 0.85);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0s 0.3s;
  line-height: 1.4;
}

.info-hotspot-modal.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease-in-out, visibility 0s;
}

.info-hotspot-modal .info-hotspot-header {
  position: absolute;
  top: 60px;
  left: 10px;
  right: 10px;
  width: auto;
  height: 50px;
  border-radius: var(--radius-card);
  background: var(--gold-faint);
  border: 1px solid var(--gold-dim);
  display: flex;
  align-items: center;
  padding: 0 16px;
  opacity: 0;
  transition: opacity 0.3s ease-in-out 0.2s;
}

.info-hotspot-modal.visible .info-hotspot-header {
  opacity: 1;
}

.info-hotspot-modal .info-hotspot-icon-wrapper {
  display: none;
}

.info-hotspot-modal .info-hotspot-title-wrapper {
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  flex: 1;
}

.info-hotspot-modal .info-hotspot-title-wrapper::before {
  display: none;
}

.info-hotspot-modal .info-hotspot-title {
  display: block;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--gold);
  -moz-user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

.info-hotspot-modal .info-hotspot-close-wrapper {
  position: absolute;
  top: 60px;
  right: 10px;
  width: 50px;
  height: 50px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gold);
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
}

.info-hotspot-modal .info-hotspot-close-icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  filter: invert(1) sepia(1) saturate(2) hue-rotate(5deg);
}

.info-hotspot-modal .info-hotspot-text {
  position: absolute;
  top: 120px;
  bottom: 10px;
  left: 10px;
  right: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-card);
  background: rgba(5, 5, 15, 0.9);
  border: 1px solid var(--gold-dim);
  overflow-y: auto;
  color: var(--text-faint);
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.6;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  -moz-user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

.info-hotspot-modal.visible .info-hotspot-text {
  opacity: 1;
  transition: opacity 0.3s ease-in-out 0.4s;
}

/* ============================================================
   View Control Buttons (always hidden — kept for JS)
   ============================================================ */
.viewControlButton {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
   Pulse Animation (shared by link & info hotspots)
   ============================================================ */
@keyframes pulse-ring {
  0%, 100% { box-shadow: none; }
  50%       { box-shadow: 0 0 0 10px rgba(212, 175, 122, 0); }
}
