/* 幕间漫游 · 06 号展厅「收藏背后」· 还是黑
 * 视觉语汇：暗房序幕 (#0e1013) → 温暖档案书桌 (#f7f3eb) · 柔琥珀金 (#d9a962 / #9d6f2c)
 */
:root {
  --dark-bg: #0e1013;
  --dark-surface: #15181e;
  --dark-ink: #f3ede2;
  --dark-muted: #aba396;
  --amber: #d9a962;
  --amber-deep: #996a26;
  --amber-soft: rgba(217, 169, 98, 0.16);

  --paper-bg: #f7f3eb;
  --paper-card: #fffdf8;
  --paper-tint: #efe8da;
  --paper-border: rgba(58, 48, 34, 0.12);
  --ink: #221f1a;
  --ink-secondary: #5e564a;
  --ink-faint: #8f8576;

  /* 字体族统一取自 /shared/shell.css：--font-display = Long Cang 龙藏，--font-body = 苹方黑体栈 */
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
  background: var(--dark-bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper-bg);
  line-height: 1.85;
  overflow-x: clip;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* 顶部发丝阅读进度条 */
.read-progress-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: rgba(217, 169, 98, 0.12);
  z-index: 9200;
  pointer-events: none;
}

.read-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #b88437 0%, #e7be7c 100%);
  transition: width 0.08s linear;
}

/* ===== 暗房序幕 Hero ===== */
.hero {
  position: relative;
  background: var(--dark-bg);
  color: var(--dark-ink);
  padding: clamp(68px, 11vw, 128px) 24px clamp(68px, 10vw, 112px);
  overflow: hidden;
}

.hero-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-glow {
  position: absolute;
  inset: -20% -10% auto;
  height: 130%;
  background:
    radial-gradient(ellipse 56% 58% at 76% 36%, rgba(217, 169, 98, 0.16), transparent 68%),
    radial-gradient(ellipse 46% 52% at 18% 82%, rgba(140, 108, 64, 0.11), transparent 72%);
}

.hero-grain {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background-image: radial-gradient(rgba(255, 248, 232, 0.5) 0.55px, transparent 0.55px);
  background-size: 6px 6px;
}

.hero-motif {
  position: absolute;
  right: max(4%, calc(50% - 500px));
  top: 50%;
  transform: translateY(-48%);
  width: clamp(210px, 28vw, 350px);
  height: auto;
  opacity: 0.14;
  filter: drop-shadow(0 0 28px rgba(217, 169, 98, 0.25));
  user-select: none;
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 780px;
  margin: 0 auto;
}

.hero-title {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: clamp(38px, 6.8vw, 66px);
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: 0.06em;
  color: #faf5eb;
}

.hero-byline {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 245, 224, 0.12);
}

.byline-author {
  font-family: var(--font-body);
  font-size: 18px;
  letter-spacing: 0.08em;
  color: var(--amber);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.hero-btn-primary {
  background: var(--amber);
  color: #16130e;
  font-weight: 600;
}

.hero-btn-primary:hover {
  background: #e5b873;
  transform: translateY(-1px);
}

.hero-btn-ghost {
  border: 1px solid rgba(255, 246, 227, 0.26);
  color: #f3ede2;
  background: rgba(255, 246, 227, 0.04);
}

.hero-btn-ghost:hover {
  border-color: rgba(217, 169, 98, 0.65);
  background: rgba(217, 169, 98, 0.1);
}

.hero-edge {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22px;
  background: linear-gradient(to bottom, rgba(14, 16, 19, 0), rgba(14, 16, 19, 0.35));
}

/* ===== 温暖档案书桌正文 ===== */
.desk-surface {
  background:
    radial-gradient(ellipse 90% 420px at 50% 0, rgba(217, 169, 98, 0.08), transparent 72%),
    var(--paper-bg);
  padding-top: clamp(36px, 6vw, 68px);
}

.essay-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 22px clamp(56px, 8vw, 96px);
}

.loading-state {
  padding: 48px 0;
  text-align: center;
  color: var(--ink-faint);
  font-size: 14px;
}

