/* ============================================================
   showcase.css — 太和殿 3D 点云展陈页
   布局基准：1280x720（--layout-scale = 1）。
   所有参考尺寸来自 showcase-config.js，由 showcase.js 写入
   --layout-scale 与各文案节点；本文件不硬编码文案内容。
   ============================================================ */

:root {
  /* 由 showcase.js 实时更新的连续布局比例 */
  --layout-scale: 1;

  /* 主题（与 showcase-config.js theme 一致，JS 也会写入） */
  --bg: #111821;
  --gold: #D9A441;
  --ivory: #F3EFE5;
  --teal: #A8D9D0;
  --text-secondary: rgba(243, 239, 229, 0.68);
  --text-faint: rgba(243, 239, 229, 0.38);
  --hairline: rgba(243, 239, 229, 0.16);

  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-serif-zh: "Songti SC", "STSong", "SimSun", "Source Han Serif SC", "Noto Serif CJK SC", serif;
  --font-serif-en: Georgia, "Times New Roman", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;              /* 禁止任何滚动条 */
  background: var(--bg);
  color: var(--ivory);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#scene-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ============ 左侧展陈文字区 ============ */

#exhibit-text {
  position: absolute;
  left: 5.6vw;                                    /* 3vw ~ 7vw 范围内 */
  top: 9.2vh;                                     /* 8vh ~ 10vh 范围内 */
  width: min(31.5vw, calc(452px * var(--layout-scale)));
  max-width: calc(100vw - 12vw);
  pointer-events: none;
  will-change: opacity, transform;
}

.category {
  font-family: var(--font-sans);
  font-size: calc(15px * var(--layout-scale));
  font-weight: 600;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold);
  line-height: 1.9;
  max-width: calc(340px * var(--layout-scale));   /* 允许自然换两行 */
}

.title-mask {
  overflow: hidden;
  margin-top: calc(18px * var(--layout-scale));
  padding-bottom: 0.06em;
}

.title {
  font-family: var(--font-serif-zh);
  font-size: calc(66px * var(--layout-scale));
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.06;
  color: var(--gold);
  will-change: transform;
}

.subtitle {
  margin-top: calc(12px * var(--layout-scale));
  font-family: var(--font-serif-en);
  font-size: calc(16px * var(--layout-scale));
  letter-spacing: 0.30em;
  color: var(--ivory);
  opacity: 0.92;
  text-transform: uppercase;
}

.intro {
  margin-top: calc(16px * var(--layout-scale));
  font-family: var(--font-serif-zh);
  font-size: calc(20px * var(--layout-scale));
  letter-spacing: 0.16em;
  color: var(--ivory);
  opacity: 0.85;
}

.body {
  margin-top: calc(14px * var(--layout-scale));
  font-size: calc(13.5px * var(--layout-scale));
  line-height: 1.9;
  letter-spacing: 0.035em;
  color: var(--text-secondary);
  min-height: calc(13.5px * var(--layout-scale) * 1.9 * 3); /* 预留行高，避免布局跳动 */
}

.cursor {
  display: inline-block;
  width: max(1px, calc(2px * var(--layout-scale)));
  height: 1.15em;
  margin-left: calc(3px * var(--layout-scale));
  background: var(--gold);
  vertical-align: -0.2em;
}

/* ---- 特征词 ---- */

.features {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-top: calc(26px * var(--layout-scale));
  gap: calc(10px * var(--layout-scale));
}

.features li {
  font-family: var(--font-serif-zh);
  font-size: calc(19px * var(--layout-scale));
  letter-spacing: 0.12em;
  color: var(--ivory);
  padding-left: calc(14px * var(--layout-scale));
  border-left: 1px solid var(--hairline);
  line-height: 1.3;
}

.features li:first-child { border-left-color: rgba(217, 164, 65, 0.55); }

/* ---- 主要颜色 / 工艺线索 ---- */

.meta {
  margin-top: calc(30px * var(--layout-scale));
  display: flex;
  flex-direction: column;
  gap: calc(12px * var(--layout-scale));
}

.section-label {
  font-size: calc(10.5px * var(--layout-scale));
  letter-spacing: 0.26em;
  color: var(--text-faint);
  margin-bottom: calc(7px * var(--layout-scale));
  text-transform: uppercase;
}

.palette-row {
  list-style: none;
  display: flex;
  align-items: center;
  gap: calc(11px * var(--layout-scale));
}

.palette-row li {
  width: calc(11px * var(--layout-scale));
  height: calc(11px * var(--layout-scale));
  border-radius: 50%;
  border: 1px solid rgba(243, 239, 229, 0.22);
}

.craft-row {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: calc(8px * var(--layout-scale));
}

.craft-row li {
  font-size: calc(12px * var(--layout-scale));
  letter-spacing: 0.18em;
  color: var(--text-secondary);
  border: 1px solid var(--hairline);
  border-radius: 0;                                 /* 细边框小矩形，非胶囊 */
  padding: calc(4.5px * var(--layout-scale)) calc(10px * var(--layout-scale));
  line-height: 1.35;
}

/* ============ 底部界面 ============ */

