/* ==========================================================================
   前台样式

   两条硬规矩：
   1. 界面（菜单、按钮、文字、照片外围背景）只允许纯黑 / 纯白 / 中间灰。
      唯一有颜色的是照片内容本身。
   2. 图片上不放任何文字。文字只出现在详情浮层和必要的界面元素里。

   移动端优先：基础样式即手机样式，再用 min-width 逐级增强。
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

:root {
  --bg: #000;
  --fg: #f0f0f0;
  --muted: rgba(255, 255, 255, .45);
  --faint: rgba(255, 255, 255, .18);
  --line: rgba(255, 255, 255, .12);

  /* 全站统一细无衬线；不让标题、菜单和正文混入第二套字体。 */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  --pad: clamp(16px, 4.5vw, 64px);
  --gap: clamp(10px, 2.4vw, 22px);
  --maxw: 1560px;

  --ease: cubic-bezier(.33, 1, .68, 1);
  --dur: 900ms;

  /* 双层视差模糊镜像的参数，由脚本按后台设置覆盖 */
  --mirror-blur: 60px;
  --mirror-gray: 1;
  --mirror-bright: .2;
  --mirror-scale: 3;
  --mirror-bg-x: 0px;
  --mirror-bg-y: 0px;
  --mirror-fg-x: 0px;
  --mirror-fg-y: 0px;
  --mirror-scroll-y: 0px;
  --menu-alpha: .82;
}

html[data-mode="light"] {
  --bg: #fff;
  --fg: #111;
  --muted: rgba(0, 0, 0, .45);
  --faint: rgba(0, 0, 0, .18);
  --line: rgba(0, 0, 0, .12);
}

html { max-width: 100%; overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.95;            /* 之前 1.75 太挤 */
  letter-spacing: .012em;
  color: var(--fg);
  background: var(--bg);
  max-width: 100%;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

/* 首页是唯一严格锁定在一个视口内的页面；其它页面只禁止横向溢出，
   纵向内容仍按正常文档流滚动。 */
html.is-home, body.is-home {
  width: 100%; height: 100%; height: 100dvh;
  min-height: 0; overflow: hidden;
  overscroll-behavior: none;
}
body.is-home > .page--wall,
body.is-home > .page--wall > .wall {
  width: 100%; height: 100%; min-height: 0;
  max-width: 100%; overflow: hidden;
}
/* 首页轮播始终用整个可视区域做画布。明确使用 flex 居中，避免横竖屏切换后
   图片因旧的块级基线或内容高度被推到下半屏。 */
body.is-home > .page--wall { position: fixed; inset: 0; }
body.is-home > .page--wall > .wall { position: relative; height: 100dvh; }
body.is-home > .page--wall > .wall > .ph { display: flex; align-items: center; justify-content: center; }
body.is-home > .page--wall > .wall > .ph > picture { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; }
body.is-home > .page--wall > .wall > .ph > .ph__img { flex: 0 0 auto; object-position: center center; }
body.is-home > .footer {
  position: absolute !important; inset: auto 0 0 !important; z-index: 20;
  padding: 8px var(--pad) calc(8px + env(safe-area-inset-bottom)) !important;
  pointer-events: none !important;
}

/* 第三种背景方案：每一页的封面（详情则是当前照片）放大、去色、模糊后铺满。
   页面内容在上层，不再用纯黑/纯白把它盖住。 */
.site__mirror {
  position: fixed; inset: -38px; z-index: 0; pointer-events: none;
  background-size: cover; background-position: center;
  transform: scale(var(--mirror-scale));
  filter: blur(var(--mirror-blur)) grayscale(var(--mirror-gray)) brightness(var(--mirror-bright));
}
.is-mirror-scheme .page, .is-mirror-scheme .footer { position: relative; z-index: 1; background: transparent; }
.is-mirror-scheme .detail { isolation: isolate; background: transparent; }
.is-mirror-scheme .detail__stage { background: transparent; }
.is-mirror-scheme .detail__box { background: transparent; }
.is-mirror-scheme .detail__mirror {
  position: fixed; inset: -38px; z-index: -1;
  background-size: cover; background-position: center;
  transform: scale(var(--mirror-scale));
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }
h1, h2 { margin: 0; font-weight: 300; line-height: 1.3; }

button {
  font: inherit; color: inherit; background: none;
  border: 0; cursor: pointer; padding: 0;
  touch-action: manipulation;
}
button, .topbar__nav a { min-height: 44px; }

:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }

/* ==========================================================================
   顶栏 —— 淡下去，但永远在
   早先版本是整个滑出屏幕，结果首页全屏轮播根本不能滚动，
   「向上滚才出现」的规则永远触发不了，访客找不到菜单。
   现在改成：闲置时只是变淡、去掉底色，logo 和汉堡按钮始终看得见。
   ========================================================================== */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 60;
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px var(--pad);
  padding-top: max(8px, env(safe-area-inset-top));
  padding-left: max(var(--pad), env(safe-area-inset-left));
  padding-right: max(var(--pad), env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 0;
  opacity: 1;
  transition: opacity .3s ease, background .35s ease, border-color .35s ease;
}
.topbar.is-shown {
  opacity: 1;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(16px);
  border-bottom-color: var(--line);
}
.topbar.is-open {
  z-index: 120;
  background: color-mix(in srgb, var(--bg) 48%, transparent);
  backdrop-filter: blur(8px);
  border-bottom-color: transparent;
}

/* 顶栏是一行 flex：左边 Home + 面包屑，右边按钮。各占各的位置，撞不到。 */
.topbar__left {
  display: flex; align-items: center; gap: 12px;
  min-width: 0;                /* 让面包屑能被压缩而不是把按钮挤出去 */
  flex: 1;
}
.topbar__left { grid-column: 1; grid-row: 1; }
.topbar__right { grid-column: 2; grid-row: 1; }
.topbar > .crumb { grid-column: 1 / -1; grid-row: 2; padding-top: 2px; }

.topbar__logo { display: flex; align-items: center; min-height: 44px; flex: none; }
.topbar__logo-img { width: auto; object-fit: contain; }
html[data-mode="dark"] .topbar__logo-img.is-light,
html[data-mode="light"] .topbar__logo-img.is-dark { display: none; }
/* 只传一张时自动反色，保证在另一种底色上也看得见 */
html[data-mode="light"] .topbar__logo-img.is-both { filter: invert(1); }

/* 文字标识的排版完全由后台写入的内联样式控制。 */
.topbar__word {
  display: block;
  line-height: 1;
  white-space: nowrap;
}

/* 面包屑：跟在 Home 右边，五种看图模式下都在 */
.crumb {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; overflow: hidden;
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  white-space: nowrap;
}
.crumb a { color: var(--muted); flex: none; transition: color .2s; }
.crumb__sep { font-style: normal; color: var(--faint); flex: none; }
.crumb__here {
  color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; min-width: 0;
}

