/* ============================================================
   光影墙 · 前台样式
   ------------------------------------------------------------
   瀑布流用「CSS Grid + grid-auto-rows:1px + 显式行跨」实现：
     · 行高设成 1px，每张图的跨行数就等于它的像素高度，精度无损；
     · 列与起始行由 JS 按"最短列优先"算好写进内联样式，
       所以阅读顺序是从左到右、从新到旧，而不是 column-count 那种
       "先排满第一列再排第二列"的错位顺序；
     · 宽高来自构建清单，图片还没下载排版就已经定了 —— 首屏零跳动。
   不依赖任何 JS 库，深色模式、响应式、无 JS 降级都在这一个文件里。
   ============================================================ */

:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
             "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-disp: "Iowan Old Style", "Palatino Linotype", Georgia, "Songti SC",
               "Noto Serif SC", serif;

  --gap: 14px;
  --col-min: 250px;
  --radius: 14px;
  --shell: 1680px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- 浅色 ---------- */
:root, [data-theme="light"] {
  --bg: #faf9f7;
  --bg-blur: rgba(250, 249, 247, .82);
  --surface: #ffffff;
  --surface-2: #f2f0ec;
  --fg: #17161a;
  --fg-soft: #4a4852;
  --muted: #82808c;
  --line: #e7e4df;
  --line-soft: #f0eeea;
  --accent: #b0603c;
  --accent-soft: rgba(176, 96, 60, .1);
  --skeleton: #ece9e4;
  --shade: rgba(12, 10, 14, .62);
  --lb-bg: rgba(10, 9, 12, .95);
  --shadow: 0 1px 2px rgba(24, 20, 30, .05), 0 8px 24px -12px rgba(24, 20, 30, .16);
  --shadow-lg: 0 2px 4px rgba(24, 20, 30, .06), 0 18px 48px -18px rgba(24, 20, 30, .28);
  --danger: #c0392b;
}

/* ---------- 深色 ---------- */
[data-theme="dark"] {
  --bg: #0e0e11;
  --bg-blur: rgba(14, 14, 17, .8);
  --surface: #17171b;
  --surface-2: #202027;
  --fg: #ececee;
  --fg-soft: #b9b8c2;
  --muted: #8b8a95;
  --line: #26262e;
  --line-soft: #1d1d23;
  --accent: #d98757;
  --accent-soft: rgba(217, 135, 87, .14);
  --skeleton: #1e1e24;
  --shade: rgba(0, 0, 0, .68);
  --lb-bg: rgba(6, 6, 8, .97);
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 28px -14px rgba(0, 0, 0, .7);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .5), 0 20px 52px -20px rgba(0, 0, 0, .8);
  --danger: #e06a5c;
}

* { box-sizing: border-box; }

/* 页面里不少元素用 display:flex/grid，会盖过浏览器给 [hidden] 的
   display:none —— 于是"设了 hidden 却还显示着"。这一条统一兜住。 */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  /* 整页纵向 flex + 让 .main 撑开 ⇒ 照片不满一屏时页脚也贴底，
     不会"浮"在照片下面半空里（站长 2026-10-16 提的）。 */
  min-height: 100vh;
  min-height: 100dvh;          /* 手机地址栏伸缩时不跳 */
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow-y: scroll;
}

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

svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

::selection { background: var(--accent-soft); }

/* ================= 顶栏 ================= */

.head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-blur);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  /* 站长 2026-10-16：这里（「光影墙」那一行下面）**不要**横线，只有导航行下面那条保留 */
}

.head__inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 8px 22px 10px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; min-width: 0; }

.brand__mark {
  width: 20px; height: 20px; flex: none;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent) 45%, var(--fg)));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}

.brand__text {
  font-family: var(--font-disp);
  font-size: 20px;
  letter-spacing: .04em;
  white-space: nowrap;
}

/* ---------- 站群导航（与 blog.xhja.cn 顶栏同款按钮） ----------
   单独占顶栏第一行、居中，下面一条细线跟「光影墙」品牌行分开。
   窄屏不让它换行撑高，改成一行内横向滚动（跟博客那边的处理一致）。 */
.sitenav {
  /* 整行铺满（线才能从这头到那头），按钮靠 justify-content 居中 */
  padding: 13px 22px 12px;
  display: flex;
  align-items: center;
  gap: 3px;
  justify-content: center;
  justify-content: safe center;   /* 溢出时自动靠左，头几个按钮不会被裁剪掉 */
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--line-soft);
}
.sitenav::-webkit-scrollbar { display: none; }

.sitenav__btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 9px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  color: var(--fg-soft);
  transition: color .18s var(--ease), background .18s var(--ease);
}
.sitenav__btn:hover { color: var(--accent); background: var(--accent-soft); }
.sitenav__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* 当前站点那一格：文案加粗上色，不再当链接看 */
.sitenav__btn.is-current { color: var(--accent); font-weight: 700; }
.sitenav__btn.is-current:hover { background: none; }

.sitenav__sep {
  flex: none;
  color: var(--line);
  font-size: 14px;
  padding: 0 1px;
  user-select: none;
  -webkit-user-select: none;
}

