/* ============================================================================
   相册 / 瞬间 栏目样式（gallery.css）
   只被 scripts/collections.js 生成的页面引用（页面内 <link>），普通文章不加载。
   颜色一律走 unify.css 的 --u-* 令牌，深浅色自动跟随。
   ========================================================================== */

/* 这两类页面不要主题的 .page-title（标题由 .gx-head 自己排） */
#body-wrap.type-photos .page-title,
#body-wrap.type-photo .page-title,
#body-wrap.type-moments .page-title,
#body-wrap.type-moment .page-title { display: none; }

#body-wrap.type-photos #article-container,
#body-wrap.type-photo #article-container,
#body-wrap.type-moments #article-container,
#body-wrap.type-moment #article-container { max-width: none; padding: 0; }

#body-wrap.type-photos #page,
#body-wrap.type-photo #page,
#body-wrap.type-moments #page,
#body-wrap.type-moment #page { padding-bottom: 0; }

.gx {
  --gx-card: #fff;
  --gx-card-2: #f6f8f8;
  --gx-radius: 16px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 6px 20px 56px;
  color: var(--u-ink);
  line-height: 1.75;
}

[data-theme="dark"] .gx {
  --gx-card: #1b1c1e;
  --gx-card-2: #202124;
}

.gx * { box-sizing: border-box; }
.gx .u-figure { margin: 0; }
.gx-card-img .u-figure, .gx-m-fig .u-figure { height: 100%; }
.gx-card-img .u-figure figcaption { display: none; }

/* ---------------------------------------------------------------- 页头 */
.gx-head { padding: 30px 0 24px; }
.gx-eyebrow {
  margin: 0 0 12px;
  font-size: 10.5px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--u-muted);
}
.gx-title {
  margin: 0 0 12px;
  font-size: clamp(26px, 3.6vw, 36px);
  font-weight: var(--u-fw-light);
  letter-spacing: .04em;
  line-height: 1.25;
  color: var(--u-ink);
}
.gx-sub {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.85;
  color: var(--u-muted);
  max-width: 44em;
}
.gx-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12.5px;
  color: var(--u-muted);
}
.gx-meta i { font-style: normal; opacity: .4; }
.gx-pin { display: inline-flex; align-items: center; gap: 4px; }
.gx-pin svg { width: 13px; height: 13px; flex-shrink: 0; }

.gx-intro {
  margin: 4px 0 14px;
  font-family: var(--u-font-serif);
  font-size: 15px;
  line-height: 1.95;
  color: var(--u-ink-2);
  max-width: 46em;
}
.gx-intro p { margin: 0 0 .7em; }

.gx-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gx-tags li {
  font-size: 11.5px;
  line-height: 22px;
  padding: 0 10px;
  border-radius: 20px;
  color: var(--u-muted);
  background: var(--u-accent-soft);
}

/* ---------------------------------------------------------------- 年份快捷 */
.gx-years {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 26px;
}
.gx-years a {
  font-size: 12px;
  line-height: 26px;
  padding: 0 12px;
  border-radius: 20px;
  border: 1px solid var(--u-line-strong);
  color: var(--u-muted);
  text-decoration: none;
  transition: color .2s, border-color .2s, background .2s;
}
.gx-years a:hover {
  color: var(--u-accent);
  border-color: var(--u-accent);
  background: var(--u-accent-soft);
}

