/* ==========================================================================
   detail.css · 内页（六项手艺 / 我的作品）
   与主册共用世界：先加载 ../style.css（世界层）+ ../sections.css（区块层），
   本文件只负责"内页"这一种版式：眉标 → 大标题 → 导语 → 图集 → 正文 → 规格 → 翻页。
   ========================================================================== */

/* ---------- 内页骨架 ---------- */
.d-main {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 40px) clamp(16px, 4vw, 32px) 64px;
}

.d-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-bottom: 10px;
  padding: 0 14px 0 10px;
  border-radius: var(--r-btn);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  text-decoration: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background 0.25s ease, color 0.25s ease;
}
.d-back:hover { transform: translateX(-3px); background: rgba(255, 255, 255, 0.3); color: var(--ink); }
.d-back .ph { font-size: 1rem; }
@media (prefers-color-scheme: dark) {
  .d-back:hover { background: rgba(255, 255, 255, 0.1); }
}

.d-title {
  font-size: clamp(2rem, 5.2vw, 3.2rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 16px;
}
.d-title .d-title-accent {
  display: block;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.d-lead {
  max-width: 58ch;
  margin-bottom: 34px;
  font-size: 1.06rem;
  line-height: 1.75;
  color: var(--ink-soft);
}

/* 内页顶部两枚订书钉：把这一页订进册子 */
.d-stapled {
  position: relative;
  padding-top: 26px;
}
.d-stapled::before,
.d-stapled::after {
  content: "";
  position: absolute;
  top: 0;
  width: 34px;
  height: 7px;
  border: 2px solid var(--accent);
  border-bottom: none;
  border-radius: 3px 3px 0 0;
  opacity: 0.75;
}
.d-stapled::before { left: 8px; }
.d-stapled::after { left: 58px; }

/* ---------- 图集 ---------- */
.d-gallery {
  display: grid;
  gap: clamp(14px, 2.2vw, 22px);
  margin: 8px 0 42px;
}
/* 站长把没有照片的页面的图片接口删掉了：空图集不要再留一大段空白 */
.d-gallery:empty,
.d-gallery:not(:has(figure)) { display: none; margin: 0; }
/* 正文第一个元素不要顶出额外的 38px（没有图集时应该贴紧导语） */
.d-body > :first-child { margin-top: 0; }

.d-shot {
  position: relative;
  margin: 0;
  border-radius: var(--r-glass);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  box-shadow: var(--glass-shadow);
}
/* 只缩不放：低分辨率截图（例如 461x112）不再被拉伸糊掉，按原尺寸居中呈现 */
.d-shot > img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
  cursor: zoom-in;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.d-shot > img:hover { transform: scale(1.012); }
.d-shot figcaption {
  padding: 10px 16px;
  border-top: 1px solid var(--glass-border);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
}

/* 图片占位槽：站长把 <span class="d-slot"> 整块换成 <img> 即可 */
.d-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 16 / 9;
  border: 1px dashed rgba(124, 92, 255, 0.45);
  border-radius: calc(var(--r-glass) - 1px);
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.07) 0 12px, transparent 12px 24px);
  color: var(--ink-soft);
  text-align: center;
  padding: 16px;
}
.d-slot .ph { font-size: 2rem; color: var(--violet); }
.d-slot b { font-family: var(--font-display); font-size: 1rem; color: var(--ink-2); }
.d-slot em {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 0.72rem;
  color: var(--ink-soft);
  word-break: break-all;
}

/* ---------- 正文 ---------- */
.d-body {
  display: block;
  margin-bottom: 40px;
}
.d-body > * { max-width: 68ch; }
.d-body h2 {
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  font-weight: 700;
  color: var(--ink);
  margin: 38px 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.d-body h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 26px 0 8px;
}
.d-body p { margin-bottom: 15px; font-size: 1.02rem; line-height: 1.8; color: var(--ink-2); }
.d-body ul, .d-body ol { margin: 0 0 16px; padding-left: 1.3em; color: var(--ink-2); }
.d-body li { margin-bottom: 7px; line-height: 1.75; }
.d-body li::marker { color: var(--pink); }
.d-body strong { color: var(--ink); font-weight: 700; }
.d-body a { color: var(--violet); text-decoration: underline; text-underline-offset: 3px; }
.d-body blockquote {
  margin: 20px 0;
  padding: 14px 20px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: rgba(255, 255, 255, 0.28);
  font-size: 1rem;
  color: var(--ink-2);
}
@media (prefers-color-scheme: dark) {
  .d-body blockquote { background: rgba(255, 255, 255, 0.07); }
}
.d-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(124, 92, 255, 0.12);
  color: var(--ink);
}

/* 需要"还没写"的段落：保留可见但标明状态 */
.d-todo {
  padding: 16px 18px;
  border-radius: var(--r-sm);
  border: 1px dashed rgba(124, 92, 255, 0.4);
  background: rgba(255, 255, 255, 0.2);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--ink-soft);
}
@media (prefers-color-scheme: dark) {
  .d-todo { background: rgba(255, 255, 255, 0.06); }
}

/* ---------- 规格表 ---------- */
.d-spec {
  display: grid;
  gap: 0;
  margin: 0 0 40px;
  border-top: 1px solid var(--line);
}
.d-spec > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
}
.d-spec dt {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}
.d-spec dd {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
}
.d-spec-title {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

/* ---------- 底部翻页 ---------- */
.d-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.d-pager { display: flex; flex-wrap: wrap; gap: 10px; }
.d-pager a,
.d-pager span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--r-btn);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  color: var(--ink-2);
  text-decoration: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background 0.25s ease, color 0.25s ease;
}
.d-pager a:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.34); color: var(--ink); }
.d-pager .is-empty { opacity: 0.4; pointer-events: none; }
@media (prefers-color-scheme: dark) {
  .d-pager a:hover { background: rgba(255, 255, 255, 0.11); }
}
.d-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

/* ---------- 图集放大（灯箱） ---------- */
.lb {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 40px);
  background: rgba(16, 10, 28, 0.82);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.lb[hidden] { display: none; }
.lb.is-open { opacity: 1; }
.lb img {
  max-width: 100%;
  max-height: calc(100% - 72px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--r-glass);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.lb-close {
  position: absolute;
  top: clamp(12px, 2vh, 20px);
  right: clamp(12px, 3vw, 28px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--r-btn);
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.lb-close:hover { background: rgba(255, 255, 255, 0.24); }
.lb-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(12px, 3vh, 26px);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.7);
}
body.lb-open { overflow: hidden; }

/* ---------- 滚动进度（与主册同一条缝线） ---------- */
.d-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 70;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: repeating-linear-gradient(90deg, var(--accent) 0 8px, transparent 8px 14px);
}

/* ---------- 进场（IntersectionObserver 驱动，无需 GSAP） ---------- */
.reveal { opacity: 0; transform: translateY(20px); }
.reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.is-in { opacity: 1; transform: none; transition: none; }
  .d-back:hover, .d-pager a:hover, .d-shot > img:hover { transform: none; }
  .lb, .lb img { transition: none; }
}

/* ---------- 窄屏 ---------- */
@media (max-width: 640px) {
  .d-main { padding-top: calc(var(--nav-h) + 24px); padding-bottom: 88px; }
  .d-title { font-size: 1.9rem; }
  .d-lead { font-size: 0.98rem; }
  .d-stapled::after { left: 50px; }
  .d-spec > div { flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 0; min-height: 0; }
  .d-spec dd { text-align: left; }
}
