/* ==========================================================================
   红色展厅 · 全景页品牌外壳
   为 REH01 / REH02 的 krpano 漫游页增加党建红品牌顶栏、加载动画、
   场景进度指示与界面统一。不改动 krpano 内核与 skin，只做外层包装与
   DOM 级样式覆盖。
   ========================================================================== */

:root {
  --r-red: #C1272D;          /* 党建正红 */
  --r-red-deep: #8E1B20;     /* 深红，用于渐变尾部 */
  --r-gold: #D9B36C;         /* 展陈金色 */
  --r-gold-soft: rgba(217, 179, 108, 0.6);
  --r-ink: #FFFFFF;
  --r-serif: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif SC", Georgia, serif;
  --r-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
}

html,
body {
  background: #0A0807;
  -webkit-tap-highlight-color: transparent;
}

/* krpano 画布在下，装饰层在上 */
#pano {
  position: relative;
  z-index: 1;
}

/* 隐藏 krpano 自带的左上角 logo 图层（CSS 背景图图层，XML 的 visible 无效） */
#pano div[style*="logo.png"] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   缩略图场景名
   krpano 的结构是：外层 div（background-image 画缩略图）+ 内部子 div
   （absolute 定位在缩略图底部 56px 处，承载场景名文字）。
   默认 11px 黑字（design_text_css 里 color 为白，但子 div 被强制成黑）
   压在浅色场景图上完全看不清。
   处理：只改文字渲染（颜色/描边/字号），绝不动 display 与尺寸 ——
   这两个值参与 scrollarea 的布局计算，改了就错位。
   -------------------------------------------------------------------------- */
#pano div[style*="thumb.jpg"] > div {
  font-size: 10.5px !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em;
  line-height: 20px !important;
  color: #fff !important;
  text-align: center;
  overflow: hidden;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 1), 0 -1px 1px rgba(0, 0, 0, 0.95),
    1px 0 1px rgba(0, 0, 0, 0.95), -1px 0 1px rgba(0, 0, 0, 0.95),
    0 0 5px rgba(0, 0, 0, 0.9);
}

/* 缩略图本体：细边 + 圆角，和党建红皮肤的描边色呼应 */
#pano div[style*="thumb.jpg"] {
  border-radius: 2px;
}

/* 场景名所在层：krpano 把文字放在缩略图**上沿**外侧的独立 div 里
   （实测：缩略图 y=774 时文字层 y=766，即文字在缩略图上方 8px）。
   这一层本身没有背景，白字压在亮画面上很难读。
   处理：把它下移 14px 压进缩略图顶部，并向上撑高，
   渐变由透明转实色，视觉上变成缩略图自带的上部暗角。 */
/* 场景名不再垫实心深色底板（那本身就是用户看到的「阴影」），
   改为四向细描边 + 一圈弱光晕：字压在缩略图上依然锐利，
   但不会再有整块发灰的色带。 */
#pano div[style*="thumb.jpg"] > div:not(:empty) {
  height: 20px !important;
  /* krpano 把这层放在缩略图**上沿**（实测 thumb 830~890 / 文字 830~850），
     顶格贴着上边缘显得很飘。下移 20px 让它落在缩略图内部垂直居中
     （文字 850~870，缩略图中心 860），既贴图又不会被裁。 */
  transform: translateY(20px) !important;
  background: none !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   右侧功能按钮组：krpano 用 scale="0.3" 缩到 30px，点击热区太小。
   放大到 1.34 倍，并加半透明底与描边，让图标在白墙上也能看清。
   -------------------------------------------------------------------------- */
#pano div[style*="rt_buttons"],
#pano div[style*="buttons-2.png"],
#pano div[style*="vtourskin.png"] {
  transform-origin: right top;
}

/* 按钮图标统一加一点投影，浅色墙面前不至于糊成一片 */
#pano div[style*="vtourskin.png"][style*="cursor: pointer"] {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.75));
}

/* --------------------------------------------------------------------------
   右侧功能按钮组：尺寸与位置由 skin/vtourskin.xml 的 rt_buttons 控制
   （scale="0.46"、y="96px"、x="18px"），不在这里用 CSS 覆盖 ——
   这些 div 的定位靠 krpano 自己的 transform 实现，CSS 改 transform 会
   直接覆盖掉位置信息，导致按钮飞到左上角。
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   加载遮罩
   -------------------------------------------------------------------------- */
.reh-loading {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 45%, #20100F 0%, #0A0807 72%);
  transition: opacity 0.85s ease, visibility 0.85s;
}

.reh-loading.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* 金色星形徽记，作为加载期的视觉锚点 */
.reh-loading__mark {
  width: 62px;
  height: 62px;
  margin-bottom: 24px;
}