/* ---------------------------------------------------------------- 相册卡片 */
.gx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(256px, 1fr));
  gap: 24px 22px;
}
.gx-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--gx-radius);
  overflow: hidden;
  background: var(--gx-card);
  /* 常态用 1px 描边而不是阴影：深色下阴影在纯黑上等于没有边界 */
  border: 1px solid var(--u-line);
  text-decoration: none;
  color: inherit;
  transition: transform .38s cubic-bezier(.22, .61, .36, 1), box-shadow .38s, border-color .38s;
}
.gx-card:hover {
  transform: translateY(-4px);
  border-color: var(--u-line-strong);
  box-shadow: var(--u-shadow-2);
}
.gx-card:focus-visible { outline: 2px solid var(--u-accent); outline-offset: 3px; }
.gx-card-img {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--gx-card-2);
}
.gx-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .7s cubic-bezier(.22, .61, .36, 1);
}
.gx-card:hover .gx-card-img img { transform: scale(1.045); }
.gx-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--u-muted);
}
.gx-ph svg { width: 30px; height: 30px; opacity: .5; }
.gx-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 16px;
}
.gx-card-t {
  font-size: 15.5px;
  font-weight: var(--u-fw-medium);
  letter-spacing: .01em;
  color: var(--u-ink);
}
.gx-card-m {
  font-size: 12px;
  color: var(--u-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.gx-card-m i { font-style: normal; opacity: .4; }
.gx-card-d {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--u-ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gx-empty {
  padding: 60px 0;
  text-align: center;
  color: var(--u-muted);
  font-size: 13.5px;
}

/* ---------------------------------------------------------------- 相册首页：精选照片流 */
/* 相册卡片下面那一条：跨相册的人工精选，正文流的形式（原图比例、4 列） */
.gx-picks {
  margin-top: 52px;
  padding-top: 34px;
  border-top: 1px solid var(--u-line);
}
.gx-picks-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.gx-picks-head .gx-eyebrow { margin: 0 0 8px; }
/* ⚠️ 主题给 #article-container h2 设了 52px 上边距 + 大字行高，
   单靠 .gx-picks-t 压不住（id + 元素 比 单个 class 更高），必须带上容器 id */
#article-container .gx-picks-t {
  margin: 0;
  padding: 0;
  border: none;
  line-height: 1.3;
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: var(--u-fw-light);
  letter-spacing: .06em;
  color: var(--u-ink);
}
.gx-picks-sub { margin: 0; font-size: 12px; color: var(--u-muted); }

.gx-pick-flow { column-count: 4; column-gap: 12px; }
.gx-pick {
  margin: 0 0 12px;
  break-inside: avoid;
  border-radius: 12px;
  overflow: hidden;
  background: var(--gx-card);
  border: 1px solid var(--u-line);
  transition: border-color .2s, box-shadow .25s, transform .25s;
}
.gx-pick:hover {
  border-color: var(--u-line-strong);
  box-shadow: var(--u-shadow-2);
  transform: translateY(-2px);
}
.gx-pick img {
  width: 100%;
  display: block;
  cursor: zoom-in;
  transition: opacity .2s;
}
.gx-pick img:hover { opacity: .94; }
.gx-pick figcaption {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 10px 9px;
  font-size: 11.5px;
  line-height: 1.5;
}
.gx-pick-cap {
  flex: 1;
  min-width: 0;
  color: var(--u-ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gx-pick-album {
  flex-shrink: 0;
  color: var(--u-muted);
  text-decoration: none;
  border-bottom: 1px dashed var(--u-line-strong);
  transition: color .2s, border-color .2s;
}
.gx-pick-album:hover { color: var(--u-accent); border-bottom-color: var(--u-accent); }
.gx-pick-album::after { content: " →"; }

@media (max-width: 1100px) { .gx-pick-flow { column-count: 3; } }
@media (max-width: 820px) {
  .gx-pick-flow { column-count: 2; }
  .gx-picks { margin-top: 40px; padding-top: 26px; }
}
@media (max-width: 560px) { .gx-pick-flow { column-count: 1; } }

/* ---------------------------------------------------------------- 相册详情 */
.gx-back {
  display: inline-flex;
  align-items: center;
  margin: 26px 0 6px;
  font-size: 12.5px;
  color: var(--u-muted);
  text-decoration: none;
  transition: color .2s;
}
.gx-back::before { content: "←"; margin-right: 6px; }
.gx-back:hover { color: var(--u-accent); }

.gx-flow {
  column-count: 2;
  column-gap: 18px;
  margin-top: 8px;
}
.gx-fig {
  margin: 0 0 18px;
  break-inside: avoid;
  border-radius: 14px;
  overflow: hidden;
  background: var(--gx-card-2);
}
.gx-fig img {
  width: 100%;
  display: block;
  cursor: zoom-in;
  transition: opacity .25s;
}
.gx-fig img:hover { opacity: .92; }
.gx-fig figcaption {
  padding: 10px 14px 11px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--u-muted);
}

.gx-adj {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--u-line);
}
.gx-adj-a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--gx-card-2);
  text-decoration: none;
  color: inherit;
  transition: background .2s;
  min-height: 62px;
}
.gx-adj-a.next { text-align: right; align-items: flex-end; }
.gx-adj-a span { font-size: 11px; letter-spacing: .12em; color: var(--u-muted); }
.gx-adj-a b { font-size: 13.5px; font-weight: var(--u-fw-medium); color: var(--u-ink); }
.gx-adj-a:hover { background: var(--u-accent-soft); }
.gx-adj-a.off { background: transparent; }