.topbar__right { display: flex; align-items: center; gap: 2px; flex: none; }

.topbar__cart {
  position: relative; width: 44px; height: 44px;
  display: grid; place-items: center;
}
.topbar__cart[hidden] { display: none; }
.topbar__cart-n {
  min-width: 20px; height: 20px; padding: 0 5px;
  display: grid; place-items: center;
  border: 1px solid var(--fg); border-radius: 999px;
  font-size: 11px; line-height: 1;
}

.topbar__theme { width: 44px; height: 44px; display: grid; place-items: center; }
.topbar__theme::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid var(--fg);
  background: linear-gradient(90deg, var(--fg) 0 50%, transparent 50%);
  transition: transform .4s var(--ease);
}
.topbar__theme:active::before { transform: rotate(180deg); }

.topbar__toggle {
  width: 44px; height: 44px;
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  padding: 0 11px;
}
.topbar__toggle span {
  display: block; height: 1px; width: 100%;
  background: var(--fg);
  transition: transform .32s var(--ease), opacity .2s;
}
.topbar__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.topbar__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.topbar__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ==========================================================================
   菜单 = 全站地图。三层结构全列出来，一步直达任何相册。
   ========================================================================== */
.topbar__nav {
  position: fixed; inset: 0; z-index: 80;
  min-height: 100dvh;
  /* 是一层半透明玻璃，不是另一张不透明的新页面。 */
  background: rgb(0 0 0 / var(--menu-alpha));
  backdrop-filter: blur(18px) saturate(.82);
  opacity: 0; visibility: hidden;
  overflow-y: auto; overscroll-behavior: contain;
  transition: opacity .32s var(--ease), visibility .32s;
}
html[data-mode="light"] .topbar__nav { background: rgb(255 255 255 / var(--menu-alpha)); }
.topbar__nav.is-open { opacity: 1; visibility: visible; }

.nav__scroll {
  max-width: 760px; margin: 0 auto;
  padding: calc(64px + env(safe-area-inset-top)) max(var(--pad), env(safe-area-inset-left))
           calc(50px + env(safe-area-inset-bottom)) max(var(--pad), env(safe-area-inset-right));
}

.nav__home {
  display: inline-block;
  font-size: clamp(20px, 4.5vw, 28px);
  font-weight: 300; letter-spacing: .04em;
  padding: 6px 0 22px;
  border-bottom: 1px solid var(--line);
  width: 100%;
}

/* 页面入口和作品栏目共用一棵纵向菜单，禁止再排成横向一行。 */
.nav__tree--ordered > .nav__ordered-link {
  display: block;
  padding: 8px 0;
  font-size: clamp(16px, 3.2vw, 20px);
  font-weight: 300;
  letter-spacing: .03em;
}
.nav__tree--ordered > .nav__ordered-link + .nav__sec { margin-top: 12px; }

.nav__sec { padding: 26px 0 4px; }
.nav__sec-name {
  display: block;
  font-size: clamp(16px, 3.2vw, 20px);
  font-weight: 300; letter-spacing: .03em;
  padding-bottom: 6px;
}
.nav__sec-name.is-empty { color: var(--faint); }
/* 空栏目也列出来，标注一下，否则用户不知道自己建过 */
.nav__sec-name.is-empty::after {
  content: " —";
  font-size: 11px; letter-spacing: .18em;
}

.nav__cat { padding: 10px 0 6px 2px; }
.nav__cat-name {
  display: block;
  font-size: 12px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted);
  padding: 5px 0;
}
.nav__album {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 8px 0 8px 18px;
  font-size: 14.5px; font-weight: 300; letter-spacing: .03em;
  color: var(--fg);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, color .2s;
}
.nav__album em { font-style: normal; font-size: 11px; color: var(--faint); flex: none; }

.nav__extra {
  display: grid; gap: 4px;
  margin-top: 30px; padding-top: 22px;
  border-top: 1px solid var(--line);
}
.nav__extra a {
  font-size: 12px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted);
  padding: 6px 0;
}

/* ==========================================================================
   页面外壳
   ========================================================================== */