.head__tools { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }

.search {
  display: flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
.search input {
  width: 130px; border: 0; background: none; outline: none;
  color: var(--fg); font: inherit; font-size: 13.5px;
}
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search input::placeholder { color: var(--muted); }

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition: background .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
}
.iconbtn:hover { background: var(--surface-2); border-color: var(--muted); }
.iconbtn:active { transform: scale(.94); }
.iconbtn svg { width: 16px; height: 16px; }

/* 搜索按钮只在窄屏顶替搜索框时出现 */
#search-toggle { display: none; }

/* 主题按钮：只显示当前模式的反面图标 */
[data-theme="light"] .i-sun,
[data-theme="dark"] .i-moon { display: none; }

/* ---------- 相册筛选条（与「光影墙」同一行） ----------
   它现在是 .head__inner 里的一个 flex 项：占满品牌与右侧工具之间的空间，
   放不下就自己横滑，不再单独占一行。 */
.chips {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chips:empty { display: none; }

.chip {
  flex: none;
  height: 30px; padding: 0 13px;
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg-soft);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .18s var(--ease);
}
.chip:hover { border-color: var(--muted); color: var(--fg); }
.chip[aria-pressed="true"] {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}
[data-theme="dark"] .chip[aria-pressed="true"] { background: var(--fg); color: #111; }
.chip__n { font-size: 11.5px; opacity: .6; font-variant-numeric: tabular-nums; }

/* ================= 主体 ================= */

.main {
  flex: 1 1 auto;              /* 撑开剩余高度，把页脚顶到页面底部 */
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 20px 22px 0;
  min-height: 60vh;
}

.stat {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .02em;
}
.stat:empty { display: none; }

/* ---------- 瀑布流 ---------- */
.wall {
  display: grid;
  grid-auto-rows: 1px;          /* 1px 一行，跨行数 = 像素高度，精度无损 */
  grid-auto-flow: row;
  column-gap: var(--gap);
  row-gap: 0;
  align-items: stretch;
}

.card {
  position: relative;
  margin: 0;
  padding-bottom: var(--gap);   /* 竖直间距靠内边距，不能靠 row-gap */
  min-width: 0;
}

.card__inner {
  position: relative;
  display: block;
  height: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--skeleton);
  cursor: zoom-in;
  outline: none;
  transition: box-shadow .26s var(--ease), transform .26s var(--ease);
}
.card__inner:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }

.card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .55s var(--ease), transform .5s var(--ease);
  color: transparent;            /* 图没出来时不显示 alt 文字 */
  background: var(--skeleton);
}
.card img.is-in { opacity: 1; }

.card__shade {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--shade) 0%, rgba(0, 0, 0, .28) 34%, transparent 62%);
  opacity: 0;
  transition: opacity .26s var(--ease);
  pointer-events: none;
}

.card__meta {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 14px 14px 13px;
  color: #fff;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .26s var(--ease), transform .26s var(--ease);
  pointer-events: none;
}
/* 全站不展示文件名与日期（2026-10-16 站长定）：
   卡片悬浮层只有相册名一个药丸；灯箱说明区第一行也只剩相册名（原来是"相机日期 · 相册"），
   所以 .card__title 与 .lb__cap b（原来的标题行）已删掉，别再往回加。 */
.card__sub {
  margin: 5px 0 0;
  display: flex; gap: 8px; align-items: center;
  font-size: 11.5px;
  color: rgba(255, 255, 255, .82);
  font-variant-numeric: tabular-nums;
}
.card__alb {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.card__inner:hover .card__shade,
.card__inner:hover .card__meta,
.card__inner:focus-visible .card__shade,
.card__inner:focus-visible .card__meta { opacity: 1; }
.card__inner:hover .card__meta { transform: none; }
.card__inner:hover img { transform: scale(1.035); }

/* 触屏没有 hover：**不要**默认把标题/日期常驻显示（手机上官配是干净的一片图）。
   想看文案就点开灯箱，那里有完整的标题、地点、EXIF。 */

/* ---------- 加载更多 / 空状态 ---------- */
.more { display: flex; justify-content: center; padding: 26px 0 40px; }

.btn {
  height: 38px; padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  font-size: 13.5px;
  transition: all .18s var(--ease);
}
.btn:hover { border-color: var(--muted); background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }

.blank { padding: 90px 0; text-align: center; }
.blank__title { margin: 0; font-family: var(--font-disp); font-size: 22px; }
.blank__hint { margin: 8px 0 0; color: var(--muted); font-size: 13.5px; }

/* ---------- 页脚 ---------- */
/* 只有一行版权。**别再把「张数 / 体积」「管理」放回这里**：
   站长 2026-10-16 明确要求去掉，后台入口走 a.xhja.cn。 */
.foot {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 34px 22px 46px;
  color: var(--muted);
  font-size: 12.5px;
  border-top: 1px solid var(--line-soft);
}
.foot__copy { margin: 0; }

/* ================= 灯箱 ================= */

.lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--lb-bg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  color: #fff;
  display: grid;
  grid-template-rows: auto 1fr auto;
  animation: lb-in .2s var(--ease);
}
.lb[hidden] { display: none; }
@keyframes lb-in { from { opacity: 0 } to { opacity: 1 } }

