/* =========================================================
   作品详情页增强：题款/印章热点、创作过程视频、分步展示
   只用 style.css :root 里的变量；类名统一 fw- 前缀，避免与其他功能冲突
   ========================================================= */

/* ---------- ⑤ 题款 / 印章热点 ---------- */

/* 与大图同尺寸的定位容器：热点按百分比放在里面，图片怎么缩放都能对准 */
.fw-figure { position: relative; width: fit-content; max-width: 100%; line-height: 0; }

.fw-spot {
  position: absolute; z-index: 2; width: 44px; height: 44px; padding: 0; margin: 0;
  transform: translate(-50%, -50%);   /* left/top 是热点中心 */
  border: 0; background: none; cursor: pointer; display: grid; place-items: center;
  -webkit-tap-highlight-color: transparent;
}
/* 可见部分：中间镂空的细圈，不遮住下面的印章；外圈一道柔和的呼吸光晕提示可点 */
.fw-spot-dot {
  position: relative; width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--paper); background: rgba(168, 53, 42, .14);
  box-shadow: 0 0 0 1.5px var(--seal), 0 2px 10px rgba(27, 26, 23, .25);
  transition: transform .25s ease, background .25s ease;
}
.fw-spot-dot::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 1px solid var(--seal); opacity: 0;
  animation: fw-pulse 2.6s ease-out infinite;
}
@keyframes fw-pulse {
  0% { transform: scale(.7); opacity: .7; }
  70%, 100% { transform: scale(1.5); opacity: 0; }
}
.fw-spot:hover .fw-spot-dot { transform: scale(1.12); }
.fw-spot[aria-expanded="true"] .fw-spot-dot { background: var(--seal); transform: scale(.8); }
.fw-spot[aria-expanded="true"] .fw-spot-dot::after { animation: none; opacity: 0; }
.fw-spot:focus-visible { outline: none; }
.fw-spot:focus-visible .fw-spot-dot { box-shadow: 0 0 0 1.5px var(--seal), 0 0 0 5px var(--paper), 0 0 0 6.5px var(--ink); }
/* 有卡片展开时，其他热点淡一点，视线集中在当前解读 */
.fw-figure.has-open .fw-spot[aria-expanded="false"] { opacity: .55; }

/* 解读卡片 */
.fw-card {
  position: absolute; z-index: 6; left: 0; top: 0;
  width: min(320px, calc(100vw - 48px));
  padding: 18px 22px 22px; background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); box-shadow: 0 2px 6px rgba(27, 26, 23, .06), 0 22px 54px rgba(27, 26, 23, .18);
  line-height: 1.6; text-align: left;
  animation: fw-card-in .22s ease-out;
}
.fw-card[hidden] { display: none; }
@keyframes fw-card-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* 小三角：默认在卡片上沿（卡片在热点下方），.is-above 时在下沿 */
.fw-card-arrow {
  position: absolute; top: -6px; left: var(--arrow-x, 50%); width: 11px; height: 11px; margin-left: -5.5px;
  background: var(--paper); border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg);
}
.fw-card.is-above .fw-card-arrow { top: auto; bottom: -6px; transform: rotate(225deg); }
.fw-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -8px -14px 6px 0; }
.fw-card-head .eyebrow { color: var(--seal); }
.fw-card-close {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center;
  border: 0; background: none; color: var(--mute); cursor: pointer;
}
.fw-card-close:hover { color: var(--ink); }
.fw-card p { margin: 0; }
.fw-card-orig { font-size: 24px; font-weight: 400; letter-spacing: .12em; line-height: 1.35; }
.fw-card-pinyin { margin-top: 2px !important; font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--mute); }
.fw-card-en { margin-top: 10px !important; font-family: var(--serif); font-size: 20px; line-height: 1.3; }
.fw-card-meaning { margin-top: 14px !important; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-2); line-height: 1.7; }

/* 提示语：桌面放在舞台左上角留白里 */
.fw-hint {
  position: absolute; left: 16px; top: 16px; margin: 0;
  display: inline-flex; align-items: center; gap: 8px;
  font: 400 12px/1.4 var(--sans); letter-spacing: .02em; color: var(--mute);
}
.fw-hint-dot { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--paper); box-shadow: 0 0 0 1px var(--seal); background: rgba(168, 53, 42, .25); }

/* ---------- 创作过程区块 ---------- */

.fw-process { padding: clamp(64px, 8vw, 120px) 0; }
.fw-process[hidden] { display: none; }
.fw-intro {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 24px clamp(40px, 6vw, 96px);
  align-items: end; margin-bottom: clamp(40px, 5vw, 64px);
}
.fw-intro-text { margin: 0; color: var(--ink-2); max-width: 44ch; }