/* ---------------------------------------------------------------- 瞬间时间流 */
.gx-stream { display: flex; flex-direction: column; gap: 38px; }

.gx-day {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 22px;
}
.gx-day-head {
  position: sticky;
  top: 84px;
  align-self: start;
  text-align: right;
  padding-top: 2px;
}
.gx-day-n {
  display: block;
  font-size: 30px;
  font-weight: var(--u-fw-light);
  line-height: 1;
  color: var(--u-ink);
  letter-spacing: .01em;
}
.gx-day-my {
  display: block;
  margin-top: 6px;
  font-size: 10.5px;
  letter-spacing: .18em;
  color: var(--u-muted);
}
.gx-day-body {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-left: 24px;
  border-left: 1px solid var(--u-line);
}

.gx-m {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  scroll-margin-top: 90px;
}
.gx-m-time {
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--u-muted);
  padding-top: 6px;
  letter-spacing: .04em;
}
.gx-m-body { min-width: 0; }
.gx-m-text {
  font-family: var(--u-font-serif);
  font-size: 15.5px;
  line-height: 1.95;
  color: var(--u-ink);
  word-break: break-word;
}
.gx-m-text p { margin: 0 0 .65em; }
.gx-m-text p:last-child { margin-bottom: 0; }
.gx-m-text a { color: var(--u-accent); text-decoration: none; border-bottom: 1px solid transparent; }
.gx-m-text a:hover { border-bottom-color: currentColor; }
.gx-m-text img { max-width: 100%; border-radius: 10px; }

.gx-m-imgs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
/* 瞬间配图外面套了 figure：一是语义正确，二是 ui-tools 的图注脚本会跳过 figure 内的图 */
.gx-m-fig { margin: 0; border-radius: 10px; overflow: hidden; background: var(--gx-card-2); }
.gx-m-fig figcaption {
  padding: 8px 10px 9px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--u-muted);
}
.gx-m-imgs img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  cursor: zoom-in;
  transition: opacity .25s;
}
.gx-m-imgs img:hover { opacity: .92; }
.gx-m-imgs[data-n="1"] { grid-template-columns: minmax(0, 420px); }
.gx-m-imgs[data-n="1"] img { aspect-ratio: 4 / 3; }

.gx-m-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--u-muted);
}
.gx-tag { color: var(--u-accent); }
.gx-link {
  color: var(--u-muted);
  text-decoration: none;
  border-bottom: 1px dashed var(--u-line-strong);
}
.gx-link:hover { color: var(--u-accent); border-bottom-color: var(--u-accent); }

.gx-moment-detail .gx-m { grid-template-columns: 1fr; gap: 8px; }
.gx-moment-detail .gx-m-time { padding-top: 0; }