.lb__bar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
}
.lb__title {
  margin-right: auto;
  min-width: 0;
  font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: rgba(255, 255, 255, .95);
}
.lb__acts { display: flex; gap: 6px; }

.lb-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  color: #fff;
  cursor: pointer;
  transition: background .18s var(--ease), transform .18s var(--ease);
}
.lb-btn:hover { background: rgba(255, 255, 255, .17); }
.lb-btn:active { transform: scale(.93); }
.lb-btn svg { width: 17px; height: 17px; }
.lb-btn[aria-pressed="true"] { background: rgba(255, 255, 255, .26); }

.lb__stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  padding: 0 68px;
}
.lb__img {
  position: absolute;
  inset: 0;
  margin: auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 24px 70px -22px rgba(0, 0, 0, .9);
  cursor: zoom-in;
  transition: opacity .22s var(--ease);
}
.lb__img.is-loading { opacity: .25; }

/* 放大到 1:1：改成可滚动的普通流，图片按原始尺寸铺开 */
.lb[data-zoom="1"] .lb__stage { display: block; overflow: auto; padding: 0; }
.lb[data-zoom="1"] .lb__img {
  position: static;
  inset: auto;
  margin: 0 auto;
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

.lb__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px; height: 76px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s var(--ease), background .2s var(--ease);
}
.lb:hover .lb__nav { opacity: 1; }
.lb__nav:hover { background: rgba(255, 255, 255, .2); }
.lb__nav:disabled { display: none; }
.lb__nav svg { width: 22px; height: 22px; }
.lb__nav--prev { left: 12px; }
.lb__nav--next { right: 12px; }
@media (hover: none) {
  .lb__nav { opacity: .9; width: 40px; height: 62px; }
}

.lb__foot {
  padding: 12px 20px 18px;
  display: flex; gap: 16px; align-items: flex-end;
  font-size: 12.5px;
  color: rgba(255, 255, 255, .74);
}
.lb__cap { flex: 1 1 auto; min-width: 0; }
.lb__cap p { margin: 0; line-height: 1.5; max-width: 62ch; }
.lb__cap .lb__line { margin: 0 0 6px; opacity: .6; font-variant-numeric: tabular-nums; }
.lb__cap .tags { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.lb__cap .tags span {
  padding: 2px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  font-size: 11.5px;
}
.lb__exif {
  flex: none;
  display: flex; gap: 14px;
  font-variant-numeric: tabular-nums;
}
.lb__exif div { text-align: right; }
.lb__exif em { display: block; font-style: normal; font-size: 10.5px; opacity: .55; margin-bottom: 2px; letter-spacing: .05em; }
.lb__exif b { font-weight: 500; color: rgba(255, 255, 255, .95); }
.lb__num { flex: none; font-variant-numeric: tabular-nums; opacity: .6; }

@media (max-width: 720px) {
  .lb__stage { padding: 0 10px; }
  .lb__nav { display: none; }
  .lb__foot { flex-wrap: wrap; gap: 10px; }
  .lb__exif { order: 3; width: 100%; justify-content: flex-start; }
  .lb__exif div { text-align: left; }
  .lb__title { font-size: 13px; }
}

/* 灯箱深处的小加载指示 */
.lb__spin {
  position: absolute;
  width: 26px; height: 26px;
  border: 2px solid rgba(255, 255, 255, .2);
  border-top-color: rgba(255, 255, 255, .8);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  opacity: 0;
  transition: opacity .2s;
}
.lb__img.is-loading + .lb__spin { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ================= 响应式 ================= */

@media (max-width: 900px) {
  :root { --col-min: 210px; --gap: 12px; }
  .head__inner { padding: 6px 16px 8px; gap: 10px; }
  .sitenav { padding: 10px 16px 9px; }
  .main { padding: 16px 16px 0; }
  .foot { padding: 24px 16px 36px; }
  .search input { width: 96px; }
  /* 窄屏字号收一点，五行按钮仍能一屏放下（分隔符保留，跟桌面同一副样子） */
  .sitenav__btn { padding: 4px 7px; font-size: 13px; }
}

@media (max-width: 560px) {
  :root { --col-min: 150px; --gap: 9px; --radius: 10px; }
  .brand__text { font-size: 18px; }
  .head__inner { position: relative; }
  .sitenav { padding: 8px 12px; }
  .sitenav__btn { padding: 4px 5px; font-size: 12.5px; }
  #search-toggle { display: inline-flex; }
  .search { display: none; }
  .search.is-open { display: flex; position: absolute; left: 12px; right: 12px; top: 6px; z-index: 5; height: 40px; }
  .search.is-open input { width: 100%; }
}

/* 360 这类窄机：五格 + 四个分隔符要一屏放得下，字距再收一点。
   真放不下时会自动横滑（.sitenav 的 safe center + overflow-x）。 */
@media (max-width: 400px) {
  .sitenav { padding: 7px 10px; }
  .sitenav__btn { padding: 4px 4px; font-size: 12px; letter-spacing: 0; }
  .sitenav__sep { padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
