/* ==========================================================================
   site.css — 成品网页共用外壳（音乐开关 / 灯箱 / 基础重置）
   三套模板各自有独立样式文件，类名前缀 rm- / mn- / st-
   ========================================================================== */

.site {
  position: relative;
  width: 100%;
  min-height: 100%;
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* 用 clip 而不是 hidden：hidden 会让 .site 变成内部滚动容器，页面出现第二根滚动条 */
  overflow-x: clip;
  isolation: isolate;
}

/* 版式容器：宽度查询作用域。
   注意：音乐按钮 / 灯箱必须放在它外面，否则会受 layout containment 影响，
   position: fixed 将被解析为相对整页高度，而不是视口。 */
.site-inner {
  position: relative;
  width: 100%;
  container-type: inline-size;
  overflow-x: clip;
}

.site *,
.site *::before,
.site *::after {
  box-sizing: border-box;
}

.site img {
  display: block;
  max-width: 100%;
}

/* 用 :where() 降低重置规则的优先级，避免覆盖组件自身的边框/字体 */
.site :where(button) {
  font: inherit;
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
}

/* 用 :where() 保持 0 额外优先级：模板里的 margin / max-width 居中规则才能生效 */
.site :where(figure, p, h1, h2, blockquote) {
  margin: 0;
}

.site .num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* --- 背景音乐开关 --- */
.site-music {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 15px 9px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  color: #f6f2ea;
  background: rgba(24, 21, 18, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px -14px rgba(0, 0, 0, 0.6);
  transition: background 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
  opacity: 0.9;
}

.site-music:hover {
  transform: translateY(-2px);
  background: rgba(24, 21, 18, 0.78);
}

.site-music__icon {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 12px;
}

.site-music__icon i {
  display: block;
  width: 2px;
  height: 4px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.55;
}

.site-music.is-playing .site-music__icon i {
  opacity: 1;
  animation: music-bar 1.1s ease-in-out infinite;
}

.site-music.is-playing .site-music__icon i:nth-child(2) {
  animation-delay: 0.22s;
}
.site-music.is-playing .site-music__icon i:nth-child(3) {
  animation-delay: 0.44s;
}

@keyframes music-bar {
  0%,
  100% {
    height: 4px;
  }
  50% {
    height: 12px;
  }
}

/* 模板配色微调 */
.tpl-romance .site-music {
  color: #7b4a43;
  background: rgba(255, 252, 249, 0.82);
  border-color: rgba(180, 111, 103, 0.35);
  box-shadow: 0 10px 30px -18px rgba(146, 85, 78, 0.55);
}

.tpl-minimal .site-music {
  color: #141210;
  background: rgba(255, 253, 248, 0.85);
  border-color: rgba(20, 18, 16, 0.2);
  box-shadow: none;
}

/* --- 灯箱 --- */
.site-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(10, 8, 7, 0.86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: lb-in 0.32s ease both;
}

.site-lightbox[hidden] {
  display: none;
}

.site-lightbox__inner {
  max-width: min(92vw, 720px);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.site-lightbox__inner img {
  max-height: 74vh;
  width: auto;
  border-radius: 4px;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.8);
}

.site-lightbox__inner figcaption {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12.5px;
  letter-spacing: 0.1em;
}

.site .site-lightbox__close {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 14px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
}

@keyframes lb-in {
  from {
    opacity: 0;
  }
}

/* --- 预览模式下图片不可点 --- */
.site[data-preview-mode="true"] [data-photo] {
  cursor: default;
}