/* 入场动画只在 JS 可用时启用：
   没 JS 时这些元素必须直接可见，否则会永远停在 opacity:0 */
.js .reh-loading__mark {
  opacity: 0;
  animation: rehMarkIn 1.1s cubic-bezier(0.16, 0.84, 0.44, 1) 0.1s forwards;
}

.reh-loading__mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.reh-loading__title {
  font-family: var(--r-serif);
  font-size: clamp(1.35rem, 3.6vw, 1.9rem);
  font-weight: 500;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  color: #fff;
}

.js .reh-loading__title {
  opacity: 0;
  animation: rehFadeUp 1s ease-out 0.28s forwards;
}

.reh-loading__sub {
  margin-top: 12px;
  font-family: var(--r-sans);
  font-size: 10.5px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: rgba(217, 179, 108, 0.75);
}

.js .reh-loading__sub {
  opacity: 0;
  animation: rehFadeUp 1s ease-out 0.42s forwards;
}

.reh-loading__bar {
  position: relative;
  width: 148px;
  height: 1px;
  margin-top: 36px;
  background: rgba(255, 255, 255, 0.13);
  overflow: hidden;
}

.reh-loading__bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--r-gold), transparent);
  transform: translateX(-100%);
  animation: rehProgress 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.reh-loading__scene {
  margin-top: 22px;
  font-family: var(--r-sans);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  color: rgba(255, 255, 255, 0.46);
  min-height: 1em;
}

.js .reh-loading__scene {
  opacity: 0;
  animation: rehFadeUp 1s ease-out 0.55s forwards;
}

@keyframes rehFadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rehMarkIn {
  from {
    opacity: 0;
    transform: scale(0.86);
  }
  to {
    opacity: 0.9;
    transform: none;
  }
}

@keyframes rehProgress {
  0% {
    transform: translateX(-100%);
  }
  55% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(100%);
  }
}

/* --------------------------------------------------------------------------
   顶部品牌栏
   -------------------------------------------------------------------------- */
.reh-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  gap: clamp(11px, 1.8vw, 22px);
  height: 74px;
  padding: 0 clamp(13px, 2.6vw, 28px);
  pointer-events: none;
  /* 上方压暗，保证白字可读，又不遮住画面主体。
     展厅顶部多为白色吊顶，纯渐变到 74px 高度时文字所在区间已经很淡，
     白字会发飘。所以让暗色一直保持到文字下沿，再快速收尾。 */
  background: linear-gradient(
    to bottom,
    rgba(10, 8, 7, 0.9) 0%,
    rgba(10, 8, 7, 0.78) 62%,
    rgba(10, 8, 7, 0.3) 88%,
    rgba(10, 8, 7, 0) 100%
  );
  transition: opacity 0.8s ease 0.3s,
    transform 0.9s cubic-bezier(0.16, 0.84, 0.44, 1) 0.3s;
}

/* 没有 JS 时不能把顶栏藏起来，否则用户看不到任何导航 */
.js .reh-bar {
  opacity: 0;
  transform: translateY(-8px);
}

.reh-bar.is-ready {
  opacity: 1;
  transform: none;
}

.reh-bar > * {
  pointer-events: auto;
}

.reh-bar__back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px 0 11px;
  font-family: var(--r-sans);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.93);
  text-decoration: none;
  border: 1px solid rgba(217, 179, 108, 0.42);
  border-radius: 999px;
  background: rgba(193, 39, 45, 0.16);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
  white-space: nowrap;
}

.reh-bar__back svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  transition: transform 0.35s cubic-bezier(0.16, 0.84, 0.44, 1);
}

.reh-bar__back:hover {
  color: #fff;
  background: var(--r-red);
  border-color: var(--r-red);
}

.reh-bar__back:hover svg {
  transform: translateX(-3px);
}

/* 竖线分隔 + 金色 */
.reh-bar__divider {
  width: 1px;
  height: 22px;
  flex: 0 0 auto;
  background: linear-gradient(
    to bottom,
    transparent,
    var(--r-gold-soft) 30%,
    var(--r-gold-soft) 70%,
    transparent
  );
}

