/* ---------------------------------------------------------------
   卡夫卡Kafka · 摄影作品集  —  仿 Indexhibit eatock 极简布局
   白底 / 细字 / 固定左侧导航 / 右侧内容
--------------------------------------------------------------- */
:root {
  /* 默认深色（关灯） */
  --bg: #0e0e0e;
  --bg-panel: #141414;
  --ink: #e8e8e8;
  --dim: #8a8a8a;
  --faint: #5a5a5a;
  --line: #2a2a2a;
  --pic-bg: #1a1a1a;
  --menu-w: 212px;
  --pad-top: 22px;
}
body.light {
  --bg: #ffffff;
  --bg-panel: #ffffff;
  --ink: #111111;
  --dim: #8c8c8c;
  --faint: #b8b8b8;
  --line: #e8e8e8;
  --pic-bg: #f5f5f5;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 12px/1.75 "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .3s ease, color .3s ease;
}

img { border: 0; }

a { color: var(--dim); text-decoration: none; transition: color .18s ease; }
a:hover { color: var(--ink); }

/* ------------------------------ 侧栏 ------------------------------ */
#menu {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--menu-w);
  height: 100vh;
  padding: 0 12px 24px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
  z-index: 30;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column;
}
#menu::-webkit-scrollbar { width: 4px; height: 0; }
#menu::-webkit-scrollbar-thumb { background: var(--line); }
#menu::-webkit-scrollbar-track { background: transparent; }

.logo { display: block; margin: var(--pad-top) auto 0 auto; width: 56px; }
.logo img { display: block; width: 56px; height: 57px; background: var(--pic-bg); object-fit: cover; margin: 0 auto; }

/* 桌面端：头像与标题纵向堆叠、居中 */
.menu-head { display: flex; flex-direction: column; align-items: center; }

.title {
  margin: 10px 0 0 0;
  font-size: 21px; line-height: 1.25; color: var(--ink); letter-spacing: .01em;
  font-weight: 500; text-align: center;
}
.title a { color: var(--ink); }
.title small {
  display: block; margin-top: 5px;
  font-size: 9px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); font-weight: 400;
}

/* 侧栏内的作品标题 + 导语（首页专用） */
.side-head { margin-top: 26px; text-align: center; }
.side-head .side-title {
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink);
  line-height: 1.6; white-space: nowrap;
}
.side-head .side-title span { color: var(--dim); font-weight: 400; }
.side-head .side-title em {
  font-style: normal; color: var(--dim); font-weight: 400;
  font-size: 11px; letter-spacing: .02em; text-transform: none;
  margin-left: 4px;
}
.side-head .side-sub { color: var(--dim); font-size: 11px; letter-spacing: .04em; margin-top: 2px; }
.side-head .side-intro { margin-top: 14px; color: var(--dim); font-size: 11.5px; line-height: 1.9; }
.side-head .side-intro p { margin: 0; }

#menu .container { padding: 30px 0 0 0; margin-top: auto; width: 100%; }
#menu ul { list-style: none; margin: 0 0 26px 0; padding: 0; }
#menu li { padding-left: 10px; font-size: 12px; }
#menu li.section-title {
  padding-left: 10px; margin-bottom: 8px;
  font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--faint);
}
#menu li a { display: block; padding: 3px 0; color: var(--ink); opacity: .58; }
#menu li a:hover { opacity: 1; }
#menu li.active a { opacity: 1; font-weight: 600; }
#menu li a .n { color: var(--faint); margin-right: 8px; font-variant-numeric: tabular-nums; }
#menu .foot { padding-left: 0; font-size: 11px; color: var(--dim); text-align: center; width: 100%; }
#menu .foot p { margin: 0 0 4px; }

/* ------------------------------ 内容 ------------------------------ */
#content {
  margin-left: var(--menu-w);
  padding: var(--pad-top) 44px 30px 0;
  min-height: 100vh;
}
.container-inner { max-width: 1040px; margin: 0 auto; }

.page-head { margin: 0 0 22px; }
.page-head h1 {
  margin: 0; font-size: 13px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--ink);
}
.page-head .sub { color: var(--dim); font-size: 11px; letter-spacing: .04em; margin-top: 3px; }

.intro { max-width: 540px; color: var(--dim); font-size: 12px; line-height: 2; margin: 0 0 34px; }
.rule { height: 1px; background: var(--line); margin: 0 0 26px; max-width: 1040px; }