/* ---------------------------------------------------------------- 分页 */
.gx-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 42px;
}
.gx-pg {
  min-width: 34px;
  height: 34px;
  padding: 0 11px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  color: var(--u-muted);
  text-decoration: none;
  border: 1px solid var(--u-line-strong);
  transition: color .2s, border-color .2s, background .2s;
}
.gx-pg:hover { color: var(--u-accent); border-color: var(--u-accent); }
.gx-pg.on {
  color: #fff;
  background: var(--u-accent);
  border-color: var(--u-accent);
}
.gx-pg.dir { padding: 0 14px; }
.gx-pg.off { opacity: .35; }

/* ---------------------------------------------------------------- 灯箱 */
html.gx-lock { overflow: hidden; }

.gx-lb {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
  background: rgba(8, 10, 12, .94);
  backdrop-filter: blur(6px);
}
.gx-lb[hidden] { display: none; }
.gx-lb-box {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(1180px, 92vw);
  max-height: 88vh;
}
.gx-lb img {
  max-width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9);
}
.gx-lb figcaption {
  margin-top: 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, .72);
  text-align: center;
  max-width: 70ch;
}
/* 「查看原图」：灯箱默认只加载 1600 的展示图，原图要用户主动点才请求。
   做得比图注更弱（细边框 + 半透明），避免抢图本身的注意力 */
.gx-lb-orig {
  margin-top: 10px;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: .02em;
  color: rgba(255, 255, 255, .78);
  text-decoration: none;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.gx-lb-orig:hover {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .4);
  color: #fff;
}
.gx-lb-orig[hidden] { display: none; }
.gx-lb-x {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s;
}
.gx-lb-x:hover { background: rgba(255, 255, 255, .24); }
.gx-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s;
}
.gx-lb-nav:hover { background: rgba(255, 255, 255, .24); }
.gx-lb-nav.prev { left: 3vw; }
.gx-lb-nav.next { right: 3vw; }
.gx-lb.single .gx-lb-nav { display: none; }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1024px) {
  .gx { padding-left: 16px; padding-right: 16px; }
  .gx-day { grid-template-columns: 78px minmax(0, 1fr); gap: 16px; }
  .gx-day-body { padding-left: 18px; }
}

@media (max-width: 720px) {
  .gx { padding: 0 14px 44px; }
  .gx-head { padding: 22px 0 18px; }
  .gx-grid { grid-template-columns: 1fr; gap: 18px; }
  .gx-flow { column-count: 1; }
  .gx-day { grid-template-columns: 1fr; gap: 12px; }
  .gx-day-head {
    position: static;
    text-align: left;
    display: flex;
    align-items: baseline;
    gap: 10px;
  }
  .gx-day-n { font-size: 24px; }
  .gx-day-my { margin-top: 0; }
  .gx-day-body {
    padding-left: 14px;
    border-left: 1px solid var(--u-line);
  }
  .gx-m { grid-template-columns: 1fr; gap: 6px; }
  .gx-m-time { padding-top: 0; font-size: 11px; }
  .gx-m-imgs { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .gx-m-imgs[data-n="1"] { grid-template-columns: 1fr; }
  .gx-adj { grid-template-columns: 1fr; }
  .gx-adj-a.next { text-align: left; align-items: flex-start; }
  .gx-lb-nav { width: 38px; height: 38px; font-size: 20px; }
  .gx-lb-nav.prev { left: 6px; }
  .gx-lb-nav.next { right: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .gx-card,
  .gx-card-img img,
  .gx-fig img,
  /* 瞬间配图外面套了 figure：一是语义正确，二是 ui-tools 的图注脚本会跳过 figure 内的图 */
.gx-m-fig { margin: 0; border-radius: 10px; overflow: hidden; background: var(--gx-card-2); }
.gx-m-fig figcaption {
  padding: 8px 10px 9px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--u-muted);
}
.gx-m-imgs img { transition: none; }
  .gx-card:hover { transform: none; }
  .gx-card:hover .gx-card-img img { transform: none; }
}
