/* =============================================================================
   前台 — 360° 環景瀏覽器
   ============================================================================= */

html, body { height: 100%; overflow: hidden; }
body { background: #05070b; color: var(--text-invert); }

#pano { position: absolute; inset: 0; }
#pano canvas { outline: none; }

/* ---------------------------------------------------------------- 頂部列 */

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(to bottom, rgba(6, 9, 14, .78), transparent);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

#titlePill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  border-radius: 999px;
  background: rgba(16, 20, 27, .72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .12);
  font-size: 14px;
  font-weight: 600;
  max-width: 62vw;
}
#titlePill.clickable { cursor: pointer; }
#titlePill.clickable:hover { background: rgba(30, 37, 48, .85); }
#titleText {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#titlePill .pill-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-invert-muted);
}

.topbar .spacer { flex: 1; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(16, 20, 27, .72);
  backdrop-filter: blur(8px);
  color: var(--text-invert);
  cursor: pointer;
  transition: background .15s;
}
.icon-btn:hover { background: rgba(40, 48, 62, .9); }

/* ---------------------------------------------------------------- 指北針 */

#compass {
  position: absolute;
  right: 14px;
  top: 62px;
  z-index: 20;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(16, 20, 27, .68);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .14);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
#compassRot { width: 44px; height: 44px; transition: transform .08s linear; }
/* N 字已改為 SVG 內元素，跟指針一齊轉（舊嘅外置 span 會停留喺頂部造成誤會） */
#compassRot .compass-n-text {
  font-size: 9px;
  font-weight: 800;
  fill: var(--c21-gold-light);
  font-family: inherit;
}

/* ---------------------------------------------------------------- 熱點
   參考 aerial360.c21.hk：米白藥丸標記 = C21 標誌 + 粗體文字，尾箭指向標注點。
   Marzipano 將熱點元素左上角放在投影點，所以藥丸用 bottom 偏移整隻浮在點上方。 */

.hotspot {
  cursor: default;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.hs-bubble {
  position: absolute;
  left: 0;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px 0 5px;
  border-radius: 999px;
  background: #f4f3ef;
  opacity: .78;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
  white-space: nowrap;
  transition: opacity .15s;
}
.hs-bubble > img {
  height: 25px;
  width: auto;
  /* base.css 有全局 img { max-width: 100% }，在 flex 氣泡內會將圖標連同
     文字一起壓扁（氣泡闊度收窄、文字出 ellipsis），必須覆寫 */
  max-width: none;
  flex: none;
}
.hs-bubble-text {
  min-width: 0;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #383635;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .01em;
}
/* 尾箭：三角形指向標注點 */
.hs-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  transform: translateX(-50%);
  border: 9px solid transparent;
  border-bottom: none;
  border-top-color: #f4f3ef;
}

/* 可點擊的標記：手型游標 + 懸浮加深 */
.hotspot-link .hs-bubble,
.hotspot-gallery .hs-bubble,
.hotspot-internal-project .hs-bubble { cursor: pointer; }
.hotspot-link .hs-bubble:hover,
.hotspot-gallery .hs-bubble:hover,
.hotspot-internal-project .hs-bubble:hover { opacity: .96; }

.hs-warn {
  position: absolute;
  left: 0;
  bottom: 54px;
  transform: translateX(-50%);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(209, 52, 91, .92);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- 品牌浮水印
   與 vr.c21.hk 一致：置中、大半透明 CENTURY21 字標，不擋點擊 */

.brand-watermark {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.brand-watermark img {
  width: 44%;
  max-width: 640px;
  min-width: 260px;
  height: auto;
  opacity: .5;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .85)) drop-shadow(0 3px 14px rgba(0, 0, 0, .6));
}
@media (max-width: 860px) {
  .brand-watermark img { width: 64%; min-width: 180px; }
}

.watermark {
  position: absolute;
  z-index: 15;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  background: rgba(8, 11, 16, .55);
  color: #fff;
  font-size: 12px;
  pointer-events: none;
}
.watermark.bottom-right { right: 16px; bottom: 14px; }
.watermark.bottom-left { left: 16px; bottom: 14px; }
.watermark.top-right { right: 16px; top: 62px; }
.watermark.top-left { left: 16px; top: 62px; }