.page { min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.page--empty { background: var(--bg); }

.page--index, .page--text {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(76px, 14vw, 150px) max(var(--pad), env(safe-area-inset-left))
           clamp(60px, 12vw, 130px) max(var(--pad), env(safe-area-inset-right));
}

.page__title {
  font-size: clamp(13px, 2.6vw, 15px);
  font-weight: 300; letter-spacing: .34em; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: clamp(24px, 5vw, 44px);
}


.prose { max-width: 62ch; color: var(--fg); font-size: 15px; }
.rows { display: grid; max-width: 620px; }
.row {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  padding: 15px 0; border-bottom: 1px solid var(--line);
}
.row__k { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.row__v { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 分类 / 相册卡片 */
.cards { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
.cardx { position: relative; display: block; overflow: hidden; }
.cardx__img { width: 100%; aspect-ratio: 3/2; object-fit: cover; transition: opacity .5s var(--ease); }
.cardx__img--empty { display: block; background: var(--line); }
.cardx__name {
  display: block; padding: 12px 2px 0;
  font-size: 12px; letter-spacing: .2em; text-transform: uppercase;
}
.cardx__n {
  position: absolute; right: 8px; top: 8px;
  padding: 2px 5px; font-size: 10px; letter-spacing: .12em;
  color: var(--fg); background: var(--bg); border: 1px solid var(--line);
}

/* ==========================================================================
   照片墙 —— 五种模式共用同一份 DOM，靠 html[data-view] 切换
   ========================================================================== */
.page--wall { position: relative; }

.ph { position: relative; margin: 0; overflow: hidden; }
.ph__img { width: 100%; height: auto; display: block; }

/* 双层视差模糊镜像：底层同图放大模糊铺满，表层原图完整居中。
   grayscale 由 --mirror-gray 控制（后台可开关），默认去色，
   保证照片外围永远是黑白灰，不把照片的颜色泼到界面上。 */
.ph__mirror {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  transform: translate3d(var(--mirror-bg-x), var(--mirror-bg-y), 0) scale(var(--mirror-scale));
  filter: blur(var(--mirror-blur)) grayscale(var(--mirror-gray)) brightness(var(--mirror-bright));
  opacity: 0;
  transition: opacity .5s ease, transform .18s ease-out;
  pointer-events: none;
}
.ph.has-mirror .ph__mirror { opacity: 1; }

/* 加入清单的 ＋，无文字，只在有授权功能时出现 */
.ph__add {
  position: absolute; right: 6px; bottom: 6px; z-index: 3;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  font-size: 19px; font-weight: 300; line-height: 1;
  color: var(--fg); background: var(--bg); border: 1px solid var(--fg);
  opacity: .82; transition: opacity .25s;
}
.ph__add.is-in { opacity: 1; }
.ph__add.is-in::after { content: ""; position: absolute; inset: 4px; border: 1px solid currentColor; border-radius: 50%; }

/* --- carousel / cinema：整屏叠放 --- */
html[data-view="carousel"] .wall,
html[data-view="cinema"] .wall {
  position: relative;
  height: 100vh; height: 100dvh;
  min-height: 420px;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}
html[data-view="carousel"] .ph,
html[data-view="cinema"] .ph {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur);
}
html[data-view="carousel"] .ph.is-active,
html[data-view="cinema"] .ph.is-active { opacity: 1; visibility: visible; z-index: 2; }
/* 照片永远缩进来一圈、带阴影浮在模糊背景上。
   不做「比例接近就铺满」——铺满了两边没有留白，双层镜像就无从显示，
   而且悬浮感正是这个版式的重点。 */
html[data-view="carousel"] .ph__img,
html[data-view="cinema"] .ph__img {
  width: 100%; height: 100%;
  object-fit: contain;          /* 一个像素都不裁 */
  aspect-ratio: auto !important;
  position: relative; z-index: 1;
  padding: 0;
  /* drop-shadow 跟着图片的实际轮廓走，box-shadow 会画在整个盒子上，不能用 */
  filter: drop-shadow(0 30px 64px rgba(0, 0, 0, .62)) drop-shadow(0 6px 18px rgba(0, 0, 0, .45));
  translate: var(--mirror-fg-x) var(--mirror-fg-y);
  transition: translate .18s ease-out;
}
html[data-mode="light"] .ph__img {
  filter: drop-shadow(0 30px 64px rgba(0, 0, 0, .28)) drop-shadow(0 6px 18px rgba(0, 0, 0, .18));
}
/* 沉浸放映留白收窄一点，画面更满 */
html[data-view="cinema"] .ph__img { padding: 0; }
html[data-view="cinema"] .ph__add { display: none; }   /* 沉浸放映不放任何界面元素 */

.wall.is-dragging .ph { transition: none !important; }

/* 左右推移 */
html[data-view="carousel"] .wall[data-motion="slide"] .ph.is-prev,
html[data-view="cinema"] .wall[data-motion="slide"] .ph.is-prev { transform: translate3d(-100%, 0, 0); opacity: 1; visibility: visible; }
html[data-view="carousel"] .wall[data-motion="slide"] .ph.is-next,
html[data-view="cinema"] .wall[data-motion="slide"] .ph.is-next { transform: translate3d(100%, 0, 0); opacity: 1; visibility: visible; }
/* 缩放渐现 */
.wall[data-motion="zoom"] .ph { transform: scale(1.05); }
.wall[data-motion="zoom"] .ph.is-active { transform: scale(1); }
/* 竖向推移 */
html[data-view="carousel"] .wall[data-motion="vslide"] .ph.is-prev { transform: translate3d(0, -100%, 0); opacity: 1; visibility: visible; }
html[data-view="carousel"] .wall[data-motion="vslide"] .ph.is-next { transform: translate3d(0, 100%, 0); opacity: 1; visibility: visible; }

.wall.kb .ph.is-active .ph__img { animation: kb 18s linear both; }
@keyframes kb { from { transform: scale(1.01); } to { transform: scale(1.08); } }

/* 轮播控件使用站点黑白色，不依赖混合模式才能看见。 */
.wallctl { position: absolute; z-index: 5; color: var(--fg); }
html[data-view="grid"] .wallctl,
html[data-view="masonry"] .wallctl,
html[data-view="stream"] .wallctl,
html[data-view="cinema"] .wallctl { display: none; }

.wall-arrow {
  top: 50%; transform: translateY(-50%);
  width: 54px; height: 54px;
  display: none; align-items: center; justify-content: center;
  background: transparent; border: 0;
  filter: drop-shadow(0 0 2px var(--bg));
  opacity: .82; transition: opacity .4s;
}
.wall-arrow svg { width: 26px; height: 26px; }
.wall-arrow--prev { left: max(4px, env(safe-area-inset-left)); }
.wall-arrow--next { right: max(4px, env(safe-area-inset-right)); }
.wall.is-idle .wall-arrow { opacity: 0; }

/* 最多 8 条，绝不换行——换行就会铺成好几排糊住画面 */
.wall-dots {
  left: 0; right: 0; bottom: calc(22px + env(safe-area-inset-bottom));
  display: flex; justify-content: center; align-items: center; gap: 4px;
  padding: 0 var(--pad); flex-wrap: nowrap;
}
.wall-dot { width: 18px; height: 34px; display: flex; align-items: center; justify-content: center; }
.wall-dot::before {
  content: ""; display: block; width: 100%; height: 1px;
  background: rgba(255,255,255,.4);
  transition: background .4s var(--ease), height .3s var(--ease);
}
.wall-dot.is-active::before { background: #fff; height: 2px; }

.wall-progress { display: none; }
.wall-progress i { display: block; height: 100%; width: 0; background: rgba(255,255,255,.5); transition: width .12s linear; }

/* --- grid：等高网格，统一裁 3:2 --- */
html[data-view="grid"] .wall { display: grid; gap: 2px; grid-template-columns: 1fr; padding-top: 0; }
html[data-view="grid"] .ph__img { aspect-ratio: 3/2; object-fit: cover; }
html[data-view="grid"] .ph__mirror { display: none; }

/* --- masonry：瀑布流，按原比例高矮错落 --- */
html[data-view="masonry"] .wall { column-count: 1; column-gap: var(--gap); padding: 0 var(--pad); }
html[data-view="masonry"] .ph { break-inside: avoid; margin-bottom: var(--gap); display: inline-block; width: 100%; }
html[data-view="masonry"] .ph__mirror { display: none; }

/* --- stream：单列大图 --- */
html[data-view="stream"] .wall { display: grid; gap: clamp(30px, 7vw, 90px); padding: 0 var(--pad); }
html[data-view="stream"] .ph__mirror { display: none; }

/* 非轮播模式给顶部留出顶栏的位置 */
html[data-view="grid"] .page--wall,
html[data-view="masonry"] .page--wall,
html[data-view="stream"] .page--wall { padding: clamp(70px, 12vw, 110px) 0 clamp(50px, 10vw, 100px); }

/* ==========================================================================
   手机画廊条 —— 点一下页面滑出，3 秒不动收回
   ========================================================================== */
.filmstrip {
  position: fixed; z-index: 45;
  left: 0; right: 0;
  bottom: 0;
  display: flex; gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  overflow-x: auto;
  scrollbar-width: none;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px);
  border-top: 0;
  transform: translateY(101%);
  transition: transform .38s var(--ease);
}
.filmstrip::-webkit-scrollbar { display: none; }
.filmstrip[hidden] { display: none; }
.filmstrip.is-shown { transform: translateY(0); }
.filmstrip img {
  width: 54px; height: 54px; flex: none;
  object-fit: cover;
  opacity: .45;
  transition: opacity .25s;
  cursor: pointer;
}
.filmstrip img.is-active { opacity: 1; outline: 1px solid var(--fg); outline-offset: -1px; }

/* ==========================================================================
   照片详情浮层
   横图：图在上、信息在下。竖图：图缩小上移，信息同样在下。
   ========================================================================== */
.detail {
  position: fixed; inset: 0; z-index: 100;
  width: 100%; max-width: 100vw;
  min-height: 100dvh;
  background: var(--bg);
  overflow-x: clip;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.detail[hidden] { display: none; }

.detail__inner {
  width: 100%; max-width: 100%; min-width: 0;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  /* 上下留出四个角的高度，照片和文字永远不会被角上的按钮压到 */
  padding: calc(58px + env(safe-area-inset-top)) 0 calc(74px + env(safe-area-inset-bottom));
}

/* ---- 四个角 ----
   每个角是一个独立的容器，彼此隔着整个屏幕的宽和高，物理上不可能重叠。
   控件统一：1px 细线的图标，没有底色、没有边框、没有文字。 */
.detail__corner {
  position: fixed; z-index: 15;
  display: flex; align-items: center; gap: 4px;
}
.detail__corner--tl { top: max(6px, env(safe-area-inset-top)); left: max(6px, env(safe-area-inset-left)); }
.detail__corner--tr { top: max(6px, env(safe-area-inset-top)); right: max(6px, env(safe-area-inset-right)); }
.detail__corner--bl { bottom: max(10px, env(safe-area-inset-bottom)); left: max(6px, env(safe-area-inset-left)); }
.detail__corner--br { bottom: max(10px, env(safe-area-inset-bottom)); right: max(6px, env(safe-area-inset-right)); }

/* 详情打开时全站顶栏仍负责承载悬浮菜单，但隐藏它自身的品牌和汉堡，避免重复。 */
body.detail-open .topbar > .topbar__left,
body.detail-open .topbar > .topbar__right { visibility: hidden; }
body.detail-open .topbar.is-open > .topbar__right { visibility: visible; }

@media (max-width:599px) {
  .nav__scroll { max-width:none; padding-top:calc(58px + env(safe-area-inset-top)); padding-bottom:calc(34px + env(safe-area-inset-bottom)); }
  .nav__home { font-size:20px; padding-bottom:14px; }
  .nav__sec { padding-top:16px; }
  .nav__sec-name { font-size:17px; }
  .nav__cat { padding-top:6px; }
  .nav__album { min-height:36px; padding:5px 0 5px 12px; font-size:13px; }
}

.ctl {
  width: 48px; height: 48px; padding: 13px;
  color: var(--fg);
  background: transparent;
  border: 0;
  opacity: .92;
  /* 不用色块垫底；只给细线图标极轻的反色描边，压在深浅照片上仍清楚。 */
  filter: drop-shadow(0 0 1px var(--bg)) drop-shadow(0 0 2px var(--bg));
  transition: opacity .2s, transform .2s, filter .2s;
}
.ctl svg { width: 100%; height: 100%; }
.ctl:hover { opacity: 1; transform: scale(1.08); filter: drop-shadow(0 0 2px var(--bg)) drop-shadow(0 0 4px var(--bg)); }
.ctl:focus-visible { outline: 0; opacity: 1; transform: scale(1.08); }
.ctl:active { transform: scale(.94); }

/* 第几张 / 共几张，极小的字，跟在返回箭头旁边 */
.detail__count {
  font-size: 10.5px; letter-spacing: .18em;
  color: var(--fg); background: var(--bg); opacity: .9;
  padding: 3px 5px;
}
.detail__count:empty { display: none; }

.detail__stage {
  position: relative;
  width: 100%; max-width: 100%; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background: var(--bg);
}
.detail__stage img {
  position: relative; z-index: 1;
  max-width: 100%;
  object-fit: contain;
  translate: var(--mirror-fg-x) var(--mirror-fg-y);
  transition: translate .18s ease-out;
}
/* 横图：撑满宽度 */
.detail[data-orient="landscape"] .detail__stage img,
.detail[data-orient="pano"] .detail__stage img { width: auto; max-width: 100%; max-height: 72vh; }
/* 竖图：不许满屏，缩小并贴上方，把下面的空间留给信息 */
.detail[data-orient="portrait"] .detail__stage img,
.detail[data-orient="square"] .detail__stage img { max-height: 58vh; width: auto; }
.detail[data-orient="portrait"] .detail__stage,
.detail[data-orient="square"] .detail__stage { align-items: flex-start; padding: 0 var(--pad); }

.detail__mirror {
  position: absolute; inset: 0;
  pointer-events: none; /* 纯视觉层，禁止拦截 TAG/展开/更多作品 的点击 */
  background-size: cover; background-position: center;
  transform: translate3d(var(--mirror-bg-x), calc(var(--mirror-bg-y) + var(--mirror-scroll-y)), 0) scale(var(--mirror-scale));
  filter: blur(var(--mirror-blur)) grayscale(var(--mirror-gray)) brightness(var(--mirror-bright));
  opacity: 0; transition: opacity .5s ease, transform .18s ease-out;
}
.detail.has-mirror .detail__mirror { opacity: 1; }

/* 放在基础详情镜像规则之后，确保第三方案的当前照片底图覆盖整个详情页。 */
.is-mirror-scheme .detail__mirror {
  position: fixed; inset: -38px; z-index: -1;
  transform: scale(var(--mirror-scale));
}
.detail__frame { flex: 0 0 auto; }
.detail__frame--incoming, .detail__frame--outgoing {
  position: absolute !important; inset: 0; margin: auto;
  transition: transform .42s cubic-bezier(.22,.61,.36,1), opacity .42s ease !important;
}
.detail__frame.from-right { transform: translateX(100%); }
.detail__frame.from-left { transform: translateX(-100%); }
.detail__frame.is-moving { transform: translateX(0); }
.detail__frame.to-left { transform: translateX(-100%); opacity: .75; }
.detail__frame.to-right { transform: translateX(100%); opacity: .75; }

/* 主图左右半区都是透明翻页热区；没有按钮底板，也不改变照片显示。 */
.detail__stage-hit {
  position: absolute; z-index: 4; top: 0; bottom: 0;
  width: 50%; padding: 0; border: 0; background: transparent;
  outline: 0; opacity: 0;
}
.detail__stage-hit--prev { left: 0; cursor: w-resize; }
.detail__stage-hit--next { right: 0; cursor: e-resize; }
.detail__side {
  position: absolute; z-index: 8; top: 50%; translate: 0 -50%;
  margin: 0; filter: drop-shadow(0 0 2px var(--bg)) drop-shadow(0 0 5px var(--bg));
}
.detail__side--prev { left: 0; }
.detail__side--next { right: 0; }

/* 信息整体收在一个框里，有明确的边界感，不再是一堆字散在黑底上 */
.detail__info {
  width: 100%;
  max-width: 860px;
  margin: clamp(22px, 4vh, 44px) auto 0;
  padding: 0 max(var(--pad), env(safe-area-inset-left))
           0 max(var(--pad), env(safe-area-inset-right));
}
.detail__box {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}
html[data-mode="light"] .detail__box { background: transparent; }

.detail__title {
  font-size: clamp(12px, 1.6vw, 15px);
  font-weight: 300;
  line-height: 1.45;
  letter-spacing: .015em;
  margin: 0 0 .55em;
}
.detail__title,.detail__desc { display:-webkit-box; -webkit-box-orient:vertical; overflow:hidden; }
.detail__title { -webkit-line-clamp:1; }
.detail__desc { -webkit-line-clamp:2; }
.detail.detail--expand-title .detail__title,
.detail.detail--expand-desc .detail__desc { display:block; overflow:visible; }
.detail__title:empty { display: none; }

.detail__desc {
  color: var(--muted);
  font-size: 15px;
  line-height: 2;
  max-width: 60ch;
  margin: 0;
}
.detail__desc:empty { display: none; }

.detail__kw { display: flex; flex-wrap: wrap; gap: 7px; margin: 22px 0 0; }
.detail__kw:empty { display: none; }
.detail__kw button, .detail__kw a {
  font-size: 11px; letter-spacing: .12em; line-height: 1.5;
  padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 2px;
  color: var(--muted);
  min-height: 0;
  transition: color .2s, border-color .2s, background .2s;
}
.detail__kw button:hover, .detail__kw button:focus-visible,
.detail__kw a:hover, .detail__kw a:focus-visible { color: var(--fg); border-color: var(--fg); background: transparent; }
.detail__disclose {
  display:block; width:max-content; min-height:24px; margin:7px 0 0; padding:0;
  border:0; background:transparent; color:var(--faint);
  font:300 10px/1.4 Arial,Helvetica,sans-serif; letter-spacing:.14em;
}
.detail__disclose[hidden] { display:none; }

.detail__buy { margin-top: 28px; }
.page--tags { box-sizing:border-box; width:100%; max-width:100%; padding:calc(var(--topbar-h) + 30px) clamp(10px,3vw,48px) 72px; min-height:100dvh; overflow-x:clip; }
.page--tags *, .page--tags *::before, .page--tags *::after { box-sizing:border-box; min-width:0; }
.tag-head { margin: 0 auto 18px; max-width: 1100px; }
.tag-head p, .tag-head span { color: var(--muted); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.tag-head h1 { margin: 5px 0; font-size: clamp(18px, 2.2vw, 30px); font-weight: 300; }
.tag-search { display:flex; max-width:1100px; margin:0 auto 18px; border-bottom:1px solid var(--line); }
.tag-search input { flex:1; min-width:0; padding:14px 4px; border:0; color:var(--fg); background:transparent; font:300 clamp(15px,2vw,22px)/1.4 Arial,sans-serif; outline:0; }
.tag-search button { padding:0 4px; color:var(--muted); background:transparent; border:0; font-size:11px; letter-spacing:.16em; text-transform:uppercase; }
.tag-scopes { width:min(1100px,100%); margin:0 auto 12px; display:flex; flex-wrap:wrap; align-items:center; gap:4px 12px; overflow:visible; }
.tag-scopes::-webkit-scrollbar { display:none; }
.tag-scope { flex:0 1 auto; max-width:100%; padding:4px 0; border:0; border-bottom:1px solid transparent; overflow:hidden; color:var(--faint); background:transparent; font:300 10px/1.4 Arial,sans-serif; text-overflow:ellipsis; white-space:nowrap; }
.tag-scope em { margin-left:3px; font-size:8px; font-style:normal; }
.tag-scope.is-active { color:var(--fg); border-bottom-color:var(--fg); }
.tag-filter { width:min(1100px,100%); margin:0 auto 28px; }
.tag-cloud { display:flex; max-width:100%; flex-wrap:wrap; gap:5px 12px; overflow:hidden; }
.tag-cloud__item { display:inline-flex; max-width:100%; align-items:baseline; gap:4px; padding:3px 0; overflow:hidden; color:var(--muted); font-size:10px; font-weight:300; line-height:1.4; text-decoration:none; border-bottom:1px solid transparent; }
.tag-cloud__item span { display:block; min-width:0; max-width:min(34ch,70vw); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tag-cloud__item:hover,.tag-cloud__item:focus-visible { color:var(--fg); border-bottom-color:var(--fg); }
.tag-cloud__item em { font-style:normal; font-size:9px; color:var(--faint); }
.tag-more { margin-top:10px; padding:4px 0; border:0; border-bottom:1px solid var(--line); color:var(--muted); background:transparent; font-size:10px; letter-spacing:.14em; text-transform:uppercase; }
.tag-pages,.tag-photo-pages { display:flex; justify-content:center; gap:14px; margin:24px auto 0; }
.tag-pages button,.tag-photo-pages button { min-width:36px;height:36px;padding:0 8px;border:0;background:transparent;color:var(--muted);font-size:10px;letter-spacing:.1em;text-transform:uppercase; }
.tag-photo-pages span { align-self:center; color:var(--faint); font-size:10px; letter-spacing:.12em; }
.tag-photo-pages button:disabled { opacity:.25; }
.tag-pages button.is-active,.tag-photo-pages button.is-active { color:var(--fg); border-bottom:1px solid var(--fg); }
.tag-empty { text-align:center; color:var(--muted); padding:10vh 0; }
.tag-results { width:min(1500px,100%); max-width:100%; margin:0 auto; overflow:hidden; }
.tag-results__meta { margin:0 0 22px; color:var(--muted); font-size:11px; letter-spacing:.15em; }
.page--tags .wall { position: relative; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 12px; min-height: 0; }
.page--tags .wall { height:auto !important; overflow:visible !important; touch-action:auto !important; }
body.is-tags .page--tags .ph { position: relative; inset: auto; opacity: 1; visibility: visible; transform: none; transition:none; }
.page--tags .ph[hidden] { display: none; }
.page--tags .wall .ph { width:100%; aspect-ratio:1/1; overflow:hidden; background:rgba(0,0,0,.18); }
.page--tags .ph picture { display:block; width:100%; height:100%; }
.page--tags .ph__mirror { display:none; }
.page--tags .wall .ph__img { display:block; width:100%; height:100%; max-width:100%; object-fit:contain; object-position:center; }
html[data-thumb-fit="cover"] .page--tags .wall .ph__img { object-fit:cover; }

@media (min-width:1601px){.page--tags .wall{grid-template-columns:repeat(6,minmax(0,1fr))}}
@media (max-width:1100px){.page--tags .wall{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media (max-width:768px){.page--tags{padding-inline:clamp(9px,2.4vw,18px)}.page--tags .wall{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width:480px){.page--tags .wall{grid-template-columns:repeat(2,minmax(0,1fr))}.tag-cloud{gap:4px 10px;margin-bottom:18px}.tag-cloud__item{font-size:9px}}
.detail__buy:empty { display: none; }

/* 购买入口只是一个不起眼的小按钮，点开才展示规格和价格 */
.buy-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 0;
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  transition: color .2s, border-color .2s;
}
.buy-toggle i { font-style: normal; font-size: 13px; transition: transform .3s var(--ease); }
.buy-toggle.is-open i { transform: rotate(45deg); }
.buy-toggle.is-open { color: var(--fg); border-color: var(--fg); }

.buy { padding-top: 20px; max-width: 620px; }
.buy[hidden] { display: none; }

.buy__spec { display: grid; grid-template-columns: auto 1fr; gap: 6px 20px; margin: 0 0 18px; }
.buy__spec dt { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--faint); }
.buy__spec dd { margin: 0; font-size: 13px; color: var(--fg); }
.buy__spec--price { padding-top: 16px; border-top: 1px solid var(--line); }
.buy__spec--price dd { font-size: 15px; }

.buy__note { font-size: 12px; color: var(--muted); margin-bottom: 18px; }

/* 第三方收款平台的嵌入代码放这里。留空时整块不存在，页面上没有任何痕迹。 */
.buy__embed { margin: 18px 0; }
.buy__embed:empty { display: none; }
.buy__embed iframe { max-width: 100%; border: 0; }
.buy__terms {
  margin: 16px 0 0;
  font-size: 10.5px; line-height: 1.85; letter-spacing: .02em;
  color: var(--faint);
}
.detail__btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

.btn-line {
  padding: 11px 20px; min-height: 44px;
  border: 1px solid var(--line);
  font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--fg);
  transition: border-color .2s, background .2s;
}
.btn-line--solid { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* 回到这张图所在的相册 */
.detail__album {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 22px;
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  transition: color .2s, border-color .2s;
}
.detail__album[hidden] { display: none; }

/* 同类图片：底部一排缩略图，点了直接换到那张，不用退出去重找 */
.detail__more {
  max-width: 1100px; width: 100%;
  margin: clamp(30px, 6vh, 62px) auto 0;
  padding: clamp(22px, 4vh, 38px) max(var(--pad), env(safe-area-inset-left)) 0
           max(var(--pad), env(safe-area-inset-right));
  border-top: 0;
}
.detail__more[hidden] { display: none; }
.detail__more-t {
  margin: 0 0 16px;
  font-size: 10.5px; letter-spacing: .24em; text-transform: uppercase;
  color: var(--faint);
}
/* 手机默认 3列×2行，桌面 6列×3行。 */
.detail__more-row {
  display: grid; gap: 6px;
  grid-template-columns: repeat(3, 1fr);
}
@media (min-width: 600px) { .detail__more-row { grid-template-columns: repeat(6, 1fr); } }
.detail__more-row img {
  width: 100%; aspect-ratio: 1; object-fit: contain;
  opacity: .62; cursor: pointer;
  transition: opacity .25s;
}
html[data-thumb-fit="cover"] .detail__more-row img { object-fit: cover; }
.detail__more-row img.is-current { opacity: 1; outline: 1px solid var(--fg); outline-offset: -1px; }
.detail__more-empty { grid-column: 1 / -1; margin: 0; color: var(--faint); font-size: 12px; }

@media (max-width:599px), (max-height:480px) and (orientation:landscape) {
  .detail__inner { padding-top:calc(54px + env(safe-area-inset-top)); padding-bottom:calc(48px + env(safe-area-inset-bottom)); }
  .detail__stage { width:100%; }
  .detail__stage img,
  .detail[data-orient="portrait"] .detail__stage img,
  .detail[data-orient="square"] .detail__stage img,
  .detail[data-orient="landscape"] .detail__stage img,
  .detail[data-orient="pano"] .detail__stage img { width:auto; max-width:100%; max-height:calc(100dvh - 72px); object-fit:contain; }
  .detail[data-orient="portrait"] .detail__stage,.detail[data-orient="square"] .detail__stage { padding:0; align-items:center; }
  .detail__info { margin-top:18px; padding-inline:clamp(16px,5vw,24px); }
  .detail__kw { gap:6px; margin-top:15px; }
  .detail__kw a { font-size:10px; padding:5px 9px; }
  .detail__kw a:nth-child(n+9) { display:none; }
  .detail--expand-tags .detail__kw a:nth-child(n+9) { display:inline-flex; }
  .detail__more { margin-top:28px; padding:20px 0 0; }
  .detail__more-row img:nth-child(n+7) { display:none; }
  .detail--expand-more .detail__more-row img:nth-child(n+7) { display:block; }
}

@media (min-width:600px) {
  .detail__title { -webkit-line-clamp:2; }
  .detail__desc { -webkit-line-clamp:3; }
  .detail__info { max-width:1100px; }
  .detail__more-row { gap:10px; }
}
.detail__album::after {
  content: ""; width: 16px; height: 1px;
  background: currentColor; flex: none;
}

/* ==========================================================================
   选图清单
   ========================================================================== */
.cart { position: fixed; inset: 0; z-index: 110; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); overflow-y: auto; }
.cart[hidden] { display: none; }
.cart__panel {
  max-width: 720px; margin: 0 auto;
  padding: max(56px, env(safe-area-inset-top)) var(--pad) calc(40px + env(safe-area-inset-bottom));
}
.cart__close {
  position: fixed; top: max(4px, env(safe-area-inset-top)); right: 6px;
  width: 48px; height: 48px; font-size: 28px; font-weight: 200; color: var(--muted);
}
.cart__title {
  margin: 0 0 18px; font-size: 13px; font-weight: 300; letter-spacing: .16em;
  text-transform: uppercase; color: var(--fg);
}
.cart__compliance {
  font-size: 11px; line-height: 1.85; letter-spacing: .04em;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 14px;
  margin-bottom: 26px;
}
.cart__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 4px; margin-bottom: 24px; }
.cart__grid figure { position: relative; margin: 0; }
.cart__grid img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.cart__grid button {
  position: absolute; top: 0; right: 0; width: 28px; height: 28px;
  color: var(--fg); background: var(--bg); border: 1px solid var(--fg); font-size: 16px; line-height: 1;
}
.cart__price { display: grid; gap: 6px; margin-bottom: 22px; font-size: 12px; letter-spacing: .14em; color: var(--muted); }
.cart__price b { color: var(--fg); font-weight: 400; }
.cart__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cart__hint { margin-top: 16px; font-size: 11px; line-height: 1.8; color: var(--faint); }

/* ==========================================================================
   页脚
   ========================================================================== */
.footer {
  padding: 40px var(--pad) calc(40px + env(safe-area-inset-bottom));
  border-top: 0;
  text-align: center; color: var(--faint);
  font-size: 11px; letter-spacing: .18em;
}
.footer p { margin: 0 0 5px; }
html[data-view="carousel"] .footer,
html[data-view="cinema"] .footer {
  position: relative; z-index: 1;
  left: auto; bottom: auto; translate: none;
  width: 100%; max-width: none;
  padding: 40px var(--pad) calc(40px + env(safe-area-inset-bottom));
  color: var(--faint); background: transparent; border: 0; opacity: 1;
  pointer-events: auto; white-space: normal;
}
html[data-view="carousel"] .footer a,
html[data-view="cinema"] .footer a { pointer-events: auto; }

/* ========================================================================== */
/* 1.3 文档流页眉、详情品牌与一屏TAG网格 */
body.is-inner>.topbar,body.is-tags>.topbar{position:relative;inset:auto;display:grid;grid-template-columns:minmax(0,1fr) auto;background:transparent;backdrop-filter:none;padding-block:var(--inner-head-pad,18px)}
body.is-inner>.topbar .topbar__left,body.is-tags>.topbar .topbar__left{grid-column:1;grid-row:1;display:flex;align-items:center;min-width:0}
body.is-inner>.topbar .topbar__right,body.is-tags>.topbar .topbar__right{grid-column:2;grid-row:1;justify-self:end}
body.is-inner>.topbar>.crumb,body.is-tags>.topbar>.crumb{grid-column:1/-1;grid-row:2;padding-top:4px}
.footer{position:relative!important;inset:auto!important;translate:none!important;width:100%!important;max-width:none!important;padding:var(--footer-pad,40px) var(--pad) calc(var(--footer-pad,40px) + env(safe-area-inset-bottom))!important;text-align:center;white-space:normal!important;pointer-events:auto!important}
.detail__header{position:relative;z-index:18;display:grid;grid-template-columns:minmax(64px,1fr) auto minmax(64px,1fr);align-items:center;width:100%;padding:max(8px,env(safe-area-inset-top)) max(8px,var(--pad)) 8px}
.detail__header-side{display:flex;align-items:center}.detail__header-side--right{justify-content:flex-end}.detail__brand{grid-column:2;justify-self:center}.detail__brand .topbar__logo{min-height:44px}.detail__inner{min-height:auto;padding:0}.detail__footer{position:relative;z-index:3;width:100%;margin-top:auto}.detail__footer .footer{background:transparent}
body.detail-open>.topbar{visibility:hidden}.detail-open .topbar__nav.is-open{visibility:visible}
.page--custom{width:min(var(--page-max,960px),100%);display:grid;gap:var(--page-gap,28px);margin-inline:auto}.page--custom .page-block{margin:0}.page--custom .page-block--title{font-size:var(--page-title-size,28px);font-weight:var(--page-title-weight,300);letter-spacing:var(--page-title-spacing,.04em);color:var(--page-title-color,var(--fg))}.page-block--image img{display:block;max-width:100%;height:auto;margin:auto}.page-block--social{display:flex;flex-wrap:wrap;gap:12px 24px}.page-block--social a{border-bottom:1px solid var(--line)}
.page--custom .page-block--text.is-collapsible,
.page--custom .page-block--license.is-collapsible{position:relative;max-height:min(34dvh,18rem);overflow:hidden}
.page--custom .page-block--text.is-expanded,
.page--custom .page-block--license.is-expanded{max-height:none;overflow:visible}
.content-more{justify-self:start;min-height:32px;margin-top:-16px;color:var(--muted);font-size:11px;font-weight:300;letter-spacing:.16em;border-bottom:1px solid var(--line)}
.content-more::after{content:" +"}.content-more[aria-expanded="true"]::after{content:" −"}
.page-block--gallery .wall{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:clamp(4px,1vw,12px)!important;height:auto!important;min-height:0!important;padding:0!important}.page-block--gallery .ph{position:relative!important;inset:auto!important;width:100%!important;height:auto!important;aspect-ratio:1/1!important;opacity:1!important;visibility:visible!important;transform:none!important;overflow:hidden;background:rgba(0,0,0,.18)}.page-block--gallery .ph__img{width:100%;height:100%;object-fit:contain}.page-block--tag-search{display:grid;grid-template-columns:1fr auto;gap:12px}.page-block--tag-search input{min-width:0;background:transparent;color:var(--fg);border:0;border-bottom:1px solid var(--line);padding:10px 0}.page-block--tag-search button{border:0;background:transparent;color:var(--fg)}
.attachment-card{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 18px;border:1px solid var(--line);border-radius:8px;color:var(--fg);text-decoration:none}.attachment-card:hover{border-color:var(--fg)}.attachment-card__name{font-weight:400;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.attachment-card__open{flex:none;color:var(--muted);font-size:12px;letter-spacing:.08em}.attachment-card__preview{display:block;width:100%;height:min(80dvh,900px);margin-top:12px;border:1px solid var(--line);border-radius:8px;background:#111}
@media(min-width:900px){.page-block--gallery .wall{grid-template-columns:repeat(5,minmax(0,1fr))!important}}
.page--custom .page-block--heading{color:var(--fg);font-weight:400;line-height:1.3}.page--custom .page-block--h2{font-size:20px;margin-top:8px}.page--custom .page-block--h3{font-size:16px;margin-top:4px}
.page--custom .page-block--list{max-width:62ch;color:var(--fg);font-size:15px;line-height:1.75;padding-left:1.4em;display:block}.page--custom .page-block--list li{margin:.25em 0}
.page--custom .page-block--divider{border:0;border-top:1px solid var(--line);width:100%;margin:4px 0}
.page--custom .page-block--date{color:var(--muted);font-size:13px;letter-spacing:.04em}
.footer__meta{color:var(--muted);font-size:12px;letter-spacing:.04em;margin-top:6px}.footer__meta a{color:inherit;border-bottom:1px solid var(--line)}.footer__meta a:hover{color:var(--fg)}.footer__sep{opacity:.5}

.page--tags{height:calc(100dvh - var(--topbar-h,64px));min-height:0;padding:8px clamp(8px,2vw,30px) 10px;display:flex;flex-direction:column;overflow:hidden}
.tag-head{flex:none;margin:0 auto 5px}.tag-head p{display:none}.tag-head h1{margin:0;font-size:clamp(15px,1.7vw,22px)}.tag-head span{display:none}
.tag-search{flex:none;margin:0 auto 5px}.tag-search input{padding:6px 3px;font-size:clamp(13px,1.5vw,17px)}.tag-search button{min-height:32px}
.tag-scopes{flex:none;margin-bottom:3px;max-height:26px;overflow:hidden}.tag-scope{padding:2px 0;font-size:9px}
.tag-filter{flex:none;margin:0 auto 5px}.tag-cloud{gap:2px 9px;max-height:42px}.tag-cloud__item{padding:1px 0;font-size:9px}.tag-more{margin-top:2px;padding:1px 0}
.tag-results{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.tag-results__meta{flex:none;margin:0 0 3px;font-size:9px}.tag-photo-pages{flex:none;height:28px;margin:3px auto 0}.tag-photo-pages button{height:28px;min-height:28px}.tag-photo-pages span{font-size:9px}
.page--tags .wall{flex:1;min-height:0!important;height:auto!important;display:grid;grid-template-columns:repeat(var(--tag-cols,5),var(--tag-cell,120px));grid-template-rows:repeat(var(--tag-rows,3),var(--tag-cell,120px));gap:var(--tag-gap,6px);place-content:center;overflow:hidden!important}
.page--tags .wall .ph{width:var(--tag-cell,120px);height:var(--tag-cell,120px);aspect-ratio:1/1}
@media(max-width:599px) and (orientation:portrait){.page--tags{min-height:420px}.tag-head{display:none}.tag-search{width:100%}.tag-scopes{max-height:22px}.tag-cloud{max-height:34px}.tag-filter{margin-bottom:3px}}
@media(max-height:520px) and (orientation:landscape){
  /* 横屏高度很小：页眉仍在文档流内，TAG 主体必须从它的下方开始，不能挤进同一行。 */
  body.is-tags>.topbar{min-height:40px;padding-block:0;position:relative;z-index:2}
  body.is-tags>.topbar .topbar__logo,body.is-tags>.topbar .topbar__toggle{min-height:40px;height:40px}
  .page--tags{height:calc(100dvh - 40px);min-height:0;padding:6px clamp(8px,2vw,30px) 4px;position:relative;z-index:1}
  .tag-head{display:none}.tag-search{margin:2px auto 3px}.tag-search input{padding:3px}.tag-search button{min-height:24px}.tag-filter{margin-bottom:1px}.tag-cloud{max-height:16px}.tag-more{display:none}.tag-scopes{max-height:16px;margin-bottom:1px}.tag-results__meta{line-height:12px}.tag-photo-pages{height:20px;margin-top:1px}.tag-photo-pages button{height:20px;min-height:20px}
}

/* ==========================================================================
   平板竖屏起  ≥768px
   ========================================================================== */
@media (min-width: 768px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  html[data-view="grid"] .wall { grid-template-columns: repeat(2, 1fr); }
  html[data-view="masonry"] .wall { column-count: 2; }
  .wall-arrow { display: flex; }
  /* 主图下面立即进入标题/TAG，不再叠加一层空白把文字推到首屏之外。 */
  .detail__info { padding-top: 0; }
  .filmstrip img { width: 64px; height: 64px; }
}

/* ==========================================================================
   桌面  ≥1280px
   ========================================================================== */
@media (min-width: 1280px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  html[data-view="grid"] .wall { grid-template-columns: repeat(3, 1fr); }
  html[data-view="masonry"] .wall { column-count: 3; }
  html[data-view="stream"] .wall { max-width: 1200px; margin: 0 auto; }
  .topbar__nav a { font-size: clamp(30px, 3.2vw, 48px); }
}

@media (min-width: 1800px) {
  html[data-view="masonry"] .wall { column-count: 4; }
  html[data-view="grid"] .wall { grid-template-columns: repeat(4, 1fr); }
}

/* 手机横屏：高度很矮，压掉多余留白 */
@media (max-height: 480px) and (orientation: landscape) {
  html[data-view="carousel"] .wall, html[data-view="cinema"] .wall { min-height: 300px; }
  .wall-dots { bottom: calc(8px + env(safe-area-inset-bottom)); }
  .topbar__nav { min-height: 100dvh; }
  .nav__scroll { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
  .detail__inner {
    min-height: 100dvh;
    padding-top: calc(60px + env(safe-area-inset-top));
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
  .detail__stage img,
  .detail[data-orient="portrait"] .detail__stage img,
  .detail[data-orient="square"] .detail__stage img,
  .detail[data-orient="landscape"] .detail__stage img,
  .detail[data-orient="pano"] .detail__stage img { max-height: calc(100dvh - 124px); }
  .detail__info { margin-top: 16px; }
  .detail__more { margin-top: 24px; }
}

/* 横屏：主图完整显示，所有文字、TAG 和缩略图保持在其下方并可纵向滚动。 */
@media (orientation: landscape) {
  .detail__inner { padding-top: calc(54px + env(safe-area-inset-top)); }
  .detail__stage img,
  .detail[data-orient="portrait"] .detail__stage img,
  .detail[data-orient="square"] .detail__stage img,
  .detail[data-orient="landscape"] .detail__stage img,
  .detail[data-orient="pano"] .detail__stage img {
    width: auto;
    max-width: 100%;
    max-height: calc(100dvh - 82px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    object-fit: contain;
  }
}

/* 只有真支持悬停的设备才加 hover */
@media (hover: hover) and (pointer: fine) {
  .topbar__nav a:hover { color: var(--fg); }
  .wall-arrow:hover { opacity: 1; }
  .wall-dot:hover::before { background: #fff; }
  .ph { cursor: zoom-in; }
  html[data-view="grid"] .ph:hover .ph__img,
  html[data-view="masonry"] .ph:hover .ph__img,
  html[data-view="stream"] .ph:hover .ph__img { opacity: .72; }
  html[data-view="grid"] .ph__img,
  html[data-view="masonry"] .ph__img,
  html[data-view="stream"] .ph__img { transition: opacity .45s var(--ease); }
  .ph__add:hover { opacity: 1; }
  .cardx:hover .cardx__img { opacity: .72; }
  .btn-line:hover { border-color: var(--fg); }
  .btn-line--solid:hover { opacity: .85; }
  .ctl:hover { opacity: 1; }
  .cart__close:hover { color: var(--fg); }
  .filmstrip img:hover { opacity: .8; }
}

/* 尊重系统「减少动态效果」 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .wall.kb .ph.is-active .ph__img { animation: none; transform: none; }
}

@media print {
  .topbar, .filmstrip, .detail, .cart, .wallctl { display: none !important; }
  body { background: #fff; color: #000; }
}
