/* ─────────────────────────────────────────────
   Soul Archive · style.css
   所有人物可视化页面共享的基础样式。
   每个人物页面只需覆盖 :root 颜色变量 + 添加特有样式。
   ───────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;1,400&family=DM+Mono:wght@300;400&family=Noto+Serif+SC:wght@400;600&display=swap');

* { margin:0; padding:0; box-sizing:border-box; }

:root {
  --bg: #f4ede0;
  --text: #3a3226;
  --muted: #9a8e7e;
  --accent: #c17a2f;
  --canvas-h: calc(100vh - 110px);
  --border-alpha: rgba(0,0,0,0.06);
  --btn-border: rgba(0,0,0,0.12);
  --btn-hover: rgba(0,0,0,0.06);
  --overlay-bg: rgba(244,237,224,0.96);
  /* bg-layer: 页面全屏背景图（可选，如陀翁的冬日森林），不设则无背景层 */
  --bg-layer-url: none;
  --bg-layer-opacity: 0;
  --bg-layer-filter: none;
}

/* ── 全屏背景层（通过 CSS 变量配置，无需额外 HTML 元素）── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background: var(--bg-layer-url) center/cover no-repeat;
  opacity: var(--bg-layer-opacity);
  filter: var(--bg-layer-filter);
  pointer-events: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Mono', monospace;
  overflow: hidden;
  height: 100vh;
  user-select: none;
}

/* ── 顶栏 ── */
#topbar {
  position: fixed; top:0; left:0; right:0; height:52px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-alpha);
  display: flex; align-items: center; padding: 0 32px;
  z-index: 200; gap: 24px;
}
#topbar h1 {
  font-family: 'Playfair Display', serif;
  font-size: 18px; font-weight: 400; white-space: nowrap;
}
#topbar h1 em { color: var(--muted); font-style: normal; font-size: 12px; margin-left: 12px; }
#phase-label {
  font-family: 'Noto Serif SC', serif; font-size: 13px; color: var(--muted);
  white-space: nowrap;
}
#zoom-controls { display: flex; align-items: center; gap: 8px; }
#zoom-controls button {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--btn-border); background: transparent;
  cursor: pointer; font-size: 16px; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
#zoom-controls button:hover { background: var(--btn-hover); }
#zoom-label { font-size: 11px; color: var(--muted); min-width: 36px; text-align: center; }

/* 手机端：压缩顶栏 */
@media (max-width: 600px) {
  #topbar { padding: 0 12px; gap: 8px; }
  #topbar h1 { font-size: 14px; }
  #topbar h1 em { display: none; }
  #phase-label { display: none; }
}

/* ── 主画布 ── */
#viewport {
  position: fixed; top: 52px; left: 0; right: 0;
  height: var(--canvas-h);
  overflow: hidden;
  touch-action: none;
}
#main-canvas {
  position: absolute; top: 0; left: 0;
  display: block;
  cursor: grab;
}
#main-canvas.grabbing { cursor: grabbing; }

/* ── 底部 minimap ── */
#minimap-bar {
  position: fixed; bottom: 0; left:0; right:0; height: 58px;
  background: var(--bg);
  border-top: 1px solid var(--border-alpha);
  display: flex; align-items: center; padding: 0 16px; gap: 12px; z-index: 200;
}
#minimap-canvas { flex: 1; height: 36px; cursor: pointer; border-radius: 4px; }
.viewport-rect {
  position: absolute; top: 11px; height: 36px;
  border: 2px solid var(--accent); border-radius: 4px;
  pointer-events: none;
}

/* ── 详情弹层 ── */
#detail-overlay {
  position: fixed; inset: 0;
  background: var(--overlay-bg);
  z-index: 300; display: none;
  justify-content: center; align-items: center;
  cursor: pointer;
}
#detail-overlay.show { display: flex; }
.detail-box {
  max-width: 560px; padding: 48px;
  cursor: default;
}
.detail-box img {
  display: block; margin: 0 auto 20px;
  max-width: 100%; max-height: 40vh;
  object-fit: contain;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}
.detail-box .d-date { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.detail-box .d-title {
  font-family: 'Playfair Display', serif; font-size: 22px;
  font-weight: 400; margin-bottom: 16px;
}
.detail-box .d-text {
  font-family: 'Playfair Display', serif; font-style: italic;
  font-size: 15px; line-height: 1.8; color: var(--text);
  max-height: 55vh; overflow-y: auto;
}
.detail-box .d-text p { margin-bottom: 1em; }
.detail-box .d-text p:last-child { margin-bottom: 0; }
.detail-box .d-meta { font-size: 10px; color: var(--muted); margin-top: 16px; }
.detail-box .d-wordcount {
  font-size: 10px; color: var(--muted); margin-top: 12px;
  display: flex; align-items: center; gap: 12px;
}
.detail-box .d-wordcount a {
  color: var(--muted); text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer;
}
.close-hint {
  position: fixed; top: 24px; right: 32px;
  font-size: 10px; color: var(--muted); z-index: 310;
  pointer-events: none;
}