.reh-bar__title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.reh-bar__name {
  font-family: var(--r-serif);
  font-size: clamp(0.95rem, 1.9vw, 1.16rem);
  font-weight: 500;
  letter-spacing: 0.13em;
  line-height: 1.22;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reh-bar__en {
  font-family: var(--r-sans);
  font-size: 9px;
  line-height: 1.3;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   当前场景指示（顶栏右侧）：序号 + 名称 + 副标
   替代 krpano 默认的 title 图层（已被 skin_settings.title="false" 关掉）
   -------------------------------------------------------------------------- */
.reh-scene {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  max-width: 42vw;
}

.reh-scene__idx {
  font-family: var(--r-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--r-gold);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.reh-scene__text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
}

.reh-scene__name {
  font-family: var(--r-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.07em;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  /* 场景名切换时的淡入，由 JS 打 class 触发 */
  transition: opacity 0.4s ease;
}

.reh-scene__sub {
  font-family: var(--r-sans);
  font-size: 10px;
  letter-spacing: 0.1em;
  line-height: 1.2;
  color: rgba(217, 179, 108, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  transition: opacity 0.4s ease;
}

.reh-scene__name.is-swap,
.reh-scene__sub.is-swap {
  opacity: 0;
}

/* --------------------------------------------------------------------------
   底部渐晕，衬托缩略图条
   -------------------------------------------------------------------------- */
.reh-vignette {
  position: fixed;
  left: 0;
  right: 0;
  /* 关键：抬到缩略图栏（距底 10~70px）之上，不再盖住场景名。
     原来的 bottom:0 + 底部 0.76 黑，会把缩略图连同场景名一起压成灰雾。 */
  bottom: 70px;
  z-index: 4000;
  height: 200px;
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(10, 8, 7, 0) 0%,
    rgba(10, 8, 7, 0.34) 28%,
    rgba(10, 8, 7, 0.30) 62%,
    rgba(10, 8, 7, 0) 100%
  );
  transition: opacity 0.9s ease 0.35s;
}

.js .reh-vignette {
  opacity: 0;
}

.reh-vignette.is-ready {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   首次进入的拖拽引导
   -------------------------------------------------------------------------- */
.reh-hint {
  position: fixed;
  left: 50%;
  bottom: 118px;
  z-index: 4500;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 17px;
  font-family: var(--r-sans);
  font-size: 12.5px;
  letter-spacing: 0.09em;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  border-radius: 999px;
  background: rgba(16, 10, 9, 0.55);
  border: 1px solid rgba(217, 179, 108, 0.28);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transform: translate(-50%, 10px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
}

/* 提示条只在 JS 下参与显示控制；无 JS 时直接不显示，
   避免它孤零零地压在画面上 */
body:not(.js) .reh-hint {
  display: none;
}

.js .reh-hint {
  opacity: 0;
}

.reh-hint.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.reh-hint.is-hide {
  opacity: 0;
  transform: translate(-50%, 8px);
}

.reh-hint svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--r-gold);
}

.reh-hint__arrows {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  animation: rehSwipe 2.2s ease-in-out infinite;
}

@keyframes rehSwipe {
  0%,
  100% {
    transform: translateX(-3px);
  }
  50% {
    transform: translateX(3px);
  }
}

/* --------------------------------------------------------------------------
   窄屏适配
   -------------------------------------------------------------------------- */
@media (max-width: 760px) {
  .reh-bar {
    height: 58px;
    gap: 9px;
  }

  .reh-bar__back {
    height: 32px;
    padding: 0 11px 0 9px;
    font-size: 12px;
  }

  /* 窄屏只留箭头，把宽度让给标题与场景名 */
  .reh-bar__back span {
    display: none;
  }

  .reh-bar__en {
    display: none;
  }

  .reh-bar__name {
    font-size: 0.9rem;
    letter-spacing: 0.09em;
  }

  /* 窄屏场景名收窄，避免和标题抢位 */
  .reh-scene {
    max-width: 46vw;
  }

  .reh-scene__name {
    font-size: 12px;
    letter-spacing: 0.04em;
  }

  /* 手机端空间紧张，副标让位给主场景名 */
  .reh-scene__sub {
    display: none;
  }

  .reh-scene__idx {
    font-size: 10px;
  }

  .reh-hint {
    bottom: 104px;
    font-size: 11.5px;
    padding: 8px 14px;
  }

  .reh-vignette {
    height: 160px;
  }
}

/* 极窄屏：场景名让位，只留序号 */
@media (max-width: 420px) {
  .reh-bar__title .reh-bar__name {
    font-size: 0.86rem;
    letter-spacing: 0.06em;
  }

  .reh-scene__name {
    max-width: 30vw;
  }
}

/* 极窄屏（<380px）：只留序号，标题完整保留 */
@media (max-width: 379px) {
  .reh-scene__name {
    display: none;
  }

  .reh-scene {
    max-width: none;
  }
}

/* 尊重系统的减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  .reh-loading__mark,
  .reh-loading__title,
  .reh-loading__sub,
  .reh-loading__scene,
  .reh-loading__bar::after,
  .reh-hint__arrows {
    animation: none;
    opacity: 1;
  }

  .reh-loading__mark {
    opacity: 0.9;
  }

  .reh-bar,
  .reh-vignette,
  .reh-scene__name {
    transition-duration: 0.001ms;
    transition-delay: 0ms;
  }
}