/* 正文排版 */
.essay-body {
  font-size: 16.5px;
  line-height: 1.95;
  color: var(--ink);
  word-break: break-word;
}

.essay-chapter-anchor {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 52px 0 22px;
  scroll-margin-top: 28px;
}

.essay-chapter-anchor:first-child {
  margin-top: 8px;
}

.chapter-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--amber-deep);
  background: rgba(217, 169, 98, 0.14);
  border: 1px solid rgba(153, 106, 38, 0.24);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.chapter-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(153, 106, 38, 0.28), rgba(153, 106, 38, 0.03));
}

.essay-p {
  margin: 0 0 1.25em;
  text-align: justify;
  text-justify: inter-ideograph;
}

.essay-p.is-catalog-entry {
  padding: 12px 16px;
  margin: 0.9em 0 1.25em;
  background: rgba(255, 253, 248, 0.78);
  border-left: 2.5px solid var(--amber);
  border-radius: 0 6px 6px 0;
}

.essay-item-heading {
  margin: 2em 0 0.75em;
  padding-bottom: 6px;
  font-family: var(--font-body);
  font-size: clamp(18px, 2.6vw, 20.5px);
  font-weight: 600;
  line-height: 1.45;
  color: #181510;
  border-bottom: 1px dashed rgba(153, 106, 38, 0.28);
}

.essay-fig-key {
  margin: 2.1em 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  background: var(--paper-tint);
  padding: 3px 10px;
  border-radius: 4px;
}

.essay-fig-key::before {
  content: "图注序号";
  font-family: var(--font-body);
  letter-spacing: 0.06em;
  color: var(--amber-deep);
}

/* 嵌入式正文配图：原比例、不裁切 */
.essay-figure {
  margin: 12px 0 32px;
  padding: 12px;
  background: var(--paper-card);
  border: 1px solid var(--paper-border);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(42, 32, 16, 0.07);
}

.essay-img-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #ede6d8;
  border-radius: 6px;
  overflow: hidden;
  cursor: zoom-in;
}

.essay-img-btn img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.35s ease;
}

.essay-img-btn:hover img {
  transform: scale(1.012);
}

/* HTML 表格移动端安全横向滚动容器 */
.table-scroll-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 24px 0 28px;
  border: 1px solid var(--paper-border);
  border-radius: 8px;
  background: var(--paper-card);
}

.table-scroll-wrap table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.65;
}

.table-scroll-wrap th,
.table-scroll-wrap td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--paper-border);
  text-align: left;
  vertical-align: top;
}

.table-scroll-wrap th {
  background: var(--paper-tint);
  font-weight: 600;
  color: var(--ink);
}

/* ===== 实物实拍图集（11 张，全原比例不裁切） ===== */
.gallery-band {
  background: #121418;
  color: var(--dark-ink);
  padding: clamp(56px, 8vw, 96px) 22px clamp(64px, 8vw, 100px);
  border-top: 1px solid rgba(217, 169, 98, 0.22);
  scroll-margin-top: 12px;
}

.gallery-inner {
  max-width: 1120px;
  margin: 0 auto;
}

.gallery-header {
  max-width: 680px;
  margin-bottom: clamp(28px, 4vw, 44px);
}

.gallery-heading {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 500;
  letter-spacing: 0.05em;
  color: #fbf6ec;
}

.gallery-masonry {
  column-count: 2;
  column-gap: 20px;
}

.gallery-card {
  break-inside: avoid;
  margin: 0 0 20px;
  background: #191c22;
  border: 1px solid rgba(255, 246, 227, 0.1);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.gallery-card:hover {
  border-color: rgba(217, 169, 98, 0.45);
  transform: translateY(-2px);
}

.gallery-card-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #0f1115;
  cursor: zoom-in;
}

.gallery-card-btn img {
  display: block;
  width: 100%;
  height: auto;
}

.gallery-card-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 14px;
}

.gallery-card-caption {
  font-size: 13.5px;
  color: #eae2d4;
  line-height: 1.5;
}

