/* style.css — 极简黑白摄影作品集 · 全部本地样式，无外部依赖 */

:root {
  /* 全屏看图：图片高度 = 视口高 − 预留（上下内边距/序号/间距）− 说明区高度。
     全部是常量 + vh，浏览器可连续重排 → 拖窗口时不会跳。
     --viewer-chrome = 图片区上下内边距 + 两个间距 + 序号高度
     --cap-h         = 说明区最大高度（更长就在自己内部滚动） */
  --viewer-chrome: 112px;   /* 上下内边距 + 两个间距 + 序号(含其上间距) */
  --cap-h: min(120px, 12vh);
  --viewer-bias: 0px;       /* 内容整体下移量：由 JS 按剩余空间自动设定（不超过剩余空间），也可手调 */
  --bg: #ffffff;
  --fg: #111111;
  --muted: #888888;        /* PROJECTS 标签等的浅灰 */
  --line: #eeeeee;
  --nav-item: #777777;     /* 侧栏导航未选中（默认）文字：比 --muted(#888) 深一点点，保持层次 */
  --nav-accent: #FF0000;   /* 侧栏导航悬停 / 当前激活 */
  --sidebar-w: 260px;  /* 左侧栏宽度 a */
  --cell-w: var(--sidebar-w); /* 每张图片宽度 = a */
  --gap: 2px;          /* 网格间隔 2px */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ------------------------------------------------------------------
 * 布局：左侧固定侧边栏 + 右侧内容
 * ------------------------------------------------------------------ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  padding: 34px 30px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: var(--bg);
  z-index: 50;
  overflow-y: auto;
  /* 隐藏中间分栏线 */
}

.brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.nav-label {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.nav-block ul { list-style: none; }
.nav-block li { margin: 6px 0; }

.nav-block a {
  font-size: 14px;
  color: var(--nav-item);
  display: inline-block;
  transition: color 0.15s ease;
}
.nav-block a:hover { color: var(--nav-accent); }

/* 当前激活：只用强调色区分，不要下划线 */
.nav-block a.active { color: var(--nav-accent); text-decoration: none; }

/* Projects 列表：字重 500；字号按侧栏宽度同比例 = 17px @ 侧栏 260px
   （汉字行高约 32 物理px。改 --sidebar-w 或以后再加断点时，字号会自动等比缩放） */
#projectNav a { font-weight: 500; font-size: calc(17 / 260 * var(--sidebar-w)); }

.muted { color: var(--muted); font-size: 13px; }

.social {
  margin-top: auto;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
  white-space: pre-wrap;
}

/* ------------------------------------------------------------------
 * 右侧画廊
 * ------------------------------------------------------------------ */
.content {
  flex: 1;
  margin-left: var(--sidebar-w);
  /* 左内边距为 0：第一列图片左缘与侧边栏右缘对齐（栏间无间隔） */
  padding: 30px 22px 30px 0;
  min-width: 0;
}

.gallery .group { display: none; }
.gallery .group.active { display: block; }

.group-title {
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 6px 0 18px;
}

.grid {
  display: grid;
  /* 每列固定为 a（= 左侧栏宽度），随可用宽度自动增加/减少列数 */
  grid-template-columns: repeat(auto-fill, var(--cell-w));
  gap: var(--gap);
}

/* 图片卡片：固定 4:3 比例，图片自适应填充格子 */
.card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: #fafafa;
  aspect-ratio: 4 / 3;
  break-inside: avoid;
}

.card picture {
  position: absolute;
  inset: 0;
  display: block;
}

.card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;   /* 填充裁剪，自适应格子 */
  /* 默认灰度（黑白）。注意：带 filter 的图片会退回 SDR、丢掉 HDR —— 这是刻意的，
     缩略图不需要 HDR；全屏看图才是要 HDR 的地方（见 .viewer-figure img）。 */
  filter: grayscale(1);
  transition: filter 0.9s cubic-bezier(0.4, 0, 0.2, 1);   /* 滑动时灰→彩缓慢过渡，不要突然变色 */
}

/* 桌面端：悬浮单张图片恢复原始色彩，其余保持灰度 */
@media (hover: hover) and (pointer: fine) {
  .card:hover img { filter: grayscale(0); }
}

