/* ============================================================
   一帛入梦 · 帛画解码短页样式
   静态阅读（非 sticky）：全画位置 → 局部线索 → 有出处解释 → 回看原图。
   深色阅读底，与二级 realm 视觉统一；仅二维。
   ============================================================ */

@font-face {
  font-family: "Painting";
  src: url("../fonts/painting-subset.woff2") format("woff2");
  font-display: swap;
}

:root {
  --ink: #0b2025;
  --ink-2: #061c23;
  --paper: #e9ddc4;
  --paper-dim: #b8c2b8;
  --gold: #c5a778;
  --cinnabar: #a85639;
  --font-han: "Painting", "Songti SC", "STSong", serif;
  --font-song: "Songti SC", "STSong", serif;
  --font-label: Arial, "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; background: var(--ink-2); }
body {
  margin: 0;
  background: var(--ink-2);
  color: var(--paper);
  font-family: var(--font-song);
  font-size: 16px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
::selection { background: rgba(168, 86, 57, .55); color: #fff; }

/* ---------- 常驻退出（复用 standalone 视觉，fixed） ---------- */
.decode-exit-fixed {
  position: fixed;
  z-index: 100;
  top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  font-size: 13px;
  letter-spacing: .18em;
  color: #f0e5cf;
  background: rgba(6, 28, 35, .78);
  border: 1px solid rgba(197, 167, 120, .4);
  border-radius: 4px;
  backdrop-filter: blur(10px);
  transition: background .3s ease, border-color .3s ease;
}
.decode-exit-fixed svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.decode-exit-fixed:hover, .decode-exit-fixed:focus-visible {
  background: rgba(143, 58, 44, .9);
  border-color: var(--gold);
}
.decode-exit-fixed:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- 阅读容器 ---------- */
.decode-wrap {
  width: min(760px, 92vw);
  margin: 0 auto;
  padding: 110px 0 60px;
}

.decode-hero { text-align: center; margin-bottom: 56px; }
.decode-hero .eyebrow {
  font-family: var(--font-label);
  font-size: 10px;
  letter-spacing: .3em;
  color: var(--gold);
}
.decode-hero h1 {
  margin: 18px 0 0;
  font-family: var(--font-han);
  font-weight: 400;
  font-size: clamp(32px, 8vw, 50px);
  letter-spacing: .1em;
  line-height: 1.4;
}
.decode-hero .hero-rule {
  width: 1px; height: 44px;
  margin: 26px auto 0;
  background: linear-gradient(var(--gold), transparent);
}

/* ---------- 阅读停留小节 ---------- */
.read-stop {
  margin: 0 0 64px;
  padding-top: 8px;
}
.stop-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.stop-label .no {
  font-family: var(--font-label);
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--gold);
}
.stop-label .line { flex: 1; height: 1px; background: rgba(197, 167, 120, .25); }
.stop-label h2 {
  font-family: var(--font-han);
  font-weight: 400;
  font-size: clamp(22px, 5.5vw, 28px);
  letter-spacing: .1em;
  white-space: nowrap;
}
.read-stop p {
  font-size: 15px;
  line-height: 2.1;
  color: var(--paper-dim);
}
.read-stop p + p { margin-top: 14px; }
.read-stop strong { color: var(--paper); font-weight: 400; }

/* ---------- 全画位置图（带 SVG 高亮） ---------- */
.map-frame {
  position: relative;
  width: min(300px, 72vw);
  margin: 8px auto 22px;
}
.map-frame img {
  width: 100%;
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, .55));
}
.map-frame svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.map-hl {
  fill: rgba(197, 167, 120, .12);
  stroke: var(--gold);
  stroke-width: 5;
  vector-effect: non-scaling-stroke;
}
.map-caption {
  text-align: center;
  font-family: var(--font-label);
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--gold);
  margin-top: -8px;
}

/* ---------- 局部线索图 ---------- */
.clue-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin: 10px 0 22px;
}
.clue {
  background: rgba(10, 30, 35, .6);
  border: 1px solid rgba(197, 167, 120, .18);
  border-radius: 4px;
  padding: 18px;
  text-align: center;
}
.clue img {
  width: auto;
  max-width: 100%;
  height: 220px;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .5));
}
.clue figcaption {
  margin-top: 14px;
  font-size: 13px;
  letter-spacing: .16em;
  color: var(--gold);
}
.clue small {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--paper-dim);
}

/* ---------- 出处说明 ---------- */
.source-note {
  border-left: 2px solid var(--cinnabar);
  padding: 4px 0 4px 18px;
  margin: 18px 0;
}
.source-note p { font-size: 13px; color: #9fb0a8; }
.source-note .src {
  display: block;
  margin-top: 10px;
  font-family: var(--font-label);
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--gold);
}

/* ---------- 页底退出 ---------- */
.decode-end {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 40px;
  padding: 56px 20px calc(40px + env(safe-area-inset-bottom));
  text-align: center;
  border-top: 1px solid rgba(197, 167, 120, .2);
}
.decode-end h2 {
  font-family: var(--font-han);
  font-weight: 400;
  font-size: clamp(24px, 6vw, 32px);
  letter-spacing: .12em;
}
.decode-end p { font-size: 13px; color: var(--paper-dim); max-width: 520px; }
.decode-exit-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  margin-top: 16px;
  padding: 14px 32px;
  font-family: var(--font-han);
  font-size: 16px;
  letter-spacing: .2em;
  color: #f0e5cf;
  background: #80382b;
  border: 1px solid #bc624c;
  border-radius: 4px;
  transition: background .35s ease, transform .35s ease;
}
.decode-exit-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.decode-exit-btn:hover, .decode-exit-btn:focus-visible {
  background: #9c4534;
  transform: translateY(-2px);
}
.decode-exit-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- 平板/桌面：局部图可并排 ---------- */
@media (min-width: 700px) {
  .clue-grid.two { grid-template-columns: 1fr 1fr; }
  .clue img { height: 240px; }
}

/* ---------- 减少动态 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
