/* ============================================================
   幕间漫游 · 5 号模块「vibecoding 合集」视觉层
   本页属于房间 2 —— 主展漫游 / 影院星球 / 林立手记（午夜放映）

   本版为「线框级正确」参考实现：干净、规范、可被换皮。
   只做基础可读样式，不含装饰动画、阴影堆叠、边框与渐变卡片。

   全站「母体骨架 + 随展厅呼吸的色温令牌（Room Lighting Tokens）」参考表：
   房间 1 · 序幕（暗房开场）：银盐纯黑 #080809 + 微光白 #E9E7E2
   房间 2 · 主展漫游 / 影院星球 / 林立手记（午夜放映）★ 本页
           蓝黑 #0D0D0F → #1B2028 + 银幕暖白 #F2EFE9 + 琥珀金 #D4A359
   房间 3 · 停下深读：档案温纸 #F4F1E9 / #EFE4D2 + 胶片炭黑 #161616 + 印章朱红 #B8402F
   房间 4 · 片尾散场：丝绒洋红 #B82E6B → #6E123B + 香槟金 #FFE2A8
   房间 5 · 彩蛋：复用 /shared/motifs/ 原创线条拼贴图案

   字体规范：标题使用 Long Cang（--font-display），正文使用苹方黑体栈
   （--font-body，变量见 /shared/shell.css）。不使用伪手写变换。
   ============================================================ */
:root {
  color-scheme: dark;

  /* —— 房间 2 · 午夜放映 色温令牌（仅基础可读样式）—— */
  --bg-0: #0D0D0F;      /* 背景最深 */
  --bg-1: #1B2028;      /* 背景亮端（渐变上端） */
  --surface: #141821;   /* 卡片单一浅表面色 */
  --ink: #F2EFE9;       /* 主文字 */
  --ink-2: #A39E93;     /* 次文字 */
  --ink-3: #6E6B64;     /* 弱文字 */
  --accent: #D4A359;    /* 强调：主按钮 + focus 焦点环 */

  /* 二维码前景/底色（扫码对比度优先，勿改） */
  --qr-fg: #161618;
  --qr-bg: #ffffff;

  /* 字阶四级 + 行高 */
  --fs-title: clamp(32px, 6vw, 48px);   /* 页面主标题 */
  --fs-label: 18px;                      /* 卡片标题 */
  --fs-body: 16px;                       /* 正文 / 描述 / 按钮 */
  --fs-caption: 13px;                    /* 类型 / 作者 / 图注 / 提示 */
  --lh-title: 1.25;
  --lh-label: 1.4;
  --lh-body: 1.7;
  --lh-caption: 1.5;

  /* 8px 间距节奏 */
  --sp-1: 8px;
  --sp-2: 16px;
  --sp-3: 24px;
  --sp-4: 32px;
  --sp-5: 40px;

  /* 圆角 */
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 8px;

  /* 字体：标题 --font-display / 正文 --font-body，定义见 /shared/shell.css；--font-mono 备用 */
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  /* 单一极简静态午夜蓝黑渐变 */
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: var(--lh-body);
  overflow-x: clip;
  padding-bottom: 104px; /* 为全局 .mj-shell-dock 预留安全空间 */
}

/* —— 图片自适应基线：所有 img 不溢出、不变形 —— */
img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ============================================================
   HEADER（纯文字元信息，无框无点）
   ============================================================ */
.exhibit-header {
  position: relative;
  z-index: 2;
  background: rgba(13, 13, 15, 0.55);
}

.header-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-3) 0;
}

.header-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-bottom: var(--sp-4);
}

.exhibit-title {
  margin: 0 0 var(--sp-1);
  font-family: var(--font-display);
  font-size: var(--fs-title);
  font-weight: 600;
  letter-spacing: 0;
  line-height: var(--lh-title);
  color: var(--ink);
}

.header-motif {
  width: 104px;
  height: auto;
  opacity: 0.28;
  flex-shrink: 0;
  pointer-events: none;
  user-select: none;
}

/* ============================================================
   MAIN / 卡片网格
   ============================================================ */
.exhibit-main {
  position: relative;
  z-index: 1;
  max-width: 1220px;
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-3) var(--sp-4);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3);
  align-items: stretch;
}

/* 卡片：单一浅表面色，无边框、无渐变、无阴影堆叠 */
.c-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
  transition: background-color 0.2s ease;
}

.c-card:hover {
  background: #181D27;
}

/* 预览图「银幕」：aspect-ratio 预留空间防 CLS，图片 object-fit:contain 不裁切 */
.c-shot-wrap {
  margin: 0;
}

.c-shot {
  appearance: none;
  border: 0;
  background: var(--bg-0);
  padding: 0;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: zoom-in;
  display: flex;
  align-items: center;
  justify-content: center;
}

.c-shot-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;   /* 保持原比例，不裁切、不变形 */
}

.c-shot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.c-shot--empty {
  color: var(--ink-3);
  font-size: var(--fs-caption);
}

/* 多图缩略图切换条：小尺寸防溢出，明暗区分选中 */
.c-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  margin-top: var(--sp-1);
}