/* ---------------------------------------------------------------- 標題圖片浮層 */

#titleImageOverlay {
  position: absolute;
  left: 16px;
  top: 64px;
  z-index: 25;
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(12, 16, 22, .9);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: var(--shadow-lg);
  padding: 6px;
}
#titleImageOverlay img { width: 100%; border-radius: var(--radius-sm); }

/* ---------------------------------------------------------------- 相簿燈箱 */

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(6, 9, 14, .94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lb-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.lb-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
}
.lb-bar {
  width: 100%;
  max-width: 900px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
}
.lb-bar .lb-caption {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: var(--text-invert-muted);
  min-height: 20px;
}
.lb-thumbs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  max-width: 100%;
  padding: 10px 0 4px;
}
.lb-thumbs img {
  width: 54px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  opacity: .5;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: opacity .15s, border-color .15s;
}
.lb-thumbs img:hover { opacity: .8; }
.lb-thumbs img.active { opacity: 1; border-color: var(--c21-gold); }
.lb-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(20, 25, 33, .8);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-close:hover { background: rgba(45, 54, 68, .95); }
.lb-counter {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  color: var(--text-invert-muted);
}

/* ---------------------------------------------------------------- 免責聲明 */

#intro {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(6, 9, 14, .92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}
.intro-card {
  background: #fff;
  color: var(--text);
  border-radius: var(--radius);
  max-width: 520px;
  width: 100%;
  max-height: 86vh;
  overflow: auto;
  padding: 26px 26px 22px;
  box-shadow: var(--shadow-lg);
}
.intro-card h2 { margin: 0 0 12px; font-size: 19px; }
.intro-card .intro-msg {
  font-size: 13.5px;
  line-height: 1.75;
  color: #47536b;
  max-height: 42vh;
  overflow: auto;
  padding-right: 6px;
}
.intro-card .intro-meta {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-muted);
}
.intro-card .intro-actions { margin-top: 16px; text-align: right; }

/* ---------------------------------------------------------------- 底部提示 */

.viewer-hint {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 18;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(10, 14, 20, .62);
  backdrop-filter: blur(6px);
  font-size: 12px;
  color: var(--text-invert-muted);
  pointer-events: none;
  animation: fadeHint 6s forwards;
}
@keyframes fadeHint {
  0%, 60% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------------------------------------------------------------- 錯誤 */

.viewer-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: #05070b;
}
.viewer-error h2 { margin: 0 0 10px; font-size: 19px; }
.viewer-error pre {
  white-space: pre-wrap;
  color: #ffb4b4;
  font-size: 13px;
  max-width: 560px;
}

/* ---------------------------------------------------------------- 相關導覽（viewer 內） */

#relatedLinks {
  position: absolute;
  left: 16px;
  bottom: 56px;
  z-index: 18;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}
#relatedLinks a {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(16, 20, 27, .74);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .14);
  font-size: 12px;
  transition: background .15s;
}
#relatedLinks a:hover { background: rgba(200, 162, 74, .9); color: #14191f; }

/* 伺服器 render 的 SEO 導覽被搬進 #relatedLinks：讓 nav 本身不產生盒子，
   內部的 <a> 直接套用角落樣式，標題則隱藏（畫面上已有「相關」語境）。 */
#relatedLinks nav.tour-links { display: contents; }
#relatedLinks nav.tour-links h2 { display: none; }

/* 未搬移時（例如未來改版）的 fallback 樣式 */
nav.tour-links {
  max-width: 900px;
  margin: 0 auto 48px;
  padding: 0 24px;
}
nav.tour-links h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin: 0 0 10px;
}

@media (max-width: 640px) {
  #titlePill { max-width: 52vw; font-size: 13px; padding: 6px 12px; }
  #compass { width: 46px; height: 46px; right: 10px; top: 56px; }
  #compassRot { width: 34px; height: 34px; }
  .hs-bubble { height: 28px; padding: 0 10px 0 4px; gap: 5px; bottom: 12px; }
  .hs-bubble > img { height: 21px; width: auto; max-width: none; }
  .hs-bubble-text { font-size: 12px; max-width: 150px; }
  .hs-warn { bottom: 46px; }
}