/* 展厅尾注 */
.exhibit-footer {
  background: #0e1013;
  color: var(--dark-muted);
  text-align: center;
  padding: 40px 20px 98px;
}

.footer-rule {
  width: 48px;
  height: 1px;
  margin: 0 auto 18px;
  background: rgba(217, 169, 98, 0.4);
}

.footer-top-link {
  display: inline-block;
  font-size: 12.5px;
  color: var(--amber);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(217, 169, 98, 0.28);
}

.footer-top-link:hover {
  background: rgba(217, 169, 98, 0.12);
}

/* ===== 浮动目录与阅读进度胶囊 ===== */
.toc-widget {
  position: fixed;
  right: 16px;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 9400;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.toc-fab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 246, 227, 0.18);
  background: rgba(16, 17, 21, 0.84);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f4efe6;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.toc-fab:hover {
  border-color: rgba(217, 169, 98, 0.55);
}

.toc-fab-icon {
  color: var(--amber);
  font-size: 12px;
}

.toc-fab-pct {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(217, 169, 98, 0.22);
  color: #f6d39c;
}

.toc-drawer {
  width: min(300px, calc(100vw - 24px));
  max-height: min(62vh, 420px);
  display: flex;
  flex-direction: column;
  background: rgba(18, 20, 25, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 246, 227, 0.16);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  color: #f4efe6;
  overflow: hidden;
}

.toc-drawer[hidden] {
  display: none;
}

.toc-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 246, 227, 0.1);
}

.toc-drawer-title {
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0.06em;
  color: #f7e4c4;
}

.toc-close-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #e6dfd2;
  cursor: pointer;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.toc-link {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: #d6cec0;
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.toc-link:hover {
  background: rgba(255, 246, 227, 0.08);
  color: #fff;
}

.toc-link.is-active {
  background: rgba(217, 169, 98, 0.18);
  color: #f8dfb5;
}

.toc-drawer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 246, 227, 0.1);
  font-size: 11.5px;
  color: var(--dark-muted);
}

.toc-top-btn {
  border: 0;
  background: transparent;
  color: var(--amber);
  cursor: pointer;
  padding: 4px 0;
}

/* ===== Lightbox 大图查看器 ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 13, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lightbox-stage {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: max(12px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
}

.lightbox-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 6px 10px;
  color: #ece4d6;
  font-size: 13px;
}

.lightbox-group {
  color: var(--dark-muted);
  font-size: 12px;
}

.lightbox-close {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 246, 227, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: #f6efe2;
  font-size: 16px;
  cursor: pointer;
}

.lightbox-viewport {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.lightbox-figure {
  margin: 0;
  max-width: min(92vw, 1140px);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.lightbox-img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 150px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.6);
}

.lightbox-caption {
  font-size: 13.5px;
  color: #dfd6c7;
  text-align: center;
  max-width: 680px;
  line-height: 1.55;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 246, 227, 0.22);
  background: rgba(15, 17, 21, 0.72);
  color: #f7efe2;
  font-size: 26px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
}

.lightbox-prev {
  left: 6px;
}

.lightbox-next {
  right: 6px;
}

.lightbox-nav:hover {
  border-color: var(--amber);
  color: var(--amber);
}

/* ===== 响应式适配（1440 / 390 / 320） ===== */
@media (min-width: 1040px) {
  .gallery-masonry {
    column-count: 3;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 54px 18px 54px;
  }

  .hero-motif {
    width: 190px;
    right: -28px;
    top: 20px;
    transform: none;
    opacity: 0.1;
  }

  .essay-shell {
    padding: 0 16px 52px;
  }

  .essay-body {
    font-size: 16px;
    line-height: 1.88;
  }

  .essay-figure {
    padding: 8px;
  }

  .gallery-band {
    padding: 48px 16px 56px;
  }

  .gallery-masonry {
    column-count: 1;
  }

  .toc-widget {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  .toc-fab {
    padding: 5px 10px;
    font-size: 11px;
    gap: 5px;
  }

  .lightbox-nav {
    width: 38px;
    height: 38px;
    font-size: 22px;
  }
}

@media (max-width: 360px) {
  .toc-fab-label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