/* ------------------------------ 首页照片墙 ------------------------------ */
/* 4 列真瀑布流：生成器按最短列分配，每列顶部对齐、底部自然不齐 */
.wall { display: flex; align-items: flex-start; gap: 18px; max-width: 1040px; margin: 0 auto; }
.wall-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.wall-item {
  display: block; position: relative; overflow: hidden;
  background: var(--pic-bg); line-height: 0;
}
.wall-item .pic { display: block; position: relative; overflow: hidden; background: var(--pic-bg); line-height: 0; }
.wall-item .pic picture { display: block; width: 100%; height: 100%; position: relative; z-index: 1; }

/* ---- 照片墙：最小模糊图占位 → 清晰（blur-up） ----
   参数对齐「陈瑾涵作品集」网格图：blur(14px) / scale(1.06) / filter 走 .7s。
   默认态是「清晰正常显示」，只有 <head> 内联脚本给 html 加上 .blur-up
   才启用模糊态 —— JS 被禁用或中途挂掉时，从根上不会留下 104 张永久糊图。 */
.wall-item .lqip { display: none; }
.wall-item .pic img {
  display: block; width: 100%; height: auto; opacity: 1;
  transition: transform .7s cubic-bezier(.19,.72,.22,1);
}
.wall-item:hover .pic img { transform: scale(1.02); }

html.blur-up .wall-item .lqip {
  display: block; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  filter: blur(12px); transform: scale(1.08);   /* 微放大盖住 blur 在边缘的透色 */
  transition: opacity .6s ease;
}
html.blur-up .wall-item .pic img {
  opacity: 0; filter: blur(14px); transform: scale(1.06);
  transition: opacity .6s ease, filter .7s ease, transform .6s ease;
}
html.blur-up .wall-item .pic img.is-hd { opacity: 1; filter: none; transform: scale(1); }
html.blur-up .wall-item:hover .pic img.is-hd { transform: scale(1.02); }
html.blur-up .wall-item.is-hd .lqip { opacity: 0; }
html.blur-up .wall-item.is-done .lqip { display: none; }   /* 揭晓完移除合成层，省 GPU */
html.blur-up .wall-item.is-error .lqip { filter: blur(3px); transform: none; }  /* 高清失败：留可辨认的淡糊图 */
/* 保险丝：main.js 未能启动时 10s 后强制显示清晰图，绝不静默卡在模糊态 */
html.blur-up-failsafe .wall-item .pic img { opacity: 1; filter: none; transform: scale(1); }
html.blur-up-failsafe .wall-item .lqip { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  html.blur-up .wall-item .lqip, html.blur-up .wall-item .pic img { transition-duration: 0s; }
}

/* ---- 图片保护：禁选中 / 禁拖拽 / 禁 iOS 长按弹「存储图像」 ----
   只防普通用户操作，挡不住开发者工具、直接访问 images/ 地址、截图与抓包。 */
img, picture, .lqip, .wall-item .pic, #fs .fs-stage, .viewer .stage {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
img { -webkit-user-drag: none; -khtml-user-drag: none; }

/* 返回顶部按钮：固定在照片墙右侧 */
#to-top {
  position: fixed; right: 22px; bottom: 28px; z-index: 150;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg-panel);
  color: var(--dim); font-size: 20px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 1; pointer-events: auto;
  transition: border-color .2s ease, color .2s ease, background .2s ease, opacity .35s ease;
}
#to-top:hover { border-color: var(--faint); color: var(--ink); }
/* 3 秒无操作后淡出；pointer-events:none 保证透明按钮不抢右下角照片的点击 */
#to-top.hide { opacity: 0; pointer-events: none; }

/* ------------------------------ 看图器 ------------------------------ */
body.album #content {
  display: flex; flex-direction: column;
  height: 100vh; padding-bottom: 18px; overflow: hidden;
}
body.album .page-head { flex: 0 0 auto; }
.viewer {
  position: relative;
  display: flex; flex-direction: column;
  flex: 1 1 auto; min-height: 0;
}
.stage {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  cursor: zoom-in;
}
.stage.loading-all::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--line); border-top-color: var(--faint);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.layer { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center; }
.layer picture { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.layer img {
  display: block; max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain; background: transparent;
  opacity: 0; transition: opacity .5s ease;
}
.layer img.in { opacity: 1; }

.nz { position: absolute; top: 0; bottom: 0; width: 24%; cursor: pointer; z-index: 2; }
.nz.prev { left: 0; cursor: w-resize; }
.nz.next { right: 0; cursor: e-resize; }
@media (hover: hover) {
  .nz.prev:hover ~ .arrow.left, .nz.next:hover ~ .arrow.right { opacity: 1; }
}
.arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 3; opacity: 0; transition: opacity .25s ease;
  width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: var(--bg-panel); color: var(--ink); font-size: 17px; line-height: 38px; text-align: center;
  cursor: pointer; box-shadow: 0 1px 10px rgba(0,0,0,.25);
  border: 1px solid var(--line);
}
.arrow:hover { opacity: 1; }
.arrow.left { left: 10px; }
.arrow.right { right: 10px; }