#exhibit-footer {
  position: absolute;
  left: 5vw;                                        /* 4vw ~ 6vw 范围内 */
  right: 5vw;
  bottom: 4.2vh;
  display: flex;
  align-items: center;
  gap: calc(22px * var(--layout-scale));
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: calc(3px * var(--layout-scale));
  white-space: nowrap;
}

.footer-crumb {
  font-size: calc(10px * var(--layout-scale));
  letter-spacing: 0.30em;
  color: var(--text-faint);
}

.footer-label {
  font-size: calc(11.5px * var(--layout-scale));
  letter-spacing: 0.22em;
  color: var(--text-secondary);
}

.progress {
  flex: 1 1 auto;
  max-width: 46vw;
}

.progress-track {
  width: 100%;
  height: max(1px, calc(1px * var(--layout-scale)));
  background: rgba(243, 239, 229, 0.13);
  position: relative;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--teal) 100%);
  box-shadow: 0 0 calc(6px * var(--layout-scale)) rgba(217, 164, 65, 0.35);
}

.restart {
  pointer-events: auto;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--hairline);
  border-radius: 0;                                 /* 不使用大圆角 */
  font-family: var(--font-sans);
  font-size: calc(11.5px * var(--layout-scale));
  letter-spacing: 0.30em;
  text-indent: 0.30em;
  padding: calc(8px * var(--layout-scale)) calc(18px * var(--layout-scale));
  transition: color 160ms ease, border-color 160ms ease;
}

.restart:hover { color: var(--gold); border-color: rgba(217, 164, 65, 0.55); }

.restart:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 3px;
}

/* ---- 暂停提示（自动模式暂停时出现） ---- */

.paused-hint {
  font-size: calc(10.5px * var(--layout-scale));
  letter-spacing: 0.24em;
  color: var(--gold);
  opacity: 0.9;
}

/* ---- 手动模式提示（footer 中部，替代进度线视觉位） ---- */

.manual-hint {
  flex: 1 1 auto;
  max-width: 46vw;
  text-align: center;
  font-size: calc(11px * var(--layout-scale));
  letter-spacing: 0.26em;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- 手动模式整体状态（body[data-mode="manual"]） ---- */

body[data-mode="manual"] #exhibit-text {
  opacity: 0 !important;              /* 覆盖 JS 每帧写入的 inline opacity */
  transition: opacity 0.45s ease;
  pointer-events: none;
}

body[data-mode="manual"] .features li { pointer-events: none; }

#exhibit-text { transition: opacity 0.45s ease; }

body[data-mode="manual"] .progress { opacity: 0; transition: opacity 0.3s ease; }
.progress { transition: opacity 0.3s ease; }

body[data-mode="manual"] #scene-canvas { cursor: grab; }
body[data-mode="manual"] #scene-canvas.dragging { cursor: grabbing; }

/* ---- 特征词可点击（热点触发） ---- */

.features li {
  pointer-events: auto;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, opacity 300ms ease;
}

.features li:hover { color: var(--gold); }

.features li:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 3px;
}

.features li.hotspot-active {
  color: var(--gold);
  border-left-color: var(--gold) !important;
}

/* ---- 画布热点悬停反馈（自动/手动模式均可点击建筑） ---- */

#scene-canvas { cursor: default; }
#scene-canvas.hotspot-hover { cursor: pointer; }

/* ============ 加载 / 错误状态 ============ */

[hidden] {
  display: none !important;
}

#loading-status {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: calc(10px * var(--layout-scale));
  font-size: calc(12px * var(--layout-scale));
  letter-spacing: 0.24em;
  color: var(--text-faint);
}

.loading-dot {
  width: calc(6px * var(--layout-scale));
  height: calc(6px * var(--layout-scale));
  border-radius: 50%;
  background: var(--gold);
  animation: loading-pulse 1.2s ease-in-out infinite;
}

@keyframes loading-pulse {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* ---- 加载进度条（真实下载百分比） ---- */

#loading-status {
  flex-direction: column;
}

#loading-status > span { display: inline-flex; align-items: center; }

.loading-bar {
  width: calc(220px * var(--layout-scale));
  height: max(1px, calc(1.5px * var(--layout-scale)));
  margin-top: calc(10px * var(--layout-scale));
  background: rgba(243, 239, 229, 0.13);
  overflow: hidden;
}

.loading-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--teal) 100%);
  transition: width 120ms linear;
}

#error-state {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: min(560px, 80vw);
  border: 1px solid rgba(217, 164, 65, 0.4);
  padding: calc(30px * var(--layout-scale)) calc(38px * var(--layout-scale));
  text-align: center;
  background: rgba(17, 24, 33, 0.9);
}

.error-title {
  font-family: var(--font-serif-zh);
  font-size: calc(22px * var(--layout-scale));
  letter-spacing: 0.14em;
  color: var(--gold);
  margin-bottom: calc(12px * var(--layout-scale));
}

.error-hint {
  font-size: calc(13px * var(--layout-scale));
  line-height: 1.85;
  color: var(--text-secondary);
}

/* ============ 减少动态效果 ============ */

@media (prefers-reduced-motion: reduce) {
  .loading-dot { animation: none; opacity: 0.8; }
  .restart, .features li, #exhibit-text, .progress, .loading-bar-fill { transition: none; }
}