.c-thumb {
  appearance: none;
  border: 0;
  background: var(--bg-0);
  border-radius: var(--radius-sm);
  padding: 0;
  width: 46px;
  height: 46px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.c-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.c-thumb.is-active {
  opacity: 1;
}

.c-thumb:hover {
  opacity: 0.85;
}

.c-thumb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 文案区：字阶分层 */
.c-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.c-type {
  margin: 0;
  font-size: var(--fs-caption);
  letter-spacing: 0.04em;
  line-height: var(--lh-caption);
  color: var(--ink-3);
}

.c-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0;
  line-height: var(--lh-label);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.c-author {
  margin: 0;
  font-size: var(--fs-caption);
  font-weight: 500;
  line-height: var(--lh-caption);
  color: var(--ink-2);
}

.c-desc {
  margin: 0;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

/* 底部：二维码 + 操作 */
.c-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
}

.c-qr {
  appearance: none;
  border: 0;
  padding: var(--sp-1);
  background: var(--qr-bg);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
}

.c-qr:hover {
  filter: brightness(0.98);
}

.c-qr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* 二维码尺寸用相对单位，随容器/视口自适应 */
.c-qr svg {
  display: block;
  width: clamp(96px, 28vw, 128px);
  height: auto;
  aspect-ratio: 1 / 1;
}

.c-qr-hint {
  margin: 0;
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  color: var(--ink-3);
  text-align: center;
}

.c-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.c-copy-tip {
  margin: 0;
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  color: var(--ink-3);
  text-align: center;
}

/* 按钮：主按钮强调色实底深字；次按钮 ghost（无边框） */
.c-btn {
  appearance: none;
  width: 100%;
  min-height: 44px;
  padding: 10px var(--sp-2);
  border-radius: var(--radius-md);
  border: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  text-align: center;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.c-btn--primary {
  background: var(--accent);
  color: #14120D;
}

.c-btn--primary:hover {
  background: #E0B46A;
}

.c-btn--secondary {
  background: transparent;
  color: var(--ink);
}

.c-btn--secondary:hover {
  background: rgba(242, 239, 233, 0.08);
  color: #FFFFFF;
}

.c-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================================
   LIGHTBOX（无边框面板，遮罩蓝黑）
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-3);
}

.lightbox[hidden],
.copy-dialog[hidden] {
  display: none !important;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 13, 15, 0.9);
}

.lightbox-frame {
  position: relative;
  z-index: 1;
  max-width: 94vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
}

/* 大图按百分比自适应，不溢出视口 */
.lightbox-media img {
  display: block;
  max-width: min(840px, 84vw);
  max-height: 76vh;
  width: auto;
  height: auto;
  border-radius: var(--radius-md);
  background: var(--bg-0);
}

.lightbox-media .lb-qr-box {
  background: var(--qr-bg);
  padding: var(--sp-2);
  border-radius: var(--radius-md);
}

.lightbox-media .lb-qr-box svg {
  display: block;
  width: clamp(160px, 66vw, 260px);
  height: auto;
  aspect-ratio: 1 / 1;
}

.lightbox-caption {
  margin-top: var(--sp-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  color: var(--ink);
  text-align: center;
  max-width: 60ch;
}

.lightbox-close {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: var(--sp-3);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close:hover {
  background: #181D27;
}

/* ============================================================
   手动复制兜底弹窗（无边框面板）
   ============================================================ */
.copy-dialog {
  position: fixed;
  inset: 0;
  z-index: 9850;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-3);
}

.copy-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 13, 15, 0.82);
}

.copy-dialog-frame {
  position: relative;
  z-index: 1;
  width: min(420px, 92vw);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-3) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.copy-dialog-close {
  position: absolute;
  top: var(--sp-1);
  right: var(--sp-1);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.copy-dialog-close:hover {
  background: rgba(242, 239, 233, 0.1);
}

.copy-dialog-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-label);
  font-weight: 600;
  line-height: var(--lh-label);
  color: var(--ink);
}

.copy-dialog-hint {
  margin: 0;
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  color: var(--ink-2);
}

.copy-dialog-input {
  width: 100%;
  min-height: 44px;
  padding: 10px var(--sp-2);
  border: 0;
  border-radius: var(--radius-md);
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-caption);
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
}

.copy-dialog-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.copy-dialog-done {
  width: 100%;
}

/* ============================================================
   TOAST / 状态
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(74px, calc(env(safe-area-inset-bottom) + 64px));
  transform: translateX(-50%);
  z-index: 9900;
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px var(--sp-2);
  font-size: var(--fs-caption);
  line-height: var(--lh-caption);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  max-width: calc(100vw - var(--sp-4));
  text-align: center;
}

.loading-state,
.error-state {
  grid-column: 1 / -1;
  padding: var(--sp-5) var(--sp-3);
  text-align: center;
  color: var(--ink-3);
  font-size: var(--fs-body);
}

.noscript-note {
  padding: var(--sp-3) var(--sp-2);
  text-align: center;
  color: var(--ink-2);
  font-size: var(--fs-body);
}

/* ============================================================
   RESPONSIVE（1440 / 390 / 320 不溢出、不裁切）
   ============================================================ */
@media (max-width: 1020px) {
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-2);
  }
}

@media (max-width: 680px) {
  .header-inner {
    padding: var(--sp-3) var(--sp-2) 0;
  }

  .header-title-row {
    padding-bottom: var(--sp-3);
  }

  .header-motif {
    width: 68px;
  }

  .exhibit-main {
    padding: var(--sp-3) var(--sp-2) var(--sp-3);
  }

  .cards-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-2);
  }

  .c-card {
    padding: var(--sp-2);
  }
}

/* ============================================================
   动效弱化
   ============================================================ */
@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;
  }
}