.bar {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 12px 0 0; color: var(--dim); font-size: 11px; letter-spacing: .1em;
}
.bar .num { min-width: 92px; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: .12em; color: var(--ink); }
.bar .sep { width: 1px; height: 12px; background: var(--line); margin: 0 10px; }
.icon-btn {
  background: none; border: 0; padding: 3px 7px; cursor: pointer;
  color: var(--dim); font-size: 11px; letter-spacing: .1em; font-family: inherit;
}
.icon-btn:hover { color: var(--ink); }
.icon-btn.on { color: var(--ink); }
.bar .cap { margin-left: auto; color: var(--faint); letter-spacing: .04em; text-align: right; }
.bar .cap.hide { display: none; }

/* ------------------------------ 全屏看图 ------------------------------ */
#fs {
  position: fixed; inset: 0; z-index: 200;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg);
  /* 整个浮层都是手势区（照片上下留白也能滑），系统原生手势全部交给 JS */
  touch-action: none; overscroll-behavior: contain;
}
#fs.on { display: flex; }

/* 舞台：裁掉翻页时露出的左右两格；下滑退场的位移/缩放也作用在这一层 */
#fs .fs-stage {
  position: relative; flex: 1 1 auto; min-height: 0; width: 100%;
  overflow: hidden; will-change: transform;
}
/* 横向轨道：跟手由 JS 1:1 写 scrollLeft（合成层承载，不用 transform 逐帧抖动）。
   刻意不用 scroll-snap —— 原生吸附的时长/缓动由系统决定，iOS 上是硬吸，没有减速。 */
#fs .fs-scroller {
  position: absolute; inset: 0;
  display: flex; flex-flow: row nowrap;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: none;
  scrollbar-width: none;
}
#fs .fs-scroller::-webkit-scrollbar { display: none; }
#fs .fs-track { display: flex; flex: 0 0 300%; width: 300%; height: 100%; }
#fs .fs-slide {
  flex: 0 0 33.3333%; width: 33.3333%; height: 100%;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
#fs .fs-pic {
  display: block; max-width: calc(100vw - 120px); max-height: 100%;
  width: auto; height: auto; object-fit: contain;
  opacity: 0; transition: opacity .34s ease;
  -webkit-user-drag: none; user-select: none;
}
#fs .fs-pic.in { opacity: 1; }

/* 顶部信息条：左上角页码（3 秒后自动隐藏） */
#fs .fs-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 210;
  display: flex; align-items: center; justify-content: flex-start;
  padding: 16px 20px; pointer-events: none;
  transition: opacity .3s ease;
}
#fs .fs-top.hide { opacity: 0; }
#fs .fs-num { color: var(--dim); font-size: 12px; letter-spacing: .08em; font-variant-numeric: tabular-nums; }

/* 关闭按钮（X）：独立于顶部信息条，始终可见（层级高于开关灯，确保可点） */
#fs .fs-close {
  position: absolute; top: 16px; right: 20px; z-index: 310;
  width: 34px; height: 34px; line-height: 34px; text-align: center;
  border: 0; background: none; color: var(--dim); font-size: 20px; cursor: pointer;
  border-radius: 50%; transition: background .2s ease, color .2s ease; pointer-events: auto;
}
#fs .fs-close:hover { background: rgba(128,128,128,.15); color: var(--ink); }

/* 拍摄参数：浮在照片下方居中，3 秒后隐藏 */
#fs .fs-caption {
  position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%);
  z-index: 212; max-width: 92%; white-space: normal; overflow: visible; text-overflow: clip;
  text-align: center; line-height: 1.5;
  color: var(--dim); font-size: 11px; letter-spacing: .06em;
  background: rgba(0,0,0,.42); color: #ddd; padding: 6px 16px; border-radius: 999px;
  opacity: 1; transition: opacity .35s ease;
  pointer-events: none;
}
body.light #fs .fs-caption { background: rgba(0,0,0,.06); color: #666; }
#fs .fs-caption.hide { opacity: 0; }

/* 左右翻页箭头（PC 端） */
#fs .fs-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 56px; height: 72px; z-index: 209;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: none; cursor: pointer;
  opacity: 0; transition: opacity .25s ease;
}
#fs:hover .fs-nav { opacity: 1; }
#fs .fs-nav.l { left: 14px; }
#fs .fs-nav.r { right: 14px; }
#fs .fs-nav .t {
  font-size: 44px; line-height: 1; color: var(--dim); font-weight: 300;
  transition: transform .2s ease;
}
#fs .fs-nav:hover .t { transform: scale(1.15); color: var(--ink); }