/* 卡片说明（可选显示） */
.card .cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 24px 12px 12px;
  font-size: 12px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.card .cap p, .card .cap li { margin: 2px 0; }
.card .cap ul { padding-left: 16px; }
.card .cap blockquote {
  margin: 6px 0;
  padding-left: 10px;
  border-left: 2px solid rgba(255,255,255,0.5);
  font-style: italic;
}

/* 网格列数自适应：由 repeat(auto-fill, a) 自动增减，不再按断点写死 */

.empty { color: var(--muted); padding: 20px 0; }

/* ------------------------------------------------------------------
 * 汉堡菜单按钮（仅移动端显示）
 * ------------------------------------------------------------------ */
/* 窄屏吸顶标题栏（桌面端隐藏） */
.m-header { display: none; }

/* 满屏看图时，站点头部与汉堡完全让位（它们 z-index 60/61 在 root 层，
   而 .viewer 的 100 被所在层叠上下文包住 → 不藏就会被压在图上） */
body.viewer-open .m-header,
body.viewer-open .menu-btn { display: none !important; }

.menu-btn {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 60;
  width: 42px; height: 42px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 10px;
}
.menu-btn span {
  display: block;
  height: 2px;
  background: var(--fg);
  margin: 5px 0;
  width: 100%;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* ------------------------------------------------------------------
 * 窄屏（≤815px）：右侧放不下两列 → 切汉堡菜单模式。
 *   两列需要内容宽 2×260 + 2px 间隔 = 522px；内容宽 = 视口 − 侧栏 260
 *   − 右内边距 22 − 站点滚动条 8（::-webkit-scrollbar width:8px）
 *   → 视口 812px 是理论临界，取 815 留几像素余量（实测 804px 时确实只剩 1 列）：
 *   · 侧边栏收起为抽屉，由汉堡展开
 *   · 站点标题移到顶部居中、与汉堡一起吸顶；滚动后标题栏投出阴影
 *   · 图片单列瀑布流，左右铺满全宽（按图片自身比例，不再 4:3 裁剪）
 * ------------------------------------------------------------------ */
/* 手机（竖屏窄 / 横屏矮）——横屏也走手机外壳：汉堡菜单 + 居中吸顶标题，不出现固定侧栏 */
@media (max-width: 815px), (orientation: landscape) and (max-height: 520px) {
  .m-header {
    display: flex;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    z-index: 60;
    transition: box-shadow 0.22s ease;
  }
  /* 页面滚动后：标题栏下方出现投影，把层次压出来 */
  body.scrolled .m-header { box-shadow: 0 10px 22px rgba(0, 0, 0, 0.16); }
  .m-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
  }

  .menu-btn { display: block; top: 7px; left: 12px; z-index: 61; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    box-shadow: none;
    padding-top: 66px;
  }
  body.menu-open .sidebar { transform: translateX(0); box-shadow: 0 0 30px rgba(0,0,0,0.12); }
  .sidebar .brand { display: none; }        /* 标题已在吸顶栏，抽屉里不再重复 */

  /* 内容：上留出吸顶栏高度，左右不再留白（铺满全宽） */
  .content { margin-left: 0; padding: 56px 0 0; }

  /* 单列瀑布流：列宽 = 内容宽（= 屏宽），图片按自身比例、不裁剪 */
  .grid { grid-template-columns: 1fr; }
  .card { aspect-ratio: auto; overflow: visible; background: none; }
  .card picture { position: static; }
  .card img { height: auto; object-fit: contain; }

  /* 分组标题：居中（图片仍铺满） */
  .group-title { padding: 0 12px; margin: 16px 0 12px; text-align: center; }
  .empty { padding: 20px 12px; text-align: center; }

  /* 瀑布流聚焦：占据视野主体的那张恢复彩色（JS 加 .in-focus），其余保持灰度；
     第一张图在初始位置天然就是主体 → 默认彩色 */
  .card.in-focus img { filter: grayscale(0); }

  body.menu-open .menu-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.menu-open .menu-btn span:nth-child(2) { opacity: 0; }
  body.menu-open .menu-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ------------------------------------------------------------------
 * 全屏看图弹窗——始终显示原始色彩
 * ------------------------------------------------------------------ */
.viewer {
  position: fixed;
  inset: 0;
  background: #000;                      /* 纯黑：0.94 时手机端深色卡片会透出鬼影 */
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-x pan-y pinch-zoom;   /* 放行双指缩放（横屏还要能左右滑动条带） */
}
.viewer[hidden] { display: none; }

.viewer-stage {
  position: relative;
  width: 100%;
  max-width: none;          /* 不再限制 1200px：大图铺满可用区域 */
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  /* 上：给关闭按钮留位；下：给底部计数行留位；左右留一点余量（箭头现在跟着图片走） */
  padding: 28px 20px 18px;
}

/* 图片区：占满「除说明文字以外」的剩余高度，图片按比例缩放到这个高度里 */
.viewer-figure {
  flex: 1 1 auto;
  min-height: 0;            /* 关键：允许被压缩，图片才会给说明文字让位 */
  padding-top: var(--viewer-bias, 0px);   /* 内容下移 → 底部黑边更小 */
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

/* 一行三格：左箭头 | 图片（+ 叠在上面的 HDR 按钮）| 右箭头。
   用网格而不是绝对定位，避免 position/transform —— 它们对 HDR 有风险。 */
.viewer-row {
  flex: 0 0 auto;                /* 高度贴合图片，不被拉满：按钮/序号/说明才能贴住图片 */
  min-height: 0;
  width: 100%;
  display: grid;
  grid-template-columns: auto auto auto;
  grid-template-rows: auto;
  align-items: center;           /* 箭头与图片居中对齐 */
  justify-content: center;       /* 整组水平居中 */
  column-gap: 14px;
}
.viewer-row > .viewer-arrow.left  { grid-area: 1 / 1; }
.viewer-row > #viewerImg          { grid-area: 1 / 2; }
.viewer-row > #viewerImgSdr       { grid-area: 1 / 2; }
.viewer-row > .viewer-arrow.right { grid-area: 1 / 3; }
.viewer-row > .hdr-toggle {
  grid-area: 1 / 2;              /* 和图片同一格 → 叠在图片上 */
  align-self: end;               /* 贴图片右下角 */
  justify-self: end;
  margin: 0 16px 16px 0;         /* 离图片右边/下边各 16px */
  z-index: 2;
}

/* 手机横屏专用：整组图片横向连续展示（默认关闭，仅下面那条媒体查询里开启） */
.viewer-strip { display: none; }

/* 上面那层 SDR 副本：默认全透明，切到 SDR 时淡入 → 柔和渐变 */
.viewer-sdr {
  dynamic-range-limit: standard;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.viewer.hdr-off .viewer-sdr { opacity: 1; }
/* 老浏览器（不认 dynamic-range-limit）回退：filter 也能把 HDR 退回 SDR */
@supports not (dynamic-range-limit: standard) {
  .viewer-sdr { filter: grayscale(0); }
}

.viewer-figure img {
  flex: 0 1 auto;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  /* 纯 CSS 定尺寸：图片区总高 − 说明预留。不依赖 JS 测量，窗口缩放时原生连续重排 */
  max-height: calc(100vh - var(--viewer-chrome) - var(--cap-h) - var(--viewer-bias, 0px));
  width: auto;
  height: auto;
  object-fit: contain;
  /* 注意：这里不要写 margin: 0 auto —— flex 行里的 auto 外边距会吃掉全部自由空间，
     把左右箭头顶到容器两端（箭头就贴不住图片了）。居中交给 justify-content。 */
  /* 这里刻意不加 filter/opacity/transform：实测确认（HDR 屏上肉眼可见）
     图片上只要带任何 filter，哪怕 grayscale(0) 这种颜色不变的空操作，
     Chrome 也会把 HDR 退回 SDR。全屏看图是要 HDR 的地方。 */
}

/* 图片说明：固定占位、最多 24vh，再长也只在自身滚动，不会把图挤没 */
.viewer-cap {
  flex: 0 0 auto;
  align-self: flex-start;          /* 靠左摆放（不随 align-items:center 居中） */
  /* 翻页键显示时：左边缘对齐图片左边缘（--img-left 由 JS 量出），
     宽度贴合文字、且左右绝不超出图片（--img-w = 图片渲染宽度） */
  width: fit-content;
  max-width: var(--img-w, 100%);
  margin: 0 0 0 var(--img-left, 0px);
  box-sizing: border-box;
  max-height: var(--cap-h);        /* 固定预留高度，超出在说明内部滚动 */
  overflow-y: auto;
  color: #ddd;
  font-size: 16px;
  font-weight: 300;          /* 正文 300 */
  line-height: 1.7;
  text-align: left;          /* 说明文字左对齐，基准 = 图片左边缘 */
  margin-top: 0;
  margin-bottom: 0;
}

/* 说明里的 **加粗** 用 700，和正文 300 形成对比 */
.viewer-cap strong,
.viewer-cap b { font-weight: 700; }
.viewer-cap p { margin: 4px 0; }
.viewer-cap a { color: #fff; text-decoration: underline; }
.viewer-cap ul { padding-left: 18px; margin: 4px 0; }
.viewer-cap blockquote {
  margin: 8px 0;
  padding-left: 12px;
  border-left: 2px solid #888;
  color: #bbb;
  font-style: italic;
}

/* 分享按钮（看图器）：与关闭按钮同一套方形灰底，摆在它左边 */
.viewer-share {
  position: absolute;
  top: 14px; right: 64px;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(128, 128, 128, 0.55);
  border: none; border-radius: 0; color: #fff;
  cursor: pointer; z-index: 10;
}
.viewer-share:hover { background: rgba(170, 170, 170, 0.72); }
.viewer-share svg, .group-share svg { display: block; }

/* 分组标题旁的分享按钮（分享这一组） */
.group-share {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; margin-left: 8px; vertical-align: middle;
  background: none; border: none; border-radius: 4px;
  color: var(--muted); cursor: pointer;
  transition: color .2s ease, background .2s ease;
}
.group-share:hover { color: var(--fg); background: rgba(128, 128, 128, 0.14); }

/* 分享后的轻提示 */
.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%);
  z-index: 200; padding: 9px 16px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.82); color: #fff;
  font-size: 13px; letter-spacing: 0.3px; white-space: nowrap;
  opacity: 0; transition: opacity .25s ease; pointer-events: none;
}
.toast.on { opacity: 1; }

.viewer-close {
  position: absolute;
  top: 14px; right: 16px;
  background: rgba(128, 128, 128, 0.55);   /* 正方形灰底：压在图片上也看得清 */
  border: none;
  border-radius: 0;                        /* 正方形，不要圆角 */
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 翻页箭头：图片左右两侧（flex 子项，不用 position/transform） */
.viewer-arrow {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.55);
  font-size: 56px;
  line-height: 1;
  cursor: pointer;
  padding: 8px 10px;
  user-select: none;
  transition: color 0.2s ease, transform 0.2s ease;
}
.viewer-arrow:hover { color: #fff; }
.viewer-arrow.left:hover  { transform: translateX(-3px); }
.viewer-arrow.right:hover { transform: translateX(3px); }

/* ------------------------------------------------------------------
 * 右下角 HDR 开关：暗灰＝SDR 效果，白色＝HDR 效果；源图无 HDR 时不显示
 * ------------------------------------------------------------------ */
.hdr-toggle {
  padding: 7px 15px;
  border: none;
  border-radius: 999px;
  font: 600 11px/1 "Helvetica Neue", Helvetica, "PingFang SC", sans-serif;
  letter-spacing: 0.14em;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.13);   /* 暗灰 = SDR */
  color: rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10);
  transition: background 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
}
.hdr-toggle:hover { color: rgba(255, 255, 255, 0.8); }
.hdr-toggle[aria-pressed="true"] {          /* 白色 = HDR 生效 */
  background: #ffffff;
  color: #141414;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.35);
}
.hdr-toggle[hidden] { display: none; }

