/* ============================================================
   冷月幽 · 丹青页专属
   瀑布流图片墙 + 占位图
   只被 danqing.html 引入
   ============================================================ */

.masonry {
  columns: 3;
  column-gap: 20px;
}

.masonry > * {
  break-inside: avoid;
  margin-bottom: 20px;
}

.photo {
  position: relative;          /* 为 hover 时的 z-index 提供定位上下文 */
  display: block;
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s var(--ease);
}

/* 悬浮抬起：上移 8px，阴影加深，并压到相邻卡片之上
   选择器带 .masonry 是为了压过入场动画的 .js .reveal.is-in { transform: none } */
.masonry .photo:hover {
  transform: translateY(-8px);
  border-color: var(--line-2);
  box-shadow:
    0 4px 10px rgba(63, 48, 32, .10),
    0 30px 60px -28px rgba(63, 48, 32, .52);
  z-index: 3;
}

[data-theme="dark"] .masonry .photo:hover {
  box-shadow:
    0 4px 12px rgba(0, 0, 0, .42),
    0 30px 60px -28px rgba(0, 0, 0, .85);
}

/* 减弱动效：不做位移，只保留阴影变化 */
@media (prefers-reduced-motion: reduce) {
  .photo { transition: box-shadow .01ms, border-color .01ms; }
  .photo:hover { transform: none; }
}

.photo-img {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #efe4cf, #e2d4b6);
}

/* 真实图片：铺满画框并裁切，比例由卡片上的 aspect-ratio 决定 */
.photo-img > .photo-real {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* 有真实图片时，去掉占位图的「月亮 + 山影」，否则会盖在照片上 */
.photo-img.has-image::before,
.photo-img.has-image::after { display: none; }

.photo-img::before {
  content: "";
  position: absolute;
  right: 14%; top: 13%;
  width: 26%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 251, 238, .85) 0 44%, rgba(255, 251, 238, .35) 56%, transparent 72%);
  box-shadow: 0 0 24px 8px rgba(255, 249, 234, .35);
}

.photo-img::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 60%;
  background: rgba(47, 39, 30, .11);
  clip-path: polygon(0% 100%, 0% 64%, 13% 46%, 25% 58%, 39% 30%, 51% 45%, 63% 22%, 77% 41%, 89% 28%, 100% 45%, 100% 100%);
  transition: background .4s var(--ease);
}

.photo:hover .photo-img::after { background: rgba(47, 39, 30, .16); }

.photo-img.p1 { background: linear-gradient(155deg, #e8dcc4, #d9c9a6); }

.photo-img.p2 { background: linear-gradient(155deg, #d8e0d6, #b9c8bd); }

.photo-img.p3 { background: linear-gradient(160deg, #ecdcc8, #d7b9a0); }

.photo-img.p4 { background: linear-gradient(150deg, #dde3e6, #bfcbd1); }

.photo-img.p5 { background: linear-gradient(165deg, #e7ddcb, #cbb896); }

.photo-img.p6 { background: linear-gradient(155deg, #e5d8cd, #c9b6a6); }

.photo-img.p2::after, .photo-img.p4::after { background: rgba(47, 55, 60, .13); }

.photo-img.p4::before { background: radial-gradient(circle, rgba(255, 255, 255, .8) 0 40%, transparent 68%); box-shadow: none; }

[data-theme="dark"] .photo-img { background: linear-gradient(160deg, #302b23, #262119); }

[data-theme="dark"] .photo-img.p1 { background: linear-gradient(155deg, #332c22, #29231b); }

[data-theme="dark"] .photo-img.p2 { background: linear-gradient(155deg, #26302b, #1f2622); }

[data-theme="dark"] .photo-img.p3 { background: linear-gradient(160deg, #33291f, #281f18); }

[data-theme="dark"] .photo-img.p4 { background: linear-gradient(150deg, #252b2e, #1e2326); }

[data-theme="dark"] .photo-img.p5 { background: linear-gradient(165deg, #302a20, #262119); }

[data-theme="dark"] .photo-img.p6 { background: linear-gradient(155deg, #302720, #251e19); }

[data-theme="dark"] .photo-img::before {
  background: radial-gradient(circle, rgba(234, 226, 211, .35) 0 40%, transparent 70%);
  box-shadow: none;
}

[data-theme="dark"] .photo-img::after { background: rgba(0, 0, 0, .28); }

[data-theme="dark"] .photo:hover .photo-img::after { background: rgba(0, 0, 0, .36); }

[data-theme="dark"] .photo-label {
  color: var(--ink-2);
  background: rgba(26, 24, 21, .8);
  border-color: var(--line-2);
}

.photo-label {
  position: absolute;
  left: 12px; bottom: 12px;
  z-index: 1;
  padding: 3px 9px;
  font-size: 13px;
  letter-spacing: .18em;
  color: var(--ink-2);
  background: rgba(255, 253, 248, .82);
  border: 1px solid rgba(207, 194, 169, .7);
  border-radius: 2px;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.photo-cap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 15px 14px;
}

.photo-cap strong {
  font-family: var(--font-kai);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .1em;
}

.photo-cap span { font-size: 13px; letter-spacing: .06em; color: var(--ink-4); }

@media (max-width: 980px) {
  .masonry { columns: 2; }
}

@media (max-width: 560px) {
  .masonry { columns: 1; }
}


/* ============================================================
   灯箱：看大图 / 下载
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: block;
  background: rgba(22, 19, 16, .93);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s var(--ease), visibility .28s;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px 140px;    /* 上给标题、下给按钮 */
  cursor: zoom-out;
}

.lightbox-img {
  max-width: 70vw;               /* 直接按视口算，宽或高最多 70% */
  max-height: 70vh;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 30px 70px -24px rgba(0, 0, 0, .9);
  transform: scale(.97);
  transition: transform .3s var(--ease);
}

.lightbox.is-open .lightbox-img { transform: scale(1); }

.lightbox-bar {
  display: contents;             /* 不生成盒子，标题和按钮各自绝对定位 */
}

.lightbox-title {
  position: absolute;
  left: 28px;
  top: 22px;
  z-index: 2;
  max-width: 60%;
  font-family: var(--font-kai);
  font-size: 16px;
  letter-spacing: .1em;
  color: rgba(255, 250, 242, .86);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox-acts {
  position: absolute;
  right: 28px;
  bottom: 100px;                 /* 任务栏约 48px，再留余量 */
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lightbox-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 40px;
  padding: 0 22px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: .1em;
  color: rgba(255, 250, 242, .95);
  text-decoration: none;
  background: rgba(255, 250, 242, .16);
  border: 1px solid rgba(255, 250, 242, .34);
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}

.lightbox-btn:hover {
  background: rgba(255, 250, 242, .16);
  border-color: rgba(255, 250, 242, .4);
  color: #fff;
}

.lightbox-btn.is-close {
  min-width: 40px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

@media (max-width: 760px) {
  .lightbox-stage { padding: 52px 14px 130px; }
  .lightbox-img { max-width: 92vw; max-height: 62vh; }
  .lightbox-title { left: 16px; top: 16px; font-size: 14px; max-width: 55%; }
  .lightbox-acts { right: 16px; bottom: 84px; }
  .lightbox-btn { height: 38px; padding: 0 16px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox, .lightbox-img { transition: none; }
  .lightbox-img { transform: none; }
}