/* 移动端隐藏左右箭头（触摸屏靠滑动/点按） */
@media (max-width: 860px) {
  #fs .fs-nav { display: none; }
  #fs .fs-pic { max-width: 100vw; max-height: 100%; }
  #fs .fs-top { padding: 12px 14px; }

  /* 拍摄参数：照片下方的普通文字，不再悬浮 / 不压在照片上。
     舞台高度由 JS 按当前照片比例收紧（fitStage），让文字紧贴照片下沿。 */
  #fs .fs-caption {
    position: static; left: auto; bottom: auto; transform: none;
    z-index: auto; max-width: 90%;
    flex: 0 0 auto; margin: 10px 12px 12px;
    white-space: normal; overflow: visible; text-overflow: clip;
    background: none; padding: 0; border-radius: 0;
    color: var(--dim); font-size: 11px; letter-spacing: .06em;
    line-height: 1.6; text-align: center;
  }
  body.light #fs .fs-caption { background: none; color: var(--dim); }
}

/* ------------------------------ 全局开关灯按钮 ------------------------------ */
#light-toggle {
  position: fixed; top: 16px; right: 22px; z-index: 300;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-panel);
  color: var(--dim); font-size: 12px; letter-spacing: .05em; cursor: pointer;
  transition: border-color .2s ease, color .2s ease, background .2s ease, opacity .3s ease;
}
#light-toggle:hover { border-color: var(--faint); color: var(--ink); }
#light-toggle .light-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
body.light #light-toggle .light-dot { background: #999; }

/* 全屏看图时：开关灯胶囊向左移，给右上角 X 腾位置；跟随 3 秒隐藏 */
body.fs-open #light-toggle { right: 66px; }
#light-toggle.hide { opacity: 0; pointer-events: none; }

/* ------------------------------ 文本页 ------------------------------ */
.text h2 { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); margin: 26px 0 6px; font-weight: 500; }
.text p { margin: 0 0 14px; }
.text ul { margin: 0 0 14px; padding-left: 16px; }
.text a { color: var(--ink); border-bottom: 1px solid var(--line); }
.text a:hover { border-color: var(--ink); }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 4px 14px; margin: 0 0 22px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; color: var(--ink); }

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 860px) {
  /* 移动端：开灯胶囊放在页面顶部右上角，随文档一起滚走，
     不再 fixed 悬浮在下滑后的照片上（桌面端保持原样）。
     body 提供定位上下文，保证 top/right 是相对文档顶部而不是视口。
     全屏看图时仍切回 fixed，否则按钮会留在文档顶端、全屏里找不到。 */
  body { position: relative; }
  #light-toggle { position: absolute; top: 14px; right: 16px; }
  body.fs-open #light-toggle { position: fixed; right: 66px; }

  #menu {
    position: static; width: auto; height: auto;
    padding: 14px 16px 12px; border-bottom: 1px solid var(--line);
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 18px;
  }
  /* 移动端：头像与标题左右排列、垂直居中 */
  .menu-head {
    flex-direction: row; align-items: center; gap: 12px;
    width: 100%;
  }
  .logo { margin: 0; flex: 0 0 auto; }
  .logo img { width: 44px; height: 45px; }
  .title { font-size: 17px; margin: 0; text-align: left; }
  .title small { margin-top: 2px; letter-spacing: .14em; }
  #menu .container { flex: 1 0 100%; padding: 8px 0 0; }
  #menu ul { display: flex; flex-wrap: nowrap; gap: 0 18px; margin: 0; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  #menu ul::-webkit-scrollbar { display: none; }
  #menu li { padding-left: 0; white-space: nowrap; font-size: 11.5px; }
  #menu li.section-title { display: none; }
  #menu .foot { display: none; }
  /* 移动端：侧栏作品标题 + 导语居中 */
  .side-head { margin-top: 14px; width: 100%; text-align: center; }
  .side-head .side-title { white-space: normal; }
  #content { margin-left: 0; padding: 16px 16px 24px; }
  body.album #content { height: auto; overflow: visible; }
  body.album .viewer { flex: 0 0 auto; height: 52vh; min-height: 240px; }
  .wall { gap: 12px; flex-wrap: wrap; }
  .wall-col { gap: 12px; flex: 1 1 46%; }
  .arrow { opacity: .9; }
  .bar .cap { display: none; }
}