/* 图片不允许拖到窗口外下载，也不给右键另存（右键在 main.js 里拦截） */
img {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}

/* 序号：说明下方 20px，与说明左边缘对齐 */
.viewer-count {
  flex: 0 0 auto;
  align-self: flex-start;
  width: fit-content;
  margin: 20px 0 0 var(--img-left, 0px);   /* 比说明再往下 20px */
  text-align: left;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  letter-spacing: 1px;
}

/* ------------------------------------------------------------------
 * 窄屏 / 触摸屏 / 竖屏适配
 * - HDR 按钮、序号、说明都跟着图片走（网格 + flex 顺序），任何宽度下都在图片右下角 / 图片正下方
 * - 竖屏：隐藏左右翻页按钮（改用手指左右滑动），图片因此可以用满宽度
 * ------------------------------------------------------------------ */
@media (max-width: 768px) {
  :root { --viewer-chrome: 104px; --cap-h: min(150px, 20vh); }
  .viewer-stage { padding: 26px 6px 12px; gap: 10px; }
  .viewer-row { column-gap: 2px; }
  .viewer-arrow { font-size: 34px; padding: 6px 4px; }
  .viewer-row > .hdr-toggle { margin: 0 12px 12px 0; }
}

/* 竖屏：翻页按钮自动隐藏，图片拉满可用宽度 */
@media (orientation: portrait) {
  :root { --viewer-chrome: 96px; --cap-h: min(150px, 20vh); }
  .viewer-arrow { display: none; }
  /* 竖屏不用翻页键：图片铺满屏幕宽度（左右不留白） */
  .viewer-stage { padding: 20px 0 10px; }
  .viewer-row { column-gap: 0; }
  .viewer-row > .hdr-toggle { margin: 0 10px 10px 0; }
  /* 此时说明不再对齐图片左边缘，而是整块在屏幕上居中、文字左右内缩 */
  /* 竖屏（翻页键隐藏）：说明块吃满图片宽度（仍受 max-width: var(--img-w) 约束）。
     否则 width:fit-content 会让短说明收窄、再被居中 → 文字左边缘整体缩进去，
     和长说明的版心不在一条线上（用户实测：Gravity 的说明比西安的缩进很多）。 */
  .viewer-cap { width: 100%; align-self: center; margin: 0 auto; padding: 0 16px; }
  .viewer-count { align-self: center; margin: 20px auto 0; text-align: center; }
}