/* ① 视频 */
.fw-video { margin: 0 0 clamp(72px, 9vw, 128px); }
.fw-video[hidden] { display: none; }
.fw-video-frame {
  position: relative; width: 100%; max-height: 78vh; margin: 0 auto;
  background: var(--paper-2); overflow: hidden;
}
.fw-video-frame video, .fw-video-frame img { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--paper-2); }
.fw-video-tag {
  position: absolute; left: 16px; top: 16px; padding: 6px 10px;
  background: rgba(248, 246, 241, .92); color: var(--ink-2);
  font: 500 11px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase;
}
.fw-play {
  position: absolute; left: 16px; bottom: 16px; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; padding: 0; cursor: pointer;
  background: rgba(248, 246, 241, .94); color: var(--ink); border: 1px solid var(--line);
  box-shadow: 0 4px 18px rgba(27, 26, 23, .08); transition: background .2s, border-color .2s;
}
.fw-play:hover { background: var(--paper); border-color: var(--ink); }
.fw-play .i-pause, .is-playing .fw-play .i-play { display: none; }
.is-playing .fw-play .i-pause { display: block; }
.fw-video figcaption { margin-top: 14px; }

/* ② 分步：桌面左侧阶段图固定，右侧文字滚动切换 */
.fw-steps {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(40px, 6vw, 96px);
  align-items: start;
}
.fw-steps-aside { position: sticky; top: 140px; display: grid; gap: 16px; }
.fw-stack {
  position: relative; height: min(calc(100vh - 240px), 820px); min-height: 360px;
  background: var(--paper-2);
}
.fw-stack img {
  position: absolute; left: 7%; top: 6%; width: 86%; height: 88%; object-fit: contain;
  opacity: 0; transition: opacity .9s ease;
  filter: drop-shadow(0 2px 3px rgba(27, 26, 23, .08)) drop-shadow(0 14px 30px rgba(27, 26, 23, .1));
}
.fw-stack img.on { opacity: 1; }

.fw-steps-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.fw-steps-nav button {
  position: relative; width: 44px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer;
  font: 500 14px/1 var(--sans); color: var(--mute); transition: color .2s;
}
.fw-steps-nav button::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 8px; height: 1px; background: currentColor;
  transform: scaleX(0); transition: transform .3s ease;
}
.fw-steps-nav button:hover { color: var(--ink); }
.fw-steps-nav button[aria-current="step"] { color: var(--seal); }
.fw-steps-nav button[aria-current="step"]::after { transform: none; }
.fw-steps-count { margin: 0 0 0 auto; padding-left: 12px; }

.fw-steps-list { list-style: none; margin: 0; padding: 0; }
.fw-step {
  min-height: 58vh; padding: 12vh 0 0; border-top: 1px solid var(--line);
  opacity: .32; transition: opacity .5s ease;
}
.fw-step:first-child { padding-top: 0; border-top: 0; }
.fw-step:last-child { min-height: calc(100vh - 260px); }
.fw-step.on { opacity: 1; }
.fw-step-img { display: none; }
.fw-step-num { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--seal); }
.fw-step-of { font-size: 15px; color: var(--mute); }
.fw-step .h3 { margin: 10px 0 14px; }
.fw-step p { margin: 0; color: var(--ink-2); max-width: 40ch; }
.fw-step .fw-step-final { margin-top: 18px; }

@media (prefers-reduced-motion: reduce) {
  .fw-spot-dot::after { animation: none; }
  .fw-card { animation: none; }
  .fw-stack img, .fw-step { transition: none; }
}

/* ---------- 手机 ---------- */
@media (max-width: 760px) {
  /* 底部 76px 留白是给 AR 按钮的：有 AR 时不放提示，没有时提示放在这里 */
  .fw-hint { top: auto; bottom: 26px; left: 50%; transform: translateX(-50%); white-space: nowrap; }
  .fw-hint.has-ar { display: none; }
  .fw-card { padding: 16px 18px 18px; }
  .fw-card-orig { font-size: 22px; }

  .fw-intro { grid-template-columns: 1fr; }
  .fw-video-frame { max-height: 70vh; }
  .fw-video-tag { left: 12px; top: 12px; }
  .fw-play { left: 12px; bottom: 12px; }

  /* 分步：横向滑动卡片，每张卡片自带阶段图 */
  .fw-steps { grid-template-columns: 1fr; gap: 8px; }
  .fw-steps-aside { position: static; }
  .fw-stack { display: none; }
  .fw-steps-list {
    display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory;
    margin: 0 calc(-1 * var(--gutter)); padding: 4px var(--gutter) 8px; scroll-padding: 0 var(--gutter);
    scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  }
  .fw-steps-list::-webkit-scrollbar { display: none; }
  .fw-step, .fw-step:first-child, .fw-step:last-child {
    flex: 0 0 82%; min-height: 0; padding: 0; border: 0; opacity: 1; scroll-snap-align: start;
  }
  .fw-step-img { display: block; width: 100%; height: auto; background: var(--paper-2); padding: 18px; margin-bottom: 18px; object-fit: contain; }
  .fw-step .h3 { font-size: 24px; margin: 6px 0 10px; }
  .fw-step p { font-size: 15px; }
}