/* ------------------------------------------------------------------
 * 手机横屏（矮视口 + 横向）：看图器改成「整组图片横向连续展示」
 *   · 每条 = 整屏高、按自身比例 → 横向铺开，相邻间隔 2px
 *   · 手指左右滑动 = 原生横向滚动（scroll-snap 吸附到一条）
 *   · 说明 / 序号 / HDR 按钮叠加在图片上层（贴屏幕下方），垫黑色渐变
 *   · 关闭按钮仍在右上角叠加在图片上，带正方形灰底
 * ------------------------------------------------------------------ */
@media (orientation: landscape) and (max-height: 520px) {
  /* 单图那一套让位，只保留它的箭头 / HDR 开关 / 说明 / 序号（下面重新定位） */
  .viewer-stage { display: block; height: 100%; padding: 0; gap: 0; }
  /* 横屏不显示图片说明 → 连它底下的黑色渐变一并去掉，画面只剩图片 */
  .viewer-cap { display: none; }
  .viewer-figure {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
    display: block; width: auto; padding: 0 16px 12px; gap: 0;
    text-align: left; pointer-events: none;
    background: none;
  }
  .viewer-count {
    margin: 0; text-align: left;
    color: rgba(255, 255, 255, 0.8); text-shadow: 0 1px 5px rgba(0, 0, 0, 0.9);
  }
  .viewer-row { position: fixed; inset: 0; display: block; z-index: 7; pointer-events: none; }
  .viewer-row > #viewerImg,
  .viewer-row > #viewerImgSdr { display: none; }   /* 单图隐藏，改由 .viewer-strip 展示 */
  .viewer-arrow {
    position: fixed; top: 50%; margin-top: -30px; font-size: 34px; line-height: 40px;
    width: 40px; height: 40px; padding: 0; text-align: center;
    background: rgba(128, 128, 128, 0.55);   /* 与关闭按钮同一套方形灰底 */
    border-radius: 0; color: #fff;
    pointer-events: auto;
    transition: opacity 0.4s ease;
  }
  .viewer-close, .viewer-share { transition: opacity 0.4s ease; }
  .viewer-share { top: 10px; right: 60px; width: 40px; height: 40px; }
  /* 用户上手左右滑动之后：翻页按钮淡出、关闭按钮弱化，把画面还给照片 */
  .viewer.arrows-hidden .viewer-arrow { opacity: 0; pointer-events: none; }
  .viewer.arrows-hidden .viewer-close,
  .viewer.arrows-hidden .viewer-share { opacity: 0.4; }
  .viewer-arrow.left { left: 8px; }
  .viewer-arrow.right { right: 8px; }
  .viewer-arrow:hover { color: #fff; transform: none; }
  .viewer-row > .hdr-toggle {
    position: fixed; right: 16px; bottom: 14px; margin: 0;
    align-self: auto; justify-self: auto; pointer-events: auto;
  }

  /* 横向连续展示本体 */
  .viewer-strip {
    position: absolute; inset: 0; z-index: 1;
    display: flex; align-items: stretch; gap: 2px;   /* 相邻间隔 2px */
    height: 100%;
    overflow-x: auto; overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    background: #000;
  }
  .viewer-strip .slide {
    position: relative;
    flex: 0 0 auto; height: 100%;
    display: flex; align-items: center;
    scroll-snap-align: center;
  }
  .viewer-strip .slide img {
    height: 100%; width: auto; max-width: none; display: block;
    filter: grayscale(1);
    /* 只做"退出焦点"时的淡入（0.6s）；进入焦点那一侧见下面 .in-focus 里的 transition:none。
       为什么要不对称：图片上带着 filter 时会退回 SDR，若在"进入焦点"时也做过渡，
       过渡途中一直是 SDR、结束瞬间才恢复 HDR → 就是肉眼看到的 HDR 跳变。 */
    transition: filter 0.6s ease;
  }
  /* 焦点那张：立即去掉 filter → 立即恢复 HDR；同时不带亮度乘法，
     压暗改由下面的 ::after 叠层完成（叠层只影响合成结果，不动图片的 HDR 通路）。 */
  .viewer-strip .slide.in-focus img { filter: none; transition: none; }

  /* 非焦点压暗 50%：黑色叠层 + opacity 过渡（平滑、且与 HDR 无关） */
  .viewer-strip .slide::after {
    content: '';
    position: absolute; inset: 0;
    background: #000;
    opacity: 0.5;
    transition: opacity 0.6s ease;
    pointer-events: none;
  }
  .viewer-strip .slide.in-focus::after { opacity: 0; }

  /* HDR 关：整条切回 SDR（等价于单图路径的色调映射） */
  .viewer.hdr-off .viewer-strip img { dynamic-range-limit: standard; }

  /* ---- 横屏手机上的图片网格：保留手机外壳（汉堡 + 居中标题），但排成整齐多列，
     便于快速查找。列数由 build.js 按该组张数写在各 section 的 --cols 上
     （1–10 → 3 列，11–50 → 4 列，51+ → 5 列）。 ---- */
  .grid {
    grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
    gap: 2px;                                    /* 细缝，和 viewer 横向条带一致 */
  }
  .card {
    aspect-ratio: 4 / 3;                         /* 回到整齐的 4:3 缩略图（同桌面） */
    overflow: hidden;
    background: #fafafa;
  }
  .card picture { position: absolute; inset: 0; }
  .card img { width: 100%; height: 100%; object-fit: cover; }
  .group-title { margin: 12px 0 8px; }           /* 横屏竖向空间紧，标题收紧 */
}
@media (hover: none) {
  .viewer-arrow:hover { color: rgba(255, 255, 255, 0.55); }
}

/* ------------------------------------------------------------------
 * 整页垂直滚动条：扁平化、默认隐藏、仅内容溢出时出现、鼠标悬停/滚动时显示并可拖动
 * ------------------------------------------------------------------ */
html {
  /* Firefox：细滚动条 */
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
}

/* WebKit（Chrome / Safari / Edge）：细窄 + 透明轨道 + 默认隐藏的滑块 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: transparent;              /* 默认隐藏 */
  border-radius: 8px;
}
html:hover::-webkit-scrollbar-thumb,
html.scrolling::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.22);      /* 悬停/滚动时出现 */
}
html:hover::-webkit-scrollbar-thumb:hover,
html.scrolling::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.38);
}
::-webkit-scrollbar-corner { background: transparent; }
